玉米工作在 Cpanel 上的 Laravel 项目中不起作用

时间:2021-01-29 10:07:59

标签: laravel scheduled-tasks cpanel

我正在尝试在 cpanel 上设置一个 Cron 作业,该作业将在每分钟后运行,但它不起作用。
我认为它不会执行。 我想知道这是什么错误?。

Cron 作业
我不知道这个是否有效:

widgets = {
     'category': forms.CheckboxSelectMultiple,
    }

命令/DSCCompile.php 这是我的应用程序/Commands/DSCCompile.php。

/usr/local/bin/php /home/vpstrong/public_html/ai/artisan schedule:run >> /dev/null 2>&1

内核.php

<块引用>
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\wwwusers;
use App\history;
use App\dsc_history;
use Illuminate\Support\Facades\DB;
use Session;
class DSCCompile extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'cron:dsc';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Send every minute using cron job.';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
       //to run and compile the cron job at the next day 00:01, so the day will be yesterday 

     $yesterday = date('Y-m-d',strtotime("yesterday"));


             $history = DB::table('dsc_history')
    ->select('wwwuserid')
    ->groupBy('wwwuserid')
    ->where('status','=','0')
    ->get();
   
        foreach($history as $value){
            $userid = $value->wwwuserid;
            $amount = DB::table('dsc_history')
            ->where('wwwuserid',$userid)
            ->where('status','=','0')
            ->sum('amount');
        //      $amount     = mysql_fetch_array(mysql_query("select sum(amount) as sum from dsc_history where wwwuserid = '".$userid."' and status = '0' "));    
        // $comm = $amount['sum'];
             $cur_date = date('Y-m-d H:i:s');
             $description="Sharing Bonus for ".$yesterday ;
             $Query =DB::table('wallet_split')
             ->select('*')
             ->where('id','>=','1')
             ->orderBy('id','ASC')
             ->get();
             foreach($Query as $value){
                $percentage = $value->percentage;
                $wallet_name = $value->wallet_name;

                $bonus = $amount * ($percentage/100);
                $desc = $percentage.'% of '.$description;
                $trans_id       = 'DSC'.rand(1,100000000);
                $payid      = $wallet_name;

                $insert = new history([
                'wwwuserid' => $userid,
                'amount' => $bonus,
                'type' => ('bonus'),
                'description'=>$desc,
                'date' =>date('Y-m-d H:i:s'), // current date $cur_date
                'transactionid'=>$trans_id, 
                'gateway_id' =>$payid,
                ]);
                $insert->save();
             }
        }
    }
}

如何调试或知道为什么它不起作用?

0 个答案:

没有答案