作者 赵彬吉
@@ -76,6 +76,7 @@ class AiBlogAuthorTask extends Command @@ -76,6 +76,7 @@ class AiBlogAuthorTask extends Command
76 $this->saveAiBlogAuthor($result['data'] ?? [],$info['project_id']); 76 $this->saveAiBlogAuthor($result['data'] ?? [],$info['project_id']);
77 DB::disconnect('custom_mysql'); 77 DB::disconnect('custom_mysql');
78 //修改任务状态 78 //修改任务状态
  79 + RouteMap::setRoute('top-blog',RouteMap::SOURCE_AI_BLOG_LIST,0,$info['project_id']);//写一条列表页路由
79 $aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]); 80 $aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]);
80 echo '结束->任务id:' . $info['task_id'] . PHP_EOL . date('Y-m-d H:i:s'); 81 echo '结束->任务id:' . $info['task_id'] . PHP_EOL . date('Y-m-d H:i:s');
81 } 82 }
@@ -124,7 +125,6 @@ class AiBlogAuthorTask extends Command @@ -124,7 +125,6 @@ class AiBlogAuthorTask extends Command
124 ]; 125 ];
125 $id = $aiBlogAuthorModel->addReturnId($param); 126 $id = $aiBlogAuthorModel->addReturnId($param);
126 $route = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); 127 $route = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id);
127 - RouteMap::setRoute('top-blog',RouteMap::SOURCE_AI_BLOG_LIST,0,$project_id);//写一条列表页路由  
128 $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]); 128 $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]);
129 } 129 }
130 } 130 }
@@ -96,7 +96,10 @@ class PostInquiryForward extends Command @@ -96,7 +96,10 @@ class PostInquiryForward extends Command
96 } else { 96 } else {
97 $res = $this->inquiry($detail, $val); 97 $res = $this->inquiry($detail, $val);
98 98
99 - //转发表单 99 + //转发详情
  100 + $detail->status = $res ? InquiryRelayDetail::STATUS_SEND : InquiryRelayDetail::STATUS_FAIL;
  101 + $detail->save();
  102 + //转发询盘
100 if ($res) { 103 if ($res) {
101 $form = InquiryInfo::find($detail['form_id']); 104 $form = InquiryInfo::find($detail['form_id']);
102 $form->success = $form->success + 1; 105 $form->success = $form->success + 1;
@@ -5,10 +5,13 @@ @@ -5,10 +5,13 @@
5 * Date: 2025/2/17 5 * Date: 2025/2/17
6 * Time: 11:24 6 * Time: 11:24
7 */ 7 */
  8 +
8 namespace App\Console\Commands\Inquiry; 9 namespace App\Console\Commands\Inquiry;
9 10
  11 +use App\Helper\FormGlobalsoApi;
10 use App\Models\Channel\Channel; 12 use App\Models\Channel\Channel;
11 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
  14 +use App\Models\Inquiry\InquiryFormData;
12 use App\Models\Inquiry\InquiryProject; 15 use App\Models\Inquiry\InquiryProject;
13 use App\Models\Inquiry\InquiryProjectRoute; 16 use App\Models\Inquiry\InquiryProjectRoute;
14 use App\Models\Product\Category; 17 use App\Models\Product\Category;
@@ -58,9 +61,9 @@ class SyncInquiryProject extends Command @@ -58,9 +61,9 @@ class SyncInquiryProject extends Command
58 */ 61 */
59 public function handle() 62 public function handle()
60 { 63 {
61 - echo '开始同步v5' . PHP_EOL; 64 + $this->output('开始同步v5');
62 $this->syncGloV5(); 65 $this->syncGloV5();
63 - echo '开始同步v6' . PHP_EOL; 66 + $this->output('开始同步v6');
64 $this->syncGloV6(); 67 $this->syncGloV6();
65 return true; 68 return true;
66 } 69 }
@@ -72,11 +75,12 @@ class SyncInquiryProject extends Command @@ -72,11 +75,12 @@ class SyncInquiryProject extends Command
72 public function syncGloV5() 75 public function syncGloV5()
73 { 76 {
74 $date = intval(date('Ymd')); 77 $date = intval(date('Ymd'));
  78 + $last_week_time = date('Y-m-d H:i:s', strtotime('-1 week'));
75 $result = http_get('https://www.quanqiusou.cn/extend_api/webs/globalso_v5_tg.php'); 79 $result = http_get('https://www.quanqiusou.cn/extend_api/webs/globalso_v5_tg.php');
76 $channel = Channel::pluck('contact_mobile', 'id')->toArray(); 80 $channel = Channel::pluck('contact_mobile', 'id')->toArray();
77 - foreach ($result as $key=>$val)  
78 - {  
79 - echo '同步项目:' . $val['postid'] . ' - ' . $val['company'] . PHP_EOL; 81 + $form_api = new FormGlobalsoApi();
  82 + foreach ($result as $key => $val) {
  83 + $this->output('同步项目:' . $val['postid'] . ' - ' . $val['company']);
80 // 记录渠道商, 如果渠道有问题, 记录日志, 跳过当前项目, 处理数据后, 第二天再重新同步 84 // 记录渠道商, 如果渠道有问题, 记录日志, 跳过当前项目, 处理数据后, 第二天再重新同步
81 $channel_tmp = []; 85 $channel_tmp = [];
82 foreach ($val['agent'] as $v) { 86 foreach ($val['agent'] as $v) {
@@ -94,10 +98,18 @@ class SyncInquiryProject extends Command @@ -94,10 +98,18 @@ class SyncInquiryProject extends Command
94 continue; 98 continue;
95 } 99 }
96 100
  101 + //判断项目7天之内是否有询盘
  102 + $recent_inquiry = 0;
  103 + $inquiry_list = $form_api->getInquiryList($val['main_url']);
  104 + $last_inquiry_time = $inquiry_list['data']['data'][0]['submit_time'] ?? '';
  105 + if ($last_inquiry_time > $last_week_time) {
  106 + $recent_inquiry = 1;
  107 + }
  108 +
97 // 保存项目 以及 获取路由信息 109 // 保存项目 以及 获取路由信息
98 - $project = InquiryProject::saveProject($date, $val['v'], $val['postid'], $val['company'], implode(',', $channel_tmp), $val['main_url'], $val['is_split'], $val['test_url']); 110 + $project = InquiryProject::saveProject($date, $val['v'], $val['postid'], $val['company'], implode(',', $channel_tmp), $val['main_url'], $recent_inquiry, $val['is_split'], $val['test_url']);
99 $route_domain = $val['is_split'] && $val['test_url'] ? $val['test_url'] : $val['main_url']; 111 $route_domain = $val['is_split'] && $val['test_url'] ? $val['test_url'] : $val['main_url'];
100 - try{ 112 + try {
101 $result = http_get($route_domain . 'k_u_api.php'); 113 $result = http_get($route_domain . 'k_u_api.php');
102 if (empty($result)) { 114 if (empty($result)) {
103 $this->log('syncGloV5Route 未获取到路由信息:' . $project->id . ', 路由获取地址:' . $route_domain . 'k_u_api.php'); 115 $this->log('syncGloV5Route 未获取到路由信息:' . $project->id . ', 路由获取地址:' . $route_domain . 'k_u_api.php');
@@ -107,7 +119,7 @@ class SyncInquiryProject extends Command @@ -107,7 +119,7 @@ class SyncInquiryProject extends Command
107 $this->pushTask($project->id); 119 $this->pushTask($project->id);
108 } catch (\Exception $e) { 120 } catch (\Exception $e) {
109 $this->log('syncGloV5Route 未获取到路由信息:' . $project->id . ', 路由获取地址:' . $route_domain . 'k_u_api.php' . ', 错误信息:' . $e->getMessage()); 121 $this->log('syncGloV5Route 未获取到路由信息:' . $project->id . ', 路由获取地址:' . $route_domain . 'k_u_api.php' . ', 错误信息:' . $e->getMessage());
110 - echo 'syncGloV5Route 未获取到路由信息:' . $project->id . ', 路由获取地址:' . $route_domain . 'k_u_api.php' . ', 错误信息:' . $e->getMessage() . PHP_EOL; 122 + $this->output('syncGloV5Route 未获取到路由信息:' . $project->id . ', 路由获取地址:' . $route_domain . 'k_u_api.php' . ', 错误信息:' . $e->getMessage());
111 continue; 123 continue;
112 } 124 }
113 } 125 }
@@ -125,6 +137,7 @@ class SyncInquiryProject extends Command @@ -125,6 +137,7 @@ class SyncInquiryProject extends Command
125 public function syncGloV6() 137 public function syncGloV6()
126 { 138 {
127 $date = intval(date('Ymd')); 139 $date = intval(date('Ymd'));
  140 + $last_week_time = date('Y-m-d H:i:s', strtotime('-1 week'));
128 // 获取优化中台项目 141 // 获取优化中台项目
129 $project = Project::leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id') 142 $project = Project::leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id')
130 ->where('gl_project.type', Project::TYPE_TWO) 143 ->where('gl_project.type', Project::TYPE_TWO)
@@ -133,15 +146,38 @@ class SyncInquiryProject extends Command @@ -133,15 +146,38 @@ class SyncInquiryProject extends Command
133 $query->orwhere('gl_project_online_check.qa_status', OnlineCheck::STATUS_ONLINE_TRUE) 146 $query->orwhere('gl_project_online_check.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
134 ->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE); 147 ->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE);
135 }) 148 })
136 - ->get(['gl_project.id', 'gl_project.title', 'gl_project.level', 'gl_project.channel']); 149 + ->get(['gl_project.id', 'gl_project.title', 'gl_project.level', 'gl_project.channel', 'gl_project.is_upgrade']);
137 // 获取所有项目域名 150 // 获取所有项目域名
138 $domains = DomainInfo::whereIn('project_id', $project->pluck('id')->toArray())->pluck('domain', 'project_id')->toArray(); 151 $domains = DomainInfo::whereIn('project_id', $project->pluck('id')->toArray())->pluck('domain', 'project_id')->toArray();
139 - foreach ($project as $key=>$val) {  
140 - echo '同步项目:' . $val->id . ' - ' . $val->title . PHP_EOL; 152 + $form_api = new FormGlobalsoApi();
  153 + foreach ($project as $key => $val) {
  154 + $this->output('同步项目:' . $val->id . ' - ' . $val->title);
141 // 过滤暂停优化项目, 映射类型2, model没有定义常量 155 // 过滤暂停优化项目, 映射类型2, model没有定义常量
142 if (in_array(2, $val->level)) 156 if (in_array(2, $val->level))
143 continue; 157 continue;
144 - $project = InquiryProject::saveProject($date,InquiryProject::VERSION_SIX, $val->id, $val->title, $val->channel['channel_id'], 'https://'.$domains[$val->id].'/'); 158 +
  159 + $domain = $domains[$val->id] ?? '';
  160 + if(!$domain){
  161 + continue;
  162 + }
  163 +
  164 + //判断项目7天之内是否有询盘
  165 + $recent_inquiry = 0;
  166 + $inquiry_list = $form_api->getInquiryList('https://' . $domain . '/', $val->is_upgrade);
  167 + $last_inquiry_time = $inquiry_list['data']['data'][0]['submit_time'] ?? '';
  168 + if ($last_inquiry_time > $last_week_time) {
  169 + $recent_inquiry = 1;
  170 + } else {
  171 + //自定义询盘也加入判断
  172 + ProjectServer::useProject($val->id);
  173 + $last_inquiry_time = InquiryFormData::orderBy('submit_at', 'desc')->value('submit_at');
  174 + if ($last_inquiry_time > $last_week_time) {
  175 + $recent_inquiry = 1;
  176 + }
  177 + DB::disconnect('custom_mysql');
  178 + }
  179 +
  180 + $project = InquiryProject::saveProject($date, InquiryProject::VERSION_SIX, $val->id, $val->title, $val->channel['channel_id'], 'https://' . $domain . '/', $recent_inquiry);
145 $this->pushTask($project->id); 181 $this->pushTask($project->id);
146 } 182 }
147 183
@@ -189,4 +225,9 @@ class SyncInquiryProject extends Command @@ -189,4 +225,9 @@ class SyncInquiryProject extends Command
189 file_put_contents(storage_path('logs/zhl/output') . date('Y-m-d') . '.log', $message, FILE_APPEND); 225 file_put_contents(storage_path('logs/zhl/output') . date('Y-m-d') . '.log', $message, FILE_APPEND);
190 return true; 226 return true;
191 } 227 }
  228 +
  229 + public function output($message)
  230 + {
  231 + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
  232 + }
192 } 233 }
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 * Date: 2025/2/18 5 * Date: 2025/2/18
6 * Time: 17:10 6 * Time: 17:10
7 */ 7 */
  8 +
