| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Console\Commands;
- use App\Models\Member;
- use App\Servers\ESign\ESignServer;
- use Illuminate\Console\Command;
- /**
- * 用户实名认证任务
- * Class MemberRealnameCommand
- * @package App\Console\Commands
- */
- class MemberRealnameCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'member:realname';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '查找最后一条未实名用户并执行实名认证流程';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- //查找最后一条未实名的用户
- $member = Member::where('realnameStatus',0)->where('is_del',0)->where('authType','PSN')->orderBy('id','desc')->first();
- if (empty($member)){
- $this->info('没有未实名的用户');
- return;
- }
- $this->info('处理用户:id='.$member->{'id'}.',姓名='.$member->{'name'}.',手机号='.$member->{'phone'});
- //调用接口查询用户是否已经完成实名认证
- $realnameStatus = ESignServer::creatServer()->personsidentityinfo($member->{'id'},$member->{'phone'},$member->{'name'},$member->{'id_number'});
- if ($realnameStatus == 1){
- $this->info('用户已完成实名认证,无需处理');
- return;
- }
- //未实名认证,执行实名认证授权流程
- ESignServer::creatServer()->psnauthurl($member->{'id'},$member->{'phone'},$member->{'name'},$member->{'id_number'},$member->{'psnId'});
- $this->info('实名认证流程执行完成');
- }
- }
|