Merge remote-tracking branch 'origin/master' into akun
正在显示
20 个修改的文件
包含
242 行增加
和
37 行删除
| @@ -61,9 +61,7 @@ class SyncInquiry extends Command | @@ -61,9 +61,7 @@ class SyncInquiry extends Command | ||
| 61 | foreach ($result as $key=>$val) { | 61 | foreach ($result as $key=>$val) { |
| 62 | ReInquiryForm::createInquiry($val['id'], $val['origin_id'], $val['adset_id'], $val['adset_name'], $val['ad_id'], $val['ad_name'], $val['full_name'], $val['email'], $val['phone_number'], $val['whatapp'], $val['ai_inquery'], $val['country'], $val['inquiry_time']); | 62 | ReInquiryForm::createInquiry($val['id'], $val['origin_id'], $val['adset_id'], $val['adset_name'], $val['ad_id'], $val['ad_name'], $val['full_name'], $val['email'], $val['phone_number'], $val['whatapp'], $val['ai_inquery'], $val['country'], $val['inquiry_time']); |
| 63 | } | 63 | } |
| 64 | - exit; | ||
| 65 | } | 64 | } |
| 66 | - return true; | ||
| 67 | } | 65 | } |
| 68 | 66 | ||
| 69 | /** | 67 | /** |
app/Console/Commands/Inquiry/postInquiry.php
0 → 100644
| 1 | +<?php | ||
| 2 | +namespace App\Console\Commands\Inquiry; | ||
| 3 | + | ||
| 4 | +use App\Models\Inquiry\ReInquiryDetail; | ||
| 5 | +use App\Models\Inquiry\ReInquiryDetailLog; | ||
| 6 | +use App\Models\Inquiry\ReInquiryForm; | ||
| 7 | +use Illuminate\Console\Command; | ||
| 8 | +use Illuminate\Support\Facades\Http; | ||
| 9 | +use Illuminate\Support\Facades\Log; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * Class postInquiry | ||
| 13 | + * @package App\Console\Commands\Inquiry | ||
| 14 | + */ | ||
| 15 | +class postInquiry extends Command | ||
| 16 | +{ | ||
| 17 | + /** | ||
| 18 | + * The name and signature of the console command. | ||
| 19 | + * | ||
| 20 | + * @var string | ||
| 21 | + */ | ||
| 22 | + protected $signature = 'post_inquiry'; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * The console command description. | ||
| 26 | + * | ||
| 27 | + * @var string | ||
| 28 | + */ | ||
| 29 | + protected $description = '执行询盘请求'; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Create a new command instance. | ||
| 33 | + * | ||
| 34 | + * @return void | ||
| 35 | + */ | ||
| 36 | + public function __construct() | ||
| 37 | + { | ||
| 38 | + parent::__construct(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + public function handle() | ||
| 43 | + { | ||
| 44 | + while (true) { | ||
| 45 | + $list = ReInquiryDetailLog::where('status', ReInquiryDetailLog::STATUS_INIT)->where('start_at', '<=', date('Y-m-d H:i:s'))->limit(100)->get(); | ||
| 46 | + if (!$list->count()){ | ||
| 47 | + //5分钟同步一次 | ||
| 48 | + sleep(1); | ||
| 49 | + } | ||
| 50 | + // 询盘数据入库 | ||
| 51 | + foreach ($list as $key => $val) { | ||
| 52 | + try { | ||
| 53 | + $detail = ReInquiryDetail::find($val['detail_id']); | ||
| 54 | + if($val['type'] == 1){ | ||
| 55 | + $this->visit($detail, $val); | ||
| 56 | + }else{ | ||
| 57 | + $res = $this->inquiry($detail, $val); | ||
| 58 | + | ||
| 59 | + //转发详情 | ||
| 60 | + $detail->status = $res ? ReInquiryDetail::STATUS_SUCCESS : ReInquiryDetail::STATUS_FAIL; | ||
| 61 | + $detail->result = $val['url']; | ||
| 62 | + $detail->save(); | ||
| 63 | + //转发表单 | ||
| 64 | + if($res){ | ||
| 65 | + $form = ReInquiryForm::find($detail['form_id']); | ||
| 66 | + $form->success_num = $form->success_num + 1; | ||
| 67 | + $form->save(); | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + }catch (\Exception $e){ | ||
| 71 | + | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public function visit(ReInquiryDetail $detail, ReInquiryDetailLog $log){ | ||
| 78 | + if($detail['is_v6']) { | ||
| 79 | + $data = [ | ||
| 80 | + 'ip' => $detail['ip'], | ||
| 81 | + 'url' => $log['url'], | ||
| 82 | + 'device_port' => $detail['device_port'], | ||
| 83 | + 'referrer_url' => $detail['referrer'], | ||
| 84 | + 'user_agent' => $detail['user_agent'], | ||
| 85 | + ]; | ||
| 86 | + $res = Http::withoutVerifying()->post($detail['re_website'] . 'api/traffic_visit/', $data)->json(); | ||
| 87 | + if (empty($res['status']) || $res['status'] != 200) { | ||
| 88 | + $log->status = ReInquiryDetailLog::STATUS_FAIL; | ||
| 89 | + $log->remark = $res['message'] ?? ''; | ||
| 90 | + $log->save(); | ||
| 91 | + | ||
| 92 | + Log::channel('inquiry_relay')->error('inquiry_relay visit error', [$res, $detail['re_website'] . 'api/traffic_visit/',$data]); | ||
| 93 | + } | ||
| 94 | + }else{ | ||
| 95 | + //v4 v5分离项目 往测试链接推 | ||
| 96 | + $website = $detail['re_website']; | ||
| 97 | + $site_array = file_get_contents('https://www.quanqiusou.cn/extend_api/saas/split.php'); | ||
| 98 | + $site_array = json_decode($site_array, true); | ||
| 99 | + $mail_urls = array_column($site_array, 'main_url'); | ||
| 100 | + $key = array_search($detail['re_website'], $mail_urls); | ||
| 101 | + if ($key !== false) { | ||
| 102 | + // 分离项目 推送到测试链接 | ||
| 103 | + $website = $site_array[$key]['test_url']; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + $data = [ | ||
| 107 | + 'action' => 'stats_init', | ||
| 108 | + 'assort' => 0, | ||
| 109 | + 'referrer' => $detail['referrer'], | ||
| 110 | + 'currweb' => $log['url'], | ||
| 111 | + 'user_agent' => $detail['user_agent'], | ||
| 112 | + "ip" => $detail['ip'], | ||
| 113 | + ]; | ||
| 114 | + $res = Http::get($website . 'wp-admin/admin-ajax.php', $data)->json(); | ||
| 115 | + if($res != 200){ | ||
| 116 | + $log->status = ReInquiryDetailLog::STATUS_FAIL; | ||
| 117 | + $log->remark = $res['message'] ?? ''; | ||
| 118 | + $log->save(); | ||
| 119 | + | ||
| 120 | + Log::channel('inquiry_relay')->error('inquiry_relay v4|v5 visit error', [$res, $website . 'wp-admin/admin-ajax.php', $data]); | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public function inquiry(ReInquiryDetail $detail, ReInquiryDetailLog $log){ | ||
| 126 | + // v6 | ||
| 127 | + if($detail['is_v6']) { | ||
| 128 | + $data = [ | ||
| 129 | + 'name' => $detail['name'], | ||
| 130 | + 'phone' => $detail['phone'], | ||
| 131 | + 'message' => $detail['message'], | ||
| 132 | + 'submit_ip' => $detail['ip'], | ||
| 133 | + 'refer' => $log->url, | ||
| 134 | + ]; | ||
| 135 | + if($detail->email){ | ||
| 136 | + $data['email'] = $detail->email; | ||
| 137 | + }else{ | ||
| 138 | + $data['__amp_source_origin'] = trim($detail['re_website'], '/'); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + $res = Http::withoutVerifying()->withHeaders(['User-Agent' => $detail['user_agent']])->post($detail['re_website'] . 'api/inquiryQd/', $data)->json(); | ||
| 142 | + if(empty($res['code']) || $res['code'] != 200){ | ||
| 143 | + $log->status = ReInquiryDetailLog::STATUS_FAIL; | ||
| 144 | + $log->remark = $res['message'] ?? ''; | ||
| 145 | + $log->save(); | ||
| 146 | + | ||
| 147 | + Log::channel('inquiry_relay')->error('inquiry_relay v6 inquiry error', [$res, $detail['website'] . 'api/inquiryQd/', $data]); | ||
| 148 | + return false; | ||
| 149 | + } | ||
| 150 | + }else{ | ||
| 151 | + $data = [ | ||
| 152 | + 'name' => $detail['name'], | ||
| 153 | + 'phone' => $detail['phone'], | ||
| 154 | + 'message' => $detail['message'], | ||
| 155 | + 'email' => $detail['email'], | ||
| 156 | + 'ip' => $detail['ip'], | ||
| 157 | + 'token' => md5($log->url . $detail['name'] . $detail['ip'] . date("Y-m-d")), | ||
| 158 | + 'refer' => $log->url, | ||
| 159 | + 'submit_time' => date('Y-m-d H:i:s'), | ||
| 160 | + 'source' => 5, | ||
| 161 | + ]; | ||
| 162 | + | ||
| 163 | + $res = Http::withoutVerifying()->post('https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data)->json(); | ||
| 164 | + if(empty($res['code']) || $res['code'] != 200){ | ||
| 165 | + $log->status = ReInquiryDetailLog::STATUS_FAIL; | ||
| 166 | + $log->remark = $res['message'] ?? ''; | ||
| 167 | + $log->save(); | ||
| 168 | + | ||
| 169 | + Log::channel('inquiry_relay')->error('inquiry_relay v4|v5 inquiry error', [$res, 'https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f', $data]); | ||
| 170 | + return false; | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + return true; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + | ||
| 177 | + public function output($message) | ||
| 178 | + { | ||
| 179 | + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL; | ||
| 180 | + } | ||
| 181 | +} |
| @@ -14,11 +14,8 @@ use Illuminate\Support\Facades\Config; | @@ -14,11 +14,8 @@ use Illuminate\Support\Facades\Config; | ||
| 14 | use Illuminate\Support\Facades\Mail; | 14 | use Illuminate\Support\Facades\Mail; |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | - * | ||
| 18 | * Class WorkchatMessageSend | 17 | * Class WorkchatMessageSend |
| 19 | - * @package App\Console\Commands | ||
| 20 | - * @author zbj | ||
| 21 | - * @date 2023/11/28 | 18 | + * @package App\Console\Commands\Task |
| 22 | */ | 19 | */ |
| 23 | class WorkchatMessageSend extends Command | 20 | class WorkchatMessageSend extends Command |
| 24 | { | 21 | { |
| @@ -56,20 +56,38 @@ class UpdateRoute extends Command | @@ -56,20 +56,38 @@ class UpdateRoute extends Command | ||
| 56 | */ | 56 | */ |
| 57 | public function handle(){ | 57 | public function handle(){ |
| 58 | $projectModel = new Project(); | 58 | $projectModel = new Project(); |
| 59 | - $list = $projectModel->list(['id'=>['in',[1646]]]); | 59 | + $list = $projectModel->list(['id'=>['in',[1799]]]); |
| 60 | $data = []; | 60 | $data = []; |
| 61 | foreach ($list as $v){ | 61 | foreach ($list as $v){ |
| 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 63 | ProjectServer::useProject($v['id']); | 63 | ProjectServer::useProject($v['id']); |
| 64 | - $this->getProduct(); | 64 | +// $this->getProduct(); |
| 65 | // $this->setProductKeyword(); | 65 | // $this->setProductKeyword(); |
| 66 | // $this->getBlog(); | 66 | // $this->getBlog(); |
| 67 | // $this->setCustomRoute($v['id']); | 67 | // $this->setCustomRoute($v['id']); |
| 68 | + $this->editProductAlt(); | ||
| 68 | DB::disconnect('custom_mysql'); | 69 | DB::disconnect('custom_mysql'); |
| 69 | } | 70 | } |
| 70 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 71 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 71 | } | 72 | } |
| 72 | 73 | ||
| 74 | + public function editProductAlt(){ | ||
| 75 | + $productModel = new Product(); | ||
| 76 | + $lists = $productModel->list(['status'=>1],'id',['id','route','thumb','gallery']); | ||
| 77 | + foreach ($lists as $k => $v){ | ||
| 78 | + $v['thumb']['alt'] = $v['route']; | ||
| 79 | + if(!empty($v['gallery'])){ | ||
| 80 | + foreach ($v['gallery'] as $keys => $values){ | ||
| 81 | + $values = (array)$values; | ||
| 82 | + $values['alt'] = $v['route']; | ||
| 83 | + $v['gallery'][$keys] = $values; | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + $productModel->edit(['thumb'=>json_encode($v['thumb'],true),'gallery'=>json_encode($v['gallery'],true)],['id'=>$v['id']]); | ||
| 87 | + } | ||
| 88 | + return true; | ||
| 89 | + } | ||
| 90 | + | ||
| 73 | public function setCustomRoute($project_id){ | 91 | public function setCustomRoute($project_id){ |
| 74 | $customModel = new CustomModuleContent(); | 92 | $customModel = new CustomModuleContent(); |
| 75 | $list = $customModel->list(); | 93 | $list = $customModel->list(); |
| @@ -13,6 +13,7 @@ use App\Http\Controllers\Aside\BaseController; | @@ -13,6 +13,7 @@ use App\Http\Controllers\Aside\BaseController; | ||
| 13 | use App\Models\Channel\Channel; | 13 | use App\Models\Channel\Channel; |
| 14 | use App\Models\Domain\DomainInfo; | 14 | use App\Models\Domain\DomainInfo; |
| 15 | use App\Models\Inquiry\ReInquiryDetail; | 15 | use App\Models\Inquiry\ReInquiryDetail; |
| 16 | +use App\Models\Inquiry\ReInquiryDetailLog; | ||
| 16 | use App\Models\Inquiry\ReInquiryForm; | 17 | use App\Models\Inquiry\ReInquiryForm; |
| 17 | use App\Models\Inquiry\ReInquiryTask; | 18 | use App\Models\Inquiry\ReInquiryTask; |
| 18 | use App\Models\Project\Project; | 19 | use App\Models\Project\Project; |
| @@ -46,6 +47,14 @@ class AdsController extends BaseController | @@ -46,6 +47,14 @@ class AdsController extends BaseController | ||
| 46 | }) | 47 | }) |
| 47 | ->orderBy('id', 'desc') | 48 | ->orderBy('id', 'desc') |
| 48 | ->paginate(); | 49 | ->paginate(); |
| 50 | + | ||
| 51 | + $relay_site_total = 0; | ||
| 52 | + foreach ($result as $item){ | ||
| 53 | + $relay_site_total += count($item->target); | ||
| 54 | + } | ||
| 55 | + $result = $result->toArray(); | ||
| 56 | + $result['relay_site_total'] = $relay_site_total; | ||
| 57 | + | ||
| 49 | return $this->response('success', Code::SUCCESS, $result); | 58 | return $this->response('success', Code::SUCCESS, $result); |
| 50 | } | 59 | } |
| 51 | 60 | ||
| @@ -115,7 +124,7 @@ class AdsController extends BaseController | @@ -115,7 +124,7 @@ class AdsController extends BaseController | ||
| 115 | $channel = Project::where('id', $domain_info['project_id'])->value('channel'); | 124 | $channel = Project::where('id', $domain_info['project_id'])->value('channel'); |
| 116 | $data = [ | 125 | $data = [ |
| 117 | 'is_v6' => 1, | 126 | 'is_v6' => 1, |
| 118 | - 'agent' => Channel::getChannelText($channel['channel']['user_id']??0) | 127 | + 'agent' => Channel::getChannelText($channel['user_id']??0) |
| 119 | ]; | 128 | ]; |
| 120 | return $this->response('success', Code::SUCCESS, $data); | 129 | return $this->response('success', Code::SUCCESS, $data); |
| 121 | } | 130 | } |
| @@ -252,7 +252,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -252,7 +252,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 252 | $this->setTemplateLog($bSettingInfo['template_id'] ?? 0,$html,$this->param['id']); | 252 | $this->setTemplateLog($bSettingInfo['template_id'] ?? 0,$html,$this->param['id']); |
| 253 | //通知 | 253 | //通知 |
| 254 | $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']); | 254 | $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']); |
| 255 | - $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$info['url']]); | 255 | + $this->curlDelRoute(['old_route'=>$info['url'],'new_route'=>$info['url']]); |
| 256 | return $this->success(); | 256 | return $this->success(); |
| 257 | } | 257 | } |
| 258 | 258 | ||
| @@ -391,7 +391,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -391,7 +391,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 391 | } | 391 | } |
| 392 | } | 392 | } |
| 393 | $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); | 393 | $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); |
| 394 | - $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$route]); | 394 | + $this->curlDelRoute(['old_route'=>$info['url'],'new_route'=>$route]); |
| 395 | return true; | 395 | return true; |
| 396 | } | 396 | } |
| 397 | 397 | ||
| @@ -436,7 +436,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -436,7 +436,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 436 | RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); | 436 | RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); |
| 437 | //生成一条删除路由记录 | 437 | //生成一条删除路由记录 |
| 438 | $info = $this->model->read(['id' => $id], ['id', 'url']); | 438 | $info = $this->model->read(['id' => $id], ['id', 'url']); |
| 439 | - $this->curlDelRoute(['route'=>$info['url']]); | 439 | + $this->curlDelRoute(['old_route'=>$info['url']]); |
| 440 | return $this->success(); | 440 | return $this->success(); |
| 441 | } | 441 | } |
| 442 | 442 |
| @@ -186,7 +186,7 @@ class InitHtmlLogic extends BaseLogic | @@ -186,7 +186,7 @@ class InitHtmlLogic extends BaseLogic | ||
| 186 | } | 186 | } |
| 187 | $this->saveTemplateCom($this->param['html'],$template_id,$this->param['type'],$is_list,$is_custom); | 187 | $this->saveTemplateCom($this->param['html'],$template_id,$this->param['type'],$is_list,$is_custom); |
| 188 | $route = RouteMap::getRoute('all',0,$this->user['project_id']); | 188 | $route = RouteMap::getRoute('all',0,$this->user['project_id']); |
| 189 | - $this->curlDelRoute(['route'=>$route,'new_route'=>$route]); | 189 | + $this->curlDelRoute(['old_route'=>$route,'new_route'=>$route]); |
| 190 | return $this->success(); | 190 | return $this->success(); |
| 191 | } | 191 | } |
| 192 | 192 |
| @@ -204,7 +204,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -204,7 +204,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 204 | RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); | 204 | RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); |
| 205 | //生成一条删除路由记录 | 205 | //生成一条删除路由记录 |
| 206 | $info = $this->model->read(['id'=>$id],['id','alias']); | 206 | $info = $this->model->read(['id'=>$id],['id','alias']); |
| 207 | - $this->curlDelRoute(['route'=>$info['alias']]); | 207 | + $this->curlDelRoute(['old_route'=>$info['alias']]); |
| 208 | return $this->success(); | 208 | return $this->success(); |
| 209 | } | 209 | } |
| 210 | 210 |
| @@ -159,7 +159,7 @@ class BlogLogic extends BaseLogic | @@ -159,7 +159,7 @@ class BlogLogic extends BaseLogic | ||
| 159 | RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); | 159 | RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); |
| 160 | //生成一条删除路由记录 | 160 | //生成一条删除路由记录 |
| 161 | $info = $this->model->read(['id'=>$id],['id','url']); | 161 | $info = $this->model->read(['id'=>$id],['id','url']); |
| 162 | - $this->curlDelRoute(['route'=>$info['url']]); | 162 | + $this->curlDelRoute(['old_route'=>$info['url']]); |
| 163 | return $this->success(); | 163 | return $this->success(); |
| 164 | } | 164 | } |
| 165 | 165 |
| @@ -180,7 +180,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -180,7 +180,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 180 | $info = $this->model->read(['id' => $id], ['id', 'route']); | 180 | $info = $this->model->read(['id' => $id], ['id', 'route']); |
| 181 | if ($info['route'] != $route) { | 181 | if ($info['route'] != $route) { |
| 182 | $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE,$route); | 182 | $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE,$route); |
| 183 | - $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); | 183 | + $this->curlDelRoute(['old_route'=>$info['route'],'new_route'=>$route]); |
| 184 | } | 184 | } |
| 185 | return true; | 185 | return true; |
| 186 | } | 186 | } |
| @@ -223,7 +223,7 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -223,7 +223,7 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 223 | } | 223 | } |
| 224 | RouteMap::delRoute(RouteMap::SOURCE_MODULE_CATE, $id, $this->user['project_id']); | 224 | RouteMap::delRoute(RouteMap::SOURCE_MODULE_CATE, $id, $this->user['project_id']); |
| 225 | //通知 | 225 | //通知 |
| 226 | - $this->curlDelRoute(['route'=>$info['route']]); | 226 | + $this->curlDelRoute(['old_route'=>$info['route']]); |
| 227 | return $this->success(); | 227 | return $this->success(); |
| 228 | } | 228 | } |
| 229 | 229 |
| @@ -247,7 +247,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -247,7 +247,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 247 | //生成一条删除路由记录 | 247 | //生成一条删除路由记录 |
| 248 | $info = $this->model->read(['id' => $id], ['id', 'route']); | 248 | $info = $this->model->read(['id' => $id], ['id', 'route']); |
| 249 | $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route); | 249 | $this->addUpdateNotify(RouteMap::SOURCE_MODULE,$route); |
| 250 | - $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]); | 250 | + $this->curlDelRoute(['old_route'=>$info['route'],'new_route'=>$route]); |
| 251 | return true; | 251 | return true; |
| 252 | } | 252 | } |
| 253 | 253 | ||
| @@ -354,7 +354,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -354,7 +354,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 354 | RouteMap::delRoute(RouteMap::SOURCE_MODULE, $id, $this->user['project_id']); | 354 | RouteMap::delRoute(RouteMap::SOURCE_MODULE, $id, $this->user['project_id']); |
| 355 | //通知 | 355 | //通知 |
| 356 | $info = $this->model->read(['id' => $id], ['id', 'route']); | 356 | $info = $this->model->read(['id' => $id], ['id', 'route']); |
| 357 | - $this->curlDelRoute(['route'=>$info['route']]); | 357 | + $this->curlDelRoute(['old_route'=>$info['route']]); |
| 358 | return $this->success(); | 358 | return $this->success(); |
| 359 | } | 359 | } |
| 360 | 360 |
| @@ -218,7 +218,7 @@ class NewsCategoryLogic extends BaseLogic | @@ -218,7 +218,7 @@ class NewsCategoryLogic extends BaseLogic | ||
| 218 | //删除路由映射 | 218 | //删除路由映射 |
| 219 | RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 219 | RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| 220 | $info = $this->model->read(['id'=>$id],['id','alias']); | 220 | $info = $this->model->read(['id'=>$id],['id','alias']); |
| 221 | - $this->curlDelRoute(['route'=>$info['alias']]); | 221 | + $this->curlDelRoute(['old_route'=>$info['alias']]); |
| 222 | return $this->success(); | 222 | return $this->success(); |
| 223 | } | 223 | } |
| 224 | 224 |
| @@ -290,7 +290,7 @@ class NewsLogic extends BaseLogic | @@ -290,7 +290,7 @@ class NewsLogic extends BaseLogic | ||
| 290 | RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); | 290 | RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); |
| 291 | //生成一条删除路由记录 | 291 | //生成一条删除路由记录 |
| 292 | $info = $this->model->read(['id' => $id], ['id', 'url']); | 292 | $info = $this->model->read(['id' => $id], ['id', 'url']); |
| 293 | - $this->curlDelRoute(['route'=>$info['url']]); | 293 | + $this->curlDelRoute(['old_route'=>$info['url']]); |
| 294 | return $this->success(); | 294 | return $this->success(); |
| 295 | } | 295 | } |
| 296 | 296 |
| @@ -194,7 +194,7 @@ class CategoryLogic extends BaseLogic | @@ -194,7 +194,7 @@ class CategoryLogic extends BaseLogic | ||
| 194 | //生成一条删除路由记录 | 194 | //生成一条删除路由记录 |
| 195 | $info = $this->model->read(['id'=>$id],['id','route']); | 195 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 196 | if($info !== false){ | 196 | if($info !== false){ |
| 197 | - $this->curlDelRoute(['route'=>$info['route']]); | 197 | + $this->curlDelRoute(['old_route'=>$info['route']]); |
| 198 | } | 198 | } |
| 199 | return $this->success(); | 199 | return $this->success(); |
| 200 | } | 200 | } |
| @@ -205,7 +205,7 @@ class KeywordLogic extends BaseLogic | @@ -205,7 +205,7 @@ class KeywordLogic extends BaseLogic | ||
| 205 | //生成一条删除路由记录 | 205 | //生成一条删除路由记录 |
| 206 | $info = $this->model->read(['id'=>$id],['id','route']); | 206 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 207 | if($info !== false){ | 207 | if($info !== false){ |
| 208 | - $this->curlDelRoute(['route'=>$info['route']]); | 208 | + $this->curlDelRoute(['old_route'=>$info['route']]); |
| 209 | } | 209 | } |
| 210 | return $this->success(); | 210 | return $this->success(); |
| 211 | } | 211 | } |
| @@ -387,7 +387,7 @@ class ProductLogic extends BaseLogic | @@ -387,7 +387,7 @@ class ProductLogic extends BaseLogic | ||
| 387 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | 387 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); |
| 388 | //生成一条删除路由记录 | 388 | //生成一条删除路由记录 |
| 389 | $info = $this->model->read(['id'=>$id],['id','route']); | 389 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 390 | - $this->curlDelRoute(['route'=>$info['route']]); | 390 | + $this->curlDelRoute(['old_route'=>$info['route']]); |
| 391 | return $this->success(); | 391 | return $this->success(); |
| 392 | } | 392 | } |
| 393 | 393 |
| @@ -56,19 +56,12 @@ class ReInquiryTask extends Base | @@ -56,19 +56,12 @@ class ReInquiryTask extends Base | ||
| 56 | return $self; | 56 | return $self; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | - public function setTarget($id, $target){ | ||
| 60 | - $self = self::where(['id' => $id])->first(); | ||
| 61 | - if (empty($self)) { | ||
| 62 | - | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | /** | 59 | /** |
| 67 | * @param $value | 60 | * @param $value |
| 68 | * @return mixed | 61 | * @return mixed |
| 69 | */ | 62 | */ |
| 70 | public function getTargetAttribute($value) | 63 | public function getTargetAttribute($value) |
| 71 | { | 64 | { |
| 72 | - return json_decode($value, true); | 65 | + return $value ? json_decode($value, true) : []; |
| 73 | } | 66 | } |
| 74 | } | 67 | } |
| @@ -33,7 +33,15 @@ class MessagePush extends Base | @@ -33,7 +33,15 @@ class MessagePush extends Base | ||
| 33 | protected $table = 'gl_workchat_message_push'; | 33 | protected $table = 'gl_workchat_message_push'; |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | - public static function addInquiryMessage($id, $project_id, $country, $submit_at){ | 36 | + /** |
| 37 | + * @param $id | ||
| 38 | + * @param $project_id | ||
| 39 | + * @param $country | ||
| 40 | + * @param $name | ||
| 41 | + * @param $submit_at | ||
| 42 | + * @return bool | ||
| 43 | + */ | ||
| 44 | + public static function addInquiryMessage($id, $project_id, $country, $name, $submit_at){ | ||
| 37 | if(!ProjectServer::useProject($project_id)){ | 45 | if(!ProjectServer::useProject($project_id)){ |
| 38 | return false; | 46 | return false; |
| 39 | } | 47 | } |
| @@ -56,7 +64,7 @@ class MessagePush extends Base | @@ -56,7 +64,7 @@ class MessagePush extends Base | ||
| 56 | $model->friend_id = $friend_id; | 64 | $model->friend_id = $friend_id; |
| 57 | $model->type = self::TYPE_INQUIRY; | 65 | $model->type = self::TYPE_INQUIRY; |
| 58 | $model->ref_ids = $id; | 66 | $model->ref_ids = $id; |
| 59 | - $model->content = '[' . date('H:i', strtotime($submit_at)) . '] 您的全球搜网站收到来自【' . $country . '】的询盘信息,请登录后台或APP进行查看!'; | 67 | + $model->content = '[' . date('H:i', strtotime($submit_at)) . '] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!'; |
| 60 | }else{ | 68 | }else{ |
| 61 | //定时发送时间 | 69 | //定时发送时间 |
| 62 | $send_time = $hour >= 9 ? date('Y-m-d 09:00:00', strtotime('+1 day')) : date('Y-m-d 09:00:00'); | 70 | $send_time = $hour >= 9 ? date('Y-m-d 09:00:00', strtotime('+1 day')) : date('Y-m-d 09:00:00'); |
| @@ -69,7 +77,7 @@ class MessagePush extends Base | @@ -69,7 +77,7 @@ class MessagePush extends Base | ||
| 69 | $model->type = self::TYPE_INQUIRY; | 77 | $model->type = self::TYPE_INQUIRY; |
| 70 | $model->ref_ids = $id; | 78 | $model->ref_ids = $id; |
| 71 | $model->send_time = $send_time; | 79 | $model->send_time = $send_time; |
| 72 | - $model->content = '[09:00] 您的全球搜网站收到来自【' . $country . '】的询盘信息,请登录后台或APP进行查看!'; | 80 | + $model->content = '[09:00] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!'; |
| 73 | }else{ | 81 | }else{ |
| 74 | $ref_ids = explode(',', $model->ref_ids); | 82 | $ref_ids = explode(',', $model->ref_ids); |
| 75 | $ref_ids[] = $id; | 83 | $ref_ids[] = $id; |
| @@ -160,7 +160,8 @@ class SyncSubmitTaskService | @@ -160,7 +160,8 @@ class SyncSubmitTaskService | ||
| 160 | 160 | ||
| 161 | //推送企微消息 | 161 | //推送企微消息 |
| 162 | try { | 162 | try { |
| 163 | - MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $data['submit_at']); | 163 | + $name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name']; |
| 164 | + MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']); | ||
| 164 | }catch (\Exception $e){ | 165 | }catch (\Exception $e){ |
| 165 | LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage()); | 166 | LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage()); |
| 166 | } | 167 | } |
-
请 注册 或 登录 后发表评论