public static void Init() { IBase_StoreInfoService storeInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); List <Base_StoreInfo> list = storeInfoService.GetModels().ToList <Base_StoreInfo>(); listStore = Utils.GetCopyList <StoreInfoCacheModel, Base_StoreInfo>(list); }
public object GetMemberDic(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string merchId = userTokenKeyModel.DataModel.MerchID; IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(resolveNew: true); IBase_MemberInfoService base_MemberInfoService = BLLContainer.Resolve <IBase_MemberInfoService>(resolveNew: true); IData_Member_CardService data_Member_CardService = BLLContainer.Resolve <IData_Member_CardService>(resolveNew: true); IData_Member_Card_StoreService data_Member_Card_StoreService = BLLContainer.Resolve <IData_Member_Card_StoreService>(resolveNew: true); var linq = from a in base_StoreInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)) join b in data_Member_Card_StoreService.GetModels() on a.StoreID equals b.StoreID join c in data_Member_CardService.GetModels() on b.CardID equals c.ID join d in base_MemberInfoService.GetModels() on c.MemberID equals d.ID select new { MemberID = d.ID, MemberName = d.UserName }; return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, linq)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object getOrder(Dictionary <string, object> dicParas) { try { string StoreID = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty; string UserToken = dicParas.ContainsKey("userToken") ? dicParas["userToken"].ToString() : string.Empty; if (string.IsNullOrEmpty(UserToken)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户token无效")); } var list = XCCloudUserTokenBusiness.GetUserTokenModel(UserToken); if (list == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户token无效")); } if (string.IsNullOrEmpty(StoreID)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效")); } string OrderNum = string.Empty; IFlw_Order_SerialNumberService flw_Order_SerialNumberService = BLLContainer.Resolve <IFlw_Order_SerialNumberService>(); var orderlist = flw_Order_SerialNumberService.GetModels(x => x.StoreiD == StoreID).ToList().FirstOrDefault(x => Convert.ToDateTime(x.CreateDate).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")); IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); var menlist = base_StoreInfoService.GetModels(x => x.StoreID == StoreID).FirstOrDefault <Base_StoreInfo>(); if (menlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到商户号")); } int num = 0; if (orderlist == null) { num = +1; Flw_Order_SerialNumber flw_Order_SerialNumber = new Flw_Order_SerialNumber(); flw_Order_SerialNumber.StoreiD = StoreID; flw_Order_SerialNumber.CreateDate = DateTime.Now; flw_Order_SerialNumber.CurNumber = num; flw_Order_SerialNumberService.Add(flw_Order_SerialNumber); } else { num = Convert.ToInt32(orderlist.CurNumber + 1); orderlist.CurNumber = num; flw_Order_SerialNumberService.Update(orderlist); } OrderNum = DateTime.Now.ToString("yyyyMMddHHmm") + menlist.MerchID + num.ToString(); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, OrderNum, Result_Code.T, "")); } catch (Exception e) { throw e; } }
public object GetUnChainStoreList(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string storeId = dicParas.ContainsKey("storeId") ? (dicParas["storeId"] + "") : string.Empty; string ruleType = dicParas.ContainsKey("ruleType") ? (dicParas["ruleType"] + "") : string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string merchId = userTokenKeyModel.DataModel.MerchID; if (string.IsNullOrEmpty(storeId)) { errMsg = "门店ID不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(ruleType)) { errMsg = "规则类别不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(ruleType)) { errMsg = "规则类别格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int iRuleType = Convert.ToInt32(ruleType); IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(resolveNew: true); IBase_ChainRuleService base_ChainRuleService = BLLContainer.Resolve <IBase_ChainRuleService>(resolveNew: true); IBase_ChainRule_StoreService base_ChainRule_StoreService = BLLContainer.Resolve <IBase_ChainRule_StoreService>(resolveNew: true); var result = from a in base_StoreInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)) join b in ( from a in base_ChainRuleService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase) && p.RuleType == iRuleType) join b in base_ChainRule_StoreService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)) on a.RuleGroupID equals b.RuleGroupID join c in base_ChainRule_StoreService.GetModels() on b.RuleGroupID equals c.RuleGroupID select c ) on a.StoreID equals b.StoreID into b1 from b in b1.DefaultIfEmpty() where string.IsNullOrEmpty(b.StoreID) select new { StoreID = a.StoreID, StoreName = a.StoreName }; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object GetStoreList(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string merchId = userTokenKeyModel.DataModel.MerchID; IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); var result = from a in base_StoreInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)) select new { StoreID = a.StoreID, StoreName = a.StoreName }; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object SaveGoodsInfo(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; string id = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty; string barCode = dicParas.ContainsKey("barCode") ? (dicParas["barCode"] + "") : string.Empty; string goodType = dicParas.ContainsKey("goodType") ? (dicParas["goodType"] + "") : string.Empty; string minValue = dicParas.ContainsKey("minValue") ? (dicParas["minValue"] + "") : string.Empty; string maxValue = dicParas.ContainsKey("maxValue") ? (dicParas["maxValue"] + "") : string.Empty; string goodName = dicParas.ContainsKey("goodName") ? (dicParas["goodName"] + "") : string.Empty; string price = dicParas.ContainsKey("price") ? (dicParas["price"] + "") : string.Empty; string points = dicParas.ContainsKey("points") ? (dicParas["points"] + "") : string.Empty; string note = dicParas.ContainsKey("note") ? (dicParas["note"] + "") : string.Empty; #region 参数验证 if (!string.IsNullOrEmpty(id) && !Utils.isNumber(id)) { errMsg = "商品ID格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(barCode)) { errMsg = "商品条码barCode不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(goodType)) { errMsg = "商品类别goodType不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(minValue) || string.IsNullOrEmpty(maxValue)) { errMsg = "库存警戒线不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(minValue) || !Utils.isNumber(maxValue)) { errMsg = "库存警戒线格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (Convert.ToInt32(minValue) < 0 || Convert.ToInt32(maxValue) < 0) { errMsg = "库存警戒线不能为负数"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (Convert.ToInt32(minValue) > Convert.ToInt32(maxValue)) { errMsg = "库存警戒线下限须小于上限"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!string.IsNullOrEmpty(price) && !Utils.IsDecimal(price)) { errMsg = "零售价格格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!string.IsNullOrEmpty(points) && (!Utils.isNumber(points) || Convert.ToInt32(points) < 0)) { errMsg = "零售积分格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } #endregion IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); var merchId = base_StoreInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault().MerchID; IBase_GoodsInfoService base_GoodsInfoService = BLLContainer.Resolve <IBase_GoodsInfoService>(); if (string.IsNullOrEmpty(id)) { if (base_GoodsInfoService.Any(a => a.Barcode.Equals(barCode, StringComparison.OrdinalIgnoreCase))) { errMsg = "该商品条码已使用"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var base_GoodsInfo = new Base_GoodsInfo(); Utils.GetModel(dicParas, ref base_GoodsInfo); base_GoodsInfo.MerchID = merchId; base_GoodsInfo.Status = 1; if (!base_GoodsInfoService.Add(base_GoodsInfo)) { errMsg = "添加商品信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } else { int iId = Convert.ToInt32(id); if (!base_GoodsInfoService.Any(a => a.ID == iId)) { errMsg = "该商品信息不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (base_GoodsInfoService.Any(a => a.ID != iId && a.Barcode.Equals(barCode, StringComparison.OrdinalIgnoreCase))) { errMsg = "该商品条码已使用"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var base_GoodsInfo = base_GoodsInfoService.GetModels(p => p.ID == iId).FirstOrDefault(); Utils.GetModel(dicParas, ref base_GoodsInfo); if (!base_GoodsInfoService.Update(base_GoodsInfo)) { errMsg = "修改商品信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (DbEntityValidationException e) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, e.EntityValidationErrors.ToErrors())); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object CheckUser(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string token = string.Empty; string userName = dicParas.ContainsKey("userName") ? dicParas["userName"].ToString() : string.Empty; string password = dicParas.ContainsKey("password") ? dicParas["password"].ToString() : string.Empty; if (string.IsNullOrWhiteSpace(userName)) { errMsg = "用户名不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrWhiteSpace(password)) { errMsg = "密码不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } password = Utils.MD5(password); UserLogResponseModel userLogResponseModel = new UserLogResponseModel(); IBase_UserInfoService base_UserInfoService = BLLContainer.Resolve <IBase_UserInfoService>(); if (base_UserInfoService.Any(p => p.LogName.Equals(userName, StringComparison.OrdinalIgnoreCase) && p.LogPassword.Equals(password, StringComparison.OrdinalIgnoreCase))) { var base_UserInfoModel = base_UserInfoService.GetModels(p => p.LogName.Equals(userName, StringComparison.OrdinalIgnoreCase) && p.LogPassword.Equals(password, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <Base_UserInfo>(); int userId = base_UserInfoModel.UserID; int userType = (int)base_UserInfoModel.UserType; int logType = (int)RoleType.XcUser; //默认普通员工登录 int isXcAdmin = base_UserInfoModel.Auditor ?? 0; int switchable = base_UserInfoModel.Switchable ?? 0; if (userType == (int)UserType.Xc && isXcAdmin == 0) { logType = (int)RoleType.XcAdmin; userLogResponseModel.Token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType); } else if (userType == (int)UserType.Store || userType == (int)UserType.StoreBoss) { logType = (int)RoleType.StoreUser; string storeId = base_UserInfoModel.StoreID; IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); if (!base_StoreInfoService.Any(a => a.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase))) { errMsg = "该门店不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } string merchId = base_StoreInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault().MerchID; var dataModel = new UserDataModel { StoreID = storeId, MerchID = merchId }; userLogResponseModel.Token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType, dataModel); } else { logType = (int)RoleType.MerchUser; string merchId = base_UserInfoModel.MerchID; IBase_MerchantInfoService base_MerchantInfoService = BLLContainer.Resolve <IBase_MerchantInfoService>(); if (!base_MerchantInfoService.Any(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase))) { errMsg = "该商户不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var base_MerchantInfoModel = base_MerchantInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); var dataModel = new MerchDataModel { MerchID = merchId, MerchType = base_MerchantInfoModel.MerchType, CreateType = base_MerchantInfoModel.CreateType, CreateUserID = base_MerchantInfoModel.CreateUserID }; userLogResponseModel.Token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType, dataModel); userLogResponseModel.MerchTag = base_MerchantInfoModel.MerchTag; } userLogResponseModel.LogType = logType; userLogResponseModel.UserType = userType; userLogResponseModel.Switchable = switchable; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, userLogResponseModel)); } else { errMsg = "用户名或密码错误"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
protected void Page_Load(object sender, EventArgs e) { try { string errMsg = string.Empty; string md5 = Request["state"] ?? ""; string url = Request.Url.GetLeftPart(UriPartial.Path); string code = Request["code"] ?? ""; LogHelper.SaveLog("code:" + code); //if (!TokenMana.GetTokenMd5(url, md5)) //{ // errMsg = url + WeiXinConfig.Md5key; // LogHelper.SaveLog("错误:" + errMsg); // Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("登录失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); // return; //} string accsess_token = string.Empty; string refresh_token = string.Empty; string openId = string.Empty; string unionId = string.Empty; string token = string.Empty; int? merchTag = null; if (TokenMana.GetOpenTokenForScanQR(code, out accsess_token, out refresh_token, out openId, out unionId)) { if (string.IsNullOrEmpty(unionId)) { if (!TokenMana.GetUnionIdFromOpen(openId, accsess_token, out unionId, out errMsg)) { Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("登录失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); return; } } //验证用户 IBase_UserInfoService userInfoService = BLLContainer.Resolve <IBase_UserInfoService>(); if (userInfoService.Any(w => w.UnionID.ToString().Equals(unionId, StringComparison.OrdinalIgnoreCase))) { var base_UserInfoModel = userInfoService.GetModels(w => w.UnionID.ToString().Equals(unionId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <Base_UserInfo>(); int userId = base_UserInfoModel.UserID; int userType = (int)base_UserInfoModel.UserType; int logType = (int)RoleType.XcUser; //默认普通员工登录 int isXcAdmin = base_UserInfoModel.Auditor ?? 0; int switchable = base_UserInfoModel.Switchable ?? 0; if (userType == (int)UserType.Xc && isXcAdmin == 0) { logType = (int)RoleType.XcAdmin; token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType); } else if (userType == (int)UserType.Store || userType == (int)UserType.StoreBoss) { logType = (int)RoleType.StoreUser; var storeId = base_UserInfoModel.StoreID; IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); if (!base_StoreInfoService.Any(a => a.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase))) { errMsg = "该门店不存在"; Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("登录失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); } string merchId = base_StoreInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault().MerchID; var dataModel = new UserDataModel { StoreID = storeId, MerchID = merchId }; token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType, dataModel); } else { logType = (int)RoleType.MerchUser; string merchId = base_UserInfoModel.MerchID; IBase_MerchantInfoService base_MerchantInfoService = BLLContainer.Resolve <IBase_MerchantInfoService>(); if (!base_MerchantInfoService.Any(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase))) { errMsg = "该商户不存在"; Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("登录失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); } var base_MerchantInfoModel = base_MerchantInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); var dataModel = new MerchDataModel { MerchID = merchId, MerchType = base_MerchantInfoModel.MerchType, CreateType = base_MerchantInfoModel.CreateType, CreateUserID = base_MerchantInfoModel.CreateUserID }; token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType, dataModel); merchTag = base_MerchantInfoModel.MerchTag; } Response.Redirect(WeiXinConfig.RedirectMainPage + "?token=" + token + "&logType=" + logType + "&userType=" + userType + "&merchTag=" + merchTag + "&switchable=" + switchable, false); } else { errMsg = "用户未注册"; LogHelper.SaveLog("失败:" + errMsg); Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("登录失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); } } else { errMsg = "获取openId失败"; LogHelper.SaveLog("错误:" + errMsg); Response.Redirect(WeiXinConfig.RedirectLogoutPage, false); } } catch (Exception ex) { LogHelper.SaveLog("错误:" + ex.Message); Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("登录失败") + "&message=" + HttpUtility.UrlEncode(ex.Message), false); } }
/// <summary> /// 验证注册参数 /// </summary> /// <returns></returns> private bool checkRegisterParas(string openId, out string storeId, out string merchId, out int userType, out string revOpenId, out string errMsg) { errMsg = string.Empty; storeId = string.Empty; merchId = string.Empty; revOpenId = string.Empty; userType = (int)UserType.Store; string scode = Request["scode"] != null ? Request["scode"].ToString() : string.Empty; string mobile = Request["mobile"] != null ? Request["mobile"].ToString() : string.Empty; string storeOrMerchId = Request["storeOrMerchId"] != null ? Request["storeOrMerchId"].ToString() : string.Empty; string username = Request["username"] != null ? Request["username"].ToString() : string.Empty; string password = Request["password"] != null ? Request["password"].ToString() : string.Empty; #region 验证参数 //如果用户未获取短信验证码 string key = mobile + "_" + scode; if (!SMSCodeCache.IsExist(key)) { errMsg = "短信验证码无效"; return(false); } if (string.IsNullOrEmpty(storeOrMerchId)) { errMsg = "门店ID或商户ID参数不能为空"; return(false); } if (string.IsNullOrEmpty(openId)) { errMsg = "用户openId参数不能为空"; return(false); } if (openId.Length > 64) { errMsg = "用户openId参数长度不能超过64个字符"; return(false); } if (string.IsNullOrEmpty(username)) { errMsg = "用户名参数不能为空"; return(false); } if (username.Length > 20) { errMsg = "用户名参数长度不能超过20个字符"; return(false); } if (!Utils.CheckMobile(mobile)) { errMsg = "手机号码参数不正确"; return(false); } if (string.IsNullOrEmpty(password)) { errMsg = "密码参数不能为空"; return(false); } #endregion //验证商户 var mId = storeOrMerchId; IBase_MerchantInfoService base_MerchantInfoService = BLLContainer.Resolve <IBase_MerchantInfoService>(); if (!base_MerchantInfoService.Any(p => p.MerchID.Equals(mId, StringComparison.OrdinalIgnoreCase))) { //验证门店 var sId = storeOrMerchId; IBase_StoreInfoService storeInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); if (!storeInfoService.Any(p => p.StoreID.Equals(sId, StringComparison.OrdinalIgnoreCase))) { errMsg = "门店不存在"; return(false); } mId = storeInfoService.GetModels(p => p.StoreID.Equals(sId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault().MerchID; storeId = storeOrMerchId; } else { merchId = storeOrMerchId; } //验证发起人 IBase_UserInfoService userInfoService = BLLContainer.Resolve <IBase_UserInfoService>(); var userList = userInfoService.GetModels(p => p.OpenID.ToString().Equals(openId, StringComparison.OrdinalIgnoreCase)); int userInfoCount = userList.Count <Base_UserInfo>(); if (userInfoService.Any(p => p.OpenID.ToString().Equals(openId, StringComparison.OrdinalIgnoreCase))) { errMsg = "用户不能重复注册"; return(false); } //验证接收人 if (!base_MerchantInfoService.Any(a => a.MerchID.Equals(mId, StringComparison.OrdinalIgnoreCase))) { errMsg = "接收商户不存在"; return(false); } var base_MerchantInfoModel = base_MerchantInfoService.GetModels(p => p.MerchID.Equals(mId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); var wxOpenId = base_MerchantInfoModel.WxOpenID; revOpenId = wxOpenId; if (!userInfoService.Any(p => p.OpenID.Equals(wxOpenId, StringComparison.OrdinalIgnoreCase))) { errMsg = "接收人不存在"; return(false); } //验证用户类别 if (!string.IsNullOrEmpty(merchId)) { userType = (int)base_MerchantInfoModel.MerchType; } else { userType = (int)UserType.Store; } return(true); }