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

接口

@@ -316,7 +316,7 @@ class AdminIndexController extends AdminBaseController @@ -316,7 +316,7 @@ class AdminIndexController extends AdminBaseController
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 }
319 - $basic_cook=Db::name('config')->where('id',1)->find()['basic_cook']; 319 + $config=Db::name('config')->where('id',1)->find();
320 $lixiangtizhong=$height-105; 320 $lixiangtizhong=$height-105;
321 $bmi= sprintf('%.1f', $before_weight/(pow($height/100,2))); 321 $bmi= sprintf('%.1f', $before_weight/(pow($height/100,2)));
322 if($bmi<=18.5){ 322 if($bmi<=18.5){
@@ -348,26 +348,26 @@ class AdminIndexController extends AdminBaseController @@ -348,26 +348,26 @@ class AdminIndexController extends AdminBaseController
348 $result=$lixiangtizhong*$param+$x; 348 $result=$lixiangtizhong*$param+$x;
349 if ($result<1850){ 349 if ($result<1850){
350 $result=1800; 350 $result=1800;
351 - $cook=$basic_cook; 351 + $cook=$config['a'];
352 }else if ($result<1950&&$result>=1850){ 352 }else if ($result<1950&&$result>=1850){
353 $result=1900; 353 $result=1900;
354 - $cook=$basic_cook.'+砝码(午餐)+砝码(晚餐)'; 354 + $cook=$config['b'];
355 } 355 }
356 else if ($result<2000&&$result>=1950){ 356 else if ($result<2000&&$result>=1950){
357 $result=1900; 357 $result=1900;
358 - $cook=$basic_cook.'+荤菜(午餐)+砝码(晚餐)'; 358 + $cook=$config['c'];
359 } 359 }
360 else if ($result<2150&&$result>=2000){ 360 else if ($result<2150&&$result>=2000){
361 $result=2100; 361 $result=2100;
362 - $cook=$basic_cook.'+荤菜(午餐)+荤菜(晚餐)'; 362 + $cook=$config['d'];
363 } 363 }
364 else if ($result<2250&&$result>=2150){ 364 else if ($result<2250&&$result>=2150){
365 $result=2100; 365 $result=2100;
366 - $cook=$basic_cook.'+荤菜(午餐)+砝码(午餐)+荤菜(晚餐)+砝码(晚餐)'; 366 + $cook=$config['e'];
367 } 367 }
368 else if ($result>=2250){ 368 else if ($result>=2250){
369 $result=2300; 369 $result=2300;
370 - $cook=$basic_cook.'+荤菜(早餐)+荤菜(午餐)+荤菜(晚餐)+砝码(晚餐)'; 370 + $cook=$config['f'];
371 } 371 }
372 return $cook; 372 return $cook;
373 } 373 }
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 <ul class="nav nav-tabs"> 5 <ul class="nav nav-tabs">
6 <li><a href="{:url('user/adminIndex/index')}">{:lang('USER_INDEXADMIN_INDEX')}</a></li> 6 <li><a href="{:url('user/adminIndex/index')}">{:lang('USER_INDEXADMIN_INDEX')}</a></li>
7 <li class="active"><a>生成菜谱</a></li> 7 <li class="active"><a>生成菜谱</a></li>
  8 + <li><a href="{:url('user/adminIndex/editCook')}">编辑菜谱</a></li>
8 </ul> 9 </ul>
9 <form method="post" class="js-ajax-form"> 10 <form method="post" class="js-ajax-form">
10 <div class="table-actions"> 11 <div class="table-actions">
  1 +<include file="public@header"/>
  2 +</head>
  3 +<body>
  4 +<div class="wrap js-check-wrap">
  5 + <ul class="nav nav-tabs">
  6 + <li><a href="{:url('user/adminIndex/index')}">{:lang('USER_INDEXADMIN_INDEX')}</a></li>
  7 + <li><a href="{:url('user/adminIndex/cookBook')}">生成菜谱</a></li>
  8 + <li><a class="active">编辑菜谱</a></li>
  9 + </ul>
  10 + <form action="{:url('AdminIndex/editPost')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
  11 + <div class="row">
  12 + <div class="col-md-9">
  13 + <table class="table table-bordered">
  14 + <tr>
  15 + <th width="120">微信名</th>
  16 + <td>
  17 + <input value="{$list.id}" name="id" hidden>
  18 + <input class="form-control" type="text" disabled value="{$list.user_nickname}"/>
  19 + </td>
  20 + </tr>
  21 + <tr>
  22 + <th>身份</th>
  23 + <td>
  24 + <input type="radio" name="user_status" value="1" <eq name="list.user_status" value="1">checked</eq>/>普通用户
  25 + <input type="radio" name="user_status" value="2" <eq name="list.user_status" value="2">checked</eq>/>vip用户
  26 + </td>
  27 + </tr>
  28 + <tr>
  29 + <th>头像</th>
  30 + <td>
  31 + <img width="25" height="25" src="{:cmf_get_image_preview_url($list.avatar)}" onclick="parent.imagePreviewDialog(this.src);"/>
  32 + </td>
  33 + </tr>
  34 + <tr>
  35 + <th>年龄(岁)</th>
  36 + <td>
  37 + <input class="form-control" type="number" name="age"
  38 + id="age" required value="{$list.age}" placeholder="请输入年龄"/>
  39 + </td>
  40 + </tr>
  41 + <tr>
  42 + <th>身高(cm)</th>
  43 + <td>
  44 + <input class="form-control" type="number" name="height" required
  45 + id="height" value="{$list.height}" placeholder="请输入身高(cm)"/>
  46 + </td>
  47 + </tr>
  48 + <tr>
  49 + <th>手机号</th>
  50 + <td>
  51 + <input class="form-control" type="number" name="mobile" required
  52 + id="mobile" value="{$list.mobile}" placeholder="请输入手机号"/>
  53 + </td>
  54 + </tr>
  55 + <tr>
  56 + <th>末次月经第一天</th>
  57 + <td>
  58 + <input class="form-control js-bootstrap-datetime" type="text" name="last_yuejin_time"
  59 + value="{:date('Y-m-d H:i',$list['last_yuejin_time'])}">
  60 + </td>
  61 + </tr>
  62 + <tr>
  63 + <th>孕前体重(kg)</th>
  64 + <td>
  65 + <input class="form-control" type="number" name="before_weight" required
  66 + id="before_weight" value="{$list.before_weight}" placeholder="请输入孕前体重"/>
  67 + </td>
  68 + </tr>
  69 + <tr>
  70 + <th>当前体重(kg)</th>
  71 + <td>
  72 + <input class="form-control" type="number" name="now_weight" required
  73 + id="now_weight" value="{$list.now_weight}" placeholder="请输入当前体重"/>
  74 + </td>
  75 + </tr>
  76 + <tr>
  77 + <th>孕周</th>
  78 + <td>
  79 + <input class="form-control" type="number" name="pregnant_week" required
  80 + id="pregnant_week" value="{$list.pregnant_week}" placeholder="请输入孕周"/>
  81 + </td>
  82 + </tr>
  83 + <tr>
  84 + <th>体力活动水平</th>
  85 + <td>
  86 + <select name="weight_level">
  87 + <option value="">请选择</option>
  88 + <option value="休息状态" <eq name="list.weight_level" value="休息状态">selected</eq>>休息状态</option>
  89 + <option value="轻体力" <eq name="list.weight_level" value="轻体力">selected</eq>>轻体力</option>
  90 + <option value="中体力" <eq name="list.weight_level" value="中体力">selected</eq>>中体力</option>
  91 + <option value="重体力" <eq name="list.weight_level" value="重体力">selected</eq>>重体力</option>
  92 + </select>
  93 + </td>
  94 + </tr>
  95 + <tr>
  96 + <th>注册时间</th>
  97 + <td>
  98 + <input class="form-control" disabled value="{:date('Y-m-d',$list.create_time);}"/>
  99 + </td>
  100 + </tr>
  101 + </table>
  102 + <div class="form-group">
  103 + <div class="col-sm-offset-2 col-sm-10">
  104 + <button type="submit" class="btn btn-primary js-ajax-submit">编辑</button>
  105 + <a class="btn btn-default" href="{:url('AdminIndex/index')}">{:lang('BACK')}</a>
  106 + </div>
  107 + </div>
  108 + </div>
  109 + </div>
  110 + </form>
  111 +</div>
  112 +<script src="__STATIC__/js/admin.js"></script>
  113 +<script type="text/javascript">
  114 + //编辑器路径定义
  115 + var editorURL = GV.WEB_ROOT;
  116 +</script>
  117 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  118 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  119 +<script type="text/javascript">
  120 + $(function () {
  121 +
  122 + editorcontent = new baidu.editor.ui.Editor();
  123 + editorcontent.render('content');
  124 + try {
  125 + editorcontent.sync();
  126 + } catch (err) {
  127 + }
  128 +
  129 + $('.btn-cancel-thumbnail').click(function () {
  130 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  131 + $('#thumbnail').val('');
  132 + });
  133 +
  134 + $('#more-template-select').val("{$post.more.template|default=''}");
  135 + });
  136 +</script>
  137 +</body>
  138 +</html>