AdminPrizeOrderController.php
2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author:kane < chengjin005@163.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;
use cmf\controller\AdminBaseController;
use function Qiniu\thumbnail;
use think\Db;
class AdminPrizeOrderController extends AdminBaseController
{
public function index()
{
//接收搜索参数
$param = $this->request->param();
//添加搜索条件
$where=[];
$keyword = empty($param['keyword']) ? '' : $param['keyword'];
if (!empty($keyword)) {
$where['u.nickname|u.mobile'] = ['like', "%$keyword%"];
}
$data = Db::name('prize_order')
->alias('po')
->join('prize p','po.prize_id=p.id')
->join('users u','po.users_id=u.id')
->where($where)
->field('po.*,p.name,p.score as pscore,po.status as postatus,u.nickname,u.mobile')
->order('po.create_time','desc')
->paginate('15');
$data->appends($param);
$this->assign('page',$data->render());
$this->assign('keyword', isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('list', $data);
return $this->fetch();
}
public function check(){
$id=$this->request->param('id');
Db::name('prize_order')->where('id',$id)->update(['status'=>1,'check_time'=>time()]);
$this->success('核销成功');
}
public function delete()
{
$id = $this->request->param('id');
Db::name('prize_order')->where('id', $id)->delete();
$this->success('删除成功');
}
}