app/Console/Commands/FanInfo.php
/**
     * Execute the console command.
     *
     * @return mixed
     */
Execute the console command.
@return mixed
Execute the console command . @return mixed
public function handle()
    {
        $accountId = $this->argument('account_id');
        $openId = $this->argument('openid');
        $account = $this->getAccount($accountId);
        $fanModel = new FanModel();
        $FanService = new FanService();
        $userService = new User($account->app_id, $account->app_secret);
        $fan = $userService->get($openId);
        if (isset($fan['subscribe']) && $fan['subscribe']) {    
            $updateInput = $FanService->formatFromWeChat($fan);
            $fanModel->where('account_id', $accountId)->where('openid', $openId)->update($updateInput);
        }
    }
public function handle ( ) { $ accountId = $ this -> argument ( 'account_id' ) ; $ openId = $ this -> argument ( 'openid' ) ; $ account = $ this -> getAccount ( $ accountId ) ; $ fanModel = new FanModel ( ) ; $ FanService = new FanService ( ) ; $ userService = new User ( $ account -> app_id , $ account -> app_secret ) ; $ fan = $ userService -> get ( $ openId ) ; if ( isset ( $ fan [ 'subscribe' ] ) && $ fan [ 'subscribe' ] ) { $ updateInput = $ FanService -> formatFromWeChat ( $ fan ) ; $ fanModel -> where ( 'account_id' , $ accountId ) -> where ( 'openid' , $ openId ) -> update ( $ updateInput ) ; } }
Execute the console command.
Execute the console command .
/*
         * 1 获取Account
         */ /*
         * 2 初始化 SDK Config, 构建 SDK 对象
         */ //subscribe=1 关注了公众号 /*
             * 存入本地
             */