正在显示
1 个修改的文件
包含
3 行增加
和
3 行删除
@@ -304,19 +304,19 @@ class SignController extends RestBaseController | @@ -304,19 +304,19 @@ class SignController extends RestBaseController | ||
304 | $user=Db::name('user')->where('id',$this->getUserId())->find(); | 304 | $user=Db::name('user')->where('id',$this->getUserId())->find(); |
305 | //判断是否是第一次周打卡 | 305 | //判断是否是第一次周打卡 |
306 | $re=Db::name('user_week_sign')->where('user_id',$user['id'])->order('create_time','desc')->find(); | 306 | $re=Db::name('user_week_sign')->where('user_id',$user['id'])->order('create_time','desc')->find(); |
307 | + $paramService=new ParamService(); | ||
307 | if (!$re){ | 308 | if (!$re){ |
308 | $param['weight']=$user['now_weight']; | 309 | $param['weight']=$user['now_weight']; |
309 | - $paramService=new ParamService(); | ||
310 | $param['status']=$paramService->status($user['before_weight'],$user['height']); | 310 | $param['status']=$paramService->status($user['before_weight'],$user['height']); |
311 | $param['increase']=$user['now_weight']-$user['before_weight']; | 311 | $param['increase']=$user['now_weight']-$user['before_weight']; |
312 | - $param['overplus']=$paramService->overplus($user['before_weight'],$user['height']); | 312 | + $param['overplus']=$paramService->overplus($user['before_weight'],$user['height'])-($user['now_weight']-$user['before_weight']); |
313 | $param['bashBoard']=[$param['overplus']*0.2+$param['weight'],$param['overplus']*0.4+$param['weight'],$param['overplus']*0.6+$param['weight'],$param['overplus']*0.8+$param['weight']]; | 313 | $param['bashBoard']=[$param['overplus']*0.2+$param['weight'],$param['overplus']*0.4+$param['weight'],$param['overplus']*0.6+$param['weight'],$param['overplus']*0.8+$param['weight']]; |
314 | $record=['day'=>ceil((time()-$user['register_time'])/(60*60*24)),'weight'=> $param['weight'],'status'=>$param['status']]; | 314 | $record=['day'=>ceil((time()-$user['register_time'])/(60*60*24)),'weight'=> $param['weight'],'status'=>$param['status']]; |
315 | }else{ | 315 | }else{ |
316 | $param['weight']=$re['weight']; | 316 | $param['weight']=$re['weight']; |
317 | $param['increase']=$re['weight']-$user['before_weight']; | 317 | $param['increase']=$re['weight']-$user['before_weight']; |
318 | - $paramService=new ParamService(); | ||
319 | $param['overplus']=$paramService->overplus($user['before_weight'],$user['height'])-($re['weight']-$user['before_weight']); | 318 | $param['overplus']=$paramService->overplus($user['before_weight'],$user['height'])-($re['weight']-$user['before_weight']); |
319 | + | ||
320 | $param['bashBoard']=[$param['overplus']*0.2+$user['weight'],$param['overplus']*0.4+$user['weight'],$param['overplus']*0.6+$user['weight'],$param['overplus']*0.8+$user['weight']]; | 320 | $param['bashBoard']=[$param['overplus']*0.2+$user['weight'],$param['overplus']*0.4+$user['weight'],$param['overplus']*0.6+$user['weight'],$param['overplus']*0.8+$user['weight']]; |
321 | $record=Db::name('user_week_sign')->where('user_id',$user['id'])->select()->each(function ($item) { | 321 | $record=Db::name('user_week_sign')->where('user_id',$user['id'])->select()->each(function ($item) { |
322 | if ($item['status']==1){ | 322 | if ($item['status']==1){ |
-
请 注册 或 登录 后发表评论