|
@@ -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
|
/**
|