示例#1
0
        /// <summary>
        /// 公共方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="requestId"></param>
        /// <param name="action"></param>
        /// <param name="json"></param>
        /// <param name="logPath"></param>
        /// <returns></returns>
        public static respMasgetModel <T> PostUrl <T>(int requestId, string action, string json, string logPath, Logic.ChannelType chanel, int MasgetId = 0)
        {
            try
            {
                bool           flag   = false;
                string         result = string.Empty;
                reqMasgetModel req    = new reqMasgetModel();
                req.chanel       = chanel;
                req.method       = action;
                req.target_appid = "";
                req.dataExpress  = json;
                req.MasgetID     = MasgetId;
                req.data         = AES.Encrypt(json, req.secretkey, req.secretkey);
                //请求前日志记录
                Logs.WriteLog("提交参数:" + JsonConvert.SerializeObject(req), MasgetLogDic, logPath);
                yeepayLogParasDao.Init(requestId, JsonConvert.SerializeObject(req), 0);

                //拼接所有传递参数
                //公共字段
                StringBuilder  strPostPara = new StringBuilder();
                PropertyInfo[] pis         = typeof(reqMasgetModel).GetProperties();
                foreach (PropertyInfo pi in pis)
                {
                    object keyName = pi.GetValue(req, null);
                    if (keyName != null && !string.IsNullOrEmpty(keyName.ToString()) && keyName.ToString() != "dataExpress" && keyName.ToString() != "MasgetID" && keyName.ToString() != "mUser")
                    {
                        strPostPara.Append("&").Append(pi.Name).Append("=").Append(pi.GetValue(req, null));
                    }
                }


                //执行请求
                int responseState = ITOrm.Utility.Client.HttpHelper.HttpPost(MasgetDomain, strPostPara.ToString(), Encoding.UTF8, out result);
                if (responseState != 200)
                {
                    result = $"{{ \"ret\":\"{responseState}\", \"message\":\"{result}\",\"data\":null  }}";
                }
                //返回后日志记录
                Logs.WriteLog("返回参数:" + result, MasgetLogDic, logPath);
                yeepayLogParasDao.Init(requestId, result, 1);

                ////易宝日志状态更新
                respMasgetModel <T> resp = JsonConvert.DeserializeObject <respMasgetModel <T> >(result);
                flag = yeepayLogDao.UpdateState(requestId, resp.backState.ToString(), resp.message, resp.backState == 0 ? 1 : resp.backState);
                Logs.WriteLog($"易宝日志状态更新:requestId:{requestId},ret:{resp.ret},message:{ resp.message},State:{flag}", MasgetLogDic, logPath);
                return(JsonConvert.DeserializeObject <respMasgetModel <T> >(result));
            }
            catch (Exception e)
            {
                return(JsonConvert.DeserializeObject <respMasgetModel <T> >($"{{ \"ret\":\"-1000\", \"message\":\"{e.Message}\"  }}"));
            }
        }
示例#2
0
        public static respMasgetModel <respTreatyQueryModel> TreatyQuery(int Platform, Logic.ChannelType chanel, string bankaccount)
        {
            respMasgetModel <respTreatyQueryModel> tip = new respMasgetModel <respTreatyQueryModel>();
            string       LogDic = "查询快捷协议";
            UserBankCard ubk    = userBankCardDao.Single("BankCard=@bankaccount", new { bankaccount });

            if (ubk == null)
            {
                tip.ret     = -100;
                tip.message = "未查到卡记录";
                return(tip);
            }
            MasgetUser mUser = masgetUserDao.Single(" UserId=@UserId", new { ubk.UserId });

            if (mUser == null)
            {
                tip.ret     = -100;
                tip.message = "用户未开户";
                return(tip);
            }
            bool flag = false;
            //获取请求流水号
            int requestId = yeepayLogDao.Init((int)Masget.Enums.MasgetType.查询快捷协议, ubk.UserId, Platform, 0, (int)chanel);

            Logs.WriteLog($"获取请求流水号:UserId:{ ubk.UserId},Platform:{Platform},requestId:{requestId}", MasgetLogDic, LogDic);
            reqMasgetModel req = new reqMasgetModel();

            req.chanel = chanel;
            reqTreatyQueryModel model = new reqTreatyQueryModel();

            model.pcompanyid  = req.appid;
            model.companyid   = mUser.CompanyId;
            model.bankaccount = bankaccount;
            model.treatycode  = "";
            //model.accountrule = "1";
            string json = Order <reqTreatyQueryModel>(model);
            var    resp = PostUrl <respTreatyQueryModel>(requestId, "masget.pay.compay.router.samename.update", json, LogDic, chanel);

            if (resp.backState == 0)
            {
            }
            return(resp);
        }