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

个人中心接口

... ... @@ -90,7 +90,7 @@ class ParamService
elseif ($weight_level=="重体力"){
$type2=[45,40,35,35];
}
if ($pregnant_week<=12){
if (($pregnant_week+ceil((time()-$register_time)/24*60*60*7))<=12){
$x=0;
}else{
$x=200;
... ...
... ... @@ -298,7 +298,7 @@ class AdminIndexController extends AdminBaseController
public function cookBook(){
$data=Db::name('user')->where('user_type',2)->paginate(10)
->each(function ($item) {
$item['cook'] = $this->getCookBook($item['before_weight'],$item['height'],$item['weight_level'],$item['pregnant_week']);
$item['cook'] = $this->getCookBook($item['before_weight'],$item['height'],$item['weight_level'],$item['pregnant_week'],$item['register_time']);
return $item;
});
// foreach ($data as $k=>$v){
... ... @@ -312,7 +312,7 @@ class AdminIndexController extends AdminBaseController
//菜谱算法
public function getCookBook($before_weight,$height,$weight_level,$pregnant_week){
public function getCookBook($before_weight,$height,$weight_level,$pregnant_week,$register_time){
if (empty($before_weight)||empty($height)||empty($weight_level)||empty($pregnant_week)){
return '数据不足';
}
... ... @@ -340,7 +340,7 @@ class AdminIndexController extends AdminBaseController
$type2=[45,40,35,35];
}
$param=$type2[$type1];
if ($pregnant_week<=12){
if (($pregnant_week+ceil((time()-$register_time)/24*60*60*7))<=12){
$x=0;
}else{
$x=200;
... ...