|
@@ -298,7 +298,7 @@ class AdminIndexController extends AdminBaseController |
|
@@ -298,7 +298,7 @@ class AdminIndexController extends AdminBaseController |
298
|
public function cookBook(){
|
298
|
public function cookBook(){
|
299
|
$data=Db::name('user')->where('user_type',2)->paginate(10)
|
299
|
$data=Db::name('user')->where('user_type',2)->paginate(10)
|
300
|
->each(function ($item) {
|
300
|
->each(function ($item) {
|
301
|
- $item['cook'] = $this->getCookBook($item['before_weight'],$item['height'],$item['weight_level'],$item['pregnant_week']);
|
301
|
+ $item['cook'] = $this->getCookBook($item['before_weight'],$item['height'],$item['weight_level'],$item['pregnant_week'],$item['register_time']);
|
302
|
return $item;
|
302
|
return $item;
|
303
|
});
|
303
|
});
|
304
|
// foreach ($data as $k=>$v){
|
304
|
// foreach ($data as $k=>$v){
|
|
@@ -312,7 +312,7 @@ class AdminIndexController extends AdminBaseController |
|
@@ -312,7 +312,7 @@ class AdminIndexController extends AdminBaseController |
312
|
|
312
|
|
313
|
|
313
|
|
314
|
//菜谱算法
|
314
|
//菜谱算法
|
315
|
- public function getCookBook($before_weight,$height,$weight_level,$pregnant_week){
|
315
|
+ public function getCookBook($before_weight,$height,$weight_level,$pregnant_week,$register_time){
|
316
|
if (empty($before_weight)||empty($height)||empty($weight_level)||empty($pregnant_week)){
|
316
|
if (empty($before_weight)||empty($height)||empty($weight_level)||empty($pregnant_week)){
|
317
|
return '数据不足';
|
317
|
return '数据不足';
|
318
|
}
|
318
|
}
|
|
@@ -340,7 +340,7 @@ class AdminIndexController extends AdminBaseController |
|
@@ -340,7 +340,7 @@ class AdminIndexController extends AdminBaseController |
340
|
$type2=[45,40,35,35];
|
340
|
$type2=[45,40,35,35];
|
341
|
}
|
341
|
}
|
342
|
$param=$type2[$type1];
|
342
|
$param=$type2[$type1];
|
343
|
- if ($pregnant_week<=12){
|
343
|
+ if (($pregnant_week+ceil((time()-$register_time)/24*60*60*7))<=12){
|
344
|
$x=0;
|
344
|
$x=0;
|
345
|
}else{
|
345
|
}else{
|
346
|
$x=200;
|
346
|
$x=200;
|