8 namespace App\Console\Commands\Inquiry; 9 namespace App\Console\Commands\Inquiry;
9 10
10 use App\Models\Channel\Channel; 11 use App\Models\Channel\Channel;
@@ -70,7 +71,8 @@ class SyncInquiryProjectRoute extends Command @@ -70,7 +71,8 @@ class SyncInquiryProjectRoute extends Command
70 continue; 71 continue;
71 72
72 // 同步对应项目路由, 以及删除过期路由 73 // 同步对应项目路由, 以及删除过期路由
73 - if ($task->version == InquiryProject::VERSION_SIX){ 74 + $this->output('同步项目ID:' . $sync_id);
  75 + if ($task->version == InquiryProject::VERSION_SIX) {
74 $this->syncGloV6Route($task); 76 $this->syncGloV6Route($task);
75 } else { 77 } else {
76 $this->syncGloV5Route($task); 78 $this->syncGloV5Route($task);
@@ -98,7 +100,7 @@ class SyncInquiryProjectRoute extends Command @@ -98,7 +100,7 @@ class SyncInquiryProjectRoute extends Command
98 return false; 100 return false;
99 } 101 }
100 102
101 - foreach ($result as $key=>$val) { 103 + foreach ($result as $key => $val) {
102 try { 104 try {
103 $tmp = explode('|', $val); 105 $tmp = explode('|', $val);
104 $url_tmp = parse_url($tmp[0]); 106 $url_tmp = parse_url($tmp[0]);
@@ -111,7 +113,7 @@ class SyncInquiryProjectRoute extends Command @@ -111,7 +113,7 @@ class SyncInquiryProjectRoute extends Command
111 InquiryProjectRoute::saveProjectRoute($task->id, $title, $route, $date); 113 InquiryProjectRoute::saveProjectRoute($task->id, $title, $route, $date);
112 } catch (\Exception $e) { 114 } catch (\Exception $e) {
113 $this->log('syncGloV5Route 解析路径:' . $val . ', 错误信息:' . $e->getMessage()); 115 $this->log('syncGloV5Route 解析路径:' . $val . ', 错误信息:' . $e->getMessage());
114 - echo 'syncGloV5Route 解析路径:' . $val . ', 错误信息:' . $e->getMessage() . PHP_EOL; 116 + $this->output('syncGloV5Route 解析路径:' . $val . ', 错误信息:' . $e->getMessage());
115 } 117 }
116 } 118 }
117 119
@@ -127,12 +129,11 @@ class SyncInquiryProjectRoute extends Command @@ -127,12 +129,11 @@ class SyncInquiryProjectRoute extends Command
127 */ 129 */
128 public function syncGloV6Route($task) 130 public function syncGloV6Route($task)
129 { 131 {
130 - echo '同步项目ID:' . $task->id . PHP_EOL;  
131 $date = intval(date('Ymd')); 132 $date = intval(date('Ymd'));
132 ProjectServer::useProject($task->primary_id); 133 ProjectServer::useProject($task->primary_id);
133 // 产品分类标题、路由, 产品标题、路由, 同步到路由表 134 // 产品分类标题、路由, 产品标题、路由, 同步到路由表
134 $category = Category::where('status', Category::STATUS_ACTIVE)->get(['title', 'route']); 135 $category = Category::where('status', Category::STATUS_ACTIVE)->get(['title', 'route']);
135 - foreach ($category as $key=>$val) { 136 + foreach ($category as $key => $val) {
136 InquiryProjectRoute::saveProjectRoute($task->id, $val->title, $val->route, $date); 137 InquiryProjectRoute::saveProjectRoute($task->id, $val->title, $val->route, $date);
137 } 138 }
138 139
@@ -143,7 +144,7 @@ class SyncInquiryProjectRoute extends Command @@ -143,7 +144,7 @@ class SyncInquiryProjectRoute extends Command
143 if ($product->isEmpty()) 144 if ($product->isEmpty())
144 break; 145 break;
145 146
146 - foreach ($product as $key=>$val) { 147 + foreach ($product as $key => $val) {
147 $id = $val->id; 148 $id = $val->id;
148 InquiryProjectRoute::saveProjectRoute($task->id, $val->title, $val->route, $date); 149 InquiryProjectRoute::saveProjectRoute($task->id, $val->title, $val->route, $date);
149 } 150 }
@@ -181,4 +182,9 @@ class SyncInquiryProjectRoute extends Command @@ -181,4 +182,9 @@ class SyncInquiryProjectRoute extends Command
181 file_put_contents(storage_path('logs/zhl/output') . date('Y-m-d') . '.log', $message, FILE_APPEND); 182 file_put_contents(storage_path('logs/zhl/output') . date('Y-m-d') . '.log', $message, FILE_APPEND);
182 return true; 183 return true;
183 } 184 }
  185 +
  186 + public function output($message)
  187 + {
  188 + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
  189 + }
