|
@@ -3,6 +3,10 @@ |
|
@@ -3,6 +3,10 @@ |
3
|
namespace app\admin\controller\verification;
|
3
|
namespace app\admin\controller\verification;
|
4
|
|
4
|
|
5
|
use app\common\controller\Backend;
|
5
|
use app\common\controller\Backend;
|
|
|
6
|
+use think\Db;
|
|
|
7
|
+use think\exception\DbException;
|
|
|
8
|
+use think\exception\PDOException;
|
|
|
9
|
+use think\exception\ValidateException;
|
6
|
|
10
|
|
7
|
/**
|
11
|
/**
|
8
|
* 订单管理
|
12
|
* 订单管理
|
|
@@ -49,7 +53,7 @@ class Order extends Backend |
|
@@ -49,7 +53,7 @@ class Order extends Backend |
49
|
return $this->selectpage();
|
53
|
return $this->selectpage();
|
50
|
}
|
54
|
}
|
51
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
55
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
52
|
-
|
56
|
+
|
53
|
$list = $this->model
|
57
|
$list = $this->model
|
54
|
->with(['store','coupon','activity','user'])
|
58
|
->with(['store','coupon','activity','user'])
|
55
|
->where($where)
|
59
|
->where($where)
|
|
@@ -74,5 +78,65 @@ class Order extends Backend |
|
@@ -74,5 +78,65 @@ class Order extends Backend |
74
|
}
|
78
|
}
|
75
|
return $this->view->fetch();
|
79
|
return $this->view->fetch();
|
76
|
}
|
80
|
}
|
|
|
81
|
+ /**
|
|
|
82
|
+ * 编辑
|
|
|
83
|
+ *
|
|
|
84
|
+ * @param $ids
|
|
|
85
|
+ * @return string
|
|
|
86
|
+ * @throws DbException
|
|
|
87
|
+ * @throws \think\Exception
|
|
|
88
|
+ */
|
|
|
89
|
+ public function edit($ids = null)
|
|
|
90
|
+ {
|
|
|
91
|
+ $row = $this->model->get($ids);
|
|
|
92
|
+ if (!$row) {
|
|
|
93
|
+ $this->error(__('No Results were found'));
|
|
|
94
|
+ }
|
|
|
95
|
+ $adminIds = $this->getDataLimitAdminIds();
|
|
|
96
|
+ if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
|
|
|
97
|
+ $this->error(__('You have no permission'));
|
|
|
98
|
+ }
|
|
|
99
|
+ //查询到用户信息
|
|
|
100
|
+ if($row){
|
|
|
101
|
+ $user=Db::name("user")->find($row['user_id']);
|
|
|
102
|
+ if($user['pid']>0){
|
|
|
103
|
+ $row['p_user']=Db::name("user")->find($user['pid']);
|
|
|
104
|
+ }
|
|
|
105
|
+ }
|
|
|
106
|
+
|
|
|
107
|
+ if (false === $this->request->isPost()) {
|
|
|
108
|
+ $this->view->assign('row', $row);
|
|
|
109
|
+ return $this->view->fetch();
|
|
|
110
|
+ }
|
|
|
111
|
+ $params = $this->request->post('row/a');
|
|
|
112
|
+ if (empty($params)) {
|
|
|
113
|
+ $this->error(__('Parameter %s can not be empty', ''));
|
|
|
114
|
+ }
|
|
|
115
|
+ $params = $this->preExcludeFields($params);
|
|
|
116
|
+ $result = false;
|
|
|
117
|
+ Db::startTrans();
|
|
|
118
|
+ try {
|
|
|
119
|
+ //是否采用模型验证
|
|
|
120
|
+ if ($this->modelValidate) {
|
|
|
121
|
+ $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
|
|
122
|
+ $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
|
|
123
|
+ $row->validateFailException()->validate($validate);
|
|
|
124
|
+ }
|
|
|
125
|
+ $result = $row->allowField(true)->save($params);
|
|
|
126
|
+ Db::commit();
|
|
|
127
|
+ } catch (ValidateException|PDOException|Exception $e) {
|
|
|
128
|
+ Db::rollback();
|
|
|
129
|
+ $this->error($e->getMessage());
|
|
|
130
|
+ }
|
|
|
131
|
+ if (false === $result) {
|
|
|
132
|
+ $this->error(__('No rows were updated'));
|
|
|
133
|
+ }
|
|
|
134
|
+ $this->success();
|
|
|
135
|
+ }
|
77
|
|
136
|
|
|
|
137
|
+ public function findidbyid(){
|
|
|
138
|
+ $id=$this->request->param('id');
|
|
|
139
|
+ $thisuser=Db::name("user")->find($id);//查询到当前用户
|
|
|
140
|
+ return json($thisuser);
|
|
|
141
|
+ }
|
78
|
} |
142
|
} |