public object getInfo(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; StoreCacheModel storeModel = null; System.Data.DataSet ds = null; //获取token模式 XCGameMemberTokenModel memberTokenModel = (XCGameMemberTokenModel)(dicParas[Constant.XCGameMemberTokenModel]); //验证门店 StoreBusiness storeBusiness = new StoreBusiness(); if (!storeBusiness.IsEffectiveStore(memberTokenModel.StoreId, ref storeModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } //如果是门店模式 if (storeModel.StoreType == 0) { XCCloudService.BLL.IBLL.XCGame.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName); var count = memberService.GetModels(p => p.Mobile.Equals(memberTokenModel.Mobile, StringComparison.OrdinalIgnoreCase)).Count <XCCloudService.Model.XCGame.t_member>(); if (count == 0) { string sql = " exec RegisterMember @Mobile,@MemberPassword,@WXOpenID,@Return output "; SqlParameter[] parameters = new SqlParameter[4]; parameters[0] = new SqlParameter("@Mobile", memberTokenModel.Mobile); parameters[1] = new SqlParameter("@MemberPassword", "888888"); parameters[2] = new SqlParameter("@WXOpenID", ""); parameters[3] = new SqlParameter("@Return", 0); parameters[3].Direction = System.Data.ParameterDirection.Output; ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters); MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0]; memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState); string meberToken = MemberTokenBusiness.SetMemberToken(memberTokenModel.StoreId, memberTokenModel.Mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate); RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(memberTokenModel.StoreId, storeModel.StoreName, meberToken, memberResponseModel); return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel)); } else { string sql = " exec GetMember @Mobile,@ICCardID"; SqlParameter[] parameters = new SqlParameter[2]; parameters[0] = new SqlParameter("@Mobile", memberTokenModel.Mobile); parameters[1] = new SqlParameter("@ICCardID", "0"); ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters); RegisterMemberResponseModel registerMemberResponseModel = Utils.GetModelList <RegisterMemberResponseModel>(ds.Tables[0])[0]; registerMemberResponseModel.StoreId = storeModel.StoreID.ToString(); registerMemberResponseModel.StoreName = storeModel.StoreName; registerMemberResponseModel.MemberState = MemberBusiness.GetMemberStateName(registerMemberResponseModel.MemberState); return(ResponseModelFactory <RegisterMemberResponseModel> .CreateModel(isSignKeyReturn, registerMemberResponseModel)); } } //如果是商户模式 else if (storeModel.StoreType == 1) { XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService>(); var count = memberService.GetModels(p => p.Mobile.Equals(memberTokenModel.Mobile, StringComparison.OrdinalIgnoreCase)).Count <XCCloudService.Model.XCCloudRS232.t_member>(); if (count == 0) { string sql = " exec RegisterMember @Mobile,@MerchId,@MemberPassword,@WXOpenID,@Return output "; SqlParameter[] parameters = new SqlParameter[5]; parameters[0] = new SqlParameter("@Mobile", memberTokenModel.Mobile); parameters[1] = new SqlParameter("@MerchId", storeModel.StoreID); parameters[2] = new SqlParameter("@MemberPassword", "888888"); parameters[3] = new SqlParameter("@WXOpenID", ""); parameters[4] = new SqlParameter("@Return", 0); parameters[4].Direction = System.Data.ParameterDirection.Output; ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters); MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0]; memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState); string meberToken = MemberTokenBusiness.SetMemberToken(memberTokenModel.StoreId, memberTokenModel.Mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate); RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(memberTokenModel.StoreId, storeModel.StoreName, meberToken, memberResponseModel); return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel)); } else { string sql = " exec GetMember @Mobile,@MerchId,@ICCardID"; SqlParameter[] parameters = new SqlParameter[3]; parameters[0] = new SqlParameter("@Mobile", memberTokenModel.Mobile); parameters[1] = new SqlParameter("@MerchId", memberTokenModel.StoreId); parameters[2] = new SqlParameter("@ICCardID", "0"); ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters); RegisterMemberResponseModel registerMemberResponseModel = Utils.GetModelList <RegisterMemberResponseModel>(ds.Tables[0])[0]; registerMemberResponseModel.StoreId = storeModel.StoreID.ToString(); registerMemberResponseModel.StoreName = storeModel.StoreName; registerMemberResponseModel.MemberState = MemberBusiness.GetMemberStateName(registerMemberResponseModel.MemberState); return(ResponseModelFactory <RegisterMemberResponseModel> .CreateModel(isSignKeyReturn, registerMemberResponseModel)); } } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店类型无效")); } } catch (Exception e) { throw e; } }
public object getMemberToken(Dictionary <string, object> dicParas) { bool isMember = false; string errMsg = string.Empty; string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty; try { MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]); //获取终端号是否存在 StoreCacheModel storeModel = null; StoreBusiness storeBusiness = new StoreBusiness(); if (!storeBusiness.IsEffectiveStore(storeId, ref storeModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } //是否注册会员 MemberResponseModel memberResponseModel = null; System.Data.DataSet ds = null; if (storeModel.StoreType == 0) { XCCloudService.BLL.IBLL.XCGame.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName); var count = memberService.GetModels(p => p.Mobile.Equals(mobileTokenModel.Mobile, StringComparison.OrdinalIgnoreCase)).Count <XCCloudService.Model.XCGame.t_member>(); if (count == 0) { string sql = " exec RegisterMember @Mobile,@MemberPassword,@WXOpenID,@Return output "; SqlParameter[] parameters = new SqlParameter[4]; parameters[0] = new SqlParameter("@Mobile", mobileTokenModel.Mobile); parameters[1] = new SqlParameter("@MemberPassword", "888888"); parameters[2] = new SqlParameter("@WXOpenID", ""); parameters[3] = new SqlParameter("@Return", 0); parameters[3].Direction = System.Data.ParameterDirection.Output; ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters); } else { string sql = " exec GetMember @Mobile,@ICCardID"; SqlParameter[] parameters = new SqlParameter[2]; parameters[0] = new SqlParameter("@Mobile", mobileTokenModel.Mobile); parameters[1] = new SqlParameter("@ICCardID", "0"); ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters); } memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0]; memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState); isMember = true; } else if (storeModel.StoreType == 1) { XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService>(); var count = memberService.GetModels(p => p.Mobile.Equals(mobileTokenModel.Mobile, StringComparison.OrdinalIgnoreCase)).Count <XCCloudService.Model.XCCloudRS232.t_member>(); if (count == 0) { string sql = " exec RegisterMember @Mobile,@MerchId,@MemberPassword,@WXOpenID,@Return output "; SqlParameter[] parameters = new SqlParameter[5]; parameters[0] = new SqlParameter("@Mobile", mobileTokenModel.Mobile); parameters[1] = new SqlParameter("@MerchId", storeId); parameters[2] = new SqlParameter("@MemberPassword", "888888"); parameters[3] = new SqlParameter("@WXOpenID", ""); parameters[4] = new SqlParameter("@Return", 0); parameters[4].Direction = System.Data.ParameterDirection.Output; ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters); } else { string sql = " exec GetMember @Mobile,@MerchId,@ICCardID"; SqlParameter[] parameters = new SqlParameter[3]; parameters[0] = new SqlParameter("@Mobile", mobileTokenModel.Mobile); parameters[1] = new SqlParameter("@MerchId", storeId); parameters[2] = new SqlParameter("@ICCardID", "0"); ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters); } memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0]; memberResponseModel.MemberState = "有效"; isMember = true; } else { isMember = false; } //设置会员token string token = string.Empty; if (isMember) { token = MemberTokenBusiness.SetMemberToken(storeId, mobileTokenModel.Mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate); } MemberTokenResponseModel memberTokenModel = new MemberTokenResponseModel(storeId, storeModel.StoreName, token, isMember, memberResponseModel); return(ResponseModelFactory <MemberTokenResponseModel> .CreateModel(isSignKeyReturn, memberTokenModel)); } catch (Exception e) { throw e; } }
public object register(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string mobile = string.Empty; XCGameManaDeviceStoreType deviceStoreType; string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty; //验证手机token MobileTokenModel mobileTokenModel = (MobileTokenModel)(dicParas[Constant.MobileTokenModel]); mobile = mobileTokenModel.Mobile; //验证门店 StoreCacheModel storeModel = null; StoreBusiness store = new StoreBusiness(); if (!store.IsEffectiveStore(storeId, out deviceStoreType, ref storeModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } string meberToken = string.Empty; if (deviceStoreType == XCGameManaDeviceStoreType.Store) { XCCloudService.BLL.IBLL.XCGame.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName); //获取手机号是否存在注册记录 var count = memberService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).Count <XCCloudService.Model.XCGame.t_member>(); if (count == 0) { string sql = " exec RegisterMember @Mobile,@MemberPassword,@WXOpenID,@Return output "; SqlParameter[] parameters = new SqlParameter[4]; parameters[0] = new SqlParameter("@Mobile", mobile); parameters[1] = new SqlParameter("@MemberPassword", "888888"); parameters[2] = new SqlParameter("@WXOpenID", ""); parameters[3] = new SqlParameter("@Return", 0); parameters[3].Direction = System.Data.ParameterDirection.Output; System.Data.DataSet ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters); MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0]; memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState); meberToken = MemberTokenBusiness.SetMemberToken(storeId, mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate); RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(storeId, storeModel.StoreName, meberToken, memberResponseModel); return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel)); } else { //如果已注册,返回会员主要信息 string sql = " exec GetMember @Mobile,@ICCardID"; SqlParameter[] parameters = new SqlParameter[2]; parameters[0] = new SqlParameter("@Mobile", mobile); parameters[1] = new SqlParameter("@ICCardID", "0"); System.Data.DataSet ds = XCGameBLL.ExecuteQuerySentence(sql, storeModel.StoreDBName, parameters); MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0]; memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState); meberToken = MemberTokenBusiness.SetMemberToken(storeId, mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate); RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(storeId, storeModel.StoreName, meberToken, memberResponseModel); return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel)); } } else if (deviceStoreType == XCGameManaDeviceStoreType.Merch) { XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService>(); //获取手机号是否存在注册记录 var count = memberService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).Count <XCCloudService.Model.XCCloudRS232.t_member>(); if (count == 0) { string sql = " exec RegisterMember @Mobile,@MerchId,@MemberPassword,@WXOpenID,@Return output "; SqlParameter[] parameters = new SqlParameter[5]; parameters[0] = new SqlParameter("@Mobile", mobile); parameters[1] = new SqlParameter("@MerchId", storeId); parameters[2] = new SqlParameter("@MemberPassword", "888888"); parameters[3] = new SqlParameter("@WXOpenID", ""); parameters[4] = new SqlParameter("@Return", 0); parameters[4].Direction = System.Data.ParameterDirection.Output; System.Data.DataSet ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters); MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0]; memberResponseModel.MemberState = MemberBusiness.GetMemberStateName(memberResponseModel.MemberState); meberToken = MemberTokenBusiness.SetMemberToken(storeId, mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate); RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(storeId, storeModel.StoreName, meberToken, memberResponseModel); return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel)); } else { //如果已注册,返回会员主要信息 string sql = " exec GetMember @Mobile,@MerchId,@ICCardID"; SqlParameter[] parameters = new SqlParameter[3]; parameters[0] = new SqlParameter("@Mobile", mobile); parameters[1] = new SqlParameter("@MerchId", storeId); parameters[2] = new SqlParameter("@ICCardID", "0"); System.Data.DataSet ds = XCCloudRS232BLL.ExecuteQuerySentence(sql, parameters); MemberResponseModel memberResponseModel = Utils.GetModelList <MemberResponseModel>(ds.Tables[0])[0]; memberResponseModel.MemberState = "使用中"; meberToken = MemberTokenBusiness.SetMemberToken(storeId, mobile, memberResponseModel.MemberLevelName, storeModel.StoreName, memberResponseModel.ICCardID.ToString(), memberResponseModel.EndDate); RegisterMemberTokenResponseModel registerMemberTokenResponseModel = new RegisterMemberTokenResponseModel(storeId, storeModel.StoreName, meberToken, memberResponseModel); return(ResponseModelFactory <RegisterMemberTokenResponseModel> .CreateModel(isSignKeyReturn, registerMemberTokenResponseModel)); } } else { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, "店号无效")); } } catch (Exception e) { throw e; } }