...
|
...
|
@@ -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;
|
...
|
...
|
|