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

修改认证

... ... @@ -122,5 +122,86 @@ class Government extends Api
}
}
/**
* @ApiTitle (认证通过)
* @ApiSummary (认证通过)
* @ApiMethod (POST)
* @ApiRoute (/api/government/successful)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="id", type="inter", required=false, description="审核的ID")
*
* @ApiReturn({
"code": 1,
"msg": "SUCCESS",
"time": "1553839125",
"data": {
}
})
*/
public function successful()
{
$user_id = $this->getUserId();
$id = $this->request->param('id');
if(empty($id)){
$this->error('缺少必要参数');
}
$res = Db::name('attestation')->where('id',$id)->find();
if($res['status'] == 1 || $res['status'] == 2){
$this->success('已经认证过了');
}
$ren['user_id'] = $res['user_id'];
$ren['title'] = '您的认证申请已通过';
$ren['createtime'] = time();
Db::name('message')->insertGetId($ren);
$data = Db::name('attestation')->where('id',$id)->update(['status'=>1]);
if(empty($data)){
$this->error('审核失败');
}else{
$this->success('审核成功');
}
}
/**
* @ApiTitle (认证拒绝)
* @ApiSummary (认证拒绝)
* @ApiMethod (POST)
* @ApiRoute (/api/government/failed)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiParams (name="id", type="inter", required=false, description="审核的ID")
*
* @ApiReturn({
"code": 1,
"msg": "SUCCESS",
"time": "1553839125",
"data": {
}
})
*/
public function failed()
{
$user_id = $this->getUserId();
$id = $this->request->param('id');
if(empty($id)){
$this->error('缺少必要参数');
}
$res = Db::name('attestation')->where('id',$id)->find();
if($res['status'] == 1 || $res['status'] == 2){
$this->success('已经认证过了');
}
$ren['user_id'] = $res['user_id'];
$ren['title'] = '您的认证申请已拒绝';
$ren['createtime'] = time();
Db::name('message')->insertGetId($ren);
$data = Db::name('attestation')->where('id',$id)->update(['status'=>2]);
if(empty($data)){
$this->error('审核失败');
}else{
$this->success('审核成功');
}
}
}
\ No newline at end of file
... ...
此 diff 太大无法显示。