184 } 190 }
@@ -40,12 +40,12 @@ class DownloadProject extends Command @@ -40,12 +40,12 @@ class DownloadProject extends Command
40 protected $description = '导出项目数据'; 40 protected $description = '导出项目数据';
41 41
42 public function handle(){ 42 public function handle(){
43 - ProjectServer::useProject(5);  
44 - echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;  
45 $v6WeekModel = new V6WeeklyReport(); 43 $v6WeekModel = new V6WeeklyReport();
46 - $data = $v6WeekModel->read(['id'=>28058]);  
47 - $data = $this->workChatMessage($data,5);  
48 - DB::disconnect('custom_mysql'); 44 + $lists = $v6WeekModel->list([],'id',['*'],'desc',100);
  45 + echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
  46 + foreach ($lists as $data){
  47 + $this->workChatMessage($data,$data['project_id']);
  48 + }
49 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 49 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
50 return true; 50 return true;
51 } 51 }
@@ -226,7 +226,7 @@ class DownloadProject extends Command @@ -226,7 +226,7 @@ class DownloadProject extends Command
226 $country .= $k.'、'; 226 $country .= $k.'、';
227 }; 227 };
228 $country = trim($country,'、'); 228 $country = trim($country,'、');
229 - $content1 = '询盘主要来源于'.$country.'等国家地区'; 229 + $content1 .= '询盘主要来源于'.$country.'等国家地区';
230 } 230 }
231 $content1 .= '如有高质量客户,请您密切关注与跟进;'; 231 $content1 .= '如有高质量客户,请您密切关注与跟进;';
232 } 232 }
@@ -312,12 +312,12 @@ class DownloadProject extends Command @@ -312,12 +312,12 @@ class DownloadProject extends Command
312 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp); 312 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
313 $param = [ 313 $param = [
314 'project_id'=>$project_id, 314 'project_id'=>$project_id,
315 - 'friend_id'=>1, 315 + 'friend_id'=>17667,
316 'type'=>MessagePush::TYPE_WEEK, 316 'type'=>MessagePush::TYPE_WEEK,
317 - 'content'=>"【全球搜V6.0周报】"."\n".$content, 317 + 'content'=>"【全球搜V6.0周报】--项目id:$project_id"."\n".$content,
318 'ref_ids'=>'', 318 'ref_ids'=>'',
319 'send_time'=>$tomorrowNineAM, 319 'send_time'=>$tomorrowNineAM,
320 - 'status'=>3, 320 + 'status'=>0,
321 ]; 321 ];
322 //写入一条推送消息 自动消费 322 //写入一条推送消息 自动消费
323 $messagePushModel = new MessagePush(); 323 $messagePushModel = new MessagePush();
@@ -12,7 +12,10 @@ namespace App\Console\Commands\LyhTest; @@ -12,7 +12,10 @@ namespace App\Console\Commands\LyhTest;
12 use App\Models\CustomModule\CustomModuleCategory; 12 use App\Models\CustomModule\CustomModuleCategory;
13 use App\Models\CustomModule\CustomModuleContent; 13 use App\Models\CustomModule\CustomModuleContent;
14 use App\Models\CustomModule\CustomModuleExtentContent; 14 use App\Models\CustomModule\CustomModuleExtentContent;
  15 +use App\Models\News\News;
15 use App\Models\RouteMap\RouteMap; 16 use App\Models\RouteMap\RouteMap;
  17 +use App\Models\Template\BTemplate;
  18 +use App\Models\Template\Template;
16 use App\Services\ProjectServer; 19 use App\Services\ProjectServer;
17 use Illuminate\Console\Command; 20 use Illuminate\Console\Command;
18 use Illuminate\Support\Facades\DB; 21 use Illuminate\Support\Facades\DB;
@@ -33,7 +36,7 @@ class LyhImportTest extends Command @@ -33,7 +36,7 @@ class LyhImportTest extends Command
33 */ 36 */
34 protected $description = '导入数据'; 37 protected $description = '导入数据';
35 38
36 - public $data = 'GBP201,Rectifier/Bridge Rectifier,GBP,-,100,2,1.10 ,1,60,5,250,-55~+150,-,Active,'; 39 + public $data = '';
37 40
38 /** 41 /**
39 * @remark :统一更新路由 42 * @remark :统一更新路由
@@ -43,9 +46,10 @@ class LyhImportTest extends Command @@ -43,9 +46,10 @@ class LyhImportTest extends Command
43 * @time :2023/11/20 15:13 46 * @time :2023/11/20 15:13
44 */ 47 */
45 public function handle(){ 48 public function handle(){
46 - ProjectServer::useProject(2837); 49 + ProjectServer::useProject(2385);
47 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 50 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
48 - $this->importCustomModule($this->data); 51 +// $this->importCustomModule($this->data);
  52 + $this->newsImportCustom();
49 DB::disconnect('custom_mysql'); 53 DB::disconnect('custom_mysql');
50 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 54 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
51 } 55 }
@@ -106,4 +110,42 @@ class LyhImportTest extends Command @@ -106,4 +110,42 @@ class LyhImportTest extends Command
106 $customExtendContentTModel->insert($saveData); 110 $customExtendContentTModel->insert($saveData);
107 } 111 }
108 } 112 }
  113 +
  114 + /**
  115 + * @remark :新闻导入到扩展模块
  116 + * @name :newsImportCustom
  117 + * @author :lyh
  118 + * @method :post
  119 + * @time :2025/2/28 11:04
  120 + */
  121 + public function newsImportCustom($project_id = 2385){
  122 + $newsModel = new News();
  123 + $lists = $newsModel->list(['category_id'=>',3,']);
  124 + foreach ($lists as $k => $v){
  125 + $param = [
  126 + 'name'=>$v['name'],
  127 + 'content'=>$v['text'],
  128 + 'remark'=>$v['remark'],
  129 + 'route'=>$v['url'],
  130 + 'image'=>$v['image'],
  131 + 'seo_title'=>$v['seo_title'],
  132 + 'seo_keywords'=>$v['seo_keywords'],
  133 + 'seo_description'=>$v['seo_keywords'],
  134 + 'project_id'=>$project_id,
  135 + 'operator_id'=>$v['operator_id'],
  136 + 'release_at'=>$v['release_at'],
  137 + 'module_id'=>3,
  138 + 'category_id'=>',2,',
  139 + ];
  140 + //删除当前新闻的路由
  141 + RouteMap::delRoute(RouteMap::SOURCE_NEWS,$v['id'],$project_id);
  142 + //删除当前数据
  143 + $newsModel->del(['id'=>$v['id']]);
  144 + $customContentModel = new CustomModuleContent();
  145 + $id = $customContentModel->addReturnId($param);
  146 + $route = RouteMap::setRoute($param['route'],RouteMap::SOURCE_MODULE,$id,$project_id);
  147 + $customContentModel->edit(['route'=>$route],['id'=>$id]);
  148 + }
  149 + return true;
  150 + }
