| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?php
- /**
- * 会员中心模块
- * @author wesmiler
- */
- namespace app\weixin\controller;
- use app\weixin\model\Member;
- use app\weixin\model\UserLog;
- use app\weixin\model\UserProfile;
- use app\weixin\model\Wechat;
- use app\weixin\service\PRedis;
- use app\weixin\validate\MemberValidate;
- use think\Db;
- use think\Request;
- class AuthController extends BaseController
- {
- public function __construct()
- {
- parent::__construct();
- $needRegProfile = session('needRegProfile');
- if($needRegProfile == true){
- Wechat::redirectUrl(url('/weixin/index/entry', '', '', true));
- exit;
- }
- }
- /**
- * 认证
- * @return mixed
- */
- public function index()
- {
- return $this->fetch();
- }
- /**
- * VIP认证
- * @return mixed
- */
- public function vip()
- {
- return $this->fetch();
- }
- /**
- * 人工牵线
- * @return mixed
- */
- public function hand()
- {
- return $this->fetch();
- }
- /**
- * 身份证认证
- * @return mixed
- */
- public function idcard()
- {
- return $this->fetch();
- }
- /**
- * 认证结果
- * @return mixed|string
- */
- public function authResult(){
- $params = input();
- $data = input('data','');
- $data = $data? json_decode($data, true) : [];
- $code = isset($data['code'])? $data['code'] : '';
- $idcard = isset($data['id'])? $data['id'] : '';
- $realname = isset($data['name'])? $data['name'] : '';
- $bizNo = isset($data['bizNo'])? $data['bizNo'] : '';
- // 签名验证
- $len = mb_strlen($bizNo, 'utf-8');
- $userId = mb_substr($bizNo, 11, $len,'utf-8');
- if($idcard && $realname && $code == 'PASS' && $userId){
- // 更新信息
- Member::updateAuth($userId, $realname, $idcard);
- $this->assign('bizNo',$bizNo);
- $this->assign('code','success');
- $this->assign('result','<em>身份验证成功</em>,请等待审核');
- }else{
- $this->assign('bizNo', '');
- $this->assign('code','error');
- $this->assign('result','<em>身份验证失败</em>,请返回重试');
- }
- $params['user_id'] = $userId;
- PRedis::set("caches:faceAuth:result:{$bizNo}", $params, 3600);
- return $this->fetch();
- }
- /**
- * 学历认证
- * @return mixed
- */
- public function education()
- {
- return $this->fetch();
- }
- /**
- * 职位认证
- * @return mixed
- */
- public function position()
- {
- return $this->fetch();
- }
- }
|