...
|
...
|
@@ -243,23 +243,25 @@ class SignController extends RestBaseController |
|
|
//用户信息
|
|
|
$user=Db::name('user')->where('id',$this->getUserId())->find();
|
|
|
//判断是否是第一次周打卡
|
|
|
$re=Db::name('user_week_sign')->where('user_id',$user['id'])->find();
|
|
|
$re=Db::name('user_week_sign')->where('user_id',$user['id'])->order('create_time','desc')->find();
|
|
|
if (!$re){
|
|
|
$param['pregnant_week']=$user['pregnant_week'];
|
|
|
$param['day']=ceil((time()-$user['register_time'])/(60*60*21));
|
|
|
$param['weight']=$user['before_weight'];
|
|
|
$paramService=new ParamService();
|
|
|
|
|
|
$param['status']=$paramService->status($user['before_weight'],$user['height']);
|
|
|
$param['increase']=0;
|
|
|
$param['overplus']=$paramService->overplus($user['before_weight'],$user['height']);
|
|
|
}else{
|
|
|
$param['weight']=$re['weight'];
|
|
|
$param['increase']=$re['weight']-$user['before_weight'];
|
|
|
$paramService=new ParamService();
|
|
|
$param['overplus']=$paramService->overplus($user['before_weight'],$user['height'])-($re['weight']-$user['before_weight']);
|
|
|
$record=Db::name('user_week_sign')->where('user_id',$user['id'])->select();
|
|
|
}
|
|
|
$param['day']=ceil((time()-$user['register_time'])/(60*60*21));
|
|
|
$param['pregnant_week']=$user['pregnant_week'];
|
|
|
//返回
|
|
|
$this->success('日打卡信息',array(
|
|
|
'all'=>$user['all_sign_day'],
|
|
|
'last'=>$user['stay_sign_day'],
|
|
|
'longest'=>$user['longest_sign_day'],
|
|
|
'morning'=>$daySign['morning'],
|
|
|
'noon'=>$daySign['noon'],
|
|
|
'night'=>$daySign['night'],
|
|
|
'sleep'=>$daySign['sleep'],
|
|
|
$param,$record
|
|
|
));
|
|
|
}
|
|
|
} |
...
|
...
|
|