正在显示
1 个修改的文件
包含
13 行增加
和
11 行删除
@@ -425,29 +425,31 @@ class SignController extends RestBaseController | @@ -425,29 +425,31 @@ class SignController extends RestBaseController | ||
425 | $param['fat']=ceil($nengliang*0.2/9); | 425 | $param['fat']=ceil($nengliang*0.2/9); |
426 | $param['water']=ceil($nengliang*0.6/4); | 426 | $param['water']=ceil($nengliang*0.6/4); |
427 | $data=Db::name('user_week_sign')->where('user_id',$this->getUserId())->select()->toArray(); | 427 | $data=Db::name('user_week_sign')->where('user_id',$this->getUserId())->select()->toArray(); |
428 | + $shangxian=[]; | ||
429 | + $xiaxian=[]; | ||
428 | foreach ($data as $k=>$v){ | 430 | foreach ($data as $k=>$v){ |
429 | $data[$k]['week']=ceil(($data[$k]['create_time'] - $user['register_time'])/(7*24*60*60)); | 431 | $data[$k]['week']=ceil(($data[$k]['create_time'] - $user['register_time'])/(7*24*60*60)); |
430 | $data[$k]['week_time']=date('m-d',strtotime('+'.$data[$k]['week'].' week',$data[$k]['create_time'])); | 432 | $data[$k]['week_time']=date('m-d',strtotime('+'.$data[$k]['week'].' week',$data[$k]['create_time'])); |
431 | if ($user['pregnant_week']+$data[$k]['week']<=12){ | 433 | if ($user['pregnant_week']+$data[$k]['week']<=12){ |
432 | - $data[$k]['shangxian']=$user['before_weight']+2; | ||
433 | - $data[$k]['xiaxian']=$user['before_weight']+0.5; | 434 | + array_push($shangxian,$user['before_weight']+2); |
435 | + array_push($xiaxian,$user['before_weight']+0.5); | ||
434 | }else{ | 436 | }else{ |
435 | if ($paramService->status($user['before_weight'],$user['height'])=='正常') { | 437 | if ($paramService->status($user['before_weight'],$user['height'])=='正常') { |
436 | - $data[$k]['shangxian']=$user['before_weight']+2+($user['pregnant_week']+$data[$k]['week']-12)*0.45; | ||
437 | - $data[$k]['xiaxian']=$user['before_weight']+0.5+($user['pregnant_week']+$data[$k]['week']-12)*0.36; | 438 | + array_push($shangxian,$user['before_weight']+2+($user['pregnant_week']+$data[$k]['week']-12)*0.45); |
439 | + array_push($xiaxian,$user['before_weight']+0.5+($user['pregnant_week']+$data[$k]['week']-12)*0.36); | ||
438 | }elseif ($paramService->status($user['before_weight'],$user['height'])=='偏瘦'){ | 440 | }elseif ($paramService->status($user['before_weight'],$user['height'])=='偏瘦'){ |
439 | - $data[$k]['shangxian']=$user['before_weight']+2+($user['pregnant_week']+$data[$k]['week']-12)*0.59; | ||
440 | - $data[$k]['xiaxian']=$user['before_weight']+0.5+($user['pregnant_week']+$data[$k]['week']-12)*0.45; | 441 | + array_push($shangxian,$user['before_weight']+2+($user['pregnant_week']+$data[$k]['week']-12)*0.59); |
442 | + array_push($xiaxian,$user['before_weight']+0.5+($user['pregnant_week']+$data[$k]['week']-12)*0.45); | ||
441 | }elseif ($paramService->status($user['before_weight'],$user['height'])=='肥胖'){ | 443 | }elseif ($paramService->status($user['before_weight'],$user['height'])=='肥胖'){ |
442 | - $data[$k]['shangxian']=$user['before_weight']+2+($user['pregnant_week']+$data[$k]['week']-12)*0.32; | ||
443 | - $data[$k]['xiaxian']=$user['before_weight']+0.5+($user['pregnant_week']+$data[$k]['week']-12)*0.23; | 444 | + array_push($shangxian,$user['before_weight']+2+($user['pregnant_week']+$data[$k]['week']-12)*0.32); |
445 | + array_push($xiaxian,$user['before_weight']+0.5+($user['pregnant_week']+$data[$k]['week']-12)*0.23); | ||
444 | }elseif ($paramService->status($user['before_weight'],$user['height'])=='超重'){ | 446 | }elseif ($paramService->status($user['before_weight'],$user['height'])=='超重'){ |
445 | - $data[$k]['shangxian']=$user['before_weight']+2+($user['pregnant_week']+$data[$k]['week']-12)*0.27; | ||
446 | - $data[$k]['xiaxian']=$user['before_weight']+0.5+($user['pregnant_week']+$data[$k]['week']-12)*0.18; | 447 | + array_push($shangxian,$user['before_weight']+2+($user['pregnant_week']+$data[$k]['week']-12)*0.27); |
448 | + array_push($xiaxian,$user['before_weight']+0.5+($user['pregnant_week']+$data[$k]['week']-12)*0.18); | ||
447 | } | 449 | } |
448 | } | 450 | } |
449 | } | 451 | } |
450 | //返回 | 452 | //返回 |
451 | - $this->success('我的体重数据',[$param,$data]); | 453 | + $this->success('我的体重数据',[$param,$data,$shangxian,$xiaxian]); |
452 | } | 454 | } |
453 | } | 455 | } |
-
请 注册 或 登录 后发表评论