109 } 151 }
@@ -52,7 +52,7 @@ class WeekProject extends Command @@ -52,7 +52,7 @@ class WeekProject extends Command
52 */ 52 */
53 public function handle(){ 53 public function handle(){
54 $projectModel = new Project(); 54 $projectModel = new Project();
55 - $list = $projectModel->list(['delete_status'=>0,'is_weekly_report'=>1,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']); 55 + $list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']);
56 foreach ($list as $k => $v){ 56 foreach ($list as $k => $v){
57 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 57 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
58 ProjectServer::useProject($v['id']); 58 ProjectServer::useProject($v['id']);
@@ -83,8 +83,9 @@ class WeekProject extends Command @@ -83,8 +83,9 @@ class WeekProject extends Command
83 $data['start_date'] = $startOfLastWeekFormatted = date('Y-m-d', $startOfLastWeek); 83 $data['start_date'] = $startOfLastWeekFormatted = date('Y-m-d', $startOfLastWeek);
84 $data['end_date'] = $endOfLastWeekFormatted = date('Y-m-d', $endOfLastWeek); 84 $data['end_date'] = $endOfLastWeekFormatted = date('Y-m-d', $endOfLastWeek);
85 $countModel = new Count(); 85 $countModel = new Count();
  86 + $startOfThisWeek = date('Y-m-d', strtotime("monday this week"));
86 $startOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfLastWeekFormatted,'project_id'=>$value['id']],['inquiry_num','country']); 87 $startOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfLastWeekFormatted,'project_id'=>$value['id']],['inquiry_num','country']);
87 - $endOfLastWeekFormattedInfo = $countModel->read(['date'=>$endOfLastWeekFormatted,'project_id'=>$value['id']],['inquiry_num','country']); 88 + $endOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfThisWeek,'project_id'=>$value['id']],['inquiry_num','country']);
88 $data['inquiry_total'] = $endOfLastWeekFormattedInfo['inquiry_num'] ?? 0;//询盘数量 89 $data['inquiry_total'] = $endOfLastWeekFormattedInfo['inquiry_num'] ?? 0;//询盘数量
89 $data['inquiry_country'] = $endOfLastWeekFormattedInfo['country'] ?? json_encode([]); 90 $data['inquiry_country'] = $endOfLastWeekFormattedInfo['country'] ?? json_encode([]);
90 $data['week_inquiry_total'] = ($endOfLastWeekFormattedInfo['inquiry_num'] ?? 0) - ($startOfLastWeekFormattedInfo['inquiry_num'] ?? 0); 91 $data['week_inquiry_total'] = ($endOfLastWeekFormattedInfo['inquiry_num'] ?? 0) - ($startOfLastWeekFormattedInfo['inquiry_num'] ?? 0);
@@ -641,6 +641,7 @@ if (!function_exists('getImageUrl')) { @@ -641,6 +641,7 @@ if (!function_exists('getImageUrl')) {
641 if($location == 0){ 641 if($location == 0){
642 $cos = config('filesystems.disks.cos'); 642 $cos = config('filesystems.disks.cos');
643 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; 643 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
  644 +// $cosCdn = 'https://file.globalso.com';//TODO::暂时使用
644 $url = $cosCdn.$path; 645 $url = $cosCdn.$path;
645 }else{ 646 }else{
646 $s3 = config('filesystems.disks.s3'); 647 $s3 = config('filesystems.disks.s3');
@@ -7,6 +7,7 @@ use App\Http\Controllers\Aside\BaseController; @@ -7,6 +7,7 @@ use App\Http\Controllers\Aside\BaseController;
7 use App\Http\Logic\Aside\Ai\AiCommandLogic; 7 use App\Http\Logic\Aside\Ai\AiCommandLogic;
8 use App\Http\Requests\Aside\Ai\AiCommandRequest; 8 use App\Http\Requests\Aside\Ai\AiCommandRequest;
9 use App\Models\Ai\AiCommand as AiCommandModel; 9 use App\Models\Ai\AiCommand as AiCommandModel;
  10 +use App\Models\Project\Project;
10 11
11 /** 12 /**
12 * @remark :ai指令 13 * @remark :ai指令
@@ -28,8 +29,17 @@ class AiCommandController extends BaseController @@ -28,8 +29,17 @@ class AiCommandController extends BaseController
28 $this->map['name|key|ai'] = ['like','%'.$this->map['scene'].'%']; 29 $this->map['name|key|ai'] = ['like','%'.$this->map['scene'].'%'];
29 unset($this->map['scene']); 30 unset($this->map['scene']);
30 } 31 }
31 -  
32 $lists = $aiCommandModel->lists($this->map,$this->page,$this->row,$this->order); 32 $lists = $aiCommandModel->lists($this->map,$this->page,$this->row,$this->order);
  33 + $projectModel = new Project();
  34 + if(!empty($lists) && !empty($lists['list'])){
  35 + foreach ($lists['list'] as $k => $v){
  36 + $v['project_name'] = '';
  37 + if($v['project_id'] != 0){
  38 + $v['project_name'] = $projectModel->getProjectName($v['project_id']);
  39 + }
  40 + $lists['list'][$k] = $v;
  41 + }
  42 + }
33 $this->response('success',Code::SUCCESS,$lists); 43 $this->response('success',Code::SUCCESS,$lists);
34 } 44 }
35 45
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Aside\Optimize; @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Aside\Optimize;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Http\Controllers\Aside\BaseController; 6 use App\Http\Controllers\Aside\BaseController;
7 use App\Http\Logic\Aside\Optimize\InquiryForwardLogic; 7 use App\Http\Logic\Aside\Optimize\InquiryForwardLogic;
  8 +use App\Models\Inquiry\AreaTimezone;
8 9
9 class InquiryForwardController extends BaseController 10 class InquiryForwardController extends BaseController
10 { 11 {
@@ -74,8 +75,6 @@ class InquiryForwardController extends BaseController @@ -74,8 +75,6 @@ class InquiryForwardController extends BaseController
74 'ip' => 'required',//ip 75 'ip' => 'required',//ip
75 'forward_url' => 'required',//转发网址 76 'forward_url' => 'required',//转发网址
76 'message' => 'required',//发送内容 77 'message' => 'required',//发送内容
77 - 'inquiry_diff' => 'required',//发送时区  
78 - 'inquiry_date' => 'required',//发送时间  
79 ], [ 78 ], [
80 'id.required' => 'ID不能为空', 79 'id.required' => 'ID不能为空',
81 'name.required' => '名称不能为空', 80 'name.required' => '名称不能为空',
@@ -84,8 +83,6 @@ class InquiryForwardController extends BaseController @@ -84,8 +83,6 @@ class InquiryForwardController extends BaseController
84 'ip.required' => 'ip不能为空', 83 'ip.required' => 'ip不能为空',
85 'forward_url.required' => '转发网址不能为空', 84 'forward_url.required' => '转发网址不能为空',
86 'message.required' => '内容不能为空', 85 'message.required' => '内容不能为空',
87 - 'inquiry_diff.required' => '发送时区不能为空',  
88 - 'inquiry_date.required' => '发送时间不能为空',  
89 ]); 86 ]);
90 } 87 }
91 88
@@ -7,6 +7,7 @@ use App\Helper\Gpt; @@ -7,6 +7,7 @@ use App\Helper\Gpt;
7 use App\Helper\Translate; 7 use App\Helper\Translate;
8 use App\Http\Logic\Aside\BaseLogic; 8 use App\Http\Logic\Aside\BaseLogic;
9 use App\Models\Ai\AiCommand; 9 use App\Models\Ai\AiCommand;
  10 +use App\Models\Inquiry\AreaTimezone;
10 use App\Models\Inquiry\InquiryInfo; 11 use App\Models\Inquiry\InquiryInfo;
11 use App\Models\Inquiry\InquiryProject; 12 use App\Models\Inquiry\InquiryProject;
12 use App\Models\Inquiry\InquiryProjectRoute; 13 use App\Models\Inquiry\InquiryProjectRoute;
@@ -40,7 +41,15 @@ class InquiryForwardLogic extends BaseLogic @@ -40,7 +41,15 @@ class InquiryForwardLogic extends BaseLogic
40 */ 41 */
41 public function getType() 42 public function getType()
42 { 43 {
43 - return $this->success($this->model->typeMap()); 44 + $type = $this->model->typeMap();
  45 + $list = [];
  46 + foreach ($type as $k => $v) {
  47 + $list[] = [
  48 + 'id' => $k,
  49 + 'name' => $v
  50 + ];
  51 + }
  52 + return $this->success($list);
44 } 53 }
45 54
46 /** 55 /**
@@ -97,14 +106,50 @@ class InquiryForwardLogic extends BaseLogic @@ -97,14 +106,50 @@ class InquiryForwardLogic extends BaseLogic
97 $is_v6 = $project_version->version == 6 ? 1 : 0; 106 $is_v6 = $project_version->version == 6 ? 1 : 0;
98 107
99 108
100 - //计算发送时间  
101 - if ($this->param['inquiry_diff'] > 0) {  
102 - $start_at = date('Y-m-d H:i:s', strtotime($this->param['inquiry_date'] . ' -' . $this->param['inquiry_diff'] . ' hours'));  
103 - } elseif ($this->param['inquiry_diff'] < 0) {  
104 - $start_at = date('Y-m-d H:i:s', strtotime($this->param['inquiry_date'] . ' +' . abs($this->param['inquiry_diff']) . ' hours'));  
105 - } else { 109 + //获取发送时间
  110 + if (isset($this->param['inquiry_date']) && $this->param['inquiry_date']) {
  111 + //填写了时间,直接使用
106 $start_at = $this->param['inquiry_date']; 112 $start_at = $this->param['inquiry_date'];
  113 + } else {
  114 + //未填写时间
  115 + //1.根据时差获取当地随机10-18点时间
  116 + $timezoneModel = new AreaTimezone();
  117 + $country_area = $timezoneModel->read(['name' => $info['country']], ['diff']);
  118 + $diff = $country_area ? $country_area['diff'] : 0;
  119 + if ($diff > 0) {
  120 + $area_time = date('Y-m-d H:i:s', strtotime($now . ' +' . $diff . ' hours'));
  121 + } elseif ($diff < 0) {
  122 + $area_time = date('Y-m-d H:i:s', strtotime($now . ' -' . abs($diff) . ' hours'));
  123 + } else {
  124 + $area_time = $now;
107 } 125 }
  126 + $area_timestamp = strtotime($area_time);
  127 + $area_hour = date('H', $area_timestamp);
  128 + if ($area_hour < 18) {
  129 + //当地时间为18点前
  130 + $area_day = date('Y-m-d', $area_timestamp);
  131 + $area_start_time = $area_hour < 10 ? '10:00:00' : date('H:i:s', $area_timestamp);
  132 + } else {
  133 + //当地时间为18点后,顺延一天
  134 + $area_day = date('Y-m-d', strtotime($area_time . ' +1 day'));
  135 + $area_start_time = '10:00:00';
  136 + }
  137 + $start_time = strtotime($area_day . ' ' . $area_start_time);
  138 + $end_time = strtotime($area_day . ' 18:00:00');
  139 + $random_timestamp = mt_rand($start_time, $end_time);
  140 + $area_date = date('Y-m-d H:i:s', $random_timestamp);
  141 +
  142 + //2.再根据时差将随机生成的当地时间换算成国内时间
  143 + if ($diff > 0) {
  144 + $start_at = date('Y-m-d H:i:s', strtotime($area_date . ' -' . $diff . ' hours'));
  145 + } elseif ($diff < 0) {
  146 + $start_at = date('Y-m-d H:i:s', strtotime($area_date . ' +' . abs($diff) . ' hours'));
  147 + } else {
  148 + $start_at = $area_date;
  149 + }
  150 + }
  151 +
  152 + //换算后的国内时间小于当前时间,使用当前时间
108 if ($start_at < $now) { 153 if ($start_at < $now) {
109 $start_at = $now; 154 $start_at = $now;
110 } 155 }
@@ -104,11 +104,6 @@ class AiBlogLogic extends BaseLogic @@ -104,11 +104,6 @@ class AiBlogLogic extends BaseLogic
104 if($result['status'] == 200){ 104 if($result['status'] == 200){
105 $aiBlogTaskModel = new AiBlogTask(); 105 $aiBlogTaskModel = new AiBlogTask();
106 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>2,'task_id'=>$result['data']['task_id'],'status'=>1]); 106 $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>2,'task_id'=>$result['data']['task_id'],'status'=>1]);
107 - //增加一条更新列表页的记录  
108 - $aiThreeInfo = $aiBlogTaskModel->read(['project_id'=>$this->user['project_id'],'type'=>3,'status'=>1]);  
109 - if($aiThreeInfo === false){  
110 - $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>3,'status'=>1]);  
111 - }  
112 $aiBlogModel = new AiBlog(); 107 $aiBlogModel = new AiBlog();
113 $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>1, 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'], 108 $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>1, 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],
114 ]); 109 ]);
@@ -35,7 +35,7 @@ class SyncImageFileJob implements ShouldQueue @@ -35,7 +35,7 @@ class SyncImageFileJob implements ShouldQueue
35 public function handle() 35 public function handle()
36 { 36 {
37 $file_path = $this->getUrl($this->param['path'].'/'.$this->param['name'], 0,$this->param['location']); 37 $file_path = $this->getUrl($this->param['path'].'/'.$this->param['name'], 0,$this->param['location']);
38 - $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php'; 38 + $cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php';
39 echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL; 39 echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL;
40 $code = shell_exec($cmd); 40 $code = shell_exec($cmd);
41 if(200 != (int)$code){ 41 if(200 != (int)$code){
@@ -33,15 +33,17 @@ class InquiryProject extends Base @@ -33,15 +33,17 @@ class InquiryProject extends Base
33 * @param $project 33 * @param $project
34 * @param $channel 34 * @param $channel
35 * @param $domain 35 * @param $domain
  36 + * @param $recent_inquiry
36 * @param int $is_split 37 * @param int $is_split
37 * @param string $test_domain 38 * @param string $test_domain
38 * @return InquiryProject 39 * @return InquiryProject
39 */ 40 */
40 - public static function saveProject($date, $version, $primary_id, $project, $channel, $domain, $is_split = 0, $test_domain = '') 41 + public static function saveProject($date, $version, $primary_id, $project, $channel, $domain,$recent_inquiry, $is_split = 0, $test_domain = '')
41 { 42 {
42 $log = self::where(compact('version', 'primary_id'))->first(); 43 $log = self::where(compact('version', 'primary_id'))->first();
43 if ($log) { 44 if ($log) {
44 $log->date = $date; 45 $log->date = $date;
  46 + $log->recent_inquiry = $recent_inquiry;
45 $log->save(); 47 $log->save();
46 return $log; 48 return $log;
47 } 49 }
@@ -54,6 +56,7 @@ class InquiryProject extends Base @@ -54,6 +56,7 @@ class InquiryProject extends Base
54 $self->is_split = $is_split; 56 $self->is_split = $is_split;
55 $self->test_domain = $test_domain; 57 $self->test_domain = $test_domain;
56 $self->date = $date; 58 $self->date = $date;
  59 + $self->recent_inquiry = $recent_inquiry;
57 $self->save(); 60 $self->save();
58 return $self; 61 return $self;
59 } 62 }
@@ -23,12 +23,12 @@ class InquiryRelayDetail extends Model @@ -23,12 +23,12 @@ class InquiryRelayDetail extends Model
23 protected $table = 'gl_inquiry_relay_detail'; 23 protected $table = 'gl_inquiry_relay_detail';
24 24
25 /** 25 /**
26 - * 任务状态, 0:待处理,1:处理中,2:处理成功,3:抛弃数据,9:处理失败 26 + * 任务状态, 0:待处理,1:处理中,2:待转发,3:转发成功,9:转发失败
27 */ 27 */
28 const STATUS_INIT = 0; 28 const STATUS_INIT = 0;
29 const STATUS_PEND = 1; 29 const STATUS_PEND = 1;
30 const STATUS_SUCCESS = 2; 30 const STATUS_SUCCESS = 2;
31 - const STATUS_FORGO = 3; 31 + const STATUS_SEND = 3;
32 const STATUS_FAIL = 9; 32 const STATUS_FAIL = 9;
33 33
34 /** 34 /**
@@ -40,9 +40,9 @@ class InquiryRelayDetail extends Model @@ -40,9 +40,9 @@ class InquiryRelayDetail extends Model
40 return [ 40 return [
41 self::STATUS_INIT => '待处理', 41 self::STATUS_INIT => '待处理',
42 self::STATUS_PEND => '处理中', 42 self::STATUS_PEND => '处理中',
43 - self::STATUS_SUCCESS => '处理成功',  
44 - self::STATUS_FORGO => '抛弃数据',  
45 - self::STATUS_FAIL => '处理失败', 43 + self::STATUS_SUCCESS => '待转发',
  44 + self::STATUS_SEND => '转发成功',
  45 + self::STATUS_FAIL => '转发失败',
46 ]; 46 ];
47 } 47 }
48 48
@@ -23,7 +23,7 @@ class InquiryRelayDetailLog extends Model @@ -23,7 +23,7 @@ class InquiryRelayDetailLog extends Model
23 protected $table = 'gl_inquiry_relay_detail_log'; 23 protected $table = 'gl_inquiry_relay_detail_log';
24 24
25 /** 25 /**
26 - * 任务状态, 0:初始化,1:待处理,2:处理成功,9:处理失败 26 + * 任务状态, 0:未发送,1:发送中,2:发送成功,9:发送失败
27 */ 27 */
28 const STATUS_INIT = 0; 28 const STATUS_INIT = 0;
29 const STATUS_PEND = 1; 29 const STATUS_PEND = 1;
@@ -43,10 +43,10 @@ class InquiryRelayDetailLog extends Model @@ -43,10 +43,10 @@ class InquiryRelayDetailLog extends Model
43 public static function statusMap() 43 public static function statusMap()
44 { 44 {
45 return [ 45 return [
46 - self::STATUS_INIT => '初始化',  
47 - self::STATUS_PEND => '待处理',  
48 - self::STATUS_SUCCESS => '处理成功',  
49 - self::STATUS_FAIL => '处理失败', 46 + self::STATUS_INIT => '未发送',
  47 + self::STATUS_PEND => '发送中',
  48 + self::STATUS_SUCCESS => '发送成功',
  49 + self::STATUS_FAIL => '发送失败',
50 ]; 50 ];
51 } 51 }
52 52