Skip to content

在队列(think-queue)中调用出错 #10

@xzusoft

Description

@xzusoft

`namespace app\home\queue;
use think\queue\Job;

use Naixiaoxin\ThinkWechat\Facade;
use app\home\model\Wechat;

class ReleaseCode{

public function fire(Job $job, $data){
  $data = json_decode($data, true);
  $openPlatform = Facade::openPlatform();
    $miniProgram = $openPlatform->miniProgram($data['program']['authorizer_appid'], $data['program']['refresh_token']);
    $code = $miniProgram->code;
    $category = $code->getCategory();
    $page = $code->getPage();
    
    $config = json_decode($data['program']['config'], true);
    //获取已授权小程序设置的类目 get_category
    if((int)$category['errcode'] === 0){
        $config['category'] = $category['category_list'];
    }
    //获取小程序的第三方提交代码的页面配置 get_page
    if((int)$page['errcode'] === 0){
        $config['page'] =   $page['page_list'];
    }
    if(!Wechat::update(['id'=>$data['program']['id'],'config'=>json_encode($config)])){
        //TODO  收集错误
        $job->release(2);
    }
    $job->delete();
    if ($job->attempts() > 3) {
        //通过这个方法可以检查这个任务已经重试了几次了
        $job->delete();
    } 
}

}命令端运行报[think\exception\ClassNotFoundException]
class not exists: wechat.open_platform `

这个是怎么回事?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions