protected void Page_Load(object sender, EventArgs e) { comid_temp = Request["comid"].ConvertTo <int>(0); B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest + " 元"; Warrant_type = agenginfo.Warrant_type; } } }
/// <summary> /// 美团配置信息其他分销是否配置过 /// </summary> /// <param name="regiinfo"></param> /// <returns></returns> public bool IsExistMeituanConfig(Agent_company regiinfo) { using (var helper = new SqlHelper()) { bool r = new InternalAgentCompany(helper).IsExistMeituanConfig(regiinfo); return(r); } }
public List <DealResponseBody> GetDealResponseBody(out int totalcount, Agent_company agentinfo, string method, List <string> productIdList, int currentPage = 0, int pageSize = 0) { using (var helper = new SqlHelper()) { List <DealResponseBody> list = new InternalDealResponse(helper).GetDealResponseBody(out totalcount, agentinfo, method, productIdList, currentPage, pageSize); return(list); } }
public string contact_phone = ""; //联系人电话 protected void Page_Load(object sender, EventArgs e) { comid_temp = Request["comid"].ConvertTo <int>(0); projectid = Request["projectid"].ConvertTo <int>(0); B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel; } if (projectid != 0) { B2b_com_projectData projectdata = new B2b_com_projectData(); var projectinfo = projectdata.GetProject(projectid, comid_temp); if (projectinfo != null) { projectname = projectinfo.Projectname + ": "; } } // ishaslvyoubusproorder = new B2bOrderData().IsHasLvyoubusProOrder(comid_temp, (int)ProductServer_Type.LvyouBus); if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元"; Warrant_type = agenginfo.Warrant_type; if (Warrant_type == 1) { Warrant_type_str = "销售扣款"; } if (Warrant_type == 2) { Warrant_type_str = "验证扣款"; } } else { Response.Redirect("/Agent/Default.aspx"); } } }
internal bool IsExistMeituanConfig(Agent_company regiinfo) { string sql = "select count(1) from agent_company where mt_partnerId='" + regiinfo.mt_partnerId + "' and id!=" + regiinfo.Id; var cmd = sqlHelper.PrepareTextSqlCommand(sql); object o = cmd.ExecuteScalar(); if (int.Parse(o.ToString()) > 0) { return(true); } else { return(false); } }
public string contact_phone = ""; //联系人电话 protected void Page_Load(object sender, EventArgs e) { DateTime gooutdate = Request["gooutdate"].ConvertTo <DateTime>(DateTime.Now); nowdate = gooutdate.ToString("yyyy-MM-dd"); monthdate = DateTime.Parse(nowdate).AddDays(6).ToString("yyyy-MM-dd"); servertype = (int)ProductServer_Type.LvyouBus; comid_temp = Request["comid"].ConvertTo <int>(0); if (comid_temp == 0) { Response.Redirect("/Agent/Default.aspx"); } ishaslvyoubusproorder = new B2bOrderData().IsHasLvyoubusProOrder(comid_temp, (int)ProductServer_Type.LvyouBus); B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel; } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元"; Warrant_type = agenginfo.Warrant_type; if (Warrant_type == 1) { Warrant_type_str = "销售扣款"; } if (Warrant_type == 2) { Warrant_type_str = "验证扣款"; } } else { Response.Redirect("/Agent/Default.aspx"); } } }
public string contact_phone = ""; //联系人电话 protected void Page_Load(object sender, EventArgs e) { comid_temp = Request["comid"].ConvertTo <int>(0); B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel; } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元"; Warrant_type = agenginfo.Warrant_type; if (Warrant_type == 1) { Warrant_type_str = "销售扣款"; } if (Warrant_type == 2) { Warrant_type_str = "验证扣款"; } } else { Response.Redirect("/Agent/Default.aspx"); } } }
public int issetidcard = 0; //是否需要填写身份证 protected void Page_Load(object sender, EventArgs e) { id = Request["id"].ConvertTo <int>(0); B2bComProData prodate = new B2bComProData(); var proinfo = prodate.GetProById(id.ToString()); if (proinfo != null) { comid_temp = proinfo.Com_id; pickuppoint = proinfo.pickuppoint; dropoffpoint = proinfo.dropoffpoint; Server_type = proinfo.Server_type; manyspeci = proinfo.Manyspeci; face_price = proinfo.Face_price; price = proinfo.Advise_price; issetidcard = proinfo.issetidcard; //如果多规格读取规格 if (manyspeci == 1) { gglist = new B2b_com_pro_SpeciData().Getgglist(proinfo.Id); } //作废超时未支付订单,完成回滚操作 int rs = new B2bComProData().CancelOvertimeOrder(proinfo); if (proinfo.Source_type == 4) { iscanbook = 1; } else { iscanbook = new B2bComProData().IsYouxiao(proinfo.Id, proinfo.Server_type, proinfo.Pro_start, proinfo.Pro_end, proinfo.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态 } } B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel; } B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid_temp.ToString()); if (pro != null) { if (pro.Smalllogo != null && pro.Smalllogo != "") { comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0)); } } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元"; Warrant_type = agenginfo.Warrant_type; if (Warrant_type == 1) { Warrant_type_str = "销售扣款"; } if (Warrant_type == 2) { Warrant_type_str = "验证扣款"; } Agentlevel = agenginfo.Warrant_level;; //if (proinfo != null) //{ // if (Agentlevel == 1) // { // hotel_agent = proinfo.Agent1_price; // } // if (Agentlevel == 2) // { // hotel_agent = proinfo.Agent2_price; // } // if (Agentlevel == 3) // { // hotel_agent = proinfo.Agent3_price; // } //} //重新给分销按 级别默认标注, if (gglist != null) { price = 0; face_price = 0; for (int i = 0; i < gglist.Count(); i++) { if (Server_type == 9)//订房 { if (Agentlevel == 1) { gglist[i].speci_advise_price = gglist[i].speci_agent1_price; } if (Agentlevel == 2) { } if (Agentlevel == 3) { gglist[i].speci_advise_price = gglist[i].speci_agent3_price; } if (price == 0 || price > gglist[i].speci_advise_price) { price = gglist[i].speci_advise_price; face_price = gglist[i].speci_face_price; } } else if (Server_type == 10)//大巴 { if (Agentlevel == 1) { gglist[i].speci_advise_price = gglist[i].speci_agent1_price; } if (Agentlevel == 2) { gglist[i].speci_advise_price = gglist[i].speci_agent2_price; } if (Agentlevel == 3) { gglist[i].speci_advise_price = gglist[i].speci_agent3_price; } if (price == 0 || price > gglist[i].speci_advise_price) { price = gglist[i].speci_advise_price; face_price = gglist[i].speci_face_price; } } else { if (Agentlevel == 1) { gglist[i].speci_advise_price = gglist[i].speci_agent1_price; } if (Agentlevel == 2) { gglist[i].speci_advise_price = gglist[i].speci_agent2_price; } if (Agentlevel == 3) { gglist[i].speci_advise_price = gglist[i].speci_agent3_price; } if (price == 0 || price > gglist[i].speci_advise_price) { price = gglist[i].speci_advise_price; face_price = gglist[i].speci_face_price; } } } } } else { Response.Redirect("/Agent/Default.aspx"); } } }
internal List <PoiResponseBody> GetPoiResponseBody(out int totalcount, string method, List <string> poiIdList, Agent_company agentinfo, int pageindex, int pagesize) { #region 多点拉取 if (method.Trim() == "multi") { string poiidstr = ""; foreach (string proid in poiIdList) { poiidstr = proid + ","; } poiidstr = poiidstr.Substring(0, poiidstr.Length - 1); string sql = @"SELECT * FROM [b2b_com_project] where id in (" + poiidstr + ") and address!='' and coordinate!='' and onlinestate=1 "; var cmd = sqlHelper.PrepareTextSqlCommand(sql); List <PoiResponseBody> list = new List <PoiResponseBody>(); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new PoiResponseBody { partnerId = int.Parse(agentinfo.mt_partnerId), partnerPoiId = reader.GetValue <int>("id").ToString(), name = reader.GetValue <string>("projectname"), city = reader.GetValue <string>("city"), address = reader.GetValue <string>("address"), phone = reader.GetValue <string>("mobile"), locType = 2, //景点坐标系类型 0 火星坐标 1 地球坐标 2 百度坐标 3 图吧坐标 4 搜狗坐标 5 其他 longitude = GetMtlongitude(reader.GetValue <string>("coordinate")), //景区地理经度 必须真实有效,值为真实值的6次方取整 latitude = GetMtlatitude(reader.GetValue <string>("coordinate")) //景区地理纬度 必须真实有效,值为真实值的6次方取整 }); } } totalcount = list.Count; return(list); } #endregion #region 批量拉取 page else if (method.Trim() == "page") { var cmd = this.sqlHelper.PrepareStoredSqlCommand("proc_ListPage"); var condition = " id in (select id from b2b_com_project where address!='' and coordinate!='' and onlinestate=1 and comid in (select comid from agent_warrant where agentid=" + agentinfo.Id + " and warrant_state=1))"; cmd.PagingCommand1("b2b_com_project", "*", "id", "", pagesize, pageindex, "", condition); List <PoiResponseBody> list = new List <PoiResponseBody>(); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new PoiResponseBody { partnerId = int.Parse(agentinfo.mt_partnerId), partnerPoiId = reader.GetValue <int>("id").ToString(), name = reader.GetValue <string>("projectname"), city = reader.GetValue <string>("city"), address = reader.GetValue <string>("address"), phone = reader.GetValue <string>("mobile"), locType = 2, //景点坐标系类型 0 火星坐标 1 地球坐标 2 百度坐标 3 图吧坐标 4 搜狗坐标 5 其他 longitude = GetMtlongitude(reader.GetValue <string>("coordinate")), //景区地理经度 必须真实有效,值为真实值的6次方取整 latitude = GetMtlatitude(reader.GetValue <string>("coordinate")) //景区地理纬度 必须真实有效,值为真实值的6次方取整 }); } } totalcount = int.Parse(cmd.Parameters[0].Value.ToString()); return(list); } #endregion else { totalcount = 0; return(new List <PoiResponseBody>()); } }
public int Agentlevel = 0; //分销级别 protected void Page_Load(object sender, EventArgs e) { unum = Request["unum"].ConvertTo <int>(1); addrid = Request["addrid"].ConvertTo <int>(0); id = Request["id"].ConvertTo <int>(0); B2bComProData prodate = new B2bComProData(); var pro = prodate.GetProById(id.ToString()); if (pro != null) { servertype = pro.Server_type; comid_temp = pro.Com_id; pickuppoint = pro.pickuppoint; dropoffpoint = pro.dropoffpoint; price = pro.Advise_price; face_price = pro.Face_price; manyspeci = pro.Manyspeci; issetidcard = pro.issetidcard; //如果多规格读取规格 if (manyspeci == 1) { gglist = new B2b_com_pro_SpeciData().Getgglist(pro.Id); } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); var Warrant_type_str = ""; Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { var yufukuan = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元"; var Warrant_type = agenginfo.Warrant_type; if (Warrant_type == 1) { Warrant_type_str = "销售扣款"; } if (Warrant_type == 2) { Warrant_type_str = "验证扣款"; } Agentlevel = agenginfo.Warrant_level;; //if (pro != null) //{ // if (Agentlevel == 1) // { // hotel_agent = pro.Agent1_price; // } // if (Agentlevel == 2) // { // hotel_agent = pro.Agent2_price; // } // if (Agentlevel == 3) // { // hotel_agent = pro.Agent3_price; // } //} //重新给分销按 级别默认标注, if (gglist != null) { for (int i = 0; i < gglist.Count(); i++) { if (servertype == 9)//订房 { if (Agentlevel == 1) { gglist[i].speci_advise_price = gglist[i].speci_agent1_price; } if (Agentlevel == 2) { gglist[i].speci_advise_price = gglist[i].speci_agent2_price; } if (Agentlevel == 3) { gglist[i].speci_advise_price = gglist[i].speci_agent3_price; } if (price == 0 || price > gglist[i].speci_advise_price) { price = gglist[i].speci_advise_price; face_price = gglist[i].speci_face_price; } } else if (servertype == 10)//大巴 { if (Agentlevel == 1) { gglist[i].speci_advise_price = gglist[i].speci_agent1_price; } if (Agentlevel == 2) { gglist[i].speci_advise_price = gglist[i].speci_agent2_price; } if (Agentlevel == 3) { gglist[i].speci_advise_price = gglist[i].speci_agent3_price; } if (price == 0 || price > gglist[i].speci_advise_price) { price = gglist[i].speci_advise_price; face_price = gglist[i].speci_face_price; } } else { if (Agentlevel == 1) { gglist[i].speci_advise_price = gglist[i].speci_agent1_price; } if (Agentlevel == 2) { gglist[i].speci_advise_price = gglist[i].speci_agent2_price; } if (Agentlevel == 3) { gglist[i].speci_advise_price = gglist[i].speci_agent3_price; } if (price == 0 || price > gglist[i].speci_advise_price) { price = gglist[i].speci_advise_price; face_price = gglist[i].speci_face_price; } } } } } else { Response.Redirect("/Agent/Default.aspx"); } } ////如果含有规格读取规格价格中最低价 //if (manyspeci == 1) //{ // if (gglist != null) // { // price = 0; // face_price = 0; // for (int i = 0; i < gglist.Count(); i++) // { // if (price == 0 || price > gglist[i].speci_advise_price) // { // price = gglist[i].speci_advise_price; // face_price = gglist[i].speci_face_price; // } // } // } //} //作废超时未支付订单,完成回滚操作 int rs = new B2bComProData().CancelOvertimeOrder(pro); if (pro.Source_type == 4) { iscanbook = 1; } else { iscanbook = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态 } } }
protected void Page_Load(object sender, EventArgs e) { cartid = Request["cartid"].ConvertTo <string>(""); //去除最右侧,号 if (cartid != "") { if (cartid.Substring(cartid.Length - 1, 1) == ",") { cartid = cartid.Substring(0, cartid.Length - 1); } } var cartid_arr = cartid.Split(','); //如果包含规格产品 var prospeciid = new B2bOrderData().SearchCartListBycartid(cartid); if (prospeciid != null) { for (int i = 0; i < prospeciid.Count; i++) { id += prospeciid[i].Id + ","; id_speciid += prospeciid[i].Speciid + ","; temp_id = prospeciid[i].Id.ToString(); temp_id_speciid = prospeciid[i].Speciid.ToString(); num += prospeciid[i].U_num + ","; } } if (num != "") { if (num.Substring(num.Length - 1, 1) == ",") { num = num.Substring(0, num.Length - 1); } } if (id != "") { if (id.Substring(id.Length - 1, 1) == ",") { id = id.Substring(0, id.Length - 1); } } if (id_speciid != "") { if (id_speciid.Substring(id_speciid.Length - 1, 1) == ",") { id_speciid = id_speciid.Substring(0, id_speciid.Length - 1); } } B2bComProData prodate = new B2bComProData(); var proinfo = prodate.GetProById(temp_id); if (proinfo != null) { comid_temp = proinfo.Com_id; pickuppoint = proinfo.pickuppoint; dropoffpoint = proinfo.dropoffpoint; //作废超时未支付订单,完成回滚操作 int rs = new B2bComProData().CancelOvertimeOrder(proinfo); } B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元"; Warrant_type = agenginfo.Warrant_type; if (Warrant_type == 1) { Warrant_type_str = "销售扣款"; } if (Warrant_type == 2) { Warrant_type_str = "验证扣款"; } } else { Response.Redirect("/Agent/Default.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { //返回订单号 orderid = Request["orderid"].ConvertTo <int>(0); agentorderid = Request["agentorderid"].ConvertTo <int>(0); act = Request["act"].ConvertTo <string>(""); if (orderid != 0) { //根据订单id得到订单信息 B2bOrderData dataorder = new B2bOrderData(); B2b_order modelb2border = dataorder.GetOrderById(orderid); //根据产品id得到产品信息 B2bComProData datapro = new B2bComProData(); B2b_com_pro modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString()); //如果订单“未付款”现实支付及订单信息 if ((int)modelb2border.Order_state == (int)OrderStatus.WaitPay) { u_name = modelb2border.U_name.Substring(0, 1) + "**"; u_mobile = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3); ; travel_date = modelb2border.U_traveldate.ToString(); buy_num = modelb2border.U_num; p_totalprice = (int)(modelb2border.U_num * modelb2border.Pay_price); ordertype = modelb2border.Order_type; if (ordertype == 2) { proname = "预付款充值"; u_youxiaoqi = ""; } else { proname = modelcompro.Pro_name; u_youxiaoqi = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString(); } } comid_temp = Request["comid"].ConvertTo <int>(0); B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest + " 元"; Warrant_type = agenginfo.Warrant_type; } } } }
public List <PoiResponseBody> GetPoiResponseBody(out int totalcount, string method, List <string> poiIdList, Agent_company agentinfo, int pageindex = 0, int pagesize = 0) { using (var helper = new SqlHelper()) { List <PoiResponseBody> list = new InternalPoiResponse(helper).GetPoiResponseBody(out totalcount, method, poiIdList, agentinfo, pageindex, pagesize); return(list); } }
public static void AsyncSendSms(asynnoticecallback asynnoticecalljson, Agent_company agentinfo) { var lvmamadata = new LVMAMA_Data(agentinfo.Lvmama_uid, agentinfo.Lvmama_password, agentinfo.Lvmama_Apikey); var asynnoticecall = lvmamadata.asyConsumeNotify(asynnoticecalljson, agentinfo.Id); }
/// 产品订单创建 public string Getordercreate(Meituan_reqlog mlog) { lock (lockobj) { var response = new OrderCreateResponse(); response.partnerId = int.Parse(agentinfo.mt_partnerId); try { var data = JsonConvert.DeserializeObject <OrderCreateRequest>(_requestParam); if (data.body == null) { response.code = 499; response.describe = "Body数据解析失败"; return(EditMTlog_Order(response, mlog)); } else { OrderCreateRequestBody body = data.body; string product_num = body.partnerDealId; string num = body.quantity.ToString(); mlog.mtorderid = body.orderId.ToString(); //todo 根据请求参数查询产品返回结果 B2b_com_pro pro = new B2bComProData().GetProById(product_num); #region 产品信息 if (pro != null) { #region 分销授权信息判断 Agent_company agentwarrantinfo = AgentCompanyData.GetAgentWarrant(agentinfo.Id, pro.Com_id); if (agentwarrantinfo != null) { int warrantid = agentwarrantinfo.Warrantid; int Warrant_type = agentwarrantinfo.Warrant_type;//支付类型分销 1出票扣款 2验码扣款 int Warrant_level = agentwarrantinfo.Warrant_level; if (agentwarrantinfo.Warrant_state == 0) { response.code = 499; response.describe = "商户尚未授权此分销"; return(EditMTlog_Order(response, mlog)); } } else { response.code = 499; response.describe = "分销还没有得到商户授权"; return(EditMTlog_Order(response, mlog)); } #endregion #region 暂时对外接口只支持票务产品 if (pro.Server_type != 1) { response.code = 499; response.describe = "暂时对外接口只支持票务产品,其他产品请到分销后台提单"; return(EditMTlog_Order(response, mlog)); } #endregion #region 价格(建议价)效验,保证美团抓到的是最新价格 string advice_price = body.unitPrice.ToString("f0"); if (pro.Advise_price.ToString("f0") != advice_price) { response.code = 410; response.describe = "价格(建议价)效验失败,请重新拉取价格库存日历"; return(EditMTlog_Order(response, mlog)); } #endregion #region 价格(分销价)效验,保证美团抓到的是最新的结算价 if (agentwarrantinfo.Warrant_level == 1) { if (body.buyPrice.ToString("f0") != pro.Agent1_price.ToString("f0")) { response.code = 410; response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历"; return(EditMTlog_Order(response, mlog)); } } if (agentwarrantinfo.Warrant_level == 2) { if (body.buyPrice.ToString("f0") != pro.Agent2_price.ToString("f0")) { response.code = 410; response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历"; return(EditMTlog_Order(response, mlog)); } } if (agentwarrantinfo.Warrant_level == 3) { if (body.buyPrice.ToString("f0") != pro.Agent3_price.ToString("f0")) { response.code = 410; response.describe = "价格(分销价)效验失败,请重新拉取价格库存日历"; return(EditMTlog_Order(response, mlog)); } } #endregion #region 多规格产品编码格式验证 int speciid = 0; //判断产品编号是否符合多规格产品特点:例如 2503-1 if (product_num.IndexOf("-") > -1) { speciid = product_num.Substring(product_num.IndexOf("-") + 1).ConvertTo <int>(0); if (speciid == 0) { response.code = 410; response.describe = "多规格产品编码格式有误"; return(EditMTlog_Order(response, mlog)); } product_num = product_num.Substring(0, product_num.IndexOf("-")); } #endregion #region 产品编码格式有误 if (product_num.ConvertTo <int>(0) == 0) { response.code = 410; response.describe = "产品编码格式有误"; return(EditMTlog_Order(response, mlog)); } #endregion #region 购买数量格式有误 if (num.ConvertTo <int>(0) == 0) { response.code = 410; response.describe = "购买数量格式有误"; return(EditMTlog_Order(response, mlog)); } #endregion #region 产品限购则需要判断 限购数量 是否足够 if (pro.Ispanicbuy != 0) { //最多可购买数量 int zuiduo_canbuynum = pro.Limitbuytotalnum; if (int.Parse(num) > zuiduo_canbuynum) { response.code = 420; response.describe = "产品库存不足"; return(EditMTlog_Order(response, mlog)); } } #endregion #region 产品已暂停 if (pro.Pro_state == 0) { response.code = 421; response.describe = "产品已暂停"; return(EditMTlog_Order(response, mlog)); } #endregion #region 产品已过期 if (pro.Pro_end < DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"))) { response.code = 421; response.describe = "产品已过期"; return(EditMTlog_Order(response, mlog)); } #endregion #region 产品是否需要预约:需要预约则最晚预约时间是 游玩前一天的18点 if (pro.isneedbespeak == 1) { if (body.travelDate != "") { DateTime visitdate = DateTime.Parse(body.travelDate); DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); //必须提前一天预约 if (bookdate >= visitdate) { response.code = 422; response.describe = "产品需要提前一天预约"; return(EditMTlog_Order(response, mlog)); } } } #endregion #region 是否有使用限制 if (pro.Iscanuseonsameday == 0)//1:当天出票可用 ;2:2小时内出票不可用;0:当天出票不可用 { if (body.travelDate != "") { DateTime visitdate = DateTime.Parse(body.travelDate);//游玩日期:2012-12-12 格式要求:yyyy-MM-dd DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); if (bookdate >= visitdate) { response.code = 422; response.describe = "预定日期至少在游玩日期之前一天"; return(EditMTlog_Order(response, mlog)); } } } #endregion Meituan_reqlog mtOrderCrateSucLog = new Meituan_reqlogData().GetMtOrderCrateLogByMtorder(body.orderId.ToString(), "200"); #region 美团订单成功创建过 if (mtOrderCrateSucLog != null) { response.code = 200; response.describe = "订单创建成功"; response.partnerId = int.Parse(agentinfo.mt_partnerId); response.body = new OrderCreateResponseBody { partnerOrderId = mtOrderCrateSucLog.ordernum }; mlog.ordernum = mtOrderCrateSucLog.ordernum; return(EditMTlog_Order(response, mlog)); } #endregion #region 美团订单没有成功创建过 else { int isInterfaceSub = 1; //是否是电子票接口提交的订单:0.否;1.是 string ordertype = "1"; //1.出票2.充值 int orderid = 0; string real_name = ""; string mobile = ""; string use_date = body.travelDate; List <BaseVisitor> visitorlist = body.visitors; if (visitorlist.Count > 0) { foreach (BaseVisitor info in visitorlist) { if (info != null) { real_name = info.name; mobile = info.mobile; break; } } } //创建一笔未支付订单 string rdata = OrderJsonData.CreateNopayOrder(agentinfo.Id, product_num, ordertype, num, real_name, mobile, use_date, isInterfaceSub, out orderid, speciid); XmlDocument retdoc = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + rdata + "}"); XmlElement retroot = retdoc.DocumentElement; string rtype = retroot.SelectSingleNode("type").InnerText; string rmsg = retroot.SelectSingleNode("msg").InnerText; if (rtype == "100")//创建订单成功 { //针对美团因为创建未支付订单 是单写的,所以同时创建一笔wl订单 #region 万龙接口订单 if (pro.Source_type == 3 && pro.Serviceid == 4) { try { B2b_company commanage = B2bCompanyData.GetAllComMsg(pro.Com_id); WlGetProInfoDealRequestData wldata = new WlGetProInfoDealRequestData(commanage.B2bcompanyinfo.wl_PartnerId, commanage.B2bcompanyinfo.wl_userkey); WlDealResponseBody WlDealinfo = wldata.SelectonegetWlProDealData(pro.Service_proid, pro.Com_id); if (WlDealinfo == null) { response.code = 499; response.describe = "订单创建失败1"; return(EditMTlog_Order(response, mlog)); } double toal = WlDealinfo.marketPrice * int.Parse(num); string tavedate = ""; var createwlorder = wldata.wlOrderCreateRequest_json(int.Parse(commanage.B2bcompanyinfo.wl_PartnerId), real_name, mobile, orderid.ToString(), product_num.ToString(), WlDealinfo.proID, WlDealinfo.settlementPrice, WlDealinfo.marketPrice, toal, int.Parse(num), tavedate);// var wlcreate = wldata.wlOrderCreateRequest_data(createwlorder, pro.Com_id); if (wlcreate.IsSuccess == true) { //wl订单创建成功 } else { //return JsonConvert.SerializeObject(new { type = 1, msg = "wl接口创建订单失败1" }); response.code = 499; response.describe = "订单创建失败1"; return(EditMTlog_Order(response, mlog)); } } catch (Exception ex) { response.code = 499; response.describe = "订单创建失败" + ex.Message; return(EditMTlog_Order(response, mlog)); } } #endregion response.code = 200; response.describe = "订单创建成功"; response.partnerId = int.Parse(agentinfo.mt_partnerId); response.body = new OrderCreateResponseBody { partnerOrderId = orderid.ToString() }; mlog.ordernum = orderid.ToString(); return(EditMTlog_Order(response, mlog)); } else { response.code = 499; response.describe = "订单创建失败"; return(EditMTlog_Order(response, mlog)); } } #endregion } else { response.code = 421; response.describe = "产品不存在"; return(EditMTlog_Order(response, mlog)); } #endregion } } catch (Exception ex) { response.code = 499; response.describe = "异常错误" + ex; return(EditMTlog_Order(response, mlog)); } } }
// 重发, public string Smsresend(Lvmama_reqlog mlog, Agent_company agentinfo) { var response = new backRefund(); response.uid = agentinfo.Lvmama_uid; try { int organization = agentinfo.Id; #region 把分销商发送过来的请求记入数据库日志表2 agent_requestlog Agent_requestlog reqlog = new Agent_requestlog() { Id = 0, Organization = organization, Encode_requeststr = "", Decode_requeststr = _requestParam, Request_time = DateTime.Now, Encode_returnstr = "", Decode_returnstr = "", Return_time = DateTime.Parse("1970-01-01 00:00:00"), Errmsg = "", Request_type = "sms_resend", Req_seq = "", Ordernum = "", Is_dealsuc = 0, Is_second_receivereq = 0, Request_ip = CommonFunc.GetRealIP() }; int reqlogid = new Agent_requestlogData().Editagent_reqlog(reqlog); reqlog.Id = reqlogid; #endregion var data = JsonConvert.DeserializeObject <sms_resendmodel>(_requestParam); if (data.uid == "") { response.uid = agentinfo.Lvmama_uid; response.status = "1"; response.msg = "数据解析失败"; return(EditLvmamalog_Order(response, mlog, reqlog)); } else { string uid = data.uid; string password = data.password; string sign = data.sign; string timestamp = data.timestamp; string extId = data.extId; var vasmodel = new SendEticketData().SendEticket(extId.ConvertTo <int>(0), 2);//重发电子码 if (vasmodel == "OK") { response.status = "0"; response.msg = "重发成功"; return(EditLvmamalog_Order(response, mlog, null)); } else { response.status = "14"; response.msg = vasmodel; return(EditLvmamalog_Order(response, mlog, null)); } } } catch (Exception ex) { response.status = "2"; response.msg = "异常错误"; return(EditLvmamalog_Order(response, mlog, null)); } }
//str4=电话,str7=预订热线 protected void Page_Load(object sender, EventArgs e) { id = Request["orderid"].ConvertTo <int>(0); B2bOrderData orderdata = new B2bOrderData(); var orderinfo = orderdata.GetOrderById(id); if (orderinfo == null) { Response.Redirect("Order.aspx");//未查询到订单 return; } //订单数量 ordernum = orderinfo.U_num; subtime = orderinfo.U_subdate; B2bEticketData eticketdata = new B2bEticketData(); //已打印数量 printnum = eticketdata.AlreadyPrintNumbyOrderid(id); unprintnum = ordernum - printnum; B2bComProData prodate = new B2bComProData(); var proinfo = prodate.GetProById(orderinfo.Pro_id.ToString()); if (proinfo != null) { comid_temp = proinfo.Com_id; proname = proinfo.Pro_name; Face_price = proinfo.Face_price; pro_end = proinfo.Pro_end.ToString("yyyy年MM月dd日"); pro_start = proinfo.Pro_start.ToString("yyyy年MM月dd日"); Pro_Remark = "备注: " + proinfo.pro_note; B2b_com_projectData projectdate = new B2b_com_projectData(); var projectinfo = projectdate.GetProject(proinfo.Projectid, proinfo.Com_id); if (projectinfo != null) { address = "地址:" + projectinfo.Address; mobile = projectinfo.Mobile; //proname = projectinfo.Projectname + proname;//不增加项目信息 } if (orderinfo.Agentid != 0) { var agentinfo = AgentCompanyData.GetAgentByid(orderinfo.Agentid); if (agentinfo != null) { mobile = agentinfo.Mobile;//读取分销电话 agentcompany = agentinfo.Company; } } } B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp); if (companyinfo != null) { company = companyinfo.Com_name; } if (Session["Agentid"] != null) { //账户信息 Agentid = Int32.Parse(Session["Agentid"].ToString()); Account = Session["Account"].ToString(); if (Agentid != orderinfo.Agentid) { //订单与分销不匹配 Response.Redirect("order.aspx"); } Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp); if (agenginfo != null) { yufukuan = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元"; Warrant_type = agenginfo.Warrant_type; if (Warrant_type == 1) { Warrant_type_str = "销售扣款"; } if (Warrant_type == 2) { Warrant_type_str = "验证扣款"; } } else { Response.Redirect("/Agent/Default.aspx"); } } }
internal List <DealResponseBody> GetDealResponseBody(out int totalcount, Agent_company Agentinfo, string method, List <string> productIdList, int currentPage = 0, int pageSize = 0) { #region 多点拉取 if (method.Trim() == "multi") { string proidstr = ""; foreach (string proid in productIdList) { proidstr = proid + ","; } proidstr = proidstr.Substring(0, proidstr.Length - 1); string sql = "select * from b2b_com_pro where id in (select proid from b2b_com_pro_groupbuystocklog where proid in (" + proidstr + ") and isstock=1 and stockagentcompanyid=" + Agentinfo.Id + ") and pro_end>='" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; var cmd = sqlHelper.PrepareTextSqlCommand(sql); List <DealResponseBody> list = new List <DealResponseBody>(); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new DealResponseBody { useDateMode = reader.GetValue <int>("isneedbespeak"), //不需要预约则为0;需要预约则预约当天可用,为1 visitorInfoType = reader.GetValue <int>("issetidcard") == 0 ? 1 : 3, //不需要身份证号则为1;需要身份证号则为3 visitorInfoGroupSize = 0, //每多少个人共用一个游客信息(不会出现这种情况,设为0) visitorInfoRule = new UserInfoRule { name = reader.GetValue <int>("issetidcard") == 0 ? false : true, pinyin = reader.GetValue <int>("issetidcard") == 0 ? false : true, mobile = true, address = false, email = false, hkmlp = false, tlp = false, mtp = false, passport = false, credentials = reader.GetValue <int>("issetidcard") == 0 ? false : true }, autoRefundTime = 0, refundType = reader.GetValue <int>("QuitTicketMechanism") == 0 ? 4 : reader.GetValue <int>("QuitTicketMechanism") == 1 ? 4 : 3, partlyRefund = false, refundNote = "", refundStairsRules = GetRefundStairsRules(reader.GetValue <int>("isneedbespeak"), reader.GetValue <int>("QuitTicketMechanism")), scheduleOnlineTime = reader.GetValue <DateTime>("pro_start").ToString("yyyy-MM-dd"), scheduleOfflineTime = reader.GetValue <DateTime>("pro_end").AddDays(1).ToString("yyyy-MM-dd"), servicePhones = new List <ServicePhone>(), //?? 服务电话 getInAddresses = new string[] { "" }, //?? 入园地址 needTicket = false, getTicketRule = new GetTicketRule(), ticketGetAddress = new string[] { "" }, orderCancelTime = 30, otherNote = reader.GetValue <string>("Precautions"), returnVoucher = true, voucherText = "", getVoucherRule = new GetVoucherRule { effectiveCertificate = false, voucherLoaders = new int[] { 2, 4 }, needCertificateSupplement = false, certificateSupplement = "" }, stock = reader.GetValue <int>("ispanicbuy") == 0 ? -1 : reader.GetValue <int>("limitbuytotalnum"), marketPrice = reader.GetValue <decimal>("face_price"), mtPrice = reader.GetValue <decimal>("advise_price"), settlementPrice = 0,//结算价?? voucherTimeBegin = 0, voucherTimeEnd = 0, voucherTimes = GetVoucherTimes(), aheadHoursType = reader.GetValue <int>("iscanuseonsameday"), aheadMinutes = reader.GetValue <int>("iscanuseonsameday") == 1 ? 0 : reader.GetValue <int>("iscanuseonsameday") == 2 ? 2 * 60 : 24 * 60 + (24 * 60 - 23 * 60 - 59), aheadTimeRules = new List <AheadTimeRule>(), idLimitDays = 0, idLimitCount = 0, phoneLimitDays = 0, phoneLimitCount = 0, maxBuyCount = reader.GetValue <int>("pro_number"), minBuyCount = 1, title = reader.GetValue <string>("pro_name"), subTitle = "", include = reader.GetValue <string>("service_Contain"), exclude = reader.GetValue <string>("service_NotContain"), partnerId = int.Parse(Agentinfo.mt_partnerId), partnerDealId = reader.GetValue <int>("id").ToString(), partnerPoiId = reader.GetValue <int>("projectid").ToString(), dealImageInfos = GetDealImageInfos(reader.GetValue <int>("imgurl")),//??产品图片 voucherDateBegin = reader.GetValue <DateTime>("pro_start").ToString("yyyy-MM-dd"), voucherDateEnd = reader.GetValue <DateTime>("pro_end").AddDays(1).ToString("yyyy-MM-dd"), validWeekRule = GetValidWeekRule(reader.GetValue <int>("isblackoutdate"), reader.GetValue <int>("etickettype")), unavailableDates = new string[] { "" } }); } } totalcount = list.Count; return(list); } #endregion #region 批量拉取 page else if (method.Trim() == "page") { var cmd = this.sqlHelper.PrepareStoredSqlCommand("proc_ListPage"); var condition = "id in (select proid from b2b_com_pro_groupbuystocklog where isstock=1 and stockagentcompanyid=" + Agentinfo.Id + ") and pro_end>='" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; cmd.PagingCommand1("b2b_com_pro", "*", "id", "", pageSize, currentPage, "", condition); List <DealResponseBody> list = new List <DealResponseBody>(); using (var reader = cmd.ExecuteReader()) { while (reader.Read()) { list.Add(new DealResponseBody { useDateMode = reader.GetValue <int>("isneedbespeak"), //不需要预约则为0;需要预约则预约当天可用,为1 visitorInfoType = reader.GetValue <int>("issetidcard") == 0 ? 1 : 3, //不需要身份证号则为1;需要身份证号则为3 visitorInfoGroupSize = 0, //每多少个人共用一个游客信息(不会出现这种情况,设为0) visitorInfoRule = new UserInfoRule { name = reader.GetValue <int>("issetidcard") == 0 ? false : true, pinyin = reader.GetValue <int>("issetidcard") == 0 ? false : true, mobile = reader.GetValue <int>("issetidcard") == 0 ? false : true, address = false, email = false, hkmlp = false, tlp = false, mtp = false, passport = false, credentials = reader.GetValue <int>("issetidcard") == 0 ? false : true }, autoRefundTime = 0, refundType = reader.GetValue <int>("QuitTicketMechanism") == 0 ? 4 : reader.GetValue <int>("QuitTicketMechanism") == 1 ? 4 : 3, partlyRefund = false, refundNote = "", refundStairsRules = GetRefundStairsRules(reader.GetValue <int>("isneedbespeak"), reader.GetValue <int>("QuitTicketMechanism")), scheduleOnlineTime = reader.GetValue <DateTime>("pro_start").ToString("yyyy-MM-dd"), scheduleOfflineTime = reader.GetValue <DateTime>("pro_end").AddDays(1).ToString("yyyy-MM-dd"), servicePhones = new List <ServicePhone>(), //?? 服务电话 getInAddresses = new string[] { "" }, //?? 入园地址 needTicket = false, getTicketRule = new GetTicketRule(), ticketGetAddress = new string[] { "" }, orderCancelTime = 30, otherNote = reader.GetValue <string>("Precautions"), returnVoucher = true, voucherText = "", getVoucherRule = new GetVoucherRule { effectiveCertificate = false, voucherLoaders = new int[] { 2, 4 }, needCertificateSupplement = false, certificateSupplement = "" }, stock = reader.GetValue <int>("ispanicbuy") == 0 ? -1 : reader.GetValue <int>("limitbuytotalnum"), marketPrice = reader.GetValue <decimal>("face_price"), mtPrice = reader.GetValue <decimal>("advise_price"), settlementPrice = 0,//结算价?? voucherTimeBegin = 0, voucherTimeEnd = 0, voucherTimes = GetVoucherTimes(), aheadHoursType = reader.GetValue <int>("iscanuseonsameday"), aheadMinutes = reader.GetValue <int>("iscanuseonsameday") == 1 ? 0 : reader.GetValue <int>("iscanuseonsameday") == 2 ? 2 * 60 : 24 * 60 + (24 * 60 - 23 * 60 - 59), aheadTimeRules = new List <AheadTimeRule>(), idLimitDays = 0, idLimitCount = 0, phoneLimitDays = 0, phoneLimitCount = 0, maxBuyCount = reader.GetValue <int>("pro_number"), minBuyCount = 1, title = reader.GetValue <string>("pro_name"), subTitle = "", include = reader.GetValue <string>("service_Contain"), exclude = reader.GetValue <string>("service_NotContain"), partnerId = int.Parse(Agentinfo.mt_partnerId), partnerDealId = reader.GetValue <int>("id").ToString(), partnerPoiId = reader.GetValue <int>("projectid").ToString(), dealImageInfos = GetDealImageInfos(reader.GetValue <int>("imgurl")),//??产品图片 voucherDateBegin = reader.GetValue <DateTime>("pro_start").ToString("yyyy-MM-dd"), voucherDateEnd = reader.GetValue <DateTime>("pro_end").AddDays(1).ToString("yyyy-MM-dd"), validWeekRule = GetValidWeekRule(reader.GetValue <int>("isblackoutdate"), reader.GetValue <int>("etickettype")), unavailableDates = new string[] { "" } }); } } totalcount = int.Parse(cmd.Parameters[0].Value.ToString()); return(list); } #endregion else { totalcount = 0; return(new List <DealResponseBody>()); } }
public static void AsyncSendSms(discardcodecallbackmodel discardcodecalljson, Agent_company agentinfo) { var lvmamadata = new LVMAMA_Data(agentinfo.Lvmama_uid, agentinfo.Lvmama_password, agentinfo.Lvmama_Apikey); var asynnoticecall = lvmamadata.discardcodecallbacksend(discardcodecalljson, agentinfo.Id); }
// 订单退票 public string Getorderrefund(Lvmama_reqlog mlog, Agent_company agentinfo) { var response = new backRefund(); response.uid = agentinfo.Lvmama_uid; try { int organization = agentinfo.Id; #region 把分销商发送过来的请求记入数据库日志表2 agent_requestlog Agent_requestlog reqlog = new Agent_requestlog() { Id = 0, Organization = organization, Encode_requeststr = "", Decode_requeststr = _requestParam, Request_time = DateTime.Now, Encode_returnstr = "", Decode_returnstr = "", Return_time = DateTime.Parse("1970-01-01 00:00:00"), Errmsg = "", Request_type = "discard_code", Req_seq = "", Ordernum = "", Is_dealsuc = 0, Is_second_receivereq = 0, Request_ip = CommonFunc.GetRealIP() }; int reqlogid = new Agent_requestlogData().Editagent_reqlog(reqlog); reqlog.Id = reqlogid; #endregion var data = JsonConvert.DeserializeObject <discard_codemodel>(_requestParam); if (data.uid == "") { response.uid = agentinfo.Lvmama_uid; response.status = "2"; response.msg = "数据解析失败"; return(EditLvmamalog_Order(response, mlog, reqlog)); } else { string uid = data.uid; string password = data.password; string sign = data.sign; string timestamp = data.timestamp; string extId = data.extId; Lvmama_reqlog LvmamaOrderCrateSucLog = new lvmama_reqlogData().GetLvmama_OrderpayreqlogBySelforderid(int.Parse(extId), "0"); if (LvmamaOrderCrateSucLog == null) { response.status = "4"; response.msg = "未查找到相对应订单"; return(EditLvmamalog_Order(response, mlog, null)); } string lvmamaorderid = LvmamaOrderCrateSucLog.mtorderid; data.lvmmamaorderid = lvmamaorderid; B2bOrderData dataorder = new B2bOrderData(); B2b_order modelb2border = dataorder.GetOrderById(int.Parse(extId)); if (modelb2border == null) { response.status = "4"; response.msg = "未查找到相对应订单"; return(EditLvmamalog_Order(response, mlog, null)); } int num = modelb2border.U_num; data.num = num; //日志表2 判断是否是二次发送相同的请求 int is_secondreq = new Agent_requestlogData().Is_secondreq(organization.ToString(), lvmamaorderid, reqlog.Request_type); #region 把发送的请求类型,请求流水号,订单号,是否是二次发送相同的请求录入数据库 日志表2 reqlog.Req_seq = lvmamaorderid; reqlog.Ordernum = extId; reqlog.Is_second_receivereq = is_secondreq; new Agent_requestlogData().Editagent_reqlog(reqlog); #endregion #region 编辑日志表1 mlog.mtorderid = lvmamaorderid; mlog.ordernum = extId; mlog.issecond_req = is_secondreq; new lvmama_reqlogData().EditReqlog(mlog); #endregion //因为是作废,重复的也可以操作,但返回不一定正确 if (is_secondreq == 1) { return(Cancel_order(reqlog, data, organization.ToString(), mlog)); } else { return(Cancel_order(reqlog, data, organization.ToString(), mlog)); } } } catch (Exception ex) { response.status = "2"; response.msg = "异常错误"; return(EditLvmamalog_Order(response, mlog, null)); } }
protected void Page_Load(object sender, EventArgs e) { #region 记入日志表Meituan_reqlog string reqip = CommonFunc.GetRealIP(); Meituan_reqlog mlog = new Meituan_reqlog { id = 0, reqstr = _requestParam, subtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), respstr = "", resptime = "", code = "", describe = "", req_type = "", sendip = reqip, stockagentcompanyid = 0 }; int logid = new Meituan_reqlogData().EditReqlog(mlog); mlog.id = logid; #endregion string date = System.Web.HttpContext.Current.Request.Headers.Get("Date"); string PartnerId = System.Web.HttpContext.Current.Request.Headers.Get("PartnerId"); string Authorization = System.Web.HttpContext.Current.Request.Headers.Get("Authorization"); string requestMethod = System.Web.HttpContext.Current.Request.HttpMethod; string URI = System.Web.HttpContext.Current.Request.CurrentExecutionFilePath; //authorization 形式: "MWS" + " " + client + ":" + sign; string mtSign = Authorization.Substring(Authorization.IndexOf(":") + 1); mlog.req_type = URI; agentinfo = new AgentCompanyData().GetAgentCompanyByMeituanPartnerId(PartnerId); #region 验证是否已经配置美团合作商信息 if (agentinfo == null) { var response = new PoiResponse(); response.partnerId = int.Parse(PartnerId); response.code = 300; response.describe = "分销尚未配置美团合作商信息(合作商PartnerId:" + PartnerId + ")"; string json = JsonConvert.SerializeObject(response); //把处理结果录入日志 mlog.respstr = json; mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); mlog.code = response.code.ToString(); mlog.describe = response.describe; new Meituan_reqlogData().EditReqlog(mlog); LogHelper.RecordSelfLog("Error", "meituan", response.describe); Response.Write(json); return; } #endregion mlog.stockagentcompanyid = agentinfo.Id; #region 签名验证 string beforeSign = requestMethod + " " + URI + "\n" + date; string afterSign = new MeiTuanInter(agentinfo.mt_partnerId, agentinfo.mt_secret, agentinfo.mt_client).GetSign(beforeSign); //判断签名是否正确 if (afterSign != mtSign) { var response = new PoiResponse(); response.partnerId = int.Parse(PartnerId); response.code = 300; response.describe = "签名验证失败"; string json = JsonConvert.SerializeObject(response); //把处理结果录入日志 mlog.respstr = json; mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); mlog.code = response.code.ToString(); mlog.describe = response.describe; new Meituan_reqlogData().EditReqlog(mlog); LogHelper.RecordSelfLog("Error", "meituan", "拉取产品 签名错误 mtSign-" + mtSign + " meSign-" + afterSign); Response.Write(json); return; } #endregion string actionResult = GetPoiList(mlog); Response.Write(actionResult); }
protected void Page_Load(object sender, EventArgs e) { //6313(易城专属测试分销) 需要替换为测试分销商id agentinfo = new AgentCompanyData().GetAgentCompany(6313); }
protected void Page_Load(object sender, EventArgs e) { #region 记入日志表LVmama_reqlog string reqip = CommonFunc.GetRealIP(); Lvmama_reqlog mlog = new Lvmama_reqlog { id = 0, reqstr = _requestParam, subtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), respstr = "", resptime = "", code = "", describe = "", req_type = "sms_resend", sendip = reqip, stockagentcompanyid = 0 }; int logid = new lvmama_reqlogData().EditReqlog(mlog); mlog.id = logid; #endregion var data = JsonConvert.DeserializeObject <sms_resendmodel>(_requestParam); if (data == null) { return; } try { uid = data.uid; password = data.password; string timestamp = data.timestamp; string sign = data.sign; string extId = data.extId; agentinfo = new AgentCompanyData().GetAgentCompanyByLvmamaPartnerId(uid); LVMAMA_Data lvmamadata = new LVMAMA_Data(agentinfo.Lvmama_uid, agentinfo.Lvmama_password, agentinfo.Lvmama_Apikey); #region 验证是否已经配置驴妈妈合作商信息 if (agentinfo == null) { var response = new apply_codeRefund(); response.uid = uid; response.orderId = "0"; response.status = "2"; response.msg = "分销尚未配置驴妈妈商信息(uid:" + uid + ")"; string json = JsonConvert.SerializeObject(response); //把处理结果录入日志 mlog.respstr = ""; mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); mlog.code = response.status; mlog.describe = response.msg; new lvmama_reqlogData().EditReqlog(mlog); LogHelper.RecordSelfLog("Error", "lvmama", response.msg); Response.Write(json); return; } #endregion mlog.stockagentcompanyid = agentinfo.Id; mlog.ordernum = extId; #region 签名验证 string Md5Sign = lvmamadata.sms_resend_codemd5(data); string afterSign = lvmamadata.lumamasign(Md5Sign, agentinfo.Lvmama_Apikey); //判断签名是否正确 if (afterSign != sign) { var response = new apply_codeRefund(); response.uid = uid; response.orderId = extId; response.status = "2"; response.msg = "签名认证失败"; string json = JsonConvert.SerializeObject(response); //把处理结果录入日志 mlog.respstr = ""; mlog.resptime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); mlog.code = response.status; mlog.describe = response.msg; new lvmama_reqlogData().EditReqlog(mlog); LogHelper.RecordSelfLog("Error", "lvmama", "签名错误 lvmamamSign-" + sign + " meSign-" + afterSign); Response.Write(json); return; } #endregion string actionResult = Smsresend(mlog, agentinfo); Response.Write(actionResult); } catch (Exception ex) { // Response.Write(ex); } }
public string Getordercreate(Lvmama_reqlog mlog, Agent_company agentinfo) { lock (lockobj) { var response = new apply_codeRefund(); try { var data = JsonConvert.DeserializeObject <apply_codemodel>(_requestParam); if (data.contacts == null) { response.uid = agentinfo.Lvmama_uid; response.status = "2"; response.msg = "数据解析失败"; return(EditLvmamalog_Order(response, mlog)); } else { contacts body = data.contacts; string num = data.num; string timestamp = data.timestamp; string visitTime = data.visitTime; string supplierGoodsId = data.supplierGoodsId; string settlePrice = data.settlePrice; string serialNo = data.serialNo; string idNum = body.idNum; string name = body.name; string mobile = body.mobile; string idType = body.idType; //结算价核对 decimal jiesuanjia = 0; ////todo 根据请求参数查询产品返回结果 B2b_com_pro pro = new B2bComProData().GetProById(supplierGoodsId); #region 产品信息 if (pro != null) { #region 分销授权信息判断 Agent_company agentwarrantinfo = AgentCompanyData.GetAgentWarrant(agentinfo.Id, pro.Com_id); if (agentwarrantinfo != null) { int warrantid = agentwarrantinfo.Warrantid; int Warrant_type = agentwarrantinfo.Warrant_type; //支付类型分销 1出票扣款 2验码扣款 int Warrant_level = agentwarrantinfo.Warrant_level; if (Warrant_level == 1) { jiesuanjia = pro.Agent1_price; } if (Warrant_level == 2) { jiesuanjia = pro.Agent2_price; } if (Warrant_level == 3) { jiesuanjia = pro.Agent3_price; } if (agentwarrantinfo.Warrant_state == 0) { response.uid = agentinfo.Lvmama_uid; response.orderId = "0"; response.status = "3"; response.msg = "商户关闭授权"; return(EditLvmamalog_Order(response, mlog)); } } else { response.uid = agentinfo.Lvmama_uid; response.orderId = "0"; response.status = "3"; response.msg = "商户未授权开通分销"; return(EditLvmamalog_Order(response, mlog)); } #endregion #region 暂时对外接口只支持票务产品 //if (pro.Server_type != 1) //{ // response.status = 300; // response.msg = "暂时对外接口只支持票务产品,其他产品请到分销后台提单"; // return EditLvmamalog_Order(response, mlog); //} #endregion #region 结算价,保证价格是最新价格 decimal advice_price = Convert.ToDecimal(settlePrice); if (jiesuanjia != advice_price) { response.uid = agentinfo.Lvmama_uid; response.orderId = "0"; response.status = "3"; response.msg = "结算价格不同,请联系供应商要去新的价格。驴妈妈价:" + advice_price + " 系统价:" + jiesuanjia; return(EditLvmamalog_Order(response, mlog)); } #endregion #region 产品编码格式有误 if (supplierGoodsId.ConvertTo <int>(0) == 0) { response.uid = agentinfo.Lvmama_uid; response.orderId = "0"; response.status = "3"; response.msg = "产品编码格式有误"; return(EditLvmamalog_Order(response, mlog)); } #endregion #region 购买数量格式有误 if (num.ConvertTo <int>(0) == 0) { response.uid = agentinfo.Lvmama_uid; response.orderId = "0"; response.status = "3"; response.msg = "购买数量格式有误"; return(EditLvmamalog_Order(response, mlog)); } #endregion #region 产品限购则需要判断 限购数量 是否足够 if (pro.Ispanicbuy != 0) { //最多可购买数量 int zuiduo_canbuynum = pro.Limitbuytotalnum; if (int.Parse(num) > zuiduo_canbuynum) { response.uid = agentinfo.Lvmama_uid; response.orderId = "0"; response.status = "3"; response.msg = "产品库存不足"; return(EditLvmamalog_Order(response, mlog)); } } #endregion #region 产品已暂停 if (pro.Pro_state == 0) { response.uid = agentinfo.Lvmama_uid; response.orderId = "0"; response.status = "3"; response.msg = "产品已下线,请联系商家"; return(EditLvmamalog_Order(response, mlog)); } #endregion #region 产品已过期 if (pro.Pro_end < DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"))) { response.uid = agentinfo.Lvmama_uid; response.orderId = "0"; response.status = "3"; response.msg = "产品已过期"; return(EditLvmamalog_Order(response, mlog)); } #endregion #region 产品是否需要预约:需要预约则最晚预约时间是 游玩前一天的18点 //if (pro.isneedbespeak == 1) //{ // if (timestamp != "") // { // DateTime visitdate = DateTime.Parse(timestamp); // DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); // //必须提前一天预约 // if (bookdate >= visitdate) // { // response.orderId = "0"; //response.status = "300"; //response.msg = "产品未预约产品"; // return EditLvmamalog_Order(response, mlog); // } // } //} #endregion #region 是否有使用限制 //if (pro.Iscanuseonsameday == 0)//1:当天出票可用 ;2:2小时内出票不可用;0:当天出票不可用 //{ // if (body.travelDate != "") // { // DateTime visitdate = DateTime.Parse(body.travelDate);//游玩日期:2012-12-12 格式要求:yyyy-MM-dd // DateTime bookdate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")); // if (bookdate >= visitdate) // { // response.code = 300; // response.describe = "预定日期至少在游玩日期之前一天"; // return EditMTlog_Order(response, mlog); // } // } //} #endregion Lvmama_reqlog mtOrderCrateSucLog = new lvmama_reqlogData().GetLvmamaOrderCreateLogByLvmamaorder(serialNo, "0"); #region 查询驴妈妈吗 是否 创建订单日志 if (mtOrderCrateSucLog != null) { string pno = ""; if (pro.Source_type == 3) //如果是接口产品,按接口方式读码selservice,接口产品只读取了wl的码 { if (pro.Serviceid == 4) { //如果是接口产品 B2b_company commanage = B2bCompanyData.GetAllComMsg(pro.Com_id); WlGetProInfoDealRequestData wldata = new WlGetProInfoDealRequestData(commanage.B2bcompanyinfo.wl_PartnerId, commanage.B2bcompanyinfo.wl_userkey); var wlorderinfo = wldata.SearchWlOrderData(pro.Com_id, 0, "", int.Parse(mtOrderCrateSucLog.ordernum)); if (wlorderinfo != null) { pno = wlorderinfo.vouchers; } } } else { //如果不是借口,则按自己规则读码 SendEticketData sendate = new SendEticketData(); pno = sendate.HuoQuEticketPno(int.Parse(mtOrderCrateSucLog.ordernum)); } response.uid = agentinfo.Lvmama_uid; response.orderId = mtOrderCrateSucLog.ordernum; response.status = "0"; response.authCode = pno; response.serialNo = serialNo; response.msg = "订单创建成功"; mlog.ordernum = mtOrderCrateSucLog.ordernum; return(EditLvmamalog_Order(response, mlog)); } #endregion #region 此驴妈妈订单号 ,没有成功创建过 else { int isInterfaceSub = 1; //是否是电子票接口提交的订单:0.否;1.是 string ordertype = "1"; //1.出票2.充值 int orderid = 0; int speciid = 0; //string real_name = ""; //string mobile = ""; string use_date = timestamp.Substring(0, 4) + "-" + timestamp.Substring(4, 2) + "-" + timestamp.Substring(6, 2); //real_name = name; //mobile = mobile; //创建一笔未支付订单 string rdata = OrderJsonData.AgentOrder(agentinfo.Id, supplierGoodsId, ordertype, num, name, mobile, use_date, "", isInterfaceSub, out orderid); XmlDocument retdoc = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + rdata + "}"); XmlElement retroot = retdoc.DocumentElement; string rtype = retroot.SelectSingleNode("type").InnerText; string rmsg = retroot.SelectSingleNode("msg").InnerText; if (rtype == "100") //创建订单成功 { response.uid = agentinfo.Lvmama_uid; response.status = "0"; response.msg = "订单创建成功"; response.orderId = orderid.ToString(); response.serialNo = serialNo; response.authCode = retroot.SelectSingleNode("pno").InnerText; //只有成功的订单才有pno项; mlog.ordernum = orderid.ToString(); return(EditLvmamalog_Order(response, mlog)); } else { response.uid = agentinfo.Lvmama_uid; response.status = "3"; response.msg = "创建订单失败" + rmsg; return(EditLvmamalog_Order(response, mlog)); } } #endregion } else { response.uid = agentinfo.Lvmama_uid; response.uid = "0"; response.status = "4"; response.msg = "产品不存在"; return(EditLvmamalog_Order(response, mlog)); } #endregion } } catch (Exception ex) { response.uid = agentinfo.Lvmama_uid; response.status = "8"; response.msg = "异常错误" + ex; return(EditLvmamalog_Order(response, mlog)); } } }