Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
5 个修改的文件
包含
146 行增加
和
20 行删除
| @@ -197,7 +197,10 @@ class RelayInquiry extends Command | @@ -197,7 +197,10 @@ class RelayInquiry extends Command | ||
| 197 | continue; | 197 | continue; |
| 198 | } | 198 | } |
| 199 | // 未设置对法对象 | 199 | // 未设置对法对象 |
| 200 | - if (empty($ad_task['target'])) { | 200 | + $target_num_arr = array_map(function ($item) { |
| 201 | + return count($item['target']); | ||
| 202 | + }, $ad_task); | ||
| 203 | + if (!array_sum($target_num_arr)) { | ||
| 201 | $val->status = ReInquiryForm::STATUS_FORGO; | 204 | $val->status = ReInquiryForm::STATUS_FORGO; |
| 202 | $val->remark = '广告任务转发对象为空!'; | 205 | $val->remark = '广告任务转发对象为空!'; |
| 203 | $val->save(); | 206 | $val->save(); |
| @@ -213,7 +216,12 @@ class RelayInquiry extends Command | @@ -213,7 +216,12 @@ class RelayInquiry extends Command | ||
| 213 | } | 216 | } |
| 214 | 217 | ||
| 215 | try { | 218 | try { |
| 216 | - $this->relayDetail($ad_task, $val); | 219 | + $res = false; |
| 220 | + foreach ($ad_task as $task){ | ||
| 221 | + $res += $this->relayDetail($task, $val); | ||
| 222 | + } | ||
| 223 | + $val->status = $res ? ReInquiryForm::STATUS_SUCCESS : ReInquiryForm::STATUS_FORGO; | ||
| 224 | + $val->save(); | ||
| 217 | } catch (\Exception $e) { | 225 | } catch (\Exception $e) { |
| 218 | $this->logChannel()->info('执行询盘错误:' . $e->getMessage()); | 226 | $this->logChannel()->info('执行询盘错误:' . $e->getMessage()); |
| 219 | $this->output('执行询盘错误:' . $e->getMessage()); | 227 | $this->output('执行询盘错误:' . $e->getMessage()); |
| @@ -294,9 +302,7 @@ class RelayInquiry extends Command | @@ -294,9 +302,7 @@ class RelayInquiry extends Command | ||
| 294 | 302 | ||
| 295 | if (empty($random_data)) { | 303 | if (empty($random_data)) { |
| 296 | $this->logChannel()->info('当前任务未发现转发对象!', ['广告任务ID:' . $task['id'], '询盘ID:' . $form->id]); | 304 | $this->logChannel()->info('当前任务未发现转发对象!', ['广告任务ID:' . $task['id'], '询盘ID:' . $form->id]); |
| 297 | - $form->status = ReInquiryForm::STATUS_FORGO; | ||
| 298 | - $form->remark = '当前任务未发现转发对象,广告ID: ' . $form->ad_id . '!'; | ||
| 299 | - $form->save(); | 305 | + $form->remark = $form->remark . '当前任务未发现转发对象,广告ID: ' . $form->ad_id . '!'; |
| 300 | return false; | 306 | return false; |
| 301 | } | 307 | } |
| 302 | 308 | ||
| @@ -444,9 +450,6 @@ class RelayInquiry extends Command | @@ -444,9 +450,6 @@ class RelayInquiry extends Command | ||
| 444 | } | 450 | } |
| 445 | } | 451 | } |
| 446 | } | 452 | } |
| 447 | - | ||
| 448 | - $form->status = ReInquiryForm::STATUS_SUCCESS; | ||
| 449 | - $form->save(); | ||
| 450 | return true; | 453 | return true; |
| 451 | } | 454 | } |
| 452 | 455 | ||
| @@ -468,12 +471,15 @@ class RelayInquiry extends Command | @@ -468,12 +471,15 @@ class RelayInquiry extends Command | ||
| 468 | */ | 471 | */ |
| 469 | public function getAdTask($ad_id) | 472 | public function getAdTask($ad_id) |
| 470 | { | 473 | { |
| 471 | - $cache_key = 'inquiry_ads_task'; | 474 | + $cache_key = 'inquiry_ads_tasks'; |
| 472 | $ads = Cache::get($cache_key, function () use ($cache_key) { | 475 | $ads = Cache::get($cache_key, function () use ($cache_key) { |
| 473 | $ads = ReInquiryTask::where(['status' => ReInquiryTask::STATUS_OPEN])->get(['id', 'ad_id', 'num', 'target', 'is_replace_text', 'ai_param']); | 476 | $ads = ReInquiryTask::where(['status' => ReInquiryTask::STATUS_OPEN])->get(['id', 'ad_id', 'num', 'target', 'is_replace_text', 'ai_param']); |
| 474 | $array = []; | 477 | $array = []; |
| 475 | foreach ($ads as $key=>$val) { | 478 | foreach ($ads as $key=>$val) { |
| 476 | - $array[$val->ad_id] = $val; | 479 | + $ad_ids = explode(',', $val['ad_id']); |
| 480 | + foreach ($ad_ids as $ad_id){ | ||
| 481 | + $array[$ad_id][] = $val; | ||
| 482 | + } | ||
| 477 | } | 483 | } |
| 478 | if ($array) | 484 | if ($array) |
| 479 | Cache::put($cache_key, $array, 60); | 485 | Cache::put($cache_key, $array, 60); |
| @@ -7,8 +7,10 @@ use App\Models\Com\Notify; | @@ -7,8 +7,10 @@ use App\Models\Com\Notify; | ||
| 7 | use App\Models\Devops\ServerConfig; | 7 | use App\Models\Devops\ServerConfig; |
| 8 | use App\Models\Devops\ServersIp; | 8 | use App\Models\Devops\ServersIp; |
| 9 | use App\Models\Domain\DomainInfo; | 9 | use App\Models\Domain\DomainInfo; |
| 10 | +use App\Models\Product\Keyword; | ||
| 10 | use App\Models\Project\Project; | 11 | use App\Models\Project\Project; |
| 11 | use App\Services\BatchExportService; | 12 | use App\Services\BatchExportService; |
| 13 | +use App\Services\ProjectServer; | ||
| 12 | use Illuminate\Console\Command; | 14 | use Illuminate\Console\Command; |
| 13 | use Symfony\Component\Process\Process; | 15 | use Symfony\Component\Process\Process; |
| 14 | 16 | ||
| @@ -29,11 +31,86 @@ class Temp extends Command | @@ -29,11 +31,86 @@ class Temp extends Command | ||
| 29 | protected $description = '临时脚本'; | 31 | protected $description = '临时脚本'; |
| 30 | 32 | ||
| 31 | /** | 33 | /** |
| 34 | + * 关键词首字母 | ||
| 35 | + * @author Akun | ||
| 36 | + * @date 2024/10/30 15:37 | ||
| 37 | + */ | ||
| 38 | + public function handle() | ||
| 39 | + { | ||
| 40 | + $projects = Project::where('id', '>', 52)->select(['id'])->orderBy('id', 'asc')->get(); | ||
| 41 | + foreach ($projects as $project) { | ||
| 42 | + ProjectServer::useProject($project->id); | ||
| 43 | + | ||
| 44 | + //处理关键词首字母 | ||
| 45 | + try { | ||
| 46 | + Keyword::select(['id', 'title', 'first_word'])->chunk(1000, function ($query) { | ||
| 47 | + foreach ($query as $item) { | ||
| 48 | + if ($item->first_word === null) { | ||
| 49 | + $item->first_word = $this->getTitleFirstLetter($item->title); | ||
| 50 | + $item->save(); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + }); | ||
| 54 | + } catch (\Exception $e) { | ||
| 55 | + $this->output($e->getMessage()); | ||
| 56 | + continue; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + $this->output('ID:' . $project->id . ',success'); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + protected function getTitleFirstLetter($title) | ||
| 65 | + { | ||
| 66 | + $first = mb_strtolower(mb_substr($title, 0, 1, 'utf-8'), 'utf-8'); | ||
| 67 | + if (in_array($first, ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"])) { | ||
| 68 | + $firstLetter = 0; | ||
| 69 | + } else { | ||
| 70 | + if (in_array($first, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'])) { | ||
| 71 | + $rule = [ | ||
| 72 | + "a" => 1, | ||
| 73 | + "b" => 2, | ||
| 74 | + "c" => 3, | ||
| 75 | + "d" => 4, | ||
| 76 | + "e" => 5, | ||
| 77 | + "f" => 6, | ||
| 78 | + "g" => 7, | ||
| 79 | + "h" => 8, | ||
| 80 | + "i" => 9, | ||
| 81 | + "j" => 10, | ||
| 82 | + "k" => 11, | ||
| 83 | + "l" => 12, | ||
| 84 | + "m" => 13, | ||
| 85 | + "n" => 14, | ||
| 86 | + "o" => 15, | ||
| 87 | + "p" => 16, | ||
| 88 | + "q" => 17, | ||
| 89 | + "r" => 18, | ||
| 90 | + "s" => 19, | ||
| 91 | + "t" => 20, | ||
| 92 | + "u" => 21, | ||
| 93 | + "v" => 22, | ||
| 94 | + "w" => 23, | ||
| 95 | + "x" => 24, | ||
| 96 | + "y" => 25, | ||
| 97 | + "z" => 26, | ||
| 98 | + ]; | ||
| 99 | + $firstLetter = $rule[$first]; | ||
| 100 | + } else { | ||
| 101 | + $firstLetter = 27; | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + return $firstLetter; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + | ||
| 108 | + /** | ||
| 32 | * 获取指定服务器所有项目 | 109 | * 获取指定服务器所有项目 |
| 33 | * @author Akun | 110 | * @author Akun |
| 34 | * @date 2024/09/30 17:01 | 111 | * @date 2024/09/30 17:01 |
| 35 | */ | 112 | */ |
| 36 | - public function handle() | 113 | + public function handle3() |
| 37 | { | 114 | { |
| 38 | $server_id = 1; | 115 | $server_id = 1; |
| 39 | 116 | ||
| @@ -79,7 +156,7 @@ class Temp extends Command | @@ -79,7 +156,7 @@ class Temp extends Command | ||
| 79 | * @author Akun | 156 | * @author Akun |
| 80 | * @date 2024/09/26 10:48 | 157 | * @date 2024/09/26 10:48 |
| 81 | */ | 158 | */ |
| 82 | - public function handle1() | 159 | + public function handle2() |
| 83 | { | 160 | { |
| 84 | $server_id = 15; | 161 | $server_id = 15; |
| 85 | 162 | ||
| @@ -131,7 +208,7 @@ class Temp extends Command | @@ -131,7 +208,7 @@ class Temp extends Command | ||
| 131 | * @author Akun | 208 | * @author Akun |
| 132 | * @date 2024/09/26 10:48 | 209 | * @date 2024/09/26 10:48 |
| 133 | */ | 210 | */ |
| 134 | - public function handle2() | 211 | + public function handle1() |
| 135 | { | 212 | { |
| 136 | $notify_model = new Notify(); | 213 | $notify_model = new Notify(); |
| 137 | $project_model = new Project(); | 214 | $project_model = new Project(); |
| @@ -176,6 +176,7 @@ class ProjectUpdate extends Command | @@ -176,6 +176,7 @@ class ProjectUpdate extends Command | ||
| 176 | 'seo_title' => $item['seo_title'] ?? '', | 176 | 'seo_title' => $item['seo_title'] ?? '', |
| 177 | 'seo_keywords' => $item['seo_keywords'] ?? '', | 177 | 'seo_keywords' => $item['seo_keywords'] ?? '', |
| 178 | 'seo_description' => $item['seo_description'] ?? '', | 178 | 'seo_description' => $item['seo_description'] ?? '', |
| 179 | + 'first_word' => $this->getTitleFirstLetter($item['name']), | ||
| 179 | 'is_upgrade' => 1, | 180 | 'is_upgrade' => 1, |
| 180 | 'route' => $route | 181 | 'route' => $route |
| 181 | ]); | 182 | ]); |
| @@ -1225,4 +1226,48 @@ class ProjectUpdate extends Command | @@ -1225,4 +1226,48 @@ class ProjectUpdate extends Command | ||
| 1225 | return false; | 1226 | return false; |
| 1226 | } | 1227 | } |
| 1227 | } | 1228 | } |
| 1229 | + | ||
| 1230 | + //获取关键词首字母对应数字 | ||
| 1231 | + protected function getTitleFirstLetter($title) | ||
| 1232 | + { | ||
| 1233 | + $first = mb_strtolower(mb_substr($title, 0, 1, 'utf-8'), 'utf-8'); | ||
| 1234 | + if (in_array($first, ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"])) { | ||
| 1235 | + $firstLetter = 0; | ||
| 1236 | + } else { | ||
| 1237 | + if (in_array($first, ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'])) { | ||
| 1238 | + $rule = [ | ||
| 1239 | + "a" => 1, | ||
| 1240 | + "b" => 2, | ||
| 1241 | + "c" => 3, | ||
| 1242 | + "d" => 4, | ||
| 1243 | + "e" => 5, | ||
| 1244 | + "f" => 6, | ||
| 1245 | + "g" => 7, | ||
| 1246 | + "h" => 8, | ||
| 1247 | + "i" => 9, | ||
| 1248 | + "j" => 10, | ||
| 1249 | + "k" => 11, | ||
| 1250 | + "l" => 12, | ||
| 1251 | + "m" => 13, | ||
| 1252 | + "n" => 14, | ||
| 1253 | + "o" => 15, | ||
| 1254 | + "p" => 16, | ||
| 1255 | + "q" => 17, | ||
| 1256 | + "r" => 18, | ||
| 1257 | + "s" => 19, | ||
| 1258 | + "t" => 20, | ||
| 1259 | + "u" => 21, | ||
| 1260 | + "v" => 22, | ||
| 1261 | + "w" => 23, | ||
| 1262 | + "x" => 24, | ||
| 1263 | + "y" => 25, | ||
| 1264 | + "z" => 26, | ||
| 1265 | + ]; | ||
| 1266 | + $firstLetter = $rule[$first]; | ||
| 1267 | + } else { | ||
| 1268 | + $firstLetter = 27; | ||
| 1269 | + } | ||
| 1270 | + } | ||
| 1271 | + return $firstLetter; | ||
| 1272 | + } | ||
| 1228 | } | 1273 | } |
| @@ -180,13 +180,14 @@ class AdsController extends BaseController | @@ -180,13 +180,14 @@ class AdsController extends BaseController | ||
| 180 | return $this->response($res['msg'] ?? '验证失败,请稍后再试!', Code::USER_ERROR, []); | 180 | return $this->response($res['msg'] ?? '验证失败,请稍后再试!', Code::USER_ERROR, []); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | - $agent = implode(',', array_map(function ($v){ | ||
| 184 | - return trim(explode('-', $v)[0]); | ||
| 185 | - }, explode(',', $res['data'] ?? ''))); | 183 | +// $agent = implode(',', array_map(function ($v){ |
| 184 | +// return trim(explode('-', $v)[0]); | ||
| 185 | +// }, explode(',', $res['data'] ?? ''))); | ||
| 186 | 186 | ||
| 187 | $data = [ | 187 | $data = [ |
| 188 | 'is_v6' => 0, | 188 | 'is_v6' => 0, |
| 189 | - 'agent' => $agent, | 189 | + 'agent' => $res['data'], |
| 190 | + 'agent_group' => trim(explode('-', $res['data'])[0]), | ||
| 190 | 'domain' => $domain, | 191 | 'domain' => $domain, |
| 191 | ]; | 192 | ]; |
| 192 | return $this->response('success', Code::SUCCESS, $data); | 193 | return $this->response('success', Code::SUCCESS, $data); |
| @@ -150,9 +150,6 @@ class ComController extends BaseController | @@ -150,9 +150,6 @@ class ComController extends BaseController | ||
| 150 | if($uploadCode != 1){ | 150 | if($uploadCode != 1){ |
| 151 | $data[] = 41; | 151 | $data[] = 41; |
| 152 | } | 152 | } |
| 153 | - if(!empty($data)){ | ||
| 154 | - $this->map['id'] = ['not in',$data]; | ||
| 155 | - } | ||
| 156 | $projectCode = $this->getProjectWatermark(); | 153 | $projectCode = $this->getProjectWatermark(); |
| 157 | if($projectCode != 1){ | 154 | if($projectCode != 1){ |
| 158 | $data[] = 50; | 155 | $data[] = 50; |
-
请 注册 或 登录 后发表评论