106 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			106 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace app\api\controller\school;
 | 
						|
 | 
						|
 | 
						|
/**
 | 
						|
 * 实名认证接口
 | 
						|
 */
 | 
						|
class RealName extends Base
 | 
						|
{
 | 
						|
 | 
						|
 | 
						|
    protected $noNeedLogin = [];
 | 
						|
    protected $noNeedRight = '*';
 | 
						|
 | 
						|
    protected $model = null;
 | 
						|
 | 
						|
    /**
 | 
						|
     * 初始化操作
 | 
						|
     * @access protected
 | 
						|
     */
 | 
						|
    protected function _initialize()
 | 
						|
    {
 | 
						|
 | 
						|
        $this->model = new \app\common\model\cardocr\Card();
 | 
						|
        parent::_initialize();
 | 
						|
 | 
						|
        //判断登录用户是否是员工
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    /**
 | 
						|
     * @ApiTitle( 更新或保存实名认证信息)
 | 
						|
     * @ApiSummary(更新或保存实名认证信息)
 | 
						|
     * @ApiMethod(POST)
 | 
						|
     * @ApiParams(name = "name", type = "string",required=true,description = "姓名")
 | 
						|
     * @ApiParams(name = "idnum", type = "string",required=true,description = "身份证号")
 | 
						|
     * @ApiParams(name = "positive_img", type = "string",required=true,description = "身份证正面")
 | 
						|
     * @ApiParams(name = "back_img", type = "string",required=true,description = "身份证反面")
 | 
						|
     * @ApiReturn({
 | 
						|
     *
 | 
						|
     *})
 | 
						|
     */
 | 
						|
    public function save()
 | 
						|
    {
 | 
						|
        $user_id = 0;
 | 
						|
        $user = $this->auth->getUser();//登录用户
 | 
						|
        if($user)$user_id = $user['id'];
 | 
						|
        $params =[];
 | 
						|
        $params["name"] = $this->request->param('name/s', ''); //页数
 | 
						|
        $params["idnum"] =  $this->request->param('idnum/s', ''); //条数
 | 
						|
        $params["positive_img"] =  $this->request->param('positive_img/s', ''); //搜索关键字
 | 
						|
        $params["back_img"] =  $this->request->param('back_img/s', ''); //搜索关键字
 | 
						|
        $params["user_id"] = $user_id;
 | 
						|
//        $params = [];
 | 
						|
//
 | 
						|
//        $params["auth_status"] =  $this->request->get('auth_status/s', ''); //搜索关键字
 | 
						|
 | 
						|
//        $activity_id =  $this->request->get('activity_id/s', ''); //搜索关键字
 | 
						|
//
 | 
						|
//        $has_evaluate =  $this->request->get('has_evaluate/d', 0); //搜索关键字
 | 
						|
//        $type =  $this->request->get('type/s', ''); //筛选学员和教练单
 | 
						|
 | 
						|
        try{
 | 
						|
            //当前申请状态
 | 
						|
            $res = $this->model->add($params,true);
 | 
						|
//            if($user_id =='670153'){
 | 
						|
//               file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
 | 
						|
//            }
 | 
						|
        }catch (\Exception $e){
 | 
						|
 | 
						|
            $this->error($e->getMessage());
 | 
						|
        }
 | 
						|
        $this->success('认证成功', $res);
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    /**
 | 
						|
     * @ApiTitle(实名认证信息查询)
 | 
						|
     * @ApiSummary(实名认证信息查询)
 | 
						|
     * @ApiMethod(GET)
 | 
						|
     * @ApiReturn({
 | 
						|
     *
 | 
						|
     *})
 | 
						|
     */
 | 
						|
    public function info()
 | 
						|
    {
 | 
						|
        $user_id = 0;
 | 
						|
        $user = $this->auth->getUser();//登录用户
 | 
						|
        if($user)$user_id = $user['id'];
 | 
						|
 | 
						|
        try{
 | 
						|
            //当前申请状态
 | 
						|
            $res = $this->model->checkRealname($user_id);
 | 
						|
 | 
						|
        }catch (\Exception $e){
 | 
						|
 | 
						|
            $this->error($e->getMessage());
 | 
						|
        }
 | 
						|
        $this->success('查询成功', $res);
 | 
						|
    }
 | 
						|
 | 
						|
} |