优化同步机制

This commit is contained in:
邓皓元 2019-08-13 14:35:05 +08:00
parent 97ccf8696c
commit ba1745124a
4 changed files with 16 additions and 6 deletions

View File

@ -2,6 +2,7 @@
namespace App\Console; namespace App\Console;
use Carbon\Carbon;
use App\Jobs\QueuedCommand; use App\Jobs\QueuedCommand;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Console\Scheduling\Schedule; use Illuminate\Console\Scheduling\Schedule;
@ -28,6 +29,10 @@ class Kernel extends ConsoleKernel
{ {
$logPath = storage_path('logs/artisan.log'); $logPath = storage_path('logs/artisan.log');
$schedule->command('real:sync-activated')->cron('* */4 * * *')->withoutOverlapping()->appendOutputTo($logPath); $schedule->command('real:sync-activated')->cron('* */4 * * *')->withoutOverlapping()->appendOutputTo($logPath);
$schedule->command(sprintf('real:sync-activated %s', Carbon::now()->subDays(2)->format('Y-m-d')))->cron('0 3 * * *')->withoutOverlapping()->appendOutputTo($logPath);
$schedule->command(sprintf('real:sync-activated %s', Carbon::now()->subDays(3)->format('Y-m-d')))->cron('0 3 * * *')->withoutOverlapping()->appendOutputTo($logPath);
$schedule->command(sprintf('real:sync-activated %s', Carbon::now()->subDays(4)->format('Y-m-d')))->cron('0 3 * * *')->withoutOverlapping()->appendOutputTo($logPath);
$schedule->command(sprintf('real:sync-activated %s', Carbon::now()->subDays(5)->format('Y-m-d')))->cron('0 3 * * *')->withoutOverlapping()->appendOutputTo($logPath);
$schedule->command('virtual:schedule-auto-activate')->cron('* * * 1 *')->withoutOverlapping()->appendOutputTo($logPath); $schedule->command('virtual:schedule-auto-activate')->cron('* * * 1 *')->withoutOverlapping()->appendOutputTo($logPath);
// $schedule->command('virtual:schedule-vd-activate')->cron('0 2 * * *')->withoutOverlapping()->appendOutputTo($logPath); // $schedule->command('virtual:schedule-vd-activate')->cron('0 2 * * *')->withoutOverlapping()->appendOutputTo($logPath);

View File

@ -23,6 +23,8 @@ class ActivatedSync extends Command
public function handle() public function handle()
{ {
$day = $this->getDay(); $day = $this->getDay();
$this->line('开始' . $this->description . '#:' . $day);
$startMicrotime = new UTCDateTime($day->copy()->startOfDay()); $startMicrotime = new UTCDateTime($day->copy()->startOfDay());
$endMicrotime = new UTCDateTime($day->copy()->endOfDay()); $endMicrotime = new UTCDateTime($day->copy()->endOfDay());

View File

@ -1018,9 +1018,12 @@ class OrderService extends Service
->whereIn('sim', array_pluck($value, 'sim'))->update(['virtual_order_id' => $node['id']]); ->whereIn('sim', array_pluck($value, 'sim'))->update(['virtual_order_id' => $node['id']]);
} }
// 只要销售订单同步卡信息即可
if ($node['type'] === 0) {
$simArray = array_pluck($data, 'sim'); $simArray = array_pluck($data, 'sim');
MongoCardJob::dispatch($simArray)->onQueue('sync'); MongoCardJob::dispatch($simArray)->onQueue('sync');
} }
}
public function refundedList(array $conditions = []) public function refundedList(array $conditions = [])
{ {

View File

@ -11,7 +11,7 @@ use App\Domains\Stats\Exports\CompanyReportExport;
require_once realpath(dirname(__FILE__) . '/TestCase.php'); require_once realpath(dirname(__FILE__) . '/TestCase.php');
$conditions = [ $conditions = [
'type' => [0, 1], 'type' => [2, 3],
'company_name' => '福建车媒通网络科技有限公司', 'company_name' => '福建车媒通网络科技有限公司',
'month' => '2016-01' 'month' => '2016-01'
]; ];