作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server

@@ -292,9 +292,17 @@ class Temp extends Command @@ -292,9 +292,17 @@ class Temp extends Command
292 } 292 }
293 } else { 293 } else {
294 //其他服务器:请求对应C端接口 294 //其他服务器:请求对应C端接口
295 - $c_url = $domain . '/api/update_page/?project_id=' . $project_id . '&type=3';  
296 - $re = http_get($c_url);  
297 - $this->output($re['message'] ?? ''); 295 + $c_url = $domain . '/api/update_page/';
  296 + $c_params = [
  297 + 'project_id' => $project_id,
  298 + 'type' => 3
  299 + ];
  300 + $re = http_post($c_url, json_encode($c_params), [], true);
  301 + if (isset($re['status']) && $re['status'] == 200) {
  302 + $this->output($c_url . ' | 请求成功');
  303 + } else {
  304 + $this->output($c_url . ' | ' . ($re['message'] ?? '未返回失败原因'));
  305 + }
298 } 306 }
299 $this->output('项目id:' . $project_id . ',end'); 307 $this->output('项目id:' . $project_id . ',end');
300 } 308 }
@@ -11,8 +11,10 @@ use App\Models\Com\KeywordVideoTaskLog; @@ -11,8 +11,10 @@ use App\Models\Com\KeywordVideoTaskLog;
11 use App\Models\Domain\DomainInfo; 11 use App\Models\Domain\DomainInfo;
12 use App\Models\Domain\DomainRedirectTask; 12 use App\Models\Domain\DomainRedirectTask;
13 use App\Models\Product\Keyword; 13 use App\Models\Product\Keyword;
  14 +use App\Models\Project\Project;
14 use App\Models\Visit\SyncSubmitTask; 15 use App\Models\Visit\SyncSubmitTask;
15 use App\Models\Visit\Visit; 16 use App\Models\Visit\Visit;
  17 +use App\Models\Workchat\MessagePush;
16 use App\Services\ProjectServer; 18 use App\Services\ProjectServer;
17 use Illuminate\Http\Request; 19 use Illuminate\Http\Request;
18 use Illuminate\Support\Facades\DB; 20 use Illuminate\Support\Facades\DB;
@@ -168,4 +170,28 @@ class NoticeController extends BaseController @@ -168,4 +170,28 @@ class NoticeController extends BaseController
168 170
169 return $this->success(); 171 return $this->success();
170 } 172 }
  173 +
  174 + /**
  175 + * 询盘通知企业微信群提示hook
  176 + * 升级项目询盘hook
  177 + * 通知发送群提醒
  178 + * @param Request $request
  179 + * @return false|string
  180 + */
  181 + public function inquiryNoticeHook(Request $request)
  182 + {
  183 + $domain = trim($request->input('domain'));
  184 + $country = trim($request->input('country'));
  185 + $name = trim($request->input('name'));
  186 + $submit = trim($request->input('submit_at'));
  187 + if (empty($domain) || empty($country) || empty($name) || empty($submit))
  188 + return $this->error('参数不完整!');
  189 +
  190 + $project = Project::getProjectByDomain($domain);
  191 + if (empty($project))
  192 + return $this->success();
  193 +
  194 + MessagePush::addInquiryMessage(0, $project->id, $country, $name, $submit);
  195 + return $this->success();
  196 + }
171 } 197 }
@@ -335,4 +335,18 @@ class PrivateController extends BaseController @@ -335,4 +335,18 @@ class PrivateController extends BaseController
335 } 335 }
336 return $this->success($result); 336 return $this->success($result);
337 } 337 }
  338 +
  339 + /**
  340 + * 获取升级项目域名
  341 + * @return false|string
  342 + */
  343 + public function upgradeProjectDomain()
  344 + {
  345 + $domain = Project::leftJoin('gl_domain_info', 'gl_project.id', '=', 'gl_domain_info.project_id')
  346 + ->where(['gl_project.is_upgrade' => Project::IS_UPGRADE_TRUE, 'gl_project.delete_status' => Project::IS_DEL_FALSE])
  347 + ->pluck('domain')
  348 + ->toArray();
  349 + $list = array_filter(array_unique($domain));
  350 + return $this->success($list);
  351 + }
338 } 352 }
@@ -81,18 +81,19 @@ class EmailController extends BaseController @@ -81,18 +81,19 @@ class EmailController extends BaseController
81 'host.regex' => 'smtp格式错误', 81 'host.regex' => 'smtp格式错误',
82 'from_name.required' => '发信人昵称必须', 82 'from_name.required' => '发信人昵称必须',
83 ]); 83 ]);
  84 + $this->param['project_id'] = $this->project['id'];
