CaiLiguang

4296 经验值

我本地是有这个问题,但是线上的项目是没问题的,不好意思啊

请问本地上传图片失败,请重试。是什么原因造成的

日志错误

[2016-12-15 15:54:20] local.ERROR: exception 'Predis\Connection\ConnectionException' with message 'Error while reading line from the server. [tcp://127.0.0.1:6379]' in /home/clg/project/kingfisher/vendor/predis/predis/src/Connection/AbstractConnection.php:155
Stack trace:
public function handle()
    {
这里就没有数据了
        $username = OrderUserModel::where('username' , $this->order->buyer_name)->first();
        $phone = OrderUserModel::where('phone' , $this->order->buyer_phone)->first();
//        \Log::info($buyer_address);
//        \Log::info($this->order);
        if(($username && $phone) !=null){
            return;
        }
        $orderUser = new OrderUserModel();
        $orderUser->username = $this->order->buyer_name;
        $orderUser->phone = $this->order->buyer_phone;
        $orderUser->store_id = $this->order->store_id;
        $orderUser->type = $this->order->type;
        if($this->order->type == 2){
            return;
        }
        $orderUser->from_to = $this->order->store->platform;
        $orderUser->buyer_address = $this->order->buyer_address;
        $orderUser->buyer_province = $this->order->buyer_province;
        $orderUser->buyer_city = $this->order->buyer_city;
        $orderUser->buyer_county = $this->order->buyer_county;
        $orderUser->save();

    }

清缓存了,还是不可以

同事本地的就有数据,线上测试环境也是可以的,我上周也是没有问题的.这个问题是突然出现的

handle方法里打印没有数据

    public function __construct(OrderModel $order)
    {
        $this->order = $order;
这里还可以打印出来
    }

上一周队列任务,本地还可以运行.不知道什么原因造成的,现在本地不执行了,但是测试环境上是可以运行的.我的redis启动了,也进行了监听
`
php artisan queue:listen
`

 use DispatchesJobs;
   /**
    * Bootstrap any application services.
    *
    * @return void
    */
   public function boot()
   {
       \DB::listen(function($sql, $bindings, $time) {
       });
       //创建订单的时候执行此队列
       OrderModel::created(function($order){
           $this->dispatch(new SendOrderUser($order));
//            \Log::info($order);
       });
   }

这里打印Log文件里是有数据的,下面任务里打印就没有数据了

class SendOrderUser extends Job implements SelfHandling, ShouldQueue
{
    use InteractsWithQueue, SerializesModels;
    protected $order;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct(OrderModel $order)
    {
        $this->order = $order;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {

    }

请问是什么原因造成的,谢谢

已经解决了,是这个中间件没有加上,谢谢

['middleware' => ['jwt.auth','jwt.refresh']
$api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($api) {
    
    // 用户注册
    $api->post('auth/register', [
        'as' => 'auth.register', 'uses' => 'AuthenticateController@register'
    ]);
    // 用户登录验证并返回Token
    $api->post('auth/login', [
        'as' => 'auth.login', 'uses' => 'AuthenticateController@login'
    ]);