Пример #1
0
        private static void SetDBMemberToken(string Token, string StoreId, string Phone, string MemberLevelName, string storeName, string ICCardID, string EndTime)
        {
            IMemberTokenService memberTokenService = BLLContainer.Resolve <IMemberTokenService>();
            var           model = memberTokenService.GetModels(p => p.StoreId.Equals(StoreId) & p.Phone.Equals(Phone)).FirstOrDefault <T_MemberToken>();
            T_MemberToken mtk   = new T_MemberToken();

            if (model == null)
            {
                mtk.Token           = Token;
                mtk.CreateTime      = DateTime.Now;
                mtk.StoreId         = StoreId;
                mtk.Phone           = Phone;
                mtk.ICCardID        = ICCardID;
                mtk.StoreName       = storeName;
                mtk.MemberLevelName = MemberLevelName;
                mtk.EndTime         = EndTime;
                memberTokenService.Add(mtk);
            }
            else
            {
                model.Token         = Token;
                model.UpdateTime    = DateTime.Now;
                mtk.ICCardID        = ICCardID;
                mtk.StoreName       = storeName;
                mtk.MemberLevelName = MemberLevelName;
                model.EndTime       = EndTime;
                memberTokenService.Update(model);
            }
        }
Пример #2
0
        public static string SetMemberCardQueryBusiness(string iccard, out string name)
        {
            IMemberTokenService memberToken = BLLContainer.Resolve <IMemberTokenService>();
            //根据iccard查询membertoken表strordID
            var menlist = memberToken.GetModels(p => p.ICCardID.Equals(iccard, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <T_MemberToken>();

            if (menlist != null)
            {
                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                int           storeid      = Convert.ToInt32(menlist.StoreId);
                //根据stroid查询t_store的对应数据库的名称
                var storelist = storeService.GetModels(p => p.id == storeid).FirstOrDefault <t_store>();
                if (storelist != null)
                {
                    String sql             = String.Format("select row_number() over (order by RealTime) as No,CONVERT(varchar(100),f.RealTime , 20)as RealTimes,'{0}' as ICCardID,f.* from (SELECT f1.RealTime, ( CAST(f1.Balance AS decimal) - CAST(f1.Coins AS decimal) ) AS last_coins, f1.Coins AS save_coins, '0' AS used_coins, f1.Balance AS now_coins, '存币机存币' AS type,  f1.Segment+ ' | '+f1.HeadAddress  AS other_info FROM ( SELECT * FROM flw_485_savecoin WHERE ICCardID = {0} ) f1 UNION ALL SELECT f2.RealTime AS RealTime, ( CASE f2.CoinType WHEN '0' THEN '0' WHEN '3' THEN ( f2.Balance - f2.Coins ) ELSE ( f2.Balance + f2.Coins ) END ) AS last_coins, ( CASE f2.CoinType WHEN '3' THEN f2.Coins ELSE '0' END ) AS save_coins, ( CASE f2.CoinType WHEN '1' THEN f2.Coins WHEN '4' THEN f2.Coins ELSE '0' END ) AS used_coins, f2.Balance AS now_coins, ( CASE f2.CoinType WHEN '0' THEN '实物投币' WHEN '1' THEN '刷卡投币' WHEN '2' THEN '实物退币' WHEN '3' THEN 'IC卡出币' WHEN '4' THEN '数字币投币' END ) AS type,  g.GameName+ ' | '+ h.HeadID + case when DeivceName='' then '' else ' | ' + DeivceName end AS other_info FROM ( SELECT s1.*,ISNULL( s2.DeivceName,'') as DeivceName FROM flw_485_coin s1 left join flw_Push_Coin s2 on s1.ID=s2.FlwID WHERE ICCardID = {0} ) f2 LEFT JOIN t_head h ON f2.HeadAddress = h.HeadAddress AND f2.Segment = h.Segment LEFT JOIN t_game g ON h.GameID = g.GameID UNION ALL SELECT f3.RealTime, ( f3.Balance + f3.Coins ) AS last_coins, '0' AS save_coins, f3.Coins AS used_coins, f3.Balance AS now_coins, ( CASE f3.FlowType WHEN '0' THEN '退币' WHEN '1' THEN '退卡' END ) AS type,  CONVERT(varchar(20),f3.UserID)+ ' | '+ f3.WorkStation  AS other_info FROM ( SELECT * FROM flw_coin_exit WHERE ICCardID = {0} ) f3 UNION ALL SELECT f4.RealTime, ( CASE f4.WorkType WHEN '3' THEN ( f4.Balance + f4.Coins ) WHEN '7' THEN ( f4.Balance + f4.Coins ) WHEN '6' THEN ( f4.Balance + f4.Coins ) ELSE ( f4.Balance - f4.Coins ) END ) AS last_coins, ( CASE f4.WorkType WHEN '3' THEN '0' WHEN '7' THEN '0' ELSE f4.Coins END ) AS save_coins, ( CASE f4.WorkType WHEN '3' THEN f4.Coins WHEN '7' THEN f4.Coins ELSE '0' END ) AS used_coins, f4.Balance AS now_coins, ( CASE f4.WorkType WHEN '4' THEN '手工存币' WHEN '3' THEN '手工提币' WHEN '7' THEN '售币机提币' WHEN '6' THEN '自助机提币' WHEN '2' THEN '送币' WHEN '5' THEN '送币' WHEN '8' THEN '送币' END ) AS type,  f4.WorkStation + ' | ' + CONVERT(VARCHAR(20), f4.UserID) + ' | ' + MacAddress AS other_info FROM ( SELECT * FROM flw_coin_sale WHERE ICCardID = {0} ) f4 UNION ALL SELECT f5.RealTime, '0' AS last_coins, f5.CoinQuantity AS save_coins, '0' AS used_coins, f5.CoinQuantity AS now_coins, '数字币销售' AS type,  h5.FoodName+ ' | '+ g5.WorkStation AS other_info FROM ( SELECT * FROM flw_digite_coin_detial WHERE ICCardID = {0} ) f5 LEFT JOIN flw_digite_coin g5 ON f5.ID = g5.ID LEFT JOIN t_foods h5 ON h5.FoodID = g5.FoodID UNION ALL SELECT f6.RealTime, f6.Balance - f6.CoinQuantity AS last_coins, ( CASE f6.FlowType WHEN 'X' THEN '0' ELSE f6.CoinQuantity END ) AS save_coins, ( CASE f6.FlowType WHEN 'X' THEN f6.CoinQuantity ELSE '0' END ) AS used_coins, f6.Balance AS now_coins, ( CASE f6.FlowType WHEN '0' THEN '开户' WHEN '1' THEN '充值' WHEN 'X' THEN '退餐' END ) AS type,  fs6.FoodName+' | '+f6.WorkStation AS other_info FROM ( SELECT * FROM flw_food_sale WHERE ICCardID = {0} ) f6 LEFT JOIN t_foods fs6 ON f6.FoodID = fs6.FoodID UNION ALL SELECT f9.RealTime, ( f9.Balance + f9.Coins ) AS last_coins, '0' AS save_coins, f9.Coins AS used_coins, f9.Balance AS now_coins, '购买商品' AS type, '销售流水号:'+CONVERT(varchar(20),f9.GoodsID) AS other_info FROM ( SELECT * FROM flw_goods WHERE ICCardID = {0} AND PayType = '2' ) f9 UNION ALL SELECT f10.RealTime, ( f10.Balance - f10.PointCoin ) AS last_coins, f10.PointCoin AS save_coins, '0' AS used_coins, f10.Balance AS now_coins, '积分兑币' AS type, fs10.RebateRuleName AS other_info FROM ( SELECT * FROM flw_rebate WHERE ICCardID = {0} ) f10 LEFT JOIN t_rebate fs10 ON f10.RebateRuleID = fs10.RebateRuleID UNION ALL SELECT f11.RealTime, ( f11.BalanceOut + f11.Coins ) AS last_coins, '0' AS save_coins, f11.Coins AS used_coins, f11.BalanceOut AS now_coins, '转出' AS type, CONVERT(varchar(500),f11.ICCardIDIn) AS other_info FROM ( SELECT * FROM flw_transfer WHERE ICCardIDOut = {0} ) f11 UNION ALL SELECT f12.RealTime, ( f12.BalanceIn - f12.Coins ) AS last_coins, f12.Coins AS save_coins, '0' AS used_coins, f12.BalanceIn AS now_coins, '转入' AS type, CONVERT(varchar(500),f12.ICCardIDOut) AS other_info FROM ( select * from flw_transfer where ICCardIDIn = {0} ) f12 UNION ALL SELECT f13.RealTime, ( f13.Balance + f13.Coins ) AS last_coins, '0' AS save_coins, f13.Coins AS used_coins, f13.Balance AS now_coins, '购买门票' AS type, '无' AS other_info FROM ( select * from flw_project_buy where ICCardID = {0} ) f13) f", iccard);
                    System.Data.DataSet ds = XCGameBLL.ExecuteQuerySentence(sql, storelist.store_dbname, null);
                    DataTable           dt = ds.Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        var list = Utils.GetModelList <MenberICCardModel>(ds.Tables[0]).ToList();
                        int time = CacheExpires.CommonPageQueryDataCacheTime;
                        MemberICICard.Add(iccard, list, time);
                        name = "1";
                        return(name);
                    }
                }
            }
            name = "";
            return(name);
        }
 public DeviceAuthApiModule(
     IMemberService memberService,
     IMemberTokenService memberTokenService,
     IDevicesService devicesService,
     IDeviceValidatableService deviceValidatableService,
     ILogger <DeviceAuthApiModule> logger) : base(memberTokenService, memberService)
 {
     _logger                   = logger;
     _devicesService           = devicesService;
     _deviceValidatableService = deviceValidatableService;
     Post("/device", _ => NewDeviceAsync());
     //Post("/update/device", _ => UpdateDeviceAsync());
 }
Пример #4
0
 public FarmsAuthApiModule(
     IMemberService memberService,
     IMemberTokenService memberTokenService,
     IFarmService farmService,
     IFarmValidatableService farmValidatableService,
     ILogger <FarmsAuthApiModule> logger) : base(memberTokenService, memberService)
 {
     _logger                 = logger;
     _farmService            = farmService;
     _farmValidatableService = farmValidatableService;
     Post("/farm", _ => NewDeviceAsync());
     Post("/update/farm", _ => UpdateFarmAsync());
 }
Пример #5
0
 public UploadImageAuthApiModule(
     IMemberService memberService,
     IMemberTokenService memberTokenService,
     IUploadImagesService uploadImagesService,
     IFarmValidatableService farmValidatableService,
     ILogger <UploadImageAuthApiModule> logger) : base(memberTokenService, memberService, "upload-image")
 {
     _logger = logger;
     _uploadImagesService    = uploadImagesService;
     _farmValidatableService = farmValidatableService;
     Post("/upload", _ => UploadImageAsync());
     Get("/list", _ => GetUploadImagesAsync());
     Get("/image/{id}/{extension}", p => GetUploadImage((string)p.id, (string)p.extension));
 }
Пример #6
0
        public static void Init()
        {
            IMemberTokenService apirequestlogservice = BLLContainer.Resolve <IMemberTokenService>();
            var model = apirequestlogservice.GetModels(p => 1 == 1).ToList <T_MemberToken>();

            if (model.Count > 0)
            {
                for (int i = 0; i < model.Count; i++)
                {
                    XCGameMemberTokenModel tokenModel = new XCGameMemberTokenModel(model[i].StoreId, model[i].Phone, model[i].ICCardID, model[i].MemberLevelName, model[i].StoreName, model[i].EndTime);
                    XCGameMemberTokenCache.AddToken(model[i].Token, tokenModel);
                }
            }
        }
Пример #7
0
 public LoginModule(
     IMemberService memberService,
     IMemberTokenService memberTokenService,
     ILoginValidatableService loginValidatableService,
     IVerificationCodeService verificationCodeService,
     IMemberLoginLogService memberLoginLogService,
     ILogger <LoginModule> logger) : base("member", "api", "")
 {
     _memberService           = memberService;
     _memberTokenService      = memberTokenService;
     _loginValidatableService = loginValidatableService;
     _verificationCodeService = verificationCodeService;
     _memberLoginLogService   = memberLoginLogService;
     _logger = logger;
     Post("/test/debug/init", _ => InitDebugData());
     Post("/login", _ => DoLoginAsync());
     Post("/regist", _ => DoRegistAsync());
     Post("/logout", _ => DoLogoutAsync());
 }
Пример #8
0
 public VerificationCodeModule(
     IMemberService memberService,
     IValidatableCodeService validatableCodeService,
     IMemberTokenService memberTokenService,
     ILoginValidatableService loginValidatableService,
     IVerificationCodeService verificationCodeService,
     IMemberLoginLogService memberLoginLogService,
     ILogger <VerificationCodeModule> logger)
 {
     _memberService           = memberService;
     _verificationCodeService = verificationCodeService;
     _validatableCodeService  = validatableCodeService;
     _memberTokenService      = memberTokenService;
     _loginValidatableService = loginValidatableService;
     _memberLoginLogService   = memberLoginLogService;
     _logger = logger;
     //注册验证码
     Get("/code/regist", p => GetRegistCodeAsync());
     Post("/code/regist/check/{code}", p => CheckRegistCodeAsync((string)p.code));
     ///短信验证码(验证码随机生成)
     Post("/code/verification", _ => GetCodeAsync());
 }
Пример #9
0
        public ManageModule(
            IMemberService memberService,
            IMemberTokenService memberTokenService,
            ILoginValidatableService loginValidatableService,
            IVerificationCodeService verificationCodeService,
            IValidatableCodeService validatableCodeService,
            IMemberLoginLogService memberLoginLogService,
            ILogger <ManageModule> logger) : base(memberTokenService, memberService)
        {
            _loginValidatableService = loginValidatableService;
            _verificationCodeService = verificationCodeService;
            _validatableCodeService  = validatableCodeService;
            _memberLoginLogService   = memberLoginLogService;
            _logger = logger;

            //修改密码验证码
            Get("/code/renew-password", p => GetRenewPasswordCodeAsync());
            Post("/code/renew-password/check/{code}", p => CheckRenewPasswordCodeAsync((string)p.code));

            Get("/check-auth", _ => CheckAuth());
            Post("/renew-password", _ => DoRenewPasswordAsync());
        }
Пример #10
0
        /// <summary>
        /// H5页面微信授权
        /// </summary>
        private void H5AuthCommon(string code)
        {
            string accsess_token = string.Empty;
            string refresh_token = string.Empty;
            string openId        = string.Empty;
            string errMsg        = string.Empty;

            try
            {
                if (TokenMana.GetTokenForScanQR(code, out accsess_token, out refresh_token, out openId, out errMsg))
                {
                    bool isReg = false;
                    IMobileTokenService mobileTokenService = BLLContainer.Resolve <IMobileTokenService>();
                    var mobileTokenModel = mobileTokenService.GetModels(p => p.OpenId.Equals(openId)).FirstOrDefault <t_MobileToken>();
                    if (mobileTokenModel != null)
                    {
                        IMemberTokenService memberTokenService = BLLContainer.Resolve <IMemberTokenService>();
                        var memberTokenModel = mobileTokenService.GetModels(p => p.OpenId.Equals(openId)).FirstOrDefault <t_MobileToken>();
                        if (memberTokenModel != null)
                        {
                            isReg = true;
                        }
                    }
                    string redirectUrl = string.Format("{0}?openId={1}&isReg={2}", CommonConfig.H5WeiXinAuthRedirectUrl, openId, Convert.ToInt32(isReg));
                    Response.Redirect(redirectUrl);
                }
                else
                {
                    LogHelper.SaveLog(TxtLogType.WeiXin, TxtLogContentType.Common, TxtLogFileType.Day, "errMsg:" + errMsg);
                    //重定向的错误页面
                    Response.Redirect(WeiXinConfig.RedirectErrorPage);
                }
            }
            catch (Exception e)
            {
                LogHelper.SaveLog(TxtLogType.WeiXin, TxtLogContentType.Exception, TxtLogFileType.Day, "Exception:" + e.Message);
            }
        }
 public NancyFarmAuthApiModule(IMemberTokenService memberTokenService, IMemberService memberService, string modulePath = "") : base("farm", "api", modulePath)
 {
     _memberTokenService = memberTokenService;
     _memberService      = memberService;
     Before += CheckAuth;
 }
Пример #12
0
 public NancyAuthApiModule(IMemberTokenService memberTokenService, IMemberService memberService, string mathod = "member", string func = "api", string modulePath = "") : base(mathod, func, modulePath)
 {
     _memberTokenService = memberTokenService;
     _memberService      = memberService;
     Before += CheckAuth;
 }
Пример #13
0
        public object update(Dictionary <string, object> dicParas)
        {
            try
            {
                string          errMsg        = string.Empty;
                string          mobile        = string.Empty;
                StoreBusiness   storeBusiness = new StoreBusiness();
                StoreCacheModel storeModel    = null;
                string          moblietoken   = dicParas.ContainsKey("moblietoken") ? dicParas["moblietoken"].ToString() : string.Empty;
                string          membername    = dicParas.ContainsKey("membername") ? dicParas["membername"].ToString() : string.Empty;
                if (membername == "")
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员姓名不能为空"));
                }
                string gender = dicParas.ContainsKey("gender") ? dicParas["gender"].ToString() : string.Empty;
                if (gender == "")
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员性别不能为空"));
                }

                string MemberPhoto = dicParas.ContainsKey("memberphoto") ? dicParas["memberphoto"].ToString() : string.Empty;
                if (!MobileTokenBusiness.ExistToken(moblietoken, out mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机token无效"));
                }

                IMemberTokenService memberTokenService = BLLContainer.Resolve <IMemberTokenService>();
                var membertokenlist = memberTokenService.GetModels(x => x.Phone == mobile).ToList();
                if (membertokenlist.Count == 0)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到会员信息"));
                }

                //遍历会员表中的所有数据,更新会员信息
                for (int i = 0; i < membertokenlist.Count; i++)
                {
                    int iccard  = Convert.ToInt32(membertokenlist[i].ICCardID);
                    int storeid = Convert.ToInt32(membertokenlist[i].StoreId);
                    if (storeBusiness.IsEffectiveStore(storeid.ToString(), ref storeModel, out errMsg))
                    {
                        if (storeModel.StoreType == 0)
                        {
                            XCCloudService.BLL.IBLL.XCGame.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName);
                            var model = memberService.GetModels(p => p.ICCardID == iccard).FirstOrDefault <XCCloudService.Model.XCGame.t_member>();
                            if (model != null)
                            {
                                model.MemberName  = membername;
                                model.Gender      = gender;
                                model.MemberPhoto = MemberPhoto;
                                memberService.Update(model);
                            }
                        }
                        else if (storeModel.StoreType == 1)
                        {
                            XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService>();
                            var model = memberService.GetModels(p => p.ICCardID == iccard).FirstOrDefault <XCCloudService.Model.XCCloudRS232.t_member>();
                            if (model != null)
                            {
                                model.MemberName = membername;
                                memberService.Update(model);
                            }
                        }
                    }
                }
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
            catch (Exception e)
            {
                throw e;
            }
        }