...
|
...
|
@@ -3,6 +3,10 @@ |
|
|
namespace app\admin\controller\verification;
|
|
|
|
|
|
use app\common\controller\Backend;
|
|
|
use think\Db;
|
|
|
use think\exception\DbException;
|
|
|
use think\exception\PDOException;
|
|
|
use think\exception\ValidateException;
|
|
|
|
|
|
/**
|
|
|
* 订单管理
|
...
|
...
|
@@ -74,5 +78,65 @@ class Order extends Backend |
|
|
}
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
/**
|
|
|
* 编辑
|
|
|
*
|
|
|
* @param $ids
|
|
|
* @return string
|
|
|
* @throws DbException
|
|
|
* @throws \think\Exception
|
|
|
*/
|
|
|
public function edit($ids = null)
|
|
|
{
|
|
|
$row = $this->model->get($ids);
|
|
|
if (!$row) {
|
|
|
$this->error(__('No Results were found'));
|
|
|
}
|
|
|
$adminIds = $this->getDataLimitAdminIds();
|
|
|
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
|
|
|
$this->error(__('You have no permission'));
|
|
|
}
|
|
|
//查询到用户信息
|
|
|
if($row){
|
|
|
$user=Db::name("user")->find($row['user_id']);
|
|
|
if($user['pid']>0){
|
|
|
$row['p_user']=Db::name("user")->find($user['pid']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (false === $this->request->isPost()) {
|
|
|
$this->view->assign('row', $row);
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
$params = $this->request->post('row/a');
|
|
|
if (empty($params)) {
|
|
|
$this->error(__('Parameter %s can not be empty', ''));
|
|
|
}
|
|
|
$params = $this->preExcludeFields($params);
|
|
|
$result = false;
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
//是否采用模型验证
|
|
|
if ($this->modelValidate) {
|
|
|
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
|
|
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
|
|
$row->validateFailException()->validate($validate);
|
|
|
}
|
|
|
$result = $row->allowField(true)->save($params);
|
|
|
Db::commit();
|
|
|
} catch (ValidateException|PDOException|Exception $e) {
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
}
|
|
|
if (false === $result) {
|
|
|
$this->error(__('No rows were updated'));
|
|
|
}
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
|
public function findidbyid(){
|
|
|
$id=$this->request->param('id');
|
|
|
$thisuser=Db::name("user")->find($id);//查询到当前用户
|
|
|
return json($thisuser);
|
|
|
}
|
|
|
} |
...
|
...
|
|