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

修改认证

@@ -122,5 +122,86 @@ class Government extends Api @@ -122,5 +122,86 @@ class Government extends Api
122 } 122 }
123 } 123 }
124 124
  125 + /**
  126 + * @ApiTitle (认证通过)
  127 + * @ApiSummary (认证通过)
  128 + * @ApiMethod (POST)
  129 + * @ApiRoute (/api/government/successful)
  130 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  131 + *
  132 + * @ApiParams (name="id", type="inter", required=false, description="审核的ID")
  133 + *
  134 + * @ApiReturn({
  135 + "code": 1,
  136 + "msg": "SUCCESS",
  137 + "time": "1553839125",
  138 + "data": {
  139 +
  140 + }
  141 + })
  142 + */
  143 + public function successful()
  144 + {
  145 + $user_id = $this->getUserId();
  146 + $id = $this->request->param('id');
  147 + if(empty($id)){
  148 + $this->error('缺少必要参数');
  149 + }
  150 + $res = Db::name('attestation')->where('id',$id)->find();
  151 + if($res['status'] == 1 || $res['status'] == 2){
  152 + $this->success('已经认证过了');
  153 + }
  154 + $ren['user_id'] = $res['user_id'];
  155 + $ren['title'] = '您的认证申请已通过';
  156 + $ren['createtime'] = time();
  157 + Db::name('message')->insertGetId($ren);
  158 + $data = Db::name('attestation')->where('id',$id)->update(['status'=>1]);
  159 + if(empty($data)){
  160 + $this->error('审核失败');
  161 + }else{
  162 + $this->success('审核成功');
  163 + }
  164 + }
  165 +
125 166
  167 + /**
  168 + * @ApiTitle (认证拒绝)
  169 + * @ApiSummary (认证拒绝)
  170 + * @ApiMethod (POST)
  171 + * @ApiRoute (/api/government/failed)
  172 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  173 + *
  174 + * @ApiParams (name="id", type="inter", required=false, description="审核的ID")
  175 + *
  176 + * @ApiReturn({
  177 + "code": 1,
  178 + "msg": "SUCCESS",
  179 + "time": "1553839125",
  180 + "data": {
  181 +
  182 + }
  183 + })
  184 + */
  185 + public function failed()
  186 + {
  187 + $user_id = $this->getUserId();
  188 + $id = $this->request->param('id');
  189 + if(empty($id)){
  190 + $this->error('缺少必要参数');
  191 + }
  192 + $res = Db::name('attestation')->where('id',$id)->find();
  193 + if($res['status'] == 1 || $res['status'] == 2){
  194 + $this->success('已经认证过了');
  195 + }
  196 + $ren['user_id'] = $res['user_id'];
  197 + $ren['title'] = '您的认证申请已拒绝';
  198 + $ren['createtime'] = time();
  199 + Db::name('message')->insertGetId($ren);
  200 + $data = Db::name('attestation')->where('id',$id)->update(['status'=>2]);
  201 + if(empty($data)){
  202 + $this->error('审核失败');
  203 + }else{
  204 + $this->success('审核成功');
  205 + }
  206 + }
126 } 207 }
此 diff 太大无法显示。