OrderController.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Created by PhpStorm.
* auther: sgj
* Date: 2020/10/14
* Time: 17:02
*/
namespace app\admin\controller;
use cmf\controller\AdminBaseController;
use cmf\controller\BaseController;
class OrderController extends AdminBaseController
{
/**
* 订单列表
*/
public function index(){
$param=$this->request->param();
$map=[];
$data= db('orders')->alias('o')
->field('v.name as user_name,v.photo,g.*,o.*')
->join('goods g','o.good_id=g.id')
->join('user u','u.id=o.user_id')
->join('volunteer v','v.user_id=o.user_id')
->where($map)
->order('o.id desc')
->paginate();
$data->appends($param);
$list=$data->items();
$this->assign([
'data'=>$list,
'page'=>$data->render(),
]);
return $this->fetch();
}
public function info(){
}
public function edit()
{
$id = input('id');
$param = $this->request->param();
$map['o.id'] = $id;
$data = db('orders')->alias('o')
->field('v.name as user_name,v.photo,g.*,o.*')
->join('goods g', 'o.good_id=g.id')
->join('user u', 'u.id=o.user_id')
->join('volunteer v', 'v.user_id=o.user_id')
->where($map)
->find();
$this->assign('data', $data);
return $this->fetch();
}
public function editPost(){
$id = input('id');
$data=input();
$data['content_info']=htmlspecialchars(cmf_replace_content_file_url(htmlspecialchars_decode($data['content_info']), true));
$data['remark']=htmlspecialchars(cmf_replace_content_file_url(htmlspecialchars_decode($data['remark']), true));
$data['reason']=htmlspecialchars(cmf_replace_content_file_url(htmlspecialchars_decode($data['reason']), true));
$result=db('orders')->where('id',$id)->update($data);
if ($result){
$this->success('编辑成功');
}else{
$this->success('编辑成功');
}
}
}