84 $info = $smtp->read(['project_id' => $this->project['id']]); 85 $info = $smtp->read(['project_id' => $this->project['id']]);
85 if (!$info) { 86 if (!$info) {
86 $smtp->add($this->param); 87 $smtp->add($this->param);
87 } else { 88 } else {
88 - $smtp->edit($this->param, ['project_id' => $this->param['project_id']]); 89 + $smtp->edit($this->param, ['project_id' => $this->project['id']]);
89 } 90 }
90 $this->response('success'); 91 $this->response('success');
91 } 92 }
92 93
93 public function get_smtp(Smtp $smtp){ 94 public function get_smtp(Smtp $smtp){
94 $info = $smtp->read(['project_id' => $this->project['id']]); 95 $info = $smtp->read(['project_id' => $this->project['id']]);
95 - $this->response($info); 96 + $this->response($info??[]);
96 } 97 }
97 98
98 public function group_send(GroupSendTask $groupSendTask) 99 public function group_send(GroupSendTask $groupSendTask)
@@ -57,7 +57,7 @@ class MessagePush extends Base @@ -57,7 +57,7 @@ class MessagePush extends Base
57 } 57 }
58 58
59 //特殊处理, 要求任何时候收到询盘都要及时推送到群里面 59 //特殊处理, 要求任何时候收到询盘都要及时推送到群里面
60 - $special_project_ids = [650]; 60 + $special_project_ids = [650, 2045];
61 //9-21 点,每条消息及时通知 61 //9-21 点,每条消息及时通知
62 //21-第二天 9 点,整合一起通知 62 //21-第二天 9 点,整合一起通知
63 $hour = date('H', strtotime($submit_at)); 63 $hour = date('H', strtotime($submit_at));
@@ -79,19 +79,26 @@ class MessagePush extends Base @@ -79,19 +79,26 @@ class MessagePush extends Base
79 $model->friend_id = $friend_id; 79 $model->friend_id = $friend_id;
80 $model->type = self::TYPE_INQUIRY; 80 $model->type = self::TYPE_INQUIRY;
81 $model->ref_ids = $id; 81 $model->ref_ids = $id;
  82 + $model->countries = $country;
82 $model->send_time = $send_time; 83 $model->send_time = $send_time;
83 $model->content = '[09:00] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!'; 84 $model->content = '[09:00] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!';
84 }else{ 85 }else{
85 $ref_ids = explode(',', $model->ref_ids); 86 $ref_ids = explode(',', $model->ref_ids);
86 $ref_ids[] = $id; 87 $ref_ids[] = $id;
87 $model->ref_ids = implode(',', $ref_ids); 88 $model->ref_ids = implode(',', $ref_ids);
88 - $countries = InquiryFormData::whereIn('id', $ref_ids)->pluck('country')->toArray(); 89 + $countries = explode(',', $model->countries);
  90 + $countries[] = $country;
  91 + $model->countries = implode(',', $countries);
  92 +
  93 + // 升级项目部分询盘无法监控, 会通过接口通知, 但是ID会值为固定值0,在数据库查不到, 无法获取对应国家
89 $count = count($countries); 94 $count = count($countries);
90 - $countries = array_unique($countries);  
91 - if(count($countries) > 3){  
92 - $country = implode(',', array_slice($countries, 0, 3)) . '...';  
93 - }else{  
94 - $country = implode(',', $countries); 95 + if ($countries) {
  96 + $countries = array_unique($countries);
  97 + if(count($countries) > 3){
  98 + $country = implode(',', array_slice($countries, 0, 3)) . '...';
  99 + }else{
  100 + $country = implode(',', $countries);
  101 + }
95 } 102 }
96 $model->content = '[09:00] 您的全球搜网站收到来自【' . $country . '】'.$count.'条询盘信息,请登录后台或APP进行查看!'; 103 $model->content = '[09:00] 您的全球搜网站收到来自【' . $country . '】'.$count.'条询盘信息,请登录后台或APP进行查看!';
97 } 104 }
@@ -41,7 +41,10 @@ Route::any('getAutoToken', [\App\Http\Controllers\Api\PrivateController::class, @@ -41,7 +41,10 @@ Route::any('getAutoToken', [\App\Http\Controllers\Api\PrivateController::class,
41 Route::any('valid_product_route', [\App\Http\Controllers\Api\PrivateController::class, 'getProductRoute'])->name('api.valid_product_route'); 41 Route::any('valid_product_route', [\App\Http\Controllers\Api\PrivateController::class, 'getProductRoute'])->name('api.valid_product_route');
42 // 6.0项目新增有效链接 - 提交Google 42 // 6.0项目新增有效链接 - 提交Google
43 Route::any('project_new_url', [\App\Http\Controllers\Api\PrivateController::class, 'projectNewUrl'])->name('api.project_new_url'); 43 Route::any('project_new_url', [\App\Http\Controllers\Api\PrivateController::class, 'projectNewUrl'])->name('api.project_new_url');
44 - 44 +// 6.0升级项目域名列表
  45 +Route::any('upgrade_project_domain', [\App\Http\Controllers\Api\PrivateController::class, 'upgradeProjectDomain'])->name('api.upgrade_project_domain');
  46 +// 询盘通知微信提示hook
  47 +Route::any('inquiry_notice_hook', [\App\Http\Controllers\Api\NoticeController::class, 'inquiryNoticeHook'])->name('api.inquiry_notice_hook');
45 48
46 // --------------------- 站群服务 ------------------------------------------ 49 // --------------------- 站群服务 ------------------------------------------
47 // 获取项目信息 50 // 获取项目信息