作者 赵彬吉

update

... ... @@ -58,37 +58,41 @@ class SyncProject extends Command
*/
public function handle()
{
$list = NoticeLog::where('type', NoticeLog::TYPE_PROJECT)->where('status', NoticeLog::STATUS_PENDING)->get();
foreach ($list as $item){
try {
$api = new OaGlobalsoApi();
$data = $api->order_info($item['data']['order_id']);
if(!$data || empty($data['data'])){
LogUtils::error('OaGlobalsoApi order_info error', $data);
$this->retry($item);
}
if($data['data']['order_type'] == '首次'){
$this->sync($data['data']);
while (true){
$list = NoticeLog::where('type', NoticeLog::TYPE_PROJECT)->where('status', NoticeLog::STATUS_PENDING)->get();
foreach ($list as $item){
try {
$api = new OaGlobalsoApi();
$data = $api->order_info($item['data']['order_id']);
if(!$data || empty($data['data'])){
LogUtils::error('OaGlobalsoApi order_info error', $data);
$this->retry($item);
}
if($data['data']['order_type'] == '首次'){
$this->sync($data['data']);
//同步aicc
if($data['data']['exclusive_aicc']){
$this->toAicc($data['data']);
//同步aicc
if($data['data']['exclusive_aicc']){
$this->toAicc($data['data']);
}
//同步hagro
if($data['data']['exclusive_hagro']){
$this->toHagro($data['data']);
}
}
//同步hagro
if($data['data']['exclusive_hagro']){
$this->toHagro($data['data']);
if($data['data']['order_type'] == '续费'){
$this->renewSync($data['data']);
}
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}catch (\Exception $e){
errorLog('项目同步失败', $item, $e);
$this->retry($item);
}
if($data['data']['order_type'] == '续费'){
$this->renewSync($data['data']);
}
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}catch (\Exception $e){
errorLog('项目同步失败', $item, $e);
$this->retry($item);
}
sleep(2);
}
}
/**
... ...
... ... @@ -29,7 +29,6 @@ class Kernel extends ConsoleKernel
$schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
$schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
$schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每周执行一次
$schedule->command('sync_project')->everyMinute()->withoutOverlapping(1); //同步项目
$schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录
$schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
$schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
... ...