作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

个人中心接口

... ... @@ -250,12 +250,14 @@ class SignController extends RestBaseController
$param['status']=$paramService->status($user['before_weight'],$user['height']);
$param['increase']=0;
$param['overplus']=$paramService->overplus($user['before_weight'],$user['height']);
$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']];
$record=['day'=>ceil((time()-$user['register_time'])/(60*60*21)),'weight'=> $param['weight'],'status'=>$param['status']];
}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']);
$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']];
$record=Db::name('user_week_sign')->where('user_id',$user['id'])->select()->each(function ($item) {
if ($item['status']==1){
$item['status']='消瘦';
... ...
... ... @@ -41,4 +41,19 @@ class UserController extends RestBaseController
Db::name('user_score_log')->insert(['score'=>-1]);
$this->success('我的健康档案',$data);
}
/**
* @title 注册信息提交
* @description 注册信息提交接口
* @author panhaowen
* @url /portal/User/registerPost
* @method POST
* @header name:XX-Token require:1 default: desc:token
*/
public function registerPost(){
$param=$this->request->param();
$param['status']=1;
Db::name('user')->where('id')
Db::name('user_score_log')->insert(['score'=>-1]);
$this->success('我的健康档案',$data);
}
}
... ...
... ... @@ -40,17 +40,17 @@ class ParamService
return $overplus;
}
public function allIncrease($weight=0,$height=0){
public function bashBoard($before_weight=0,$weight=0,$height=0){
$bmi=$weight/pow(($height/100),2);
if($bmi<=18.5){
$status='消瘦';
$i=0.2;
}elseif (18.5<$bmi&&$bmi<=23.9){
$status='正常';
$i=0.4;
}elseif (24<$bmi&&$bmi<=27.9){
$status='超重';
$i=0.6;
}elseif ($bmi>=28){
$status='肥胖';
$i=0.8;
}
return $status;
return $before_weight+($this->overplus($weight,$height)*$i);
}
}
... ...