예제 #1
0
        public async Task <H5ResponseViewModel <object> > AlterUserName([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <object> response = null;
            var    sysCode = _sys.CheckParameters(Parameters.data, "alterUserName_H5");
            string token   = Parameters.data.token;
            bool   isLog   = _token.VerifyToken(token);

            if (isLog)
            {
                var userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>
                                    (RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                isLog = await _user.AlterUserNameAsync(userLogin.Userid, (string)Parameters.data.name);

                if (!isLog)
                {
                    sysCode = SysCode.Err;
                }
            }
            else
            {
                sysCode = SysCode.TokenLose;
            }
            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }
예제 #2
0
        public H5ResponseViewModel <ValidateCodeView> GetValidate([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <ValidateCodeView> response = null;
            ValidateCode     validatecode = new ValidateCode();
            ValidateSetting  _imgurl      = new ValidateSetting();
            ValidateCodeView validate     = null;
            var sysCode = _sys.CheckParameters(Parameters.data, "GetValidate");

            if (sysCode == SysCode.Ok)
            {
                dynamic dyParameter = Parameters.data;
                string  strCodeId   = dyParameter.codeId;
                if (!string.IsNullOrEmpty(strCodeId))
                {
                    RedisHelper.KeyDelete(strCodeId, RedisFolderEnum.code, RedisEnum.Four); //删除原来的图片
                }
                validatecode.key = Guid.NewGuid().ToString();
                validatecode.CreateValidateImage(4);
                validate = new ValidateCodeView
                {
                    name   = validatecode.key,
                    imgUrl = $"{_validate.Url}{validatecode.key}.gif"
                };
            }
            else
            {
                sysCode = SysCode.Err;
            }
            response = new H5ResponseViewModel <ValidateCodeView>(sysCode, validate);
            return(response);
        }
예제 #3
0
        public H5ResponseViewModel <CostStatusResult> CostStatus([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "costStatus");
            H5ResponseViewModel <CostStatusResult> response = null;
            CostStatusResult result  = null;
            CostStatusResult result2 = null;
            CostStatusResult result3 = null;

            if (sysCode == SysCode.Ok)
            {
                //result = _biz.CostStatus((string)Parameters.data.forderId);
                result = _accout.CostStatus_php((string)Parameters.data.forderId);

                result2 = _accout.CostOrderStatus_php((string)Parameters.data.forderId);


                if (result == null && result2 == null)
                {
                    result3 = null;
                }
                else
                {
                    result3 = (result == null) ? result2 : result;
                }

                //从php根据兑出订单号查询订单状态
                // _accout.CostStatus_php((string)Parameters.data.forderId);
            }
            response = new H5ResponseViewModel <CostStatusResult>(sysCode, result3 ?? null);
            return(response);
        }
예제 #4
0
        public async Task <H5ResponseViewModel <object> > WebFeedback([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "webFeedback");
            H5ResponseViewModel <object> response = null;

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isLog = _token.VerifyToken(token);
                if (isLog)
                {
                    var  userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    long userId    = long.Parse(userLogin.Userid.ToString());
                    if (!await _user.AddFeedbackAsync(new FeedbackDto
                    {
                        App_version = "H5",
                        Content = Parameters.data.opinion,
                        Createtime = DateTime.Now,
                        Updatetime = DateTime.Now,
                        Respond = 0,
                        Userid = userId
                    }))
                    {
                        sysCode = SysCode.Err;
                    }
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }
예제 #5
0
        public H5ResponseViewModel <Object> Register([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "Register");
            H5ResponseViewModel <Object> response = null;
            string phone  = Parameters.data.phone;
            string strKey = $"{CacheKey.Rgister.ToString()}{phone}";

            if (sysCode == SysCode.Ok)
            {
                if (RedisHelper.KeyExists(strKey, RedisFolderEnum.code, RedisEnum.Four) &&
                    RedisHelper.StringGet(strKey, RedisFolderEnum.code, RedisEnum.Four).Equals((string)Parameters.data.verifyCode))
                {
                    var  salt   = _sys.GetRandomSeed(8);
                    long userId = _user.Register(new RegisterDto
                    {
                        App_version = "",
                        Channel     = Parameters.data.channelId,
                        Createtime  = DateTime.Now,
                        Device_code = "",
                        Os_type     = "",
                        Gps         = "",
                        Os_version  = "",
                        Phone       = phone,
                        Platform    = "H5",
                        Updatetime  = DateTime.Now
                    }, new UserLoginDto
                    {
                        Createtime = TimeHelper.GetDateTime(),
                        Is_first   = 1,
                        Password   = _sys.Md5Encode($"{(string)Parameters.data.password}{salt}"),
                        Phone      = phone,
                        Status     = 0,
                        Salt       = salt,
                        Updatetime = TimeHelper.GetDateTime(),
                    }, new UserInfoDto
                    {
                        Createtime = TimeHelper.GetDateTime(),
                        Head       = "",
                        Updatetime = TimeHelper.GetDateTime(),
                        Nick_name  = ""
                    });
                    if (userId != 0)
                    {
                        RedisHelper.KeyDelete(strKey, RedisFolderEnum.code, RedisEnum.Four);
                    }
                    else
                    {
                        sysCode = SysCode.Err;
                    }
                }
                else
                {
                    sysCode = SysCode.CodeErr;
                }
            }
            response = new H5ResponseViewModel <Object>(sysCode, null);
            return(response);
        }
예제 #6
0
        public async Task <H5ResponseViewModel <object> > PrepaidRefill([FromBody] H5RequestViewModel obj)
        {
            H5ResponseViewModel <object> response = null;
            var  code  = SysCode.Ok;
            bool isLog = _token.VerifyToken((string)obj.data.userOpenId, (string)obj.data.sessionToken);

            if (isLog)
            {
                string       strJson = RedisHelper.StringGet($"{CacheKey.Token}{(string)obj.data.userOpenId}", RedisFolderEnum.token, RedisEnum.Three);
                UserLoginDto userLog = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson);
                //获取商品信息
                var ofpaybyid = await _ofpay.GetOfOayByIdAsync(long.Parse((string)obj.data.ofpayId));

                OfpayLogDto ofpayLog = new OfpayLogDto
                {
                    CreateTime = DateTime.Now,
                    OfPay_Id   = ofpaybyid.Id,
                    Order_Id   = Guid.NewGuid().ToString(),
                    Phone      = userLog.Phone,
                    Status     = 1,
                    UpdateTime = DateTime.Now,
                    UserId     = userLog.Userid,
                };
                if (!await _ofpay.OfpayLogAsync(ofpayLog))
                {
                    //这里如果报错会直接进异常不会执行下面的代码
                    _log.Error($"话费充值接口生成本地订单错误,参数{ofpayLog}");
                }
                if (await _ofpay.PrepaidRefillAsync(ofpayLog.Phone, ofpaybyid.Cardnum, ofpayLog.Order_Id))
                {
                    ExchangeDto exchange = new ExchangeDto
                    {
                        Amount   = double.Parse(ofpaybyid.Currency), //总价
                        ForderId = ofpayLog.Order_Id,
                        FuserId  = userLog.Userid.ToString(),
                        Name     = "虚拟商品兑出",                         //ofpaybyid.Name,
                        Price    = double.Parse(ofpaybyid.Currency), //单价
                        Quantity = 1
                    };
                    //关闭章鱼兑换
                    // await _biz.Exchange(exchange);
                    //从php兑出
                    await _accout.Exchange_php(exchange);
                }
                else
                {
                    code = SysCode.Err;
                }
                _log.Info($"欧飞充值记录,参数为{ofpayLog}结果为{code}");
            }
            else
            {
                code = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <object>(code, null);
            return(response);
        }
예제 #7
0
        public async Task <H5ResponseViewModel <List <OfpayDto> > > GetOfPayList([FromBody] H5RequestViewModel obj)
        {
            H5ResponseViewModel <List <OfpayDto> > response = null;
            var code = SysCode.Ok;
            var list = await _ofpay.GetOfOayListAsync();

            response = new H5ResponseViewModel <List <OfpayDto> >(code, list.Count > 0 ? list : null);
            return(response);
        }
예제 #8
0
        public async Task <H5ResponseViewModel <TokenView> > PwdLogin([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "PwdLogin_H5");
            H5ResponseViewModel <TokenView> response = null;
            TokenView result = null;

            if (sysCode == SysCode.Ok)
            {
                string phone = Parameters.data.phone;
                //判断手机号码是否注册
                bool isExist = await _user.PhoneExistAsync(phone);

                if (isExist)
                {
                    //获取用户登录信息。
                    var userLogin = await _user.GetUserLoginAsync(phone);

                    if (userLogin.Salt != 0)
                    {
                        string pwd    = _sys.Md5Encode($"{(string)Parameters.data.password}{userLogin.Salt}");
                        var    userId = _user.UserLoginOrPwd(phone, pwd);
                        if (userId != 0)
                        {
                            result = _token.GetH5Token(userId);
                            await _user.RecordLoginLogAsync(new userLoginLogDto
                            {
                                App_version = "H5",
                                Createtime  = TimeHelper.GetDateTime(),
                                Device_code = "H5",
                                Gps         = "H5",
                                Os_type     = "H5",
                                Os_version  = "H5",
                                Phone       = phone,
                                Userid      = userId
                            });
                        }
                        else
                        {
                            sysCode = SysCode.PwdErr;
                        }
                    }
                    else
                    {
                        //用户H5登录注册,没有密码
                        sysCode = SysCode.UserPwdIsNull;
                    }
                }
                else
                {
                    sysCode = SysCode.PhoneNonentity;
                }
            }
            response = new H5ResponseViewModel <TokenView>(sysCode, result ?? null);
            return(response);
        }
예제 #9
0
        public async Task <H5ResponseViewModel <object> > UpdatePwd([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <object> response = null;
            var    sysCode = _sys.CheckParameters(Parameters.data, "UpdatePwd_H5");
            string token   = Parameters.data.token;
            bool   isLog   = _token.VerifyToken(token);

            if (sysCode == SysCode.Ok)
            {
                if (isLog)
                {
                    var userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>
                                        (RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    var    salt      = _sys.GetRandomSeed(8);
                    string pwd       = _sys.Md5Encode($"{(string)Parameters.data.password}{salt}");
                    string pwdEctype = _sys.Md5Encode($"{(string)Parameters.data.passwordEctype}{salt}");
                    if (pwd.Equals(pwdEctype))
                    {
                        string verifyCode = Parameters.data.verifyCode;
                        string strKey     = $"{ CacheKey.UpdatePwd.ToString()}{userLogin.Phone}";
                        if (RedisHelper.KeyExists(strKey, RedisFolderEnum.code, RedisEnum.Four) &&
                            RedisHelper.StringGet(strKey, RedisFolderEnum.code, RedisEnum.Four).Equals(verifyCode))
                        {
                            if (userLogin.Password.Equals(pwd))
                            {
                                sysCode = SysCode.PwdNoDifference; //密码一致
                            }
                            else
                            {
                                if (!await _user.UpdatePwdAsync(userLogin.Userid, pwd, salt)) //修改密码
                                {
                                    sysCode = SysCode.Err;
                                }
                                RedisHelper.KeyDelete(strKey, RedisFolderEnum.code, RedisEnum.Four); //删除验证码缓存
                            }
                        }
                        else
                        {
                            sysCode = SysCode.CodeErr;
                        }
                    }
                    else
                    {
                        sysCode = SysCode.PwdInconformity;
                    }
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }
예제 #10
0
        public async Task <H5ResponseViewModel <UserInfoView> > UserInfo([FromBody] H5RequestViewModel Parameters)
        {
            var          sysCode = _sys.CheckParameters(Parameters.data, "userverify");
            UserInfoView Result  = null;
            H5ResponseViewModel <UserInfoView> response = null;

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isLog = _token.VerifyToken(token);
                if (isLog)
                {
                    UserLoginDto userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    long         userId    = long.Parse(userLogin.Userid.ToString());
                    UserInfoDto  userInfo  = await _user.SearchUserInfoAsync(userId);

                    UserBalanceDto UserBalance = null;
                    //关闭章鱼余额查询
                    // UserBalance = _biz.AcquireBalance(userId);
                    //从php获取用户余额
                    UserBalance = _accout.AcquireBalance_php(userId);

                    if (UserBalance == null)
                    {
                        UserBalance = new UserBalanceDto
                        {
                            PrizeBalance = 0.00,
                            Balance      = 0.00
                        };
                    }
                    //查询用户渠道并返回用户信息
                    var userchannel = await _routine.GetUserIdChannelIdAsync(userId);

                    Result = new UserInfoView
                    {
                        Balance      = UserBalance.Balance,
                        IdCard       = userInfo.Id_card,
                        Nickname     = userInfo.Nick_name,
                        Phone        = userLogin.Phone,
                        PrizeBalance = UserBalance.PrizeBalance,
                        RealName     = userInfo.Real_name,
                        channel      = userchannel
                    };
                }
                else
                {
                    /*短令牌失效*/
                    sysCode = SysCode.SessionTokenLose;
                }
            }
            response = new H5ResponseViewModel <UserInfoView>(sysCode, Result);
            return(response);
        }
예제 #11
0
        public async Task <H5ResponseViewModel <UserSignViewModel> > UserSignInfo([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "userverify");
            H5ResponseViewModel <UserSignViewModel> response = null;

            sysCode = SysCode.Ok;
            UserSignViewModel result = new UserSignViewModel
            {
                Multiple = 1,
                Number   = 1,
                state    = true,
            };

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isLog = _token.VerifyToken(token);
                if (isLog)
                {
                    UserLoginDto userLogin   = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    long         userId      = long.Parse(userLogin.Userid.ToString());
                    UserSignDto  userSignDto = await _userTask.QueryUserSignAsync(userId);

                    DateTime nowTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));//当前时间
                    if (userSignDto != null)
                    {
                        DateTime time = Convert.ToDateTime(userSignDto.Createtime.ToString("yyyy-MM-dd")); //用户最后一次签到时间
                        if (time == nowTime)
                        {
                            result.Multiple = userSignDto.Multiple;
                            result.Number   = userSignDto.Number;
                            result.state    = false;
                        }
                        else
                        {
                            if (TimeHelper.Dateday(nowTime, Convert.ToDateTime(time)) == 1)
                            {
                                result.Multiple = userSignDto.Multiple;
                                result.Number   = userSignDto.Number;
                                result.state    = true;
                            }
                        }
                    }
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <UserSignViewModel>(sysCode, result);
            return(response);
        }
예제 #12
0
        public async Task <H5ResponseViewModel <AliPayH5View> > PayRequest([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "payrequest");
            H5ResponseViewModel <AliPayH5View> response = null;
            AliPayH5View result = null;
            string       token  = Parameters.data.token;
            bool         isLog  = _token.VerifyToken(token);

            if (sysCode == SysCode.Ok)
            {
                if (isLog)
                {
                    string       json              = RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five);
                    UserLoginDto userLogin         = JsonHelper.DeserializeJsonToObject <UserLoginDto>(json);
                    int          id                = int.Parse((string)Parameters.data.id);
                    var          rechargeCommodity = await _recharge.GetRechargeCommodityByIdAsync(id);

                    string order = Guid.NewGuid().ToString();
                    result = _recharge.CreateAlipayH5Receipt(rechargeCommodity, order);
                    AliPayOrderDto AliPayOrder = new AliPayOrderDto()
                    {
                        Commodity_id = id,
                        Out_trade_no = order,
                        Createtime   = DateTime.Now,
                        Updatetime   = DateTime.Now,
                        Gmt_payment  = DateTime.Now,
                        Userid       = userLogin.Userid,
                        Total_amount = rechargeCommodity.Money           //人名币
                    };
                    await _recharge.RecordAlipayOrderAsync(AliPayOrder); //记录支付宝订单。

                    RechargeDto recharge = new RechargeDto()
                    {
                        Amount     = rechargeCommodity.Amount, //虚拟币
                        createtime = DateTime.Now,
                        Pay_type   = 1,                        //支付类型 1支付宝,2微信,3苹果内购
                        Status     = 1,                        //1 待处理 2 已支付 3 支付失败 4 超时
                        updatetime = DateTime.Now,
                        UserId     = userLogin.Userid,
                        Order_id   = AliPayOrder.Out_trade_no,
                    };
                    await _recharge.RecordRechargeLogAsync(recharge); //记录充值订
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <AliPayH5View>(sysCode, result ?? null);
            return(response);
        }
예제 #13
0
        public async Task <H5ResponseViewModel <object> > OfPayIsNo([FromBody] H5RequestViewModel obj)
        {
            H5ResponseViewModel <object> response = null;
            var code      = SysCode.Ok;
            var ofpaybyid = await _ofpay.GetOfOayByIdAsync(long.Parse((string)obj.data.ofpayId));

            long cardnums = long.Parse(ofpaybyid.Cardnum);
            var  result   = _ofpay.GetOfOayIsNo((string)obj.data.phone, cardnums);

            if (!result)
            {
                code = SysCode.Err;
            }
            response = new H5ResponseViewModel <object>(code, null);
            return(response);
        }
예제 #14
0
        public async Task <H5ResponseViewModel <GameUrlResponse> > GetUrl([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "gameUrl");
            H5ResponseViewModel <GameUrlResponse> response = null;
            GameUrlResponse result = null;

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isNo = _token.VerifyToken(token);
                if (isNo)
                {
                    UserLoginDto userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    long         user_id   = long.Parse(userLogin.Userid.ToString());
                    string       temp      = Parameters.data.gameId;
                    //获取用户信息,
                    UserInfoDto userInfo = await _user.SearchUserInfoAsync(user_id);

                    string key = string.Empty;
                    switch (temp)
                    {
                    case "1":
                        key = _gameKey.Dog;
                        break;

                    case "2":
                        key = _gameKey.Fish;
                        break;

                    case "3":
                        key = _gameKey.Star;
                        break;

                    default:
                        break;
                    }
                    result = _biz.GameUrl(key, user_id, "H5", 4, "H5", userInfo.Nick_name);
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <GameUrlResponse>(sysCode, result ?? null);
            return(response);
        }
예제 #15
0
        public async Task <H5ResponseViewModel <UserSignViewModel> > UserSignInfo([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <UserSignViewModel> response = null;
            bool isLog               = _token.VerifyToken((string)Parameters.data.userOpenId, (string)Parameters.data.sessionToken);
            var  sysCode             = SysCode.Ok;
            UserSignViewModel result = new UserSignViewModel
            {
                Multiple = 1,
                Number   = 1,
                state    = true,
            };

            if (isLog)
            {
                string strJson     = RedisHelper.StringGet($"{CacheKey.Token}{(string)Parameters.data.userOpenId}", RedisFolderEnum.token, RedisEnum.Three);
                var    userLog     = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson);
                var    userSignDto = await _userTask.QueryUserSignAsync(userLog.Userid);

                DateTime nowTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));//当前时间
                if (userSignDto != null)
                {
                    DateTime time = Convert.ToDateTime(userSignDto.Createtime.ToString("yyyy-MM-dd")); //用户最后一次签到时间
                    if (time == nowTime)
                    {
                        result.Multiple = userSignDto.Multiple;
                        result.Number   = userSignDto.Number;
                        result.state    = false;
                    }
                    else
                    {
                        if (TimeHelper.Dateday(nowTime, Convert.ToDateTime(time)) == 1)
                        {
                            result.Multiple = userSignDto.Multiple;
                            result.Number   = userSignDto.Number;
                            result.state    = true;
                        }
                    }
                }
            }
            else
            {
                sysCode = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <UserSignViewModel>(sysCode, result);
            return(response);
        }
예제 #16
0
        public async Task <H5ResponseViewModel <UserSignViewModel> > UserSignInfo_v1([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <UserSignViewModel> response = null;
            string            userId  = _biz.IsNoLogin((string)Parameters.data.token, (string)Parameters.data.userOpenId);
            var               sysCode = SysCode.Ok;
            UserSignViewModel result  = new UserSignViewModel
            {
                Multiple = 1,
                Number   = 1,
                state    = true,
            };

            if (userId != "0")
            {
                long user_id     = long.Parse(userId);
                var  userSignDto = await _userTask.QueryUserSignAsync(user_id);

                DateTime nowTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));//当前时间
                if (userSignDto != null)
                {
                    DateTime time = Convert.ToDateTime(userSignDto.Createtime.ToString("yyyy-MM-dd")); //用户最后一次签到时间
                    if (time == nowTime)
                    {
                        result.Multiple = userSignDto.Multiple;
                        result.Number   = userSignDto.Number;
                        result.state    = false;
                    }
                    else
                    {
                        if (TimeHelper.Dateday(nowTime, Convert.ToDateTime(time)) == 1)
                        {
                            result.Multiple = userSignDto.Multiple;
                            result.Number   = userSignDto.Number;
                            result.state    = true;
                        }
                    }
                }
            }
            else
            {
                sysCode = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <UserSignViewModel>(sysCode, result);
            return(response);
        }
예제 #17
0
        public H5ResponseViewModel <GameUrlResponse> GetUrl([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <GameUrlResponse> response = null;
            GameUrlResponse result  = null;
            var             sysCode = SysCode.Ok;
            string          userId  = _biz.IsNoLogin((string)Parameters.data.token, (string)Parameters.data.userOpenId);

            if (userId != "0")
            {
                long user_id = long.Parse(userId);
                result = _biz.GameUrl("sixc", user_id, "", 1, "", "");
            }
            else
            {
                sysCode = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <GameUrlResponse>(sysCode, result);
            return(response);
        }
예제 #18
0
        public H5ResponseViewModel <Object> LoginSendCode([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <Object> response = null;
            var    sysCode = _sys.CheckParameters(Parameters.data, "LoginSendCode");;
            string phone   = Parameters.data.phone;
            string key     = $"{CacheKey.H5LogIn.ToString()}{phone}";

            if (sysCode == SysCode.Ok)
            {
                if (RedisHelper.KeyExists(key, RedisFolderEnum.code, RedisEnum.Four)) //是否存在
                {
                    /*重复获取*/
                    sysCode = SysCode.RepeatedGetCode;
                }
                if (sysCode == SysCode.Ok)
                {
                    #region
                    string code = "123456";
                    if (false)
                    {
                        /*获取验证码失败*/
                        sysCode = SysCode.GetCodeErr;
                    }
                    else
                    {
                        RedisHelper.StringSet(key, code, 1, RedisFolderEnum.code, RedisEnum.Four);
                    }
                    #endregion
                    //string code = _sys.GetRandomSeed(4).ToString();
                    //if (!_msg.MessageCode((string)Parameters.data.phone, code, StringExtension.ToInt((string)Parameters.data.sendType)))
                    //{
                    //    /*获取验证码失败*/
                    //    sysCode = SysCode.GetCodeErr;
                    //}
                    //else
                    //{
                    //    RedisHelper.StringSet(key, code, 1, RedisFolderEnum.code, RedisEnum.Four);
                    //}
                }
            }
            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }
예제 #19
0
        public async Task <H5ResponseViewModel <object> > H5SubmitIbc([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <object> response = null;
            var sysCode = _sys.CheckParameters(Parameters.data, "H5SubmitIbc");

            if (sysCode == SysCode.Ok)
            {
                string       userPhone   = Parameters.data.phone;
                string       downid      = Parameters.data.downid;
                string       gameType    = Parameters.data.gameType;
                string       channelId   = Parameters.data.channelId;
                string       timesTamp   = Parameters.data.timesTamp;
                long         userId      = _user.GetUserIdByPhone(userPhone);
                ibeaconlocus ibeaconlocu = new ibeaconlocus();
                if (userId != 0)
                {
                    var resignChannel = await _routine.GetUserIdChannelIdAsync(userId);

                    ibeaconlocu.downid     = downid;
                    ibeaconlocu.userId     = userId;
                    ibeaconlocu.iBeacons   = null;
                    ibeaconlocu.phone      = userPhone;
                    ibeaconlocu.gps        = null;
                    ibeaconlocu.timestamp  = timesTamp;
                    ibeaconlocu.token      = null;
                    ibeaconlocu.userOpenid = null;
                    ibeaconlocu.phoneType  = null;
                    ibeaconlocu.gameType   = gameType;
                    ibeaconlocu.ibcChannel = channelId;
                    ibeaconlocu.channelId  = resignChannel;
                    ibeaconlocu.createTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
                    _routine.WriteIbcInfo(ibeaconlocu);
                }
                else
                {
                    sysCode = SysCode.UserExist;
                }
            }

            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }
예제 #20
0
        public async Task <H5ResponseViewModel <GameUrlResponse> > GetUrl_v1([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "gameUrl_v1");
            H5ResponseViewModel <GameUrlResponse> response = null;
            GameUrlResponse result = null;

            if (sysCode == SysCode.Ok)
            {
                string       strJson  = RedisHelper.StringGet($"{CacheKey.Token}{Parameters.data.userOpenId}", RedisFolderEnum.token, RedisEnum.Three);
                UserLoginDto userLog  = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson);
                UserInfoDto  userInfo = await _user.SearchUserInfoAsync(userLog.Userid);

                string temp = Parameters.data.gameType;
                string key  = string.Empty;
                switch (temp)
                {
                case "3":
                    key = _gameKey.Dog;
                    break;

                case "2":
                    key = _gameKey.Fish;
                    break;

                case "4":
                    key = _gameKey.Star;
                    break;

                default:
                    sysCode = SysCode.GameUrlIsNot;
                    break;
                }
                int osType = 2;
                result = _biz.GameUrl(key, userLog.Userid, "2.0.2", osType, "20002", userInfo.Nick_name);
                if (result == null)
                {
                    sysCode = SysCode.Err;
                }
            }
            response = new H5ResponseViewModel <GameUrlResponse>(sysCode, result ?? null);
            return(response);
        }
예제 #21
0
        public async Task <H5ResponseViewModel <object> > UserNewAward([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "userverify");
            H5ResponseViewModel <object> response = null;

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isLog = _token.VerifyToken(token);
                if (isLog)
                {
                    UserLoginDto userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    long         userId    = long.Parse(userLogin.Userid.ToString());
                    sysCode = _userTask.JudgeUser518(userId);
                    bool            isNo         = false;
                    GiveCurrencyDto giveCurrency = new GiveCurrencyDto
                    {
                        amount   = 518.00,
                        forderId = Guid.NewGuid().ToString(),
                        fuserId  = userId.ToString(),
                        key      = _currencyKey.Activity
                    };
                    if (sysCode == SysCode.Ok)
                    {
                        //关闭章鱼赠币
                        // isNo = await _biz.GiveCurrencyAsync(giveCurrency);
                        //从php赠币
                        isNo = await _accout.GiveCurrencyAsync_php(giveCurrency);
                    }
                    _log.InfoFormat("H5用户518领取, 用户id:{0},订单号:{1},code:{2},赠送结果{3}", userLogin.Userid, giveCurrency.forderId, sysCode, isNo);
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }

            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }
예제 #22
0
        public H5ResponseViewModel <MobInfoViewModel> MobInfo([FromBody] H5RequestViewModel obj)
        {
            H5ResponseViewModel <MobInfoViewModel> response = null;
            MobInfoViewModel result = null;
            bool             isLog  = _token.VerifyToken((string)obj.data.userOpenId, (string)obj.data.sessionToken);
            var code = SysCode.Ok;

            if (isLog)
            {
                string       strJson = RedisHelper.StringGet($"{CacheKey.Token}{(string)obj.data.userOpenId}", RedisFolderEnum.token, RedisEnum.Three);
                UserLoginDto userLog = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson);
                result = _ofpay.MobInfo(userLog.Phone);
            }
            else
            {
                /*短令牌失效*/
                code = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <MobInfoViewModel>(code, result ?? null);
            return(response);
        }
예제 #23
0
        public async Task <H5ResponseViewModel <object> > UserEight([FromBody] H5RequestViewModel Parameters)
        {
            Thread.Sleep(3000);
            H5ResponseViewModel <object> response = null;
            bool isLog   = _token.VerifyToken((string)Parameters.data.userOpenId, (string)Parameters.data.sessionToken);
            var  sysCode = SysCode.Ok;

            if (isLog)
            {
                string strJson = RedisHelper.StringGet($"{CacheKey.Token}{(string)Parameters.data.userOpenId}", RedisFolderEnum.token, RedisEnum.Three);
                var    userLog = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson);
                sysCode = _userTask.JudgeUser518(userLog.Userid);
                GiveCurrencyDto giveCurrency = new GiveCurrencyDto
                {
                    amount   = 518.00,
                    forderId = Guid.NewGuid().ToString(),
                    fuserId  = userLog.Userid.ToString(),
                    key      = _currencyKey.Activity
                };
                bool isNo = false;
                if (sysCode == SysCode.Ok)
                {
                    //关闭章鱼赠币
                    //isNo = await _biz.GiveCurrencyAsync(giveCurrency);
                    //从php赠币
                    isNo = await _accout.GiveCurrencyAsync_php(giveCurrency);
                }
                _log.InfoFormat("518,用户id:{0},订单号:{1},code:{2},赠送结果{3}", userLog.Userid, giveCurrency.forderId, sysCode, isNo);
            }
            else
            {
                sysCode = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }
예제 #24
0
        public async Task <H5ResponseViewModel <UserInfoTimeView> > UserInfoTime([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode             = _sys.CheckParameters(Parameters.data, "userInfoTime");
            UserInfoTimeView Result = null;
            H5ResponseViewModel <UserInfoTimeView> response = null;

            if (sysCode == SysCode.Ok)
            {
                string openId       = Parameters.data.userOpenId;
                string sessionToken = Parameters.data.sessionToken;
                //token是否有效
                bool isLog = _token.VerifyToken(openId, sessionToken);
                if (isLog)
                {
                    string       strJson = RedisHelper.StringGet($"{CacheKey.Token}{openId}", RedisFolderEnum.token, RedisEnum.Three);
                    UserLoginDto UserLog = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson);
                    Result = new UserInfoTimeView()
                    {
                        Userid     = UserLog.Userid,
                        CreateTime = UserLog.Createtime
                    };
                }
                else
                {
                    sysCode = SysCode.SessionTokenLose;
                    Result  = null;
                }
            }
            else
            {
                /*短令牌失效*/
                sysCode = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <UserInfoTimeView>(sysCode, Result);
            return(response);
        }
예제 #25
0
        public async Task <H5ResponseViewModel <ActivityViewModel> > ActivityList([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "ActivityList");
            H5ResponseViewModel <ActivityViewModel> response = null;
            ActivityViewModel result = new ActivityViewModel
            {
                data = new List <Activity>()
            };

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                bool   isNo  = _token.VerifyToken(token);
                if (isNo)
                {
                    if (((string)Parameters.data.channel).IsNotBlank())
                    {
                        result.data = await _activity.GetActivityListAsync((string)Parameters.data.channel);

                        result.count = result.data.Count();
                    }
                    else
                    {
                        result.data = await _activity.GetActivityListAsync();

                        result.count = result.data.Count();
                    }
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <ActivityViewModel>(sysCode, result.count == 0 ? null : result);
            return(response);
        }
예제 #26
0
        public H5ResponseViewModel <FundList> FundRecord([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "FundRecord_H5");
            H5ResponseViewModel <FundList> response = null;
            FundList result = null;

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isNo = _token.VerifyToken(token);
                if (isNo)
                {
                    //读取redis用户基本信息
                    var userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    //交易类型
                    int type = ((string)Parameters.data.type).ToInt();
                    //请求分页页码
                    int pageIndex = ((string)Parameters.data.pageIndex).ToInt();
                    //请求分页的大小
                    int pageSize = ((string)Parameters.data.pageSize).ToInt();
                    //关闭章鱼流水查询
                    //查询用户流水
                    //result = _biz.AcquireFund(userLogin.Userid, type, pageIndex, pageSize);
                    //从php查询用户流水
                    result = _accout.AcquireFund_php(userLogin.Userid, type, pageIndex, pageSize);
                }
                else
                {
                    //token失效
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <FundList>(sysCode, result ?? null);
            return(response);
        }
예제 #27
0
        public async Task <H5ResponseViewModel <userSignInfoViewModel> > UserSign([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "userverify");
            H5ResponseViewModel <userSignInfoViewModel> response = null;
            userSignInfoViewModel userSignInfo = null;

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isLog = _token.VerifyToken(token);
                if (isLog)
                {
                    UserLoginDto userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    long         userId    = long.Parse(userLogin.Userid.ToString());
                    UserSignDto  userSign  = await _userTask.QueryUserSignAsync(userId);

                    UserSignDto userSignDto = null;
                    DateTime    nowTime     = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));//当前时间
                    Random      rd          = new Random();
                    int         day         = 0;
                    decimal     multiple    = 0.00m;
                    decimal     amout       = 0.00m;
                    int         num         = rd.Next(10, 16);//随机数
                    if (userSign != null)
                    {
                        //有签到信息
                        DateTime time = Convert.ToDateTime(userSign.Createtime.ToString("yyyy-MM-dd")); //用户最后一次签到时间
                        if (nowTime != time)
                        {
                            if (TimeHelper.Dateday(nowTime, time) == 1)                          //当前时间和签到时间相差一天
                            {
                                if (userSign.Number < 6)                                         //小于六天
                                {
                                    multiple = Convert.ToDecimal((userSign.Number * 0.5) + 0.5); //从新计算倍数
                                    amout    = num * multiple;
                                }
                                else
                                {
                                    multiple = 3;
                                    amout    = num * multiple;
                                }
                                day = userSign.Number + 1;
                            }
                            else
                            {
                                //签到中断,从第一天开始计算
                                multiple = Convert.ToDecimal((1 * 0.5) + 0.5);//签到倍数
                                amout    = num * multiple;
                                day      = 1;
                            }
                        }
                        else
                        {
                            sysCode = SysCode.RepeatToReceive;
                        }
                    }
                    else
                    {
                        multiple = Convert.ToDecimal((1 * 0.5) + 0.5);//签到倍数
                        amout    = num * multiple;
                        day      = 1;
                    }
                    if (sysCode == SysCode.Ok)
                    {
                        userSignDto = new UserSignDto
                        {
                            Amount     = amout,
                            Createtime = DateTime.Now,
                            Multiple   = multiple,
                            Number     = day,
                            UserId     = userId
                        };
                        if (await _userTask.RecordUserSignAsync(userSignDto)) //记录签到记录
                        {
                            GiveCurrencyDto giveCurrencyDto = new GiveCurrencyDto
                            {
                                amount   = double.Parse(userSignDto.Amount.ToString()),
                                forderId = Guid.NewGuid().ToString(),
                                fuserId  = userId.ToString(),
                                key      = _currencyKey.Sign,
                            };
                            bool isNo = false;
                            //关闭章鱼赠币
                            //isNo = await _biz.GiveCurrencyAsync(giveCurrencyDto);
                            //从php赠币
                            isNo = await _accout.GiveCurrencyAsync_php(giveCurrencyDto);

                            userSignInfo = new userSignInfoViewModel
                            {
                                Amount         = amout.ToString(),
                                Multiple       = multiple.ToString(),
                                SignTime       = DateTime.Now,
                                UserSignNumber = userSignDto.Number.ToString()
                            };
                            _log.InfoFormat("签到,用户id:{0},金额:{1},签到时间{2},订单号:{3},签到结果:{4}"
                                            , userId, userSignDto.Amount, userSignDto.Createtime, giveCurrencyDto.forderId, isNo);
                        }
                    }
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <userSignInfoViewModel>(sysCode, sysCode == SysCode.Ok ? userSignInfo : null);
            return(response);
        }
예제 #28
0
        public async Task <H5ResponseViewModel <Object> > VerificationCode([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <Object> response = null;
            var    sysCode = _sys.CheckParameters(Parameters.data, "verificationCode");
            string phone   = Parameters.data.phone;
            bool   isExist = await _user.PhoneExistAsync(phone);

            if (sysCode == SysCode.Ok)
            {
                string key  = string.Empty;
                string code = string.Empty;
                switch ((string)Parameters.data.type)
                {
                case "1":
                    key = CacheKey.Rgister.ToString();
                    if (isExist)
                    {
                        /*手机号码已经注册*/
                        sysCode = SysCode.PhoneExist;
                    }
                    break;

                case "2":
                    key = CacheKey.LogIn.ToString();
                    if (!isExist)
                    {
                        /*未注册*/
                        sysCode = SysCode.PhoneNonentity;
                    }
                    break;

                case "3":
                    key = CacheKey.SeekPwd.ToString();
                    if (!isExist)
                    {
                        /*未注册*/
                        sysCode = SysCode.PhoneNonentity;
                    }
                    break;

                case "4":
                    key = CacheKey.UnbindPhone.ToString();
                    break;

                case "5":
                    key = CacheKey.BindPhone.ToString();
                    if (isExist)
                    {
                        /*手机号码已经注册*/
                        sysCode = SysCode.PhoneExist;
                    }
                    break;

                case "6":
                    key = CacheKey.UpdatePwd.ToString();
                    if (!isExist)
                    {
                        /*未注册*/
                        sysCode = SysCode.PhoneNonentity;
                    }
                    break;

                default:
                    break;
                }
                key = $"{key}{(string)Parameters.data.phone}";
                #region
                code = "123456"; //_sys.getrandomseed(4).tostring();
                if (sysCode == SysCode.Ok)
                {
                    if (RedisHelper.KeyExists(key, RedisFolderEnum.code, RedisEnum.Four)) //是否存在
                    {
                        /*重复获取*/
                        sysCode = SysCode.RepeatedGetCode;
                    }
                    if (sysCode == SysCode.Ok)
                    {
                        //!_mag.messagecode((string)obj.data.phone, code, stringextension.toint((string)obj.data.sendtype))
                        if (false)
                        {
                            /*获取验证码失败*/
                            sysCode = SysCode.GetCodeErr;
                        }
                        else
                        {
                            RedisHelper.StringSet(key, code, 10, RedisFolderEnum.code, RedisEnum.Four);
                        }
                    }
                }
                #endregion
                //code = _sys.GetRandomSeed(4).ToString();
                //if (sysCode == SysCode.Ok)
                //{
                //    if (RedisHelper.KeyExists(key, RedisFolderEnum.code, RedisEnum.Four)) //是否存在
                //    {
                //        /*重复获取*/
                //        sysCode = SysCode.RepeatedGetCode;
                //    }
                //    if (sysCode == SysCode.Ok)
                //    {
                //        if (!_msg.StraitMessageCode((string)Parameters.data.phone, code, ((string)Parameters.data.sendType).ToInt()))
                //        {
                //            /*获取验证码失败*/
                //            sysCode = SysCode.GetCodeErr;
                //        }
                //        else
                //        {
                //            _log.Info("获取短信验证码成功");
                //            RedisHelper.StringSet(key, code, 1, RedisFolderEnum.code, RedisEnum.Four);
                //        }
                //    }
                //}
            }
            response = new H5ResponseViewModel <Object>(sysCode, null);
            return(response);
        }
예제 #29
0
        public async Task <H5ResponseViewModel <userSignInfoViewModel> > UserSign_v1([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <userSignInfoViewModel> response = null;
            string userId  = _biz.IsNoLogin((string)Parameters.data.token, (string)Parameters.data.userOpenId);
            var    sysCode = SysCode.Ok;
            userSignInfoViewModel userSignInfo = null;

            if (userId != "0")
            {
                int     day      = 0;
                decimal multiple = 0.00m;
                decimal amout    = 0.00m;
                long    user_id  = long.Parse(userId);
                var     userSign = await _userTask.QueryUserSignAsync(user_id);

                UserSignDto userSignDto = null;
                DateTime    nowTime     = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); //当前时间
                Random      rd          = new Random();
                int         num         = rd.Next(10, 16);                                         //随机数
                if (userSign != null)
                {
                    //有签到信息
                    DateTime time = Convert.ToDateTime(userSign.Createtime.ToString("yyyy-MM-dd")); //用户最后一次签到时间
                    if (nowTime != time)
                    {
                        if (TimeHelper.Dateday(nowTime, time) == 1)                          //当前时间和签到时间相差一天
                        {
                            if (userSign.Number < 6)                                         //小于六天
                            {
                                multiple = Convert.ToDecimal((userSign.Number * 0.5) + 0.5); //从新计算倍数
                                amout    = num * multiple;
                            }
                            else
                            {
                                multiple = 3;
                                amout    = num * multiple;
                            }
                            day = userSign.Number + 1;
                        }
                        else
                        {
                            //签到中断,从第一天开始计算
                            multiple = Convert.ToDecimal((1 * 0.5) + 0.5);//签到倍数
                            amout    = num * multiple;
                            day      = 1;
                        }
                    }
                    else
                    {
                        sysCode = SysCode.RepeatToReceive;
                    }
                }
                else
                {
                    multiple = Convert.ToDecimal((1 * 0.5) + 0.5);//签到倍数
                    amout    = num * multiple;
                    day      = 1;
                }
                if (sysCode == SysCode.Ok)
                {
                    userSignDto = new UserSignDto
                    {
                        Amount     = amout,
                        Createtime = DateTime.Now,
                        Multiple   = multiple,
                        Number     = day,
                        UserId     = long.Parse(userId)
                    };
                    if (await _userTask.RecordUserSignAsync(userSignDto)) //记录签到记录
                    {
                        GiveCurrencyDto giveCurrencyDto = new GiveCurrencyDto
                        {
                            amount   = double.Parse(userSignDto.Amount.ToString()),
                            forderId = Guid.NewGuid().ToString(),
                            fuserId  = userId.ToString(),
                            key      = _currencyKey.Sign,
                        };
                        bool isNo = false;
                        //关闭章鱼赠币
                        //isNo = await _biz.GiveCurrencyAsync(giveCurrencyDto);
                        //从php 赠币
                        isNo = await _accout.GiveCurrencyAsync_php(giveCurrencyDto);

                        userSignInfo = new userSignInfoViewModel
                        {
                            Amount         = amout.ToString(),
                            Multiple       = multiple.ToString(),
                            SignTime       = DateTime.Now,
                            UserSignNumber = userSignDto.Number.ToString()
                        };
                        _log.InfoFormat("签到,用户id:{0},金额:{1},签到时间{2},订单号:{3},签到结果:{4}"
                                        , userId, userSignDto.Amount, userSignDto.Createtime, giveCurrencyDto.forderId, isNo);
                    }
                }
            }
            else
            {
                sysCode = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <userSignInfoViewModel>(sysCode, sysCode == SysCode.Ok ? userSignInfo : null);
            return(response);
        }
예제 #30
0
        public async Task <H5ResponseViewModel <TokenView> > Login([FromBody] H5RequestViewModel Parameters)
        {
            //判断参数完整
            var sysCode = _sys.CheckParameters(Parameters.data, "Login");
            H5ResponseViewModel <TokenView> response = null;
            TokenView result = null;
            //用户手机号码
            string phone = Parameters.data.phone;
            //验证码缓存Key
            string strKey = $"{CacheKey.H5LogIn.ToString()}{phone}";

            if (sysCode == SysCode.Ok)
            {
                //判断验证码是否正确
                if (RedisHelper.KeyExists(strKey, RedisFolderEnum.code, RedisEnum.Four) &&
                    RedisHelper.StringGet(strKey, RedisFolderEnum.code, RedisEnum.Four).Equals((string)Parameters.data.verifyCode))
                {
                    //判断手机号码是否注册
                    long userId = 0;
                    if (await _user.PhoneExistAsync(phone))
                    {
                        userId = _user.GetUserIdByPhone(phone);
                    }
                    else
                    {
                        /*注册信息*/
                        /*登陆信息*/
                        /*用户基本信息*/
                        userId = _user.Register(new RegisterDto
                        {
                            App_version = "",
                            Channel     = Parameters.data.channelId,
                            Createtime  = DateTime.Now,
                            Device_code = "",
                            Os_type     = "",
                            Gps         = "",
                            Os_version  = "",
                            Phone       = phone,
                            Platform    = "H5",
                            Updatetime  = DateTime.Now
                        }, new UserLoginDto
                        {
                            Createtime = TimeHelper.GetDateTime(),
                            Is_first   = 1,
                            Password   = "",
                            Phone      = phone,
                            Status     = 0,
                            Salt       = 0,
                            Updatetime = TimeHelper.GetDateTime(),
                        }, new UserInfoDto
                        {
                            Createtime = TimeHelper.GetDateTime(),
                            Head       = "",
                            Updatetime = TimeHelper.GetDateTime(),
                            Nick_name  = ""
                        });
                    }
                    if (userId != 0)
                    {
                        result = _token.GetH5Token(userId);
                        //记录用户登陆日志
                        userLoginLogDto Log = new userLoginLogDto
                        {
                            App_version = "H5",
                            Createtime  = TimeHelper.GetDateTime(),
                            Device_code = "H5",
                            Gps         = "H5",
                            Os_type     = "H5",
                            Os_version  = "H5",
                            Phone       = phone,
                            Userid      = userId
                        };
                        await _user.RecordLoginLogAsync(Log);
                    }
                    else
                    {
                        sysCode = SysCode.Err;
                    }
                }
                else
                {
                    //验证码不存在或者验证错误
                    sysCode = SysCode.CodeErr;
                }
            }
            response = new H5ResponseViewModel <TokenView>(sysCode, result ?? null);
            return(response);
        }