1 个管道
的构建
通过
耗费
2 秒
Merge remote-tracking branch 'origin/master'
正在显示
7 个修改的文件
包含
87 行增加
和
13 行删除
@@ -36,13 +36,15 @@ class AdminFaultAuditController extends AdminBaseController{ | @@ -36,13 +36,15 @@ class AdminFaultAuditController extends AdminBaseController{ | ||
36 | } | 36 | } |
37 | $data=Db::name('fault') | 37 | $data=Db::name('fault') |
38 | ->alias('a') | 38 | ->alias('a') |
39 | - ->field('a.*,b.serial_number,b.hospital') | 39 | + ->field('a.*,b.serial_number,b.hospital,u.phone') |
40 | ->join('equipment b','a.eq_name=b.name') | 40 | ->join('equipment b','a.eq_name=b.name') |
41 | + ->join('users u','a.users_id=u.id') | ||
41 | ->where($where) | 42 | ->where($where) |
42 | ->order('a.state','ase') | 43 | ->order('a.state','ase') |
43 | ->order('a.create_time','desc') | 44 | ->order('a.create_time','desc') |
44 | ->paginate(10); | 45 | ->paginate(10); |
45 | 46 | ||
47 | + $this->assign('page',$data->render()); | ||
46 | $this->assign('data',$data); | 48 | $this->assign('data',$data); |
47 | $this->assign('fault_type', isset($param['fault_type']) ? $param['fault_type'] : ''); | 49 | $this->assign('fault_type', isset($param['fault_type']) ? $param['fault_type'] : ''); |
48 | return $this->fetch(); | 50 | return $this->fetch(); |
@@ -31,7 +31,7 @@ class AdminFaultController extends AdminBaseController{ | @@ -31,7 +31,7 @@ class AdminFaultController extends AdminBaseController{ | ||
31 | 31 | ||
32 | public function index(){ | 32 | public function index(){ |
33 | $data=Db::name('fault')->alias('a') | 33 | $data=Db::name('fault')->alias('a') |
34 | - ->field('a.eq_name,b.hospital') | 34 | + ->field('a.eq_name,b.hospital,b.serial_number') |
35 | ->join('equipment b','a.eq_name=b.name') | 35 | ->join('equipment b','a.eq_name=b.name') |
36 | ->group('a.eq_name') | 36 | ->group('a.eq_name') |
37 | ->paginate(10)->each(function ($item){ | 37 | ->paginate(10)->each(function ($item){ |
@@ -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 |
@@ -27,8 +28,20 @@ use cmf\controller\AdminBaseController; | @@ -27,8 +28,20 @@ use cmf\controller\AdminBaseController; | ||
27 | class AdminUsersController extends AdminBaseController{ | 28 | class AdminUsersController extends AdminBaseController{ |
28 | 29 | ||
29 | public function index(){ | 30 | public function index(){ |
31 | + $param=$this->request->param(); | ||
32 | + $where=[]; | ||
33 | + if (!empty($param['keyword'])){ | ||
34 | + $where['phone']=['like','%'.$param['keyword'].'%']; | ||
35 | + } | ||
30 | $users=new UsersModel(); | 36 | $users=new UsersModel(); |
31 | - $data=$users->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'],'state'=>1])->find()['eq_name']; | ||
40 | + } | ||
41 | + return $item; | ||
42 | + }); | ||
43 | + $data->appends($param); | ||
44 | + $this->assign('keyword', isset($param['keyword']) ? $param['keyword'] : ''); | ||
32 | $this->assign('data',$data); | 45 | $this->assign('data',$data); |
33 | return $this->fetch(); | 46 | return $this->fetch(); |
34 | } | 47 | } |
@@ -36,7 +36,7 @@ class UsersController extends HomeBaseController{ | @@ -36,7 +36,7 @@ class UsersController extends HomeBaseController{ | ||
36 | * @author sgj | 36 | * @author sgj |
37 | * @url /portal/users/changeorder | 37 | * @url /portal/users/changeorder |
38 | * @method GET | 38 | * @method GET |
39 | - * | 39 | + * @group 用户相关接口2 |
40 | * @param name:id type:String require:1 default:无 other: desc:订单id | 40 | * @param name:id type:String require:1 default:无 other: desc:订单id |
41 | * | 41 | * |
42 | */ | 42 | */ |
@@ -439,4 +439,55 @@ class UsersController extends HomeBaseController{ | @@ -439,4 +439,55 @@ class UsersController extends HomeBaseController{ | ||
439 | $return['fee']=\db('users')->where('id',$user_id)->value('fee'); | 439 | $return['fee']=\db('users')->where('id',$user_id)->value('fee'); |
440 | $this->apiResponse(200,'success',$return); | 440 | $this->apiResponse(200,'success',$return); |
441 | } | 441 | } |
442 | + | ||
443 | + | ||
444 | + /** | ||
445 | + * @title 用户提现 | ||
446 | + * @description | ||
447 | + * @author panhaowen | ||
448 | + * @url /portal/users/withdraw | ||
449 | + * @method GET | ||
450 | + * @param name:user_id type:String require:1 default:无 other: desc:用户id | ||
451 | + * @param name:fee type:int require:1 default:无 other: desc:用户id | ||
452 | + */ | ||
453 | + public function withdraw(){ | ||
454 | + $user_id=input('user_id'); | ||
455 | + $fee=$this->request->param('fee'); | ||
456 | + $user=Db::name('users')->where('id',$user_id)->find(); | ||
457 | + if ($user['fee']>=$fee) { | ||
458 | + $order_sn=cmf_get_order_sn(); | ||
459 | + Db::startTrans(); | ||
460 | + try{ | ||
461 | + Db::name('users')->where('id',$user_id)->setDec('fee', $fee); | ||
462 | + Db::name('withdraw')->insert([ | ||
463 | + 'user_id'=>$user_id, | ||
464 | + 'money'=>$fee, | ||
465 | + 'create_time'=>time(), | ||
466 | + 'order_sn'=>$order_sn | ||
467 | + ]); | ||
468 | + Db::commit(); | ||
469 | + }catch (\Exception $e) { | ||
470 | + // 回滚事务 | ||
471 | + Db::rollback(); | ||
472 | + $this->apiResponse(301,'提现失败'); | ||
473 | + } | ||
474 | + $app = new Application($this->options); | ||
475 | + $merchantPay = $app->merchant_pay; | ||
476 | + $merchantPayData = [ | ||
477 | + 'partner_trade_no' => $order_sn, //随机字符串作为订单号,跟红包和支付一个概念。 | ||
478 | + 'openid' => $user['open_id'], //收款人的openid | ||
479 | + 'check_name' => 'NO_CHECK', //文档中有三种校验实名的方法 NO_CHECK OPTION_CHECK FORCE_CHECK | ||
480 | +// 're_user_name'=>'张三', //OPTION_CHECK FORCE_CHECK 校验实名的时候必须提交 | ||
481 | + 'amount' => $fee * 100, //单位为分 | ||
482 | +// 'amount' => 100, //单位为分 | ||
483 | + 'desc' => '企业付款', | ||
484 | + 'spbill_create_ip' => get_client_ip(0, true), //发起交易的IP地址 | ||
485 | + ]; | ||
486 | + $re = $merchantPay->send($merchantPayData); | ||
487 | + $this->apiResponse(200,'success',$re); | ||
488 | + }else{ | ||
489 | + $this->apiResponse(300,'余额不足提现失败'); | ||
490 | + } | ||
491 | + | ||
492 | + } | ||
442 | } | 493 | } |
@@ -29,6 +29,7 @@ | @@ -29,6 +29,7 @@ | ||
29 | <thead> | 29 | <thead> |
30 | <tr> | 30 | <tr> |
31 | <th>设备名称</th> | 31 | <th>设备名称</th> |
32 | + <th>设备锁编号</th> | ||
32 | <th>初始医院</th> | 33 | <th>初始医院</th> |
33 | <th>计费故障次数</th> | 34 | <th>计费故障次数</th> |
34 | <th>锁故障次数</th> | 35 | <th>锁故障次数</th> |
@@ -40,6 +41,7 @@ | @@ -40,6 +41,7 @@ | ||
40 | <foreach name="data" item="vo"> | 41 | <foreach name="data" item="vo"> |
41 | <tr> | 42 | <tr> |
42 | <td>{$vo.eq_name}</td> | 43 | <td>{$vo.eq_name}</td> |
44 | + <td>{$vo.serial_number}</td> | ||
43 | <td>{$vo.hospital}</td> | 45 | <td>{$vo.hospital}</td> |
44 | <td>{$vo.fault_time|default='0'}</td> | 46 | <td>{$vo.fault_time|default='0'}</td> |
45 | <td>{$vo.fault_lock|default='0'}</td> | 47 | <td>{$vo.fault_lock|default='0'}</td> |
@@ -49,6 +51,7 @@ | @@ -49,6 +51,7 @@ | ||
49 | </tr> | 51 | </tr> |
50 | </foreach> | 52 | </foreach> |
51 | </table> | 53 | </table> |
54 | + <ul class="pagination">{$page|default=''}</ul> | ||
52 | </form> | 55 | </form> |
53 | </div> | 56 | </div> |
54 | <script src="__STATIC__/js/admin.js"></script> | 57 | <script src="__STATIC__/js/admin.js"></script> |
@@ -27,6 +27,7 @@ | @@ -27,6 +27,7 @@ | ||
27 | </label> | 27 | </label> |
28 | </th> | 28 | </th> |
29 | <th width="50">ID</th> | 29 | <th width="50">ID</th> |
30 | + <th>上报人号码</th> | ||
30 | <th>设备名称</th> | 31 | <th>设备名称</th> |
31 | <th>设备锁编号</th> | 32 | <th>设备锁编号</th> |
32 | <th>所在医院</th> | 33 | <th>所在医院</th> |
@@ -44,6 +45,7 @@ | @@ -44,6 +45,7 @@ | ||
44 | value="{$vo.id}" title="ID:{$vo.id}"> | 45 | value="{$vo.id}" title="ID:{$vo.id}"> |
45 | </td> | 46 | </td> |
46 | <td><b>{$vo.id}</b></td> | 47 | <td><b>{$vo.id}</b></td> |
48 | + <td>{$vo.phone}</td> | ||
47 | <td>{$vo.eq_name}</td> | 49 | <td>{$vo.eq_name}</td> |
48 | <td>{$vo.serial_number}</td> | 50 | <td>{$vo.serial_number}</td> |
49 | <td>{$vo.hospital}</td> | 51 | <td>{$vo.hospital}</td> |
@@ -110,7 +112,7 @@ | @@ -110,7 +112,7 @@ | ||
110 | <!--{:lang('DELETE')}--> | 112 | <!--{:lang('DELETE')}--> |
111 | <!--</button>--> | 113 | <!--</button>--> |
112 | <!--</div>--> | 114 | <!--</div>--> |
113 | - <ul class="pagination">{$page|default=''}</ul> | 115 | + <ul style="text-align: center">{$page|default=''}</ul> |
114 | </form> | 116 | </form> |
115 | </div> | 117 | </div> |
116 | <script src="__STATIC__/js/admin.js"></script> | 118 | <script src="__STATIC__/js/admin.js"></script> |
@@ -6,12 +6,7 @@ | @@ -6,12 +6,7 @@ | ||
6 | <li class="active"><a href="javascript:;">用户列表</a></li> | 6 | <li class="active"><a href="javascript:;">用户列表</a></li> |
7 | <!--<li><a href="{:url('AdminArticle/add')}">添加文章</a></li>--> | 7 | <!--<li><a href="{:url('AdminArticle/add')}">添加文章</a></li>--> |
8 | </ul> | 8 | </ul> |
9 | - <form class="well form-inline margin-top-20" method="post" action="{:url('AdminArticle/index')}"> | ||
10 | - 分类: | ||
11 | - <select class="form-control" name="category" style="width: 140px;"> | ||
12 | - <option value='0'>全部</option> | ||
13 | - {$category_tree|default=''} | ||
14 | - </select> | 9 | + <form class="well form-inline margin-top-20" method="post" action="{:url('AdminUsers/index')}"> |
15 | 时间: | 10 | 时间: |
16 | <input type="text" class="form-control js-bootstrap-datetime" name="start_time" | 11 | <input type="text" class="form-control js-bootstrap-datetime" name="start_time" |
17 | value="{$start_time|default=''}" | 12 | value="{$start_time|default=''}" |
@@ -21,9 +16,9 @@ | @@ -21,9 +16,9 @@ | ||
21 | style="width: 140px;" autocomplete="off"> | 16 | style="width: 140px;" autocomplete="off"> |
22 | 关键字: | 17 | 关键字: |
23 | <input type="text" class="form-control" name="keyword" style="width: 200px;" | 18 | <input type="text" class="form-control" name="keyword" style="width: 200px;" |
24 | - value="{$keyword|default=''}" placeholder="请输入关键字..."> | 19 | + value="{$keyword|default=''}" placeholder="手机号"> |
25 | <input type="submit" class="btn btn-primary" value="搜索"/> | 20 | <input type="submit" class="btn btn-primary" value="搜索"/> |
26 | - <a class="btn btn-danger" href="{:url('AdminArticle/index')}">清空</a> | 21 | + <a class="btn btn-danger" href="{:url('AdminUsers/index')}">清空</a> |
27 | </form> | 22 | </form> |
28 | <form class="js-ajax-form" action="" method="post"> | 23 | <form class="js-ajax-form" action="" method="post"> |
29 | <table class="table table-hover table-bordered table-list"> | 24 | <table class="table table-hover table-bordered table-list"> |
@@ -41,6 +36,7 @@ | @@ -41,6 +36,7 @@ | ||
41 | <th>手机号</th> | 36 | <th>手机号</th> |
42 | <th>是否交了押金</th> | 37 | <th>是否交了押金</th> |
43 | <th>押金</th> | 38 | <th>押金</th> |
39 | + <th>使用设备</th> | ||
44 | </tr> | 40 | </tr> |
45 | </thead> | 41 | </thead> |
46 | <foreach name="data" item="vo"> | 42 | <foreach name="data" item="vo"> |
@@ -67,6 +63,13 @@ | @@ -67,6 +63,13 @@ | ||
67 | <td> | 63 | <td> |
68 | {$vo.deposit|default='0'} | 64 | {$vo.deposit|default='0'} |
69 | </td> | 65 | </td> |
66 | + <td> | ||
67 | + <eq name="vo.is_use" value="1"> | ||
68 | + {$vo.eq} | ||
69 | + <else /> | ||
70 | + 未使用 | ||
71 | + </eq> | ||
72 | + </td> | ||
70 | </tr> | 73 | </tr> |
71 | </foreach> | 74 | </foreach> |
72 | </table> | 75 | </table> |
-
请 注册 或 登录 后发表评论