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

XIAOPAN

@@ -11,6 +11,7 @@ namespace app\portal\controller; @@ -11,6 +11,7 @@ namespace app\portal\controller;
11 11
12 use app\portal\model\UsersModel; 12 use app\portal\model\UsersModel;
13 use cmf\controller\AdminBaseController; 13 use cmf\controller\AdminBaseController;
  14 +use think\Db;
14 /** 15 /**
15 * Class AdminUsersController 16 * Class AdminUsersController
16 * @package app\portal\controller 17 * @package app\portal\controller
@@ -33,7 +34,12 @@ class AdminUsersController extends AdminBaseController{ @@ -33,7 +34,12 @@ class AdminUsersController extends AdminBaseController{
33 $where['phone']=['like','%'.$param['keyword'].'%']; 34 $where['phone']=['like','%'.$param['keyword'].'%'];
34 } 35 }
35 $users=new UsersModel(); 36 $users=new UsersModel();
36 - $data=$users->where($where)->order('create_time','desc')->paginate(10); 37 + $data=$users->where($where)->order('create_time','desc')->paginate(10)->each(function ($item) {
  38 + if ($item['is_use']==1){
  39 + $item['eq']=Db::name('order')->where(['users_id'=>$item['id'],'status'=>1])->find()['eq_name'];
  40 + }
  41 + return $item;
  42 + });
37 $data->appends($param); 43 $data->appends($param);
38 $this->assign('keyword', isset($param['keyword']) ? $param['keyword'] : ''); 44 $this->assign('keyword', isset($param['keyword']) ? $param['keyword'] : '');
39 $this->assign('data',$data); 45 $this->assign('data',$data);
@@ -36,6 +36,7 @@ @@ -36,6 +36,7 @@
36 <th>手机号</th> 36 <th>手机号</th>
37 <th>是否交了押金</th> 37 <th>是否交了押金</th>
38 <th>押金</th> 38 <th>押金</th>
  39 + <th>使用设备</th>
39 </tr> 40 </tr>
40 </thead> 41 </thead>
41 <foreach name="data" item="vo"> 42 <foreach name="data" item="vo">
@@ -60,6 +61,13 @@ @@ -60,6 +61,13 @@
60 </switch> 61 </switch>
61 </td> 62 </td>
62 <td> 63 <td>
  64 + <eq name="vo.is_use" value="1">
  65 + {$vo.eq}
  66 + <else />
  67 + 未使用
  68 + </eq>
  69 + </td>
  70 + <td>
63 {$vo.deposit|default='0'} 71 {$vo.deposit|default='0'}
64 </td> 72 </td>
65 </tr> 73 </tr>