作者 lyh

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -58,37 +58,41 @@ class SyncProject extends Command @@ -58,37 +58,41 @@ class SyncProject extends Command
58 */ 58 */
59 public function handle() 59 public function handle()
60 { 60 {
61 - $list = NoticeLog::where('type', NoticeLog::TYPE_PROJECT)->where('status', NoticeLog::STATUS_PENDING)->get();  
62 - foreach ($list as $item){  
63 - try {  
64 - $api = new OaGlobalsoApi();  
65 - $data = $api->order_info($item['data']['order_id']);  
66 - if(!$data || empty($data['data'])){  
67 - LogUtils::error('OaGlobalsoApi order_info error', $data);  
68 - $this->retry($item);  
69 - }  
70 - if($data['data']['order_type'] == '首次'){  
71 - $this->sync($data['data']); 61 + while (true){
  62 + $list = NoticeLog::where('type', NoticeLog::TYPE_PROJECT)->where('status', NoticeLog::STATUS_PENDING)->get();
  63 + foreach ($list as $item){
  64 + try {
  65 + $api = new OaGlobalsoApi();
  66 + $data = $api->order_info($item['data']['order_id']);
  67 + if(!$data || empty($data['data'])){
  68 + LogUtils::error('OaGlobalsoApi order_info error', $data);
  69 + $this->retry($item);
  70 + }
  71 + if($data['data']['order_type'] == '首次'){
  72 + $this->sync($data['data']);
72 73
73 - //同步aicc  
74 - if($data['data']['exclusive_aicc']){  
75 - $this->toAicc($data['data']); 74 + //同步aicc
  75 + if($data['data']['exclusive_aicc']){
  76 + $this->toAicc($data['data']);
  77 + }
  78 + //同步hagro
  79 + if($data['data']['exclusive_hagro']){
  80 + $this->toHagro($data['data']);
  81 + }
76 } 82 }
77 - //同步hagro  
78 - if($data['data']['exclusive_hagro']){  
79 - $this->toHagro($data['data']); 83 + if($data['data']['order_type'] == '续费'){
  84 + $this->renewSync($data['data']);
80 } 85 }
  86 + $item->status = NoticeLog::STATUS_SUCCESS;
  87 + $item->save();
  88 + }catch (\Exception $e){
  89 + errorLog('项目同步失败', $item, $e);
  90 + $this->retry($item);
81 } 91 }
82 - if($data['data']['order_type'] == '续费'){  
83 - $this->renewSync($data['data']);  
84 - }  
85 - $item->status = NoticeLog::STATUS_SUCCESS;  
86 - $item->save();  
87 - }catch (\Exception $e){  
88 - errorLog('项目同步失败', $item, $e);  
89 - $this->retry($item);  
90 } 92 }
  93 + sleep(2);
91 } 94 }
  95 +
92 } 96 }
93 97
94 /** 98 /**
@@ -29,7 +29,6 @@ class Kernel extends ConsoleKernel @@ -29,7 +29,6 @@ class Kernel extends ConsoleKernel
29 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 29 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
30 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 30 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
31 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每周执行一次 31 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每周执行一次
32 - $schedule->command('sync_project')->everyMinute()->withoutOverlapping(1); //同步项目  
33 $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录 32 $schedule->command('month_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计记录
34 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 33 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
35 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 34 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次