作者 郭盛
1 个管道 的构建 通过 耗费 4 秒

修改正在审核

@@ -88,4 +88,57 @@ class Attestation extends Backend @@ -88,4 +88,57 @@ class Attestation extends Backend
88 $this->assign('data',$data); 88 $this->assign('data',$data);
89 return $this->view->fetch(); 89 return $this->view->fetch();
90 } 90 }
  91 +
  92 +
  93 + /**
  94 + * 编辑
  95 + */
  96 + public function edit($ids = null)
  97 + {
  98 + $row = $this->model->get($ids);
  99 + if (!$row) {
  100 + $this->error(__('No Results were found'));
  101 + }
  102 + $adminIds = $this->getDataLimitAdminIds();
  103 + if (is_array($adminIds)) {
  104 + if (!in_array($row[$this->dataLimitField], $adminIds)) {
  105 + $this->error(__('You have no permission'));
  106 + }
  107 + }
  108 + if ($this->request->isPost()) {
  109 + $params = $this->request->post("row/a");
  110 + if ($params) {
  111 + $params = $this->preExcludeFields($params);
  112 + $result = false;
  113 + Db::startTrans();
  114 + try {
  115 + //是否采用模型验证
  116 + if ($this->modelValidate) {
  117 + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
  118 + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
  119 + $row->validateFailException(true)->validate($validate);
  120 + }
  121 + $result = $row->allowField(true)->save($params);
  122 + Db::commit();
  123 + } catch (ValidateException $e) {
  124 + Db::rollback();
  125 + $this->error($e->getMessage());
  126 + } catch (PDOException $e) {
  127 + Db::rollback();
  128 + $this->error($e->getMessage());
  129 + } catch (Exception $e) {
  130 + Db::rollback();
  131 + $this->error($e->getMessage());
  132 + }
  133 + if ($result !== false) {
  134 + $this->success();
  135 + } else {
  136 + $this->error(__('No rows were updated'));
  137 + }
  138 + }
  139 + $this->error(__('Parameter %s can not be empty', ''));
  140 + }
  141 + $this->view->assign("row", $row);
  142 + return $this->view->fetch();
  143 + }
91 } 144 }
@@ -42,12 +42,6 @@ @@ -42,12 +42,6 @@
42 {$data.identity} 42 {$data.identity}
43 </div> 43 </div>
44 </div> 44 </div>
45 - <!--<div class="form-group">-->  
46 - <!--<label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>-->  
47 - <!--<div class="col-xs-12 col-sm-8">-->  
48 - <!--<img src="{$data.image}" alt="" style="width:100px;height:100px; ">-->  
49 - <!--</div>-->  
50 - <!--</div>-->  
51 <div class="form-group"> 45 <div class="form-group">
52 <label class="control-label col-xs-12 col-sm-2">认证状态:</label> 46 <label class="control-label col-xs-12 col-sm-2">认证状态:</label>
53 <div class="col-xs-12 col-sm-8"> 47 <div class="col-xs-12 col-sm-8">
@@ -502,7 +502,7 @@ class Attestation extends Api @@ -502,7 +502,7 @@ class Attestation extends Api
502 $param['status'] = 0; 502 $param['status'] = 0;
503 $data = Db::name('attestation')->where('user_id',$user_id)->where('farm_id',$param['farm_id'])->update($param); 503 $data = Db::name('attestation')->where('user_id',$user_id)->where('farm_id',$param['farm_id'])->update($param);
504 if($data){ 504 if($data){
505 - $this->success('提交成功'); 505 + $this->success('正在审核中');
506 }else{ 506 }else{
507 $this->error('提交失败'); 507 $this->error('提交失败');
508 } 508 }