public string execute(string request) { //1201|31.118725|121.376808|12312aasdas12312|IMEI|7a31f99279327f8b75506acbf0503973 string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[1] + req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[5].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[3].ToLower()); if (parter != null) { string lat = req[1].Trim(); string lng = req[2].Trim(); if (parter.Id == 11)//判断是博泰,对坐标进行转换 { ChangeCoords.ChangeCoordinate(ref lat, ref lng, 3, 5); } int countsum = new T_PDLoginLogDal().GetcountBysign(req[3].ToLower()); //计算使用次数 if (parter.Daycount > countsum) { //添加 double latNear = Convert.ToDouble(req[1]); double lngNear = Convert.ToDouble(req[2]); CoordinateHelper.BaiduToScott(ref lngNear, ref latNear); req[1] = latNear.ToString(); req[2] = lngNear.ToString(); List<sjinfo> users = new D_DriverInfoDal().GetNewUserByLatlng(req[1], req[2],parter.Sign); if (users.Count != 0) { //添加数据 T_ParterDyLog TPL = new T_ParterDyLog(); TPL.sign = req[3].ToLower(); TPL.lat = lat; TPL.lng = lng; TPL.imei = req[4]; TPL.addtime = DateTime.Now; //1:获取司机2:上传通话3:上传预约 TPL.typeid = 1; new T_ParterDyLogDal().AddParterDyLog(TPL); } return JsonConvert.SerializeObject(users); } else { throw new Exception("当天次数已经使用完毕!"); } } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
public string execute(string request) { // 1205|12312aasdas12312|上海| IMEI |7a31f99279327f8b75506acbf0503973 string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[4].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[1].ToLower()); if (parter != null) { int countsum = new T_ParterDyLogDal().GetcountBysign(req[1].ToLower()); //计算使用次数 if (parter.Daycount > countsum) { //添加数据 T_ParterDyLog TPL = new T_ParterDyLog(); TPL.sign = req[1].ToLower(); TPL.lat = "0"; TPL.lng = "0"; TPL.imei = req[3]; TPL.addtime = DateTime.Now; //1:获取司机2:上传通话3:上传预约4:获取评价5:获取城市信息 TPL.typeid = 5; new T_ParterDyLogDal().AddParterDyLog(TPL); ChengShiModel cs = new D_CityPriceDal().GetChengShiInfo(req[2].ToLower()); if (cs.Name != null) { return JsonConvert.SerializeObject(cs); } else { IList<ChengShiName> csn = new D_CityPriceDal().GetChengShiName(req[2].ToLower()); return JsonConvert.SerializeObject(csn); } } else { throw new Exception("当天次数已经使用完毕!"); } } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
// 1214|sign|orderid|CustomerCellPhone|Ucode|DriverName|ComplaintContent|7a31f99279327f8b75506acbf0503973 public string execute(string request) { int flag = 0; string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[7].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[1].ToLower()); if (parter != null) { string orderCellPhone = ""; string orderUcode = ""; new D_OrderInfoDal().getOrderCellphone_Ucode(req[2], out orderCellPhone, out orderUcode); if (!orderCellPhone.ToLower().Equals(req[3].ToLower())) { throw new Exception("没有该用户"); } if (!orderUcode.ToLower().Equals(req[4].ToLower())) { throw new Exception("没有该司机"); } CustomerInfoEntity ci = new D_CustomerInfoDal().GetClientInfoByPhone(orderCellPhone); D_OrderComplaint dc = new D_OrderComplaint() { Cellphone = ci.Cellphone, OrderId = req[2], CustomerId = ci.CustomerId, CustomerName = ci.CustomerName, Ucode = req[4], ComplaintContent = req[6], DriverName = req[5], CreateUser = "******" }; flag = new ComplainDAL().addComplain(dc); } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } return flag.ToString(); }
// 1216|sign|UCode|7a31f99279327f8b75506acbf0503973 public string execute(string request) { string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[3].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[1].ToLower()); if (parter != null) { AdjDBObject db = new AdjDBObject(); string sql = "select Ucode, DriverName,'" + ConfigHelper.ImagePath + "/' + Photo Photo,DrivedYears,DriveCount,NewGrade,SatisfactionRate from d_driverinfo where UCode = @UCode"; db.GetSqlStringCommand(sql); db.AddInParameter("@UCode", System.Data.DbType.String, req[2]); DataTable dt = db.ExecuteDataSet().Tables[0]; if (dt.Rows.Count > 0) { return JsonConvert.SerializeObject(new { Ucode = dt.Rows[0]["Ucode"].ToString(), DriverName = dt.Rows[0]["DriverName"].ToString(), DrivedYears = dt.Rows[0]["DrivedYears"].ToString(), Photo = dt.Rows[0]["Photo"].ToString(), DriveCount = dt.Rows[0]["DriveCount"].ToString(), NewGrade = dt.Rows[0]["NewGrade"].ToString(), SatisfactionRate = dt.Rows[0]["SatisfactionRate"].ToString() }); } throw new Exception("没有该司机!"); } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
public string execute(string request) { //1208|1订单号|2合作商标识|3MD5串-MD5(订单号+aidaijia) string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[1] + "aidaijia", "utf-8"); if (sign.ToLower() == req[3].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[2].ToLower()); if (parter != null) { return InvokeGetOrderStateService(req[1]); } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
// 1215|sign|orderid|7a31f99279327f8b75506acbf0503973 public string execute(string request) { string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[3].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[1].ToLower()); if (parter != null) { AdjDBObject db = new AdjDBObject(); string sql = "SELECT Id,OrderId,OrderStatus,StatusText,create_time FROM D_OrderStatusChangeLog where OrderId = @OrderId"; db.GetSqlStringCommand(sql); db.AddInParameter("@OrderId",System.Data.DbType.String,req[2]); DataTable dt = db.ExecuteDataSet().Tables[0]; List<OrderHistory> list = new List<OrderHistory>(); for (int i = 0; i < dt.Rows.Count; i++) { list.Add(new OrderHistory() { orderid = dt.Rows[i]["OrderId"].ToString(), OrderStatus = Convert.ToInt32(dt.Rows[i]["OrderStatus"]), StatusText = dt.Rows[i]["StatusText"].ToString(), create_time = Convert.ToDateTime(dt.Rows[i]["create_time"]) }); } return JsonConvert.SerializeObject(list); } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
public string execute(string request) { //1220|1|6|U0089023|某某|38.00|MV2JL366U9H1|1|3fe5d0205970e8a732686c7cc2e99999|5874bddc503680232ffab25fbd9f4b6e string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[6] + "aidaijia", "utf-8"); if (sign.ToLower() == req[9].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[8].ToLower()); if (parter != null) { D_CustomerRechargeEntity dcre = new D_CustomerRechargeEntity(); CustomerInfoEntity ci = new D_CustomerInfoDal().GetClientInfoByPhone(req[3]); string cn = string.IsNullOrEmpty(ci.CustomerId) ? string.Empty : ci.CustomerId; dcre.RechargeType =Convert.ToInt32(req[1]); dcre.From = Convert.ToInt32(req[2]); dcre.CustomerName = req[4]; dcre.CustomerId = cn; dcre.Amount = Convert.ToDecimal(req[5]); dcre.Status = 0; dcre.create_user = "******"; dcre.OrderId = req[6]; dcre.SubRechargeType = Convert.ToInt32(req[7]); string RechargeId = AddCustomerRecharge(dcre); return JsonHelper.ToJson<object>(new { out_trade_no = RechargeId }); } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
/// <summary> /// 立即预约,成功返回订单号 /// </summary> /// <param name="request"></param> /// <returns></returns> public string execute(string request) { //1217|1姓名|2客户手机号|3地址|4司机工号|5lat|6lng|7from|8sign|9IMEI|10MD5串|11remark|12youhui string result = "0"; string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[10].ToLower()) { ThirdPartyCoupon cc = new ThirdPartyCoupon(); //判断T_ClentInfo是否有此手机号相关信息 //如果用户不存在,创建一个新用户 CustomerInfoEntity cinfo = new D_CustomerInfoDal().GetClientInfoByPhone(req[2].Trim()); T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[8].ToLower()); string couponCode = ""; if (parter != null) { #region 调用冯超接口检查是否新用户 if (InvokeStateService(req[2].Trim()).Equals(1)) { if (parter.url != null) { cc.isCoupon(parter.url); if (!cc.check(req[12], req[13], parter.url)) { throw new Exception("优惠码无效"); } couponCode = req[11]; } } #endregion #region 优惠码操作 //if (req.Length == 14 && parter.url != null) //{ // if (!cc.check(req[12], req[13], parter.url)) // { // throw new Exception("优惠码无效"); // } // //couponCode = cc.addCoupon(parter.Id.ToString(), req[12], req[13], cinfo); //} #endregion #region 调用web service 处理创建指定司机派单信息 DriverInfoEntity driverInfo = new D_DriverInfoDal().GetDriverInfoByUcode(req[4].Trim()); if (driverInfo == null) { throw new Exception("指定司机不存在!"); } if (driverInfo.Online == 0) { throw new Exception("该司机已经下线,不能接受您指派的任务!"); } else if (driverInfo.OnService == 1 || driverInfo.OnDOService == 1) { throw new Exception("该司机已经在服务中了,不能接受您指派的任务!"); } else { CreateOrderServiceRequestEntity createOrderEntity = new CreateOrderServiceRequestEntity(); createOrderEntity.Ucode = req[4].Trim(); createOrderEntity.RecommendCode = couponCode; createOrderEntity.Parterid = parter.Id; createOrderEntity.BusinessType = 1; // 酒后代驾 createOrderEntity.OrderFrom = 5; // 合作商 createOrderEntity.AppointTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); createOrderEntity.Address = req[3].Trim(); createOrderEntity.FromCellPhone = req[2].Trim(); createOrderEntity.CellPhone = req[2].Trim(); string latStr = req[5].Trim(); string lngStr = req[6].Trim(); if (parter.Id == 11)//判断是博泰,对坐标进行转换 { ChangeCoords.ChangeCoordinate(ref latStr, ref lngStr, 3, 5); } double lat; if (double.TryParse(latStr, out lat)) { createOrderEntity.Lat = lat; } double lng; if (double.TryParse(lngStr, out lng)) { createOrderEntity.Lng = lng; } createOrderEntity.AllUserCount = 1; createOrderEntity.Remark = req[11].Trim(); createOrderEntity.Status = 0; string url = string.Format("http://{0}/api/createOrder", ConfigHelper.APIServer); result = new CreateOrder().InvokeCreateOrderService(url, createOrderEntity); } #endregion } else { throw new Exception("商户标识错误。"); } } else { throw new Exception("签名错误。"); } return result; }
public string execute(string request) { // 1207|12312aasdas12312|ucode| IMEI |7a31f99279327f8b75506acbf0503973 string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[4].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[1].ToLower()); if (parter != null) { int countsum = new T_PDLoginLogDal().GetcountBysign(req[1].ToLower()); //计算使用次数 if (parter.Daycount > countsum) { //添加数据 T_ParterDyLog TPL = new T_ParterDyLog(); TPL.sign = req[1].ToLower(); TPL.lat = "0"; TPL.lng = "0"; TPL.imei = req[3]; TPL.addtime = DateTime.Now; //1:获取司机2:上传通话3:上传预约4:获取评价 TPL.typeid = 4; new T_ParterDyLogDal().AddParterDyLog(TPL); List<SjComment> tdpl = new D_DriverCommentDal().GetPingLuns(req[2]); List<SjComment> tdpl2 = new List<SjComment>(); if (tdpl != null) { for (int i = 0; i < tdpl.Count; i++) { SjComment temp = new SjComment(); temp.Create_time = tdpl[i].Create_time; if (tdpl[i].Cellphone.Length > 8) // Regex.IsMatch(tdpl[i].Cellphone, "^1[3-9]{1}[0-9*]{9}") temp.Cellphone = tdpl[i].Cellphone.Substring(0, 4) + "****" + tdpl[i].Cellphone.Substring(8); else temp.Cellphone = "1000****000"; //电话号码长度不匹配处理 temp.Comment = tdpl[i].Comment; temp.CustomerName = tdpl[i].CustomerName; temp.Evaluate = tdpl[i].Evaluate; temp.Ucode = tdpl[i].Ucode; tdpl2.Add(temp); } } return JsonConvert.SerializeObject(tdpl2); } else { throw new Exception("当天次数已经使用完毕!"); } } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
/// <summary> /// 在线预约,成功返回订单号 /// </summary> /// <param name="request"></param> /// <returns></returns> public string execute(string request) { //1211|1张三|21381234567|3莘凌路211号(小锦江酒店)|421:00|5asdfas1231asd|6IMEI|7MD5串|8lat|9lng|10remark|11youhui|12youhuijine string result = "0"; string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[7].ToLower()) { //判断T_ClentInfo是否有此手机号相关信息 //如果用户不存在,创建一个新用户 CustomerInfoEntity cinfo = new D_CustomerInfoDal().GetClientInfoByPhone(req[2].Trim()); T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[5].ToLower()); if (parter != null) { #region 用户不存在则创建 if (cinfo == null) { int clentnum = new D_CustomerInfoDal().SelectSeqClent(); if (clentnum != 0) { string num = string.Empty; for (int i = 0; i < 8 - clentnum.ToString().Length; i++) { num += @"0"; } num = "U" + num + clentnum; CustomerInfoEntity customerEn = new CustomerInfoEntity() { AccountType = 2, Amount = 0, BusinessmanId = 0, Cellphone = req[2].Trim(), ParentPhone = req[2].Trim(), CustomerId = num, CustomerName = req[1].Trim(), CustomerType = 1, Email = string.Empty, HomeAddress = string.Empty, IsNewCustomer = true, LastAppointmentTime = null, LastCalledAddress = string.Empty, RecommendCode = new D_CustomerInfoDal().GenerateCustomerRecommendCode( new D_CustomerInfoDal().SelectSeqClent()), RegisterFrom = 5, //第三方API RegisterVersion = "" }; bool isture = new D_CustomerInfoDal().AddCustomerInfo(customerEn); if (!isture) { //return "0"; throw new Exception("添加新用户失败。"); } cinfo = customerEn; } else { //return "0"; throw new Exception("获取客户种子数失败。"); } } #endregion #region 优惠码操作 string couponCode = ""; if (!WebUtility.ConfigHelper.CloseSign.ToLower().Contains(req[5].ToLower())) { if (req.Length == 13 && parter.url != null) { ThirdPartyCoupon cc = new ThirdPartyCoupon(); if (!cc.check(req[11], req[12], parter.url)) { throw new Exception("优惠码无效"); } couponCode = cc.addCoupon(parter.Id.ToString(), req[11], req[12], cinfo); } log.log("1211IF:【" + request + "】CLOSESIGN【" + WebUtility.ConfigHelper.CloseSign.ToLower() + "】req[5]【" + req[5].ToLower() + "】", System.Web.HttpContext.Current.Server.MapPath("Log/log.txt")); } else { log.log("1211ELSE:【" + request + "】CLOSESIGN【" + WebUtility.ConfigHelper.CloseSign.ToLower() + "】req[5]【" + req[5].ToLower() + "】", System.Web.HttpContext.Current.Server.MapPath("Log/log.txt")); } #endregion #region 调用web service 处理创建预约订单 CreateOrderServiceRequestEntity createOrderEntity = new CreateOrderServiceRequestEntity(); createOrderEntity.Ucode = string.Empty; createOrderEntity.Parterid = parter.Id; createOrderEntity.RecommendCode = "[" + couponCode; createOrderEntity.BusinessType = 1; // 酒后代驾 createOrderEntity.OrderFrom = 5; // 合作商 createOrderEntity.AppointTime = string.Empty; DateTime appointTime; if (DateTime.TryParse(req[4].Trim(), out appointTime)) { createOrderEntity.AppointTime = appointTime.ToString("yyyy-MM-dd HH:mm"); } createOrderEntity.Address = req[3].Trim(); createOrderEntity.FromCellPhone = cinfo.Cellphone; createOrderEntity.CellPhone = cinfo.Cellphone; string latStr = req[8].Trim(); string lngStr = req[9].Trim(); if (parter.Id == 11)//判断是博泰,对坐标进行转换 { ChangeCoords.ChangeCoordinate(ref latStr, ref lngStr, 3, 5); } double lat; double lng; if (double.TryParse(latStr, out lat) && double.TryParse(lngStr, out lng)) { CoordinateHelper.BaiduToScott(ref lng, ref lat); createOrderEntity.Lat = lat; createOrderEntity.Lng = lng; } createOrderEntity.geoType = 1; createOrderEntity.AllUserCount = 1; createOrderEntity.Remark = req[10].Trim(); createOrderEntity.Status = 0; // result = InvokeCreateOrderService(createOrderEntity); string url = string.Format("http://{0}/api/createOrder", ConfigHelper.APIServer); result = new CreateOrder().InvokeCreateOrderService(url ,createOrderEntity); #endregion } else { throw new Exception("商户标识错误。"); } } else { throw new Exception("签名错误。"); } return result; }
public string execute(string request) { //1206|1姓名|2客户手机号|3地址|4司机工号|5lat|6lng|7from|8sign|9IMEI|10MD5串 string result = "0"; string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[10].ToLower()) { //判断T_ClentInfo是否有此手机号相关信息 //如果用户不存在,创建一个新用户 CustomerInfoEntity cinfo = new D_CustomerInfoDal().GetClientInfoByPhone(req[2].Trim()); string cusid = string.Empty; int CustomerType = 1; int AccountType = 2; T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[8].ToLower()); if (parter != null) { #region 用户不存在则创建 if (cinfo == null) { int clentnum = new D_CustomerInfoDal().SelectSeqClent(); if (clentnum != 0) { string num = string.Empty; for (int i = 0; i < 8 - clentnum.ToString().Length; i++) { num += @"0"; } num = "U" + num + clentnum; cusid = num; CustomerInfoEntity customerEn = new CustomerInfoEntity() { AccountType = 2, Amount = 0, BusinessmanId = 0, Cellphone = req[2].Trim(), ParentPhone = req[2].Trim(), CustomerId = num, CustomerName = req[1].Trim(), CustomerType = 1, Email = string.Empty, HomeAddress = string.Empty, IsNewCustomer = true, LastAppointmentTime = null, LastCalledAddress = string.Empty, RecommendCode = new D_CustomerInfoDal().GenerateCustomerRecommendCode( new D_CustomerInfoDal().SelectSeqClent()), RegisterFrom = 5, //第三方API RegisterVersion = "" }; bool isture = new D_CustomerInfoDal().AddCustomerInfo(customerEn); if (!isture) { return "0"; } } else { return "0"; } } else { cusid = cinfo.CustomerId; CustomerType = cinfo.CustomerType; AccountType = cinfo.AccountType; } #endregion #region 创建指定司机派单信息 DriverInfoEntity driverInfo = new D_DriverInfoDal().GetDriverInfoByUcode(req[4].Trim()); if (driverInfo == null) { throw new Exception("指定司机不存在!"); } if (driverInfo.Online == 0) { throw new Exception("该司机已经下线,不能接受您指派的任务!"); } else if (driverInfo.OnService == 1 || driverInfo.OnDOService == 1) { throw new Exception("该司机已经在服务中了,不能接受您指派的任务!"); } else { //直接派单 string distributeOrderId = new DistributeOrderInfoDAL().GenerateDistributeOrderId(new DistributeOrderInfoDAL().SelectSeqOrder()); string lat = req[5].Trim(); string lng = req[6].Trim(); if (parter.Id == 11)//判断是博泰,对坐标进行转换 { ChangeCoords.ChangeCoordinate(ref lat, ref lng, 3, 5); } DistributeOrderInfoEntity model = new DistributeOrderInfoEntity() { Address = req[3].Trim(), AppointOrderId = null, BusinessType = 10, //10酒后代驾 Cellphone = req[2].Trim(), //客户手机号 CustomerId = cusid, CustomerName = req[1].Trim(), CustomerType = CustomerType, AccountType = AccountType, AppointmentTime = DateTime.Now, DistributeOrderId = distributeOrderId, DistributeUser = cusid, DistributeUserType = 3, Fromcellphone = req[2].Trim(), Lat = float.Parse(lat), Lng = float.Parse(lng), OrderFrom = 5,//由8改为5 OrderId = null, OrderType = 1, Status = 11, Create_user = "******", Create_time = DateTime.Now, Remark = "", Ucode = req[4].Trim(), PartyId = parter.Id }; bool istrue = new DistributeOrderInfoDAL().AddDistributeOrderInfo(model); //修改派单状态:派单中 bool isupdate = new DistributeOrderInfoDAL().UpdateOnDoService(1, req[4].Trim()); DistributeOrderDetailEntity detail = new DistributeOrderDetailEntity() { DistributeOrderId = distributeOrderId, Status = 0, Ucode = req[4].Trim(), Create_user = "******" }; bool OrderDetail = new D_DistributeOrderDetailDal().CreateDistributeOrderDetail(detail); DistributeOrderStatusChangeLogEntity log = new DistributeOrderStatusChangeLogEntity() { DistributeOrderId = distributeOrderId, Status = 11, StatusText = "派单已由第三方合作商接口分配给指定司机工号" + req[4].Trim(), Create_user = "******" }; bool OrderStatusChangeLog = new D_DistributeOrderStatusChangeLogDal().CreateDistributeOrderStatusChangeLog(log); if (!istrue || !isupdate) { return "0"; } else { //添加数据 T_ParterDyLog tpl = new T_ParterDyLog(); tpl.sign = req[8]; tpl.lat = "0"; tpl.lng = "0"; tpl.imei = req[9]; tpl.addtime = DateTime.Now; //1:获取司机2:上传通话3:上传预约 tpl.typeid = 3; new T_ParterDyLogDal().AddParterDyLog(tpl); result = "1"; } } #endregion } else { throw new Exception("商户标识错误。"); } } else { throw new Exception("签名错误。"); } return result; }
private string InvokeService(PartCreateOrderEntiry partCreateOrderEntiry) { ////判断T_ClentInfo是否有此手机号相关信息 ////如果用户不存在,创建一个新用户 //CustomerInfoEntity cinfo = new D_CustomerInfoDal().GetClientInfoByPhone(partCreateOrderEntiry.Phone); //string cusid = string.Empty; T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(partCreateOrderEntiry.Sign); if (parter != null) { partCreateOrderEntiry.PartId = parter.Id; var invokeResult = InvokeCreateOrderService(partCreateOrderEntiry); if (invokeResult.Item1) { // return 0 or 1 return invokeResult.Item2; } else { // error throw new Exception(invokeResult.Item2); } } else { throw new Exception("商户标识错误。"); } }
public string execute(string request) { // 1204|12312aasdas12312|uid| IMEI |7a31f99279327f8b75506acbf0503973 string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[4].ToLower()) { #region old代码 //T_Parter parter = new ParterDal().GetParterModelBySign(req[1].ToLower()); //if (parter != null) //{ // int countsum = new ParterDyLogDal().GetcountBysign(req[1].ToLower()); // //计算使用次数 // if (parter.daycount > countsum) // { // //添加数据 // T_ParterDyLog TPL = new T_ParterDyLog(); // TPL.sign = req[1].ToLower(); // TPL.lat = "0"; // TPL.lng = "0"; // TPL.imei = req[3]; // TPL.addtime = DateTime.Now; // //1:获取司机2:上传通话3:上传预约4:获取评价 // TPL.typeid = 4; // new ParterDyLogDal().AddParterDyLog(TPL); // List<Pinglun> tdpl = new PingJiaDal().GetPingLuns(req[2]); // return JsonConvert.SerializeObject(tdpl); // } // else // { // throw new Exception("当天次数已经使用完毕!"); // } //} //else //{ // throw new Exception("商户标识错误"); //} #endregion T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[1].ToLower()); if (parter != null) { int countsum = new T_PDLoginLogDal().GetcountBysign(req[1].ToLower()); //计算使用次数 if (parter.Daycount > countsum) { //添加数据 T_ParterDyLog TPL = new T_ParterDyLog(); TPL.sign = req[1].ToLower(); TPL.lat = "0"; TPL.lng = "0"; TPL.imei = req[3]; TPL.addtime = DateTime.Now; //1:获取司机2:上传通话3:上传预约4:获取评价 TPL.typeid = 4; new T_ParterDyLogDal().AddParterDyLog(TPL); List<Pinglun> tdpl2 = new List<Pinglun>(); string sjucode = new D_DriverInfoDal().GetUcodeById(req[2]); if (sjucode != "") { List<SjComment> tdpl = new D_DriverCommentDal().GetPingLuns(sjucode); if (tdpl != null) { for (int i = 0; i < tdpl.Count; i++) { Pinglun temp = new Pinglun(); temp.addtime = Convert.ToDateTime(tdpl[i].Create_time); temp.Info = tdpl[i].Comment; temp.name = tdpl[i].CustomerName; if (tdpl[i].Evaluate == 3) { temp.plstate = 0; } else if (tdpl[i].Evaluate == 2) { temp.plstate = 1; } else { temp.plstate = 2; } // 0差评1中评2好评 //新版(1,好评;2,中评;3,差评) temp.uid = Convert.ToInt32(req[2].Trim()); tdpl2.Add(temp); } } return JsonConvert.SerializeObject(tdpl2); } else { return JsonConvert.SerializeObject(tdpl2); } } else { throw new Exception("当天次数已经使用完毕!"); } } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
public string execute(string request) { //1218|1张三|21381234567|3莘凌路211号(小锦江酒店)|421:00|5asdfas1231asd|6IMEI|7MD5串|8lat|9lng|10remark|11youhui|12youhuijine string result = "0"; string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[7].ToLower()) { ThirdPartyCoupon cc = new ThirdPartyCoupon(); //判断T_ClentInfo是否有此手机号相关信息 //如果用户不存在,创建一个新用户 CustomerInfoEntity cinfo = new D_CustomerInfoDal().GetClientInfoByPhone(req[2].Trim()); T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[5].ToLower()); if (parter != null) { string couponCode = ""; #region 调用冯超接口检查是否新用户 if (InvokeStateService(req[2].Trim()).Equals(1)) { if (parter.url != null) { cc.isCoupon(parter.url); if (!cc.check(req[12], req[13], parter.url)) { throw new Exception("优惠码无效"); } couponCode = req[11]; } } #endregion #region 优惠码操作 if (req.Length == 13 && parter.url != null) { if (!cc.check(req[11], req[12], parter.url)) { throw new Exception("优惠码无效"); } couponCode = cc.addCoupon(parter.Id.ToString(), req[11], req[12], cinfo); } #endregion #region 调用web service 处理创建预约订单 CreateOrderServiceRequestEntity createOrderEntity = new CreateOrderServiceRequestEntity(); createOrderEntity.Ucode = string.Empty; createOrderEntity.Parterid = parter.Id; createOrderEntity.BusinessType = 1; // 酒后代驾 createOrderEntity.OrderFrom = 5; // 合作商 createOrderEntity.AppointTime = string.Empty; createOrderEntity.RecommendCode = couponCode; DateTime appointTime; if (DateTime.TryParse(req[4].Trim(), out appointTime)) { createOrderEntity.AppointTime = appointTime.ToString("yyyy-MM-dd HH:mm"); } createOrderEntity.Address = req[3].Trim(); createOrderEntity.FromCellPhone = cinfo.Cellphone; createOrderEntity.CellPhone = cinfo.Cellphone; string latStr = req[8].Trim(); string lngStr = req[9].Trim(); if (parter.Id == 11)//判断是博泰,对坐标进行转换 { ChangeCoords.ChangeCoordinate(ref latStr, ref lngStr, 3, 5); } double lat; if (double.TryParse(latStr, out lat)) { createOrderEntity.Lat = lat; } double lng; if (double.TryParse(lngStr, out lng)) { createOrderEntity.Lng = lng; } createOrderEntity.AllUserCount = 1; createOrderEntity.Remark = req[10].Trim(); createOrderEntity.Status = 0; // result = InvokeCreateOrderService(createOrderEntity); string url = string.Format("http://{0}/api/createOrder", ConfigHelper.APIServer); result = new CreateOrder().InvokeCreateOrderService(url, createOrderEntity); #endregion } else { throw new Exception("商户标识错误。"); } } else { throw new Exception("签名错误。"); } return result; }
public string execute(string request) { //1202|1张三|21381234567|3莘凌路211号(小锦江酒店)|421:00|5asdfas1231asd|6IMEI|7MD5串|8lat|9lng string result = "0"; string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[7].ToLower()) { //判断T_ClentInfo是否有此手机号相关信息 //如果用户不存在,创建一个新用户 CustomerInfoEntity cinfo = new D_CustomerInfoDal().GetClientInfoByPhone(req[2].Trim()); string cusid = string.Empty; int CustomerType = 1; int AccountType = 2; T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[5].ToLower()); if (parter != null) { #region 用户不存在则创建 if (cinfo == null) { int clentnum = new D_CustomerInfoDal().SelectSeqClent(); if (clentnum != 0) { string num = string.Empty; for (int i = 0; i < 8 - clentnum.ToString().Length; i++) { num += @"0"; } num = "U" + num + clentnum; cusid = num; CustomerInfoEntity customerEn = new CustomerInfoEntity() { AccountType = 2, Amount = 0, BusinessmanId = 0, Cellphone = req[2].Trim(), ParentPhone = req[2].Trim(), CustomerId = num, CustomerName = req[1].Trim(), CustomerType = 1, Email = string.Empty, HomeAddress = string.Empty, IsNewCustomer = true, LastAppointmentTime = null, LastCalledAddress = string.Empty, RecommendCode = new D_CustomerInfoDal().GenerateCustomerRecommendCode( new D_CustomerInfoDal().SelectSeqClent()), RegisterFrom = 8, //第三方API RegisterVersion = "" }; bool isture = new D_CustomerInfoDal().AddCustomerInfo(customerEn); if (!isture) { return "0"; } } else { return "0"; } } else { cusid = cinfo.CustomerId; CustomerType = cinfo.CustomerType; AccountType = cinfo.AccountType; } #endregion #region 优惠码操作 string couponCode = ""; if (req.Length == 12 && parter.url != null) { ThirdPartyCoupon cc = new ThirdPartyCoupon(); if (!cc.check(req[10], req[11], parter.url)) { throw new Exception("优惠码无效"); } couponCode = cc.addCoupon(parter.Id.ToString(), req[10], req[11], cinfo); } #endregion #region 创建预约订单 int zz = new D_AppointmentOrderInfoDA().SelectSeqOrder(); if (zz != 0) { string ordernum = string.Empty; for (int i = 0; i < 8 - zz.ToString().Length; i++) { ordernum += @"0"; } ordernum = "Party" + ordernum + zz; string lat = req[8].Trim(); string lng = req[9].Trim(); if (parter.Id == 11)//判断是博泰,对坐标进行转换 { ChangeCoords.ChangeCoordinate(ref lat, ref lng, 3, 5); } AppointmentOrderInfoEntity orderEn = new AppointmentOrderInfoEntity() { AppointAddress = req[3].ToLower(), AppointOrderId = ordernum, AppointOrderFrom = 5, // 第三方合作用户,由8改为5 AppointOrderSign = "1", AppointOrderState = 10, AppointOrderType = 1, // 1自己叫 AppointTime = Convert.ToDateTime(req[4].Trim()), AppointTimeStr = DateTime.Now.ToString("yyyy-MM-dd-HH-mm"), Cellphone = req[2].Trim(), FromCellphone = req[2].Trim(), CustomerId = cusid, CustomerName = req[1].Trim(), Create_time = DateTime.Now, Create_user = "******", BusinessType = 1, CustomerType = CustomerType, AccountType = AccountType, PartyId = parter.Id }; if (req.Length > 8) { orderEn.Lat = Convert.ToDecimal(lat); orderEn.Lng = Convert.ToDecimal(lng); } bool istrue = new D_AppointmentOrderInfoDA().AddAppointmentOrderInfo(orderEn); if (!istrue) { result = "0"; } else { //添加数据 T_ParterDyLog tpl = new T_ParterDyLog(); tpl.sign = req[5]; tpl.lat = "0"; tpl.lng = "0"; tpl.imei = req[6]; tpl.addtime = DateTime.Now; //1:获取司机2:上传通话3:上传预约 tpl.typeid = 3; new T_ParterDyLogDal().AddParterDyLog(tpl); result = "1"; } } else { throw new Exception("预约订单失败!"); } #endregion } else { throw new Exception("商户标识错误。"); } } else { throw new Exception("签名错误。"); } return result; }
public string execute(string request) { //1219|1张三|21381234567|3莘凌路211号(小锦江酒店)|42|521:00|613896365986|7沪B195689|81369896522344|9""|10lat|11lng|128|13合作商标识|14IMEI|15MD5串|16Remark|17SendCarUserName|18SendCarPhone|19EndDriveLat|20EndDriveLng|21EndDriveAddress:|22ReceiveCarPhone|23ReceiveCarUserName string result = string.Empty; string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[2] + "aidaijia", "utf-8"); if (sign.ToLower() == req[15].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[13].ToLower()); if (parter != null && parter.State.Equals(ConfigHelper.Sign)) { BusinessOrderServiceRequestEntity model = new BusinessOrderServiceRequestEntity() { Address = req[3], AppointTime = req[5], AllUserCount = req[4], CalledNo = req[6], CarNumber = req[7], CellPhone = req[8], DriverRemark = req[9], EndDriveAddress = req[21], EndDriveLat = Convert.ToDouble(req[19]), EndDriveLng = Convert.ToDouble(req[20]), From = req[12], IMEI = req[14], Lat = Convert.ToDouble(req[10]), Lng = Convert.ToDouble(req[11]), Name = req[1], Phone = req[2], ReceiveCarPhone = req[22], ReceiveCarUserName = req[23], Remark = req[16], SendCarPhone = req[18], SendCarUserName = req[17], Sign = req[13], BusinessType = 6, Smart = 1, OrderFrom = 11, OrderTime = DateTime.Now }; double lat=model.Lat; double lng=model.Lng; CoordinateHelper.BaiduToScott(ref lng, ref lat); model.Lat = lat; model.Lng = lng; string url = string.Format("http://{0}/api/createOrder", ConfigHelper.APIServer); result = new CreateBusinessOrder().InvokeCreateOrderService(url, model); return result; } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }