public ReturnResult wlOrderPayRequest_data(wlOrderPayRequest requestData, int comid) { string url = wl_url + "wl.trip.order.pay"; #region 记入日志表 string reqip = CommonFunc.GetRealIP(); WL_reqlog mlog = new WL_reqlog { id = 0, reqstr = JsonConvert.SerializeObject(requestData), subtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), respstr = "", resptime = "", code = "", describe = "", req_type = "", orderid = requestData.body.partnerOrderId, sendip = reqip, stockagentcompanyid = comid }; int logid = new WL_reqlogData().EditReqlog(mlog); mlog.id = logid; #endregion ReturnResult result = new ReturnResult { IsSuccess = false, }; try { var responseStr = DoRequest(url, JsonConvert.SerializeObject(requestData)); if (string.IsNullOrEmpty(responseStr)) { result.Message = "返回数据为空"; } else { mlog.req_type = "wl.trip.order.pay"; mlog.respstr = responseStr; mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); new WL_reqlogData().EditReqlog(mlog); wlOrderPayResponse wlOrderPayResponse = (wlOrderPayResponse)JsonConvert.DeserializeObject(responseStr, typeof(wlOrderPayResponse)); if (wlOrderPayResponse.code == 200) { result.IsSuccess = true; result.Message = "支付成功"; //完成支付 using (var sql = new SqlHelper()) { try { var internalData = new InternalWlGetProInfoDealRequest(sql); int wl_id = internalData.UpdateWlOrderPaySC(wlOrderPayResponse);//一次性插入万龙id } catch { throw; } } } else { result.IsSuccess = false; result.Message = wlOrderPayResponse.describe; } //记录在日志表 mlog.code = wlOrderPayResponse.code.ToString(); mlog.describe = wlOrderPayResponse.describe; mlog.mtorderid = wlOrderPayResponse.body.wlOrderId; } } catch (Exception ex) { result.Message = "异常" + ex.Message; } #region 记录在日志表 //mlog.req_type = "wl.trip.order.get"; //mlog.respstr = result.Message; //mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); new WL_reqlogData().EditReqlog(mlog); #endregion return(result); }
//订单支付成功后 internal int UpdateWlOrderPaySC(wlOrderPayResponse m) { if (m.body.wlOrderId != "") { string sql = @"UPDATE [wl_OrderCreate] SET pay_code=@pay_code, pay_describe=@pay_describe, voucherType=@voucherType, vouchers=@vouchers, voucherPics=@voucherPics, status=@status WHERE wlorderid=@wlorderid"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); cmd.AddParam("@wlorderid", m.body.wlOrderId); cmd.AddParam("@pay_code", m.code); cmd.AddParam("@pay_describe", m.describe); cmd.AddParam("@voucherType", m.body.voucherType); string vouchers = ""; if (m.body.vouchers != null) { for (int i = 0; i < m.body.vouchers.Count(); i++) { if (vouchers == "") { vouchers = m.body.vouchers[i]; } else { vouchers = vouchers + "," + m.body.vouchers[i]; } } } cmd.AddParam("@vouchers", vouchers); string voucherPics = ""; if (m.body.voucherPics != null) { for (int i = 0; i < m.body.voucherPics.Count(); i++) { if (voucherPics == "") { voucherPics = m.body.voucherPics[i]; } else { voucherPics = voucherPics + "," + m.body.voucherPics[i]; } } } cmd.AddParam("@voucherPics", voucherPics); cmd.AddParam("@status", 4); cmd.ExecuteNonQuery(); return(1); } else { return(0); } }