作者 李宇航

合并分支 'master-lyh-edit' 到 'master'

处理定制项目



查看合并请求 !617
@@ -82,15 +82,18 @@ class Count extends Command @@ -82,15 +82,18 @@ 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 - echo date('Y-m-d H:i:s') . json_encode($arr) . '->' . PHP_EOL;  
86 - $data[] = $arr; 85 + if($arr === false){
  86 + $data[] = $v['test_domain'];
87 } 87 }
88 //判断数据是否存在 88 //判断数据是否存在
89 - DB::table('gl_count')->insert($data); 89 + DB::table('gl_count')->insert($arr);
  90 + }
90 } 91 }
91 }catch (\Exception $e){ 92 }catch (\Exception $e){
92 echo date('Y-m-d H:i:s') . ' error: ' . '->' . $e->getMessage() . PHP_EOL; 93 echo date('Y-m-d H:i:s') . ' error: ' . '->' . $e->getMessage() . PHP_EOL;
  94 + Log::channel('day_count')->error('day_count:失败 ' . $e->getMessage());
93 } 95 }
  96 + Log::channel('day_count')->error('day_count:失败的域名 ' .json_encode($data));
94 echo date('Y-m-d H:i:s') . ' end: ' . PHP_EOL; 97 echo date('Y-m-d H:i:s') . ' end: ' . PHP_EOL;
95 echo $this->error; 98 echo $this->error;
96 } 99 }
@@ -127,6 +130,9 @@ class Count extends Command @@ -127,6 +130,9 @@ class Count extends Command
127 */ 130 */
128 public function inquiry($arr,$domain,$project_id){ 131 public function inquiry($arr,$domain,$project_id){
129 $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 + }
130 if($inquiry_list['status'] == self::STATUS_ERROR){ 136 if($inquiry_list['status'] == self::STATUS_ERROR){
131 $arr['inquiry_num'] = 0; 137 $arr['inquiry_num'] = 0;
132 $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 }
@@ -10,6 +10,7 @@ use App\Services\ProjectServer; @@ -10,6 +10,7 @@ use App\Services\ProjectServer;
10 use Carbon\Carbon; 10 use Carbon\Carbon;
11 use Illuminate\Console\Command; 11 use Illuminate\Console\Command;
12 use Illuminate\Support\Facades\DB; 12 use Illuminate\Support\Facades\DB;
  13 +use Illuminate\Support\Facades\Log;
13 14
14 class InquiryMonthlyCount extends Command 15 class InquiryMonthlyCount extends Command
15 { 16 {
@@ -70,7 +71,11 @@ class InquiryMonthlyCount extends Command @@ -70,7 +71,11 @@ class InquiryMonthlyCount extends Command
70 $arr['project_id'] = $value['project_id']; 71 $arr['project_id'] = $value['project_id'];
71 // 获取当前日期时间 72 // 获取当前日期时间
72 $arr['month'] = Carbon::now()->subMonth()->format('Y-m'); 73 $arr['month'] = Carbon::now()->subMonth()->format('Y-m');
  74 + try {
73 DB::table('gl_month_count')->insert($arr); 75 DB::table('gl_month_count')->insert($arr);
  76 + }catch (\Exception $e){
  77 + Log::channel('month_count')->error('month_count:失败 ' . $e->getMessage());
  78 + }
74 } 79 }
75 return true; 80 return true;
76 } 81 }
@@ -50,8 +50,6 @@ class HeaderFooter extends Command @@ -50,8 +50,6 @@ class HeaderFooter extends Command
50 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 50 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
51 ProjectServer::useProject($v['id']); 51 ProjectServer::useProject($v['id']);
52 DB::table('gl_web_template_com')->truncate(); 52 DB::table('gl_web_template_com')->truncate();
53 - $templateComModel = new BTemplateCom();  
54 - $templateComModel->truncate();  
55 $this->saveTemplateCom($v['id']); 53 $this->saveTemplateCom($v['id']);
56 DB::disconnect('custom_mysql'); 54 DB::disconnect('custom_mysql');
57 } 55 }
@@ -131,7 +131,7 @@ class CustomTemplateLogic extends BaseLogic @@ -131,7 +131,7 @@ class CustomTemplateLogic extends BaseLogic
131 if($rs === false){ 131 if($rs === false){
132 $this->fail('系统错误,请联系管理'); 132 $this->fail('系统错误,请联系管理');
133 } 133 }
134 - $this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']); 134 + $this->setTemplateLog($bSettingInfo['template_id'] ?? 0,$html,$this->param['id']);
135 //通知 135 //通知
136 $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']); 136 $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']);
137 $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$info['url']]); 137 $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$info['url']]);
@@ -154,7 +154,7 @@ class KeywordLogic extends BaseLogic @@ -154,7 +154,7 @@ class KeywordLogic extends BaseLogic
154 } 154 }
155 } 155 }
156 }catch (\Exception $e){ 156 }catch (\Exception $e){
157 - return false; 157 + $this->fail('保存失败,请联系管理员');
158 } 158 }
159 Common::del_user_cache('product_keyword',$this->user['project_id']); 159 Common::del_user_cache('product_keyword',$this->user['project_id']);
160 NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]); 160 NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]);
@@ -78,6 +78,18 @@ return [ @@ -78,6 +78,18 @@ return [
78 'via' => \App\Factory\LogFormatterFactory::class, 78 'via' => \App\Factory\LogFormatterFactory::class,
79 'prefix' => 'test', 79 'prefix' => 'test',
80 ], 80 ],
  81 + //日记录日志
  82 + 'day_count' => [
  83 + 'driver' => 'custom',
  84 + 'via' => \App\Factory\LogFormatterFactory::class,
  85 + 'prefix' => 'day_count',
  86 + ],
  87 + //月记录日志
  88 + 'month_count' => [
  89 + 'driver' => 'custom',
  90 + 'via' => \App\Factory\LogFormatterFactory::class,
  91 + 'prefix' => 'month_count',
  92 + ],
81 'wechatside' => [ 93 'wechatside' => [
82 'driver' => 'custom', 94 'driver' => 'custom',
83 'via' => \App\Factory\LogFormatterFactory::class, 95 'via' => \App\Factory\LogFormatterFactory::class,