作者 lyh

gx

@@ -82,9 +82,11 @@ class Count extends Command @@ -82,9 +82,11 @@ class Count extends Command
82 $arr['updated_at'] = date('Y-m-d H:i:s'); 82 $arr['updated_at'] = date('Y-m-d H:i:s');
83 //询盘统计 83 //询盘统计
84 $arr = $this->inquiry($arr,$v['test_domain'], $v['id']); 84 $arr = $this->inquiry($arr,$v['test_domain'], $v['id']);
  85 + if($arr !== false){
85 echo date('Y-m-d H:i:s') . json_encode($arr) . '->' . PHP_EOL; 86 echo date('Y-m-d H:i:s') . json_encode($arr) . '->' . PHP_EOL;
86 $data[] = $arr; 87 $data[] = $arr;
87 } 88 }
  89 + }
88 //判断数据是否存在 90 //判断数据是否存在
89 DB::table('gl_count')->insert($data); 91 DB::table('gl_count')->insert($data);
90 } 92 }
@@ -128,6 +130,9 @@ class Count extends Command @@ -128,6 +130,9 @@ class Count extends Command
128 */ 130 */
129 public function inquiry($arr,$domain,$project_id){ 131 public function inquiry($arr,$domain,$project_id){
130 $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); 132 $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
  133 + if($inquiry_list == false){
  134 + return false;
  135 + }
131 if($inquiry_list['status'] == self::STATUS_ERROR){ 136 if($inquiry_list['status'] == self::STATUS_ERROR){
132 $arr['inquiry_num'] = 0; 137 $arr['inquiry_num'] = 0;
133 $countryArr = []; 138 $countryArr = [];
@@ -42,8 +42,7 @@ class ImportChannel extends Command @@ -42,8 +42,7 @@ class ImportChannel extends Command
42 'channel'=>['like','%"user_id": "0"%'], 42 'channel'=>['like','%"user_id": "0"%'],
43 ]; 43 ];
44 $lists = $projectModel->list($map); 44 $lists = $projectModel->list($map);
45 -// var_dump($lists);  
46 -// die(); 45 + if(!empty($lists)){
47 foreach ($lists as $k => $v){ 46 foreach ($lists as $k => $v){
48 $order_id = $v['notice_order_id']; 47 $order_id = $v['notice_order_id'];
49 $api = new OaGlobalsoApi(); 48 $api = new OaGlobalsoApi();
@@ -52,6 +51,7 @@ class ImportChannel extends Command @@ -52,6 +51,7 @@ class ImportChannel extends Command
52 $channel = Channel::getProjectChannel($data['company_id'], $data['username_sales']); 51 $channel = Channel::getProjectChannel($data['company_id'], $data['username_sales']);
53 $projectModel->edit(['channel'=>$channel],['id'=>$v['id']]); 52 $projectModel->edit(['channel'=>$channel],['id'=>$v['id']]);
54 } 53 }
55 - return 1; 54 + }
  55 + return true;
56 } 56 }
57 } 57 }
@@ -30,7 +30,7 @@ class ImportManager extends Command @@ -30,7 +30,7 @@ class ImportManager extends Command
30 * 30 *
31 * @var string 31 * @var string
32 */ 32 */
33 - protected $description = '导入数据'; 33 + protected $description = '导入数据(同步5.0人事信息)';
34 /** 34 /**
35 * @remark :导入5.0管理员数据 35 * @remark :导入5.0管理员数据
36 * @name :handle 36 * @name :handle
@@ -57,13 +57,10 @@ class LastInquiry extends Command @@ -57,13 +57,10 @@ class LastInquiry extends Command
57 //其他询盘的最新时间 57 //其他询盘的最新时间
58 ProjectServer::useProject($item['id']); 58 ProjectServer::useProject($item['id']);
59 $other_last_time = InquiryFormData::orderBy('id', 'desc')->value('submit_at'); 59 $other_last_time = InquiryFormData::orderBy('id', 'desc')->value('submit_at');
60 -  
61 $last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time; 60 $last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time;
62 -  
63 if(!$last_inquiry_time){ 61 if(!$last_inquiry_time){
64 continue; 62 continue;
65 } 63 }
66 -  
67 $item->last_inquiry_time = $last_inquiry_time; 64 $item->last_inquiry_time = $last_inquiry_time;
68 $item->save(); 65 $item->save();
69 } 66 }
@@ -74,7 +74,7 @@ class InquiryMonthlyCount extends Command @@ -74,7 +74,7 @@ class InquiryMonthlyCount extends Command
74 try { 74 try {
75 DB::table('gl_month_count')->insert($arr); 75 DB::table('gl_month_count')->insert($arr);
76 }catch (\Exception $e){ 76 }catch (\Exception $e){
77 - Log::channel('month_count')->error('day_count:失败 ' . $e->getMessage()); 77 + Log::channel('month_count')->error('month_count:失败 ' . $e->getMessage());
78 } 78 }
79 } 79 }
80 return true; 80 return true;