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); }