|
...
|
...
|
@@ -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);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|