Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
35 个修改的文件
包含
782 行增加
和
529 行删除
| @@ -119,6 +119,8 @@ class ProjectImport extends Command | @@ -119,6 +119,8 @@ class ProjectImport extends Command | ||
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | + $v[0] = $this->special2str($v[0]); | ||
| 123 | + | ||
| 122 | $total_count += 1; | 124 | $total_count += 1; |
| 123 | try { | 125 | try { |
| 124 | if ($task->type == ImportTask::TYPE_NEWS) { | 126 | if ($task->type == ImportTask::TYPE_NEWS) { |
| @@ -200,6 +202,30 @@ class ProjectImport extends Command | @@ -200,6 +202,30 @@ class ProjectImport extends Command | ||
| 200 | return false; | 202 | return false; |
| 201 | } | 203 | } |
| 202 | 204 | ||
| 205 | + //特殊字符转换 | ||
| 206 | + protected function special2str($str) | ||
| 207 | + { | ||
| 208 | + if (strpos($str, ';') === false) { | ||
| 209 | + return $str; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + $list = [ | ||
| 213 | + '<' => '<', | ||
| 214 | + '>' => '>', | ||
| 215 | + '&' => '&', | ||
| 216 | + '´' => "'", | ||
| 217 | + '"' => '"', | ||
| 218 | + ' ' => ' ', | ||
| 219 | + ''' => "'" | ||
| 220 | + ]; | ||
| 221 | + | ||
| 222 | + foreach ($list as $k => $v) { | ||
| 223 | + $str = str_replace($k, $v, $str); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + return $str; | ||
| 227 | + } | ||
| 228 | + | ||
| 203 | //发送站内通知 | 229 | //发送站内通知 |
| 204 | protected function send_mail($user_list, $time, $type, $success_count, $repeat_count, $fail_count, $reason, $fail_line = []) | 230 | protected function send_mail($user_list, $time, $type, $success_count, $repeat_count, $fail_count, $reason, $fail_line = []) |
| 205 | { | 231 | { |
| @@ -136,7 +136,7 @@ class HtmlCollect extends Command | @@ -136,7 +136,7 @@ class HtmlCollect extends Command | ||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | 138 | ||
| 139 | - $update_log = UpdateLog::where('project_id', '<', 799)->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first(); | 139 | + $update_log = UpdateLog::whereNotIn('project_id', [626])->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first(); |
| 140 | if (!$update_log) { | 140 | if (!$update_log) { |
| 141 | return false; | 141 | return false; |
| 142 | } | 142 | } |
| @@ -20,21 +20,21 @@ use Illuminate\Support\Facades\Redis; | @@ -20,21 +20,21 @@ use Illuminate\Support\Facades\Redis; | ||
| 20 | * @author Akun | 20 | * @author Akun |
| 21 | * @date 2023/11/10 16:04 | 21 | * @date 2023/11/10 16:04 |
| 22 | */ | 22 | */ |
| 23 | -class HtmlCollectNew extends Command | 23 | +class HtmlSpecialCollect extends Command |
| 24 | { | 24 | { |
| 25 | /** | 25 | /** |
| 26 | * The name and signature of the console command. | 26 | * The name and signature of the console command. |
| 27 | * | 27 | * |
| 28 | * @var string | 28 | * @var string |
| 29 | */ | 29 | */ |
| 30 | - protected $signature = 'project_html_collect_new'; | 30 | + protected $signature = 'project_html_special_collect'; |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * The console command description. | 33 | * The console command description. |
| 34 | * | 34 | * |
| 35 | * @var string | 35 | * @var string |
| 36 | */ | 36 | */ |
| 37 | - protected $description = '执行项目html页面采集'; | 37 | + protected $description = '执行特殊项目html页面采集'; |
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | public function handle() | 40 | public function handle() |
| @@ -129,14 +129,14 @@ class HtmlCollectNew extends Command | @@ -129,14 +129,14 @@ class HtmlCollectNew extends Command | ||
| 129 | //获取任务 | 129 | //获取任务 |
| 130 | protected function get_task() | 130 | protected function get_task() |
| 131 | { | 131 | { |
| 132 | - $key = 'console_html_collect_new_task'; | 132 | + $key = 'console_html_special_collect_task'; |
| 133 | $task_id = Redis::rpop($key); | 133 | $task_id = Redis::rpop($key); |
| 134 | if ($task_id) { | 134 | if ($task_id) { |
| 135 | return $task_id; | 135 | return $task_id; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | 138 | ||
| 139 | - $update_log = UpdateLog::where('project_id', '>=', 799)->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first(); | 139 | + $update_log = UpdateLog::whereIn('project_id', [626])->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first(); |
| 140 | if (!$update_log) { | 140 | if (!$update_log) { |
| 141 | return false; | 141 | return false; |
| 142 | } | 142 | } |
| @@ -267,7 +267,8 @@ class HtmlCollectNew extends Command | @@ -267,7 +267,8 @@ class HtmlCollectNew extends Command | ||
| 267 | && (strpos($path_end, 'com') === false) | 267 | && (strpos($path_end, 'com') === false) |
| 268 | && (strpos($path_end, 'xml') === false) | 268 | && (strpos($path_end, 'xml') === false) |
| 269 | ) { | 269 | ) { |
| 270 | - $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); | 270 | + $new_url = str_replace($home_url, $web_url_domain, $url); |
| 271 | + $source = CollectSource::where('project_id', $project_id)->where('origin', $new_url)->first(); | ||
| 271 | if (!$source) { | 272 | if (!$source) { |
| 272 | return [ | 273 | return [ |
| 273 | 'download' => true, | 274 | 'download' => true, |
app/Console/Commands/Update/ProjectVisit.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\Update; | ||
| 4 | + | ||
| 5 | +use App\Models\Com\UpdateVisit; | ||
| 6 | +use App\Models\Visit\Visit; | ||
| 7 | +use App\Models\Visit\VisitItem; | ||
| 8 | +use App\Services\ProjectServer; | ||
| 9 | +use Illuminate\Console\Command; | ||
| 10 | +use Illuminate\Support\Facades\DB; | ||
| 11 | +use Illuminate\Support\Facades\Redis; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 4.0,5.0升级到6.0,访问同步 | ||
| 15 | + * Class ProjectImport | ||
| 16 | + * @package App\Console\Commands | ||
| 17 | + * @author Akun | ||
| 18 | + * @date 2023/12/18 15:52 | ||
| 19 | + */ | ||
| 20 | +class ProjectVisit extends Command | ||
| 21 | +{ | ||
| 22 | + /** | ||
| 23 | + * The name and signature of the console command. | ||
| 24 | + * | ||
| 25 | + * @var string | ||
| 26 | + */ | ||
| 27 | + protected $signature = 'project_visit'; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * The console command description. | ||
| 31 | + * | ||
| 32 | + * @var string | ||
| 33 | + */ | ||
| 34 | + protected $description = '执行项目升级访问任务'; | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + public function handle() | ||
| 38 | + { | ||
| 39 | + ini_set('memory_limit', '512M'); | ||
| 40 | + while (true) { | ||
| 41 | + $this->start_visit(); | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + protected function start_visit() | ||
| 46 | + { | ||
| 47 | + $task_id = $this->get_task(); | ||
| 48 | + if (!$task_id) { | ||
| 49 | + sleep(60); | ||
| 50 | + return true; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + $task = UpdateVisit::where('id', $task_id)->where('status', UpdateVisit::STATUS_UN)->first(); | ||
| 54 | + if (!$task) { | ||
| 55 | + sleep(2); | ||
| 56 | + return true; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + $project_id = $task->project_id; | ||
| 60 | + $api_type = $task->api_type; | ||
| 61 | + $api_url = $task->api_url; | ||
| 62 | + | ||
| 63 | + $page_size = 1000; | ||
| 64 | + | ||
| 65 | + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', task_type: ' . $api_type . ', update start' . PHP_EOL; | ||
| 66 | + | ||
| 67 | + $task->status = UpdateVisit::STATUS_ING;//同步中 | ||
| 68 | + $task->save(); | ||
| 69 | + | ||
| 70 | + //设置数据库 | ||
| 71 | + $project = ProjectServer::useProject($project_id); | ||
| 72 | + if ($project) { | ||
| 73 | + if ($api_type == 'visit_list') { | ||
| 74 | + //访问列表 | ||
| 75 | + $url = $api_url . '?' . http_build_query(['w' => 'visit_list', 'page' => 1, 'pagesize' => 1]); | ||
| 76 | + $data = curl_c($url); | ||
| 77 | + if (isset($data['count']) && $data['count'] > 0) { | ||
| 78 | + $count = $data['count']; | ||
| 79 | + $max_id = $data['data'][0]['id'] ?? 0; | ||
| 80 | + $is_stop = 0; | ||
| 81 | + | ||
| 82 | + $total_page = ceil($count / $page_size); | ||
| 83 | + for ($page = 1; $page <= $total_page; $page++) { | ||
| 84 | + if ($is_stop) { | ||
| 85 | + break; | ||
| 86 | + } | ||
| 87 | + $url_page = $api_url . '?' . http_build_query(['w' => 'visit_list', 'page' => $page, 'pagesize' => $page_size]); | ||
| 88 | + $data_page = curl_c($url_page); | ||
| 89 | + if (isset($data_page['data']) && $data_page['data']) { | ||
| 90 | + $items = $data_page['data']; | ||
| 91 | + $model = new Visit(); | ||
| 92 | + $insert = []; | ||
| 93 | + foreach ($items as $item) { | ||
| 94 | + if (isset($item['id']) && $item['id']) { | ||
| 95 | + if ($item['id'] > $task->max_id) { | ||
| 96 | + $url_arr = parse_url($item['request'] ?? ''); | ||
| 97 | + $insert[] = [ | ||
| 98 | + 'url' => $item['request'] ?? '', | ||
| 99 | + 'referrer_url' => $item['referrer'] ?? '', | ||
| 100 | + 'device_port' => isset($item['is_moblie']) && $item['is_moblie'] == 1 ? 2 : 1, | ||
| 101 | + 'country' => $item['ip_area'] ?? '', | ||
| 102 | + 'ip' => $item['ip'] ?? '', | ||
| 103 | + 'depth' => $item['pv'], | ||
| 104 | + 'domain' => $url_arr['host'] ?? '', | ||
| 105 | + 'is_inquiry' => $item['is_cf'] ?? 0, | ||
| 106 | + 'created_at' => date('Y-m-d H:i:s', isset($item['update']) && $item['update'] ? $item['update'] : time()), | ||
| 107 | + 'updated_at' => date('Y-m-d H:i:s', isset($item['update']) && $item['update'] ? $item['update'] : time()), | ||
| 108 | + 'updated_date' => date('Y-m-d', isset($item['c_time']) && $item['c_time'] ? strtotime($item['c_time']) : time()), | ||
| 109 | + 'original_id' => $item['id'], | ||
| 110 | + ]; | ||
| 111 | + } else { | ||
| 112 | + $is_stop = 1; | ||
| 113 | + break; | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + if ($insert) { | ||
| 118 | + try { | ||
| 119 | + $model->insert($insert); | ||
| 120 | + } catch (\Exception $e) { | ||
| 121 | + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ',page: ' . $page . ' error: ' . $e->getMessage() . PHP_EOL; | ||
| 122 | + continue; | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + if ($max_id) { | ||
| 128 | + $task->max_id = $max_id; | ||
| 129 | + } | ||
| 130 | + } else { | ||
| 131 | + return true; | ||
| 132 | + } | ||
| 133 | + } else { | ||
| 134 | + //访问明细 | ||
| 135 | + $url = $api_url . '?' . http_build_query(['w' => 'visit_detail_list', 'page' => 1, 'pagesize' => 1]); | ||
| 136 | + $data = curl_c($url); | ||
| 137 | + if (isset($data['count']) && $data['count'] > 0) { | ||
| 138 | + $count = $data['count']; | ||
| 139 | + $max_id = $data['data'][0]['id'] ?? 0; | ||
| 140 | + $is_stop = 0; | ||
| 141 | + | ||
| 142 | + $total_page = ceil($count / $page_size); | ||
| 143 | + for ($page = 1; $page <= $total_page; $page++) { | ||
| 144 | + if ($is_stop) { | ||
| 145 | + break; | ||
| 146 | + } | ||
| 147 | + $url_page = $api_url . '?' . http_build_query(['w' => 'visit_detail_list', 'page' => $page, 'pagesize' => $page_size]); | ||
| 148 | + $data_page = curl_c($url_page); | ||
| 149 | + if (isset($data_page['data']) && $data_page['data']) { | ||
| 150 | + $items = $data_page['data']; | ||
| 151 | + $model = new VisitItem(); | ||
| 152 | + $p_model = new Visit(); | ||
| 153 | + $insert = []; | ||
| 154 | + foreach ($items as $item) { | ||
| 155 | + if (isset($item['id']) && $item['id']) { | ||
| 156 | + if ($item['id'] > $task->max_id) { | ||
| 157 | + $p_info = $p_model->read(['ip' => $item['ip'] ?? '', 'updated_date' => $item['day_at'] ?? '']); | ||
| 158 | + if ($p_info) { | ||
| 159 | + $insert[] = [ | ||
| 160 | + 'customer_visit_id' => $p_info['id'], | ||
| 161 | + 'url' => $p_info['url'], | ||
| 162 | + 'referrer_url' => $p_info['referrer_url'], | ||
| 163 | + 'device_port' => $p_info['device_port'], | ||
| 164 | + 'country' => $p_info['country'], | ||
| 165 | + 'ip' => $p_info['ip'], | ||
| 166 | + 'domain' => $p_info['domain'], | ||
| 167 | + 'created_at' => $item['time_str'] ?? $p_info['created_at'], | ||
| 168 | + 'updated_at' => $item['time_str'] ?? $p_info['updated_at'], | ||
| 169 | + 'updated_date' => $item['day_at'] ?? $p_info['updated_date'], | ||
| 170 | + 'original_id' => $item['id'], | ||
| 171 | + ]; | ||
| 172 | + } | ||
| 173 | + } else { | ||
| 174 | + $is_stop = 1; | ||
| 175 | + break; | ||
| 176 | + } | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + if ($insert) { | ||
| 180 | + try { | ||
| 181 | + $model->insert($insert); | ||
| 182 | + } catch (\Exception $e) { | ||
| 183 | + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ',page: ' . $page . ' error: ' . $e->getMessage() . PHP_EOL; | ||
| 184 | + continue; | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + if ($max_id) { | ||
| 190 | + $task->max_id = $max_id; | ||
| 191 | + } | ||
| 192 | + } else { | ||
| 193 | + return true; | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + } | ||
| 197 | + //关闭数据库 | ||
| 198 | + DB::disconnect('custom_mysql'); | ||
| 199 | + | ||
| 200 | + $task->status = UpdateVisit::STATUS_COM;//同步完成 | ||
| 201 | + $task->save(); | ||
| 202 | + | ||
| 203 | + echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', task_type: ' . $api_type . ', update end ' . PHP_EOL; | ||
| 204 | + | ||
| 205 | + sleep(2); | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + //获取任务 | ||
| 209 | + protected function get_task() | ||
| 210 | + { | ||
| 211 | + $key = 'console_visit_task'; | ||
| 212 | + $task_id = Redis::rpop($key); | ||
| 213 | + if ($task_id) { | ||
| 214 | + return $task_id; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + $task_list = UpdateVisit::where('status', UpdateVisit::STATUS_UN)->orderBy('sort', 'asc')->orderBy('project_id', 'asc')->limit(20)->get(); | ||
| 218 | + if ($task_list->count() == 0) { | ||
| 219 | + return false; | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + foreach ($task_list as $value) { | ||
| 223 | + Redis::lpush($key, $value->id); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + $task_id = Redis::rpop($key); | ||
| 227 | + return $task_id; | ||
| 228 | + } | ||
| 229 | +} |
| @@ -53,9 +53,13 @@ class UpdateRoute extends Command | @@ -53,9 +53,13 @@ class UpdateRoute extends Command | ||
| 53 | * @time :2023/11/20 15:13 | 53 | * @time :2023/11/20 15:13 |
| 54 | */ | 54 | */ |
| 55 | public function handle(){ | 55 | public function handle(){ |
| 56 | - ProjectServer::useProject(75); | 56 | + $projectModel = new Project(); |
| 57 | + $list = $projectModel->list(['type'=>['in',[1,2,3,4]]]); | ||
| 58 | + foreach ($list as $v){ | ||
| 59 | + ProjectServer::useProject($v['id']); | ||
| 57 | $this->getProductKeyword(); | 60 | $this->getProductKeyword(); |
| 58 | DB::disconnect('custom_mysql'); | 61 | DB::disconnect('custom_mysql'); |
| 62 | + } | ||
| 59 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 63 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 60 | } | 64 | } |
| 61 | 65 | ||
| @@ -68,14 +72,18 @@ class UpdateRoute extends Command | @@ -68,14 +72,18 @@ class UpdateRoute extends Command | ||
| 68 | */ | 72 | */ |
| 69 | public function getProductKeyword(){ | 73 | public function getProductKeyword(){ |
| 70 | $keywordModel = new Keyword(); | 74 | $keywordModel = new Keyword(); |
| 71 | - $lists = $keywordModel->list(['route'=>'']); | 75 | + $lists = $keywordModel->list(['status'=>1]); |
| 72 | if(!empty($lists)){ | 76 | if(!empty($lists)){ |
| 73 | foreach ($lists as $v){ | 77 | foreach ($lists as $v){ |
| 74 | - echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 75 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']); | ||
| 76 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 77 | - $this->model->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 78 | - echo date('Y-m-d H:i:s') . 'end :'.$route . PHP_EOL; | 78 | + $tag = "-tag"; |
| 79 | + if (!(substr($v['route'], -strlen($tag)) === $tag)) { | ||
| 80 | + echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL; | ||
| 81 | + $route = $v['route'].$tag; | ||
| 82 | + // 如果不是以 '-tag' 结尾,则拼接上 '-tag' | ||
| 83 | + $routeModel = new RouteMap(); | ||
| 84 | + $routeModel->edit(['route'=>$route],['source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,'source_id'=>$v['id']]); | ||
| 85 | + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 86 | + } | ||
| 79 | } | 87 | } |
| 80 | } | 88 | } |
| 81 | } | 89 | } |
| @@ -66,11 +66,11 @@ class Handler extends ExceptionHandler | @@ -66,11 +66,11 @@ class Handler extends ExceptionHandler | ||
| 66 | '-------错误行数:' . $exception->getLine(); | 66 | '-------错误行数:' . $exception->getLine(); |
| 67 | //A端错误 | 67 | //A端错误 |
| 68 | if ($exception instanceof AsideGlobalException) { | 68 | if ($exception instanceof AsideGlobalException) { |
| 69 | - LogUtils::error("AsideGlobalException", [], $exceptionMessage); | 69 | +// LogUtils::error("AsideGlobalException", [], $exceptionMessage); |
| 70 | } | 70 | } |
| 71 | //B端错误 | 71 | //B端错误 |
| 72 | elseif($exception instanceof BsideGlobalException) { | 72 | elseif($exception instanceof BsideGlobalException) { |
| 73 | - LogUtils::error("BsideGlobalException", [], $exceptionMessage); | 73 | +// LogUtils::error("BsideGlobalException", [], $exceptionMessage); |
| 74 | } | 74 | } |
| 75 | //验证错误(非手动抛出) | 75 | //验证错误(非手动抛出) |
| 76 | elseif ($exception instanceof ValidationException) { | 76 | elseif ($exception instanceof ValidationException) { |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :CreateKeywordController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/12/19 9:14 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\Optimize; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Aside\BaseController; | ||
| 14 | +use App\Http\Logic\Aside\Optimize\CreateKeywordLogic; | ||
| 15 | +use App\Models\Com\CreateKeyword; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :生成关键字 | ||
| 19 | + * @name :CreateKeywordController | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2023/12/19 9:14 | ||
| 23 | + */ | ||
| 24 | +class CreateKeywordController extends BaseController | ||
| 25 | +{ | ||
| 26 | + /** | ||
| 27 | + * @remark :根据类型获取对应的语种 | ||
| 28 | + * @name :lists | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2023/12/19 9:31 | ||
| 32 | + */ | ||
| 33 | + public function lists(CreateKeyword $createKeyword){ | ||
| 34 | + $list = $createKeyword->list($this->map); | ||
| 35 | + $this->response('success',Code::SUCCESS,$list); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @remark :保存数据 | ||
| 40 | + * @name :save | ||
| 41 | + * @author :lyh | ||
| 42 | + * @method :post | ||
| 43 | + * @time :2023/12/19 9:35 | ||
| 44 | + */ | ||
| 45 | + public function save(CreateKeywordLogic $logic){ | ||
| 46 | + $this->request->validate([ | ||
| 47 | + 'type'=>'required|integer', | ||
| 48 | + 'name'=>'required', | ||
| 49 | + ],[ | ||
| 50 | + 'type.required' => '类型不能为空', | ||
| 51 | + 'type.integer' => '类型必须为数字', | ||
| 52 | + 'name.required' => '名称不能为空', | ||
| 53 | + ]); | ||
| 54 | + $logic->saveKeyword(); | ||
| 55 | + $this->response('success'); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * @remark :创建关键字 | ||
| 60 | + * @name :createKeyword | ||
| 61 | + * @author :lyh | ||
| 62 | + * @method :post | ||
| 63 | + * @time :2023/12/19 10:12 | ||
| 64 | + */ | ||
| 65 | + public function createKeyword(CreateKeywordLogic $logic){ | ||
| 66 | + $data = $logic->createKeyword(); | ||
| 67 | + $this->response('success',Code::SUCCESS,$data); | ||
| 68 | + } | ||
| 69 | +} |
| @@ -46,23 +46,6 @@ class CNoticeController extends BaseController | @@ -46,23 +46,6 @@ class CNoticeController extends BaseController | ||
| 46 | ]; | 46 | ]; |
| 47 | http_post($url, json_encode($param)); | 47 | http_post($url, json_encode($param)); |
| 48 | $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); | 48 | $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); |
| 49 | -// $updateProgressModel = new UpdateProgress(); | ||
| 50 | -// $progressInfo = $updateProgressModel->formatQuery(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']])->orderBy('id','desc')->first(); | ||
| 51 | -// if((!empty($progressInfo))){ | ||
| 52 | -// $progressInfo = $progressInfo->toArray(); | ||
| 53 | -// if(($progressInfo['total_num'] > $progressInfo['current_num'])){ | ||
| 54 | -// $this->response('当前页面正在生成了,请完成后再点击',Code::SUCCESS,$progressInfo); | ||
| 55 | -// } | ||
| 56 | -// } | ||
| 57 | -// //通知更新 | ||
| 58 | -// if($this->param['type'] == UpdateNotify::TYPE_MASTER){ | ||
| 59 | -// $this->updateMaster(); | ||
| 60 | -// }else{ | ||
| 61 | -// $this->updateMinorLanguages(); | ||
| 62 | -// } | ||
| 63 | -// $urlStr = $this->getString($this->param['type'],$this->param['page']); | ||
| 64 | -// curlGet($urlStr); | ||
| 65 | -// $this->response('更新成功'); | ||
| 66 | } | 49 | } |
| 67 | 50 | ||
| 68 | /** | 51 | /** |
| @@ -35,14 +35,6 @@ class ComController extends BaseController | @@ -35,14 +35,6 @@ class ComController extends BaseController | ||
| 35 | $this->map = $this->getAdminMenuCondition(); | 35 | $this->map = $this->getAdminMenuCondition(); |
| 36 | } | 36 | } |
| 37 | $lists = $projectMenuModel->list($this->map,'sort'); | 37 | $lists = $projectMenuModel->list($this->map,'sort'); |
| 38 | - foreach ($lists as $k => $v){ | ||
| 39 | - $v = (array)$v; | ||
| 40 | - if(empty($this->user['is_upload_manage'])){ | ||
| 41 | - if($v['rules'] == '/fileUpload'){ | ||
| 42 | - unset($lists[$k]); | ||
| 43 | - } | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | $menu = array(); | 38 | $menu = array(); |
| 47 | foreach ($lists as $k => $v){ | 39 | foreach ($lists as $k => $v){ |
| 48 | $v = (array)$v; | 40 | $v = (array)$v; |
| @@ -94,15 +86,24 @@ class ComController extends BaseController | @@ -94,15 +86,24 @@ class ComController extends BaseController | ||
| 94 | * @time :2023/9/6 11:47 | 86 | * @time :2023/9/6 11:47 |
| 95 | */ | 87 | */ |
| 96 | public function getNoAdminMenuCondition(){ | 88 | public function getNoAdminMenuCondition(){ |
| 97 | - $code = $this->getIsHome(); | ||
| 98 | $projectRoleModel = new ProjectRoleModel(); | 89 | $projectRoleModel = new ProjectRoleModel(); |
| 99 | $info = $projectRoleModel->read(['id'=>$this->user['role_id']]); | 90 | $info = $projectRoleModel->read(['id'=>$this->user['role_id']]); |
| 100 | if($info === false){ | 91 | if($info === false){ |
| 101 | $this->fail('当前登录角色不存在'); | 92 | $this->fail('当前登录角色不存在'); |
| 102 | }else{ | 93 | }else{ |
| 94 | + $code = $this->getIsHome(); | ||
| 103 | if($code != 1){ | 95 | if($code != 1){ |
| 104 | $info['role_menu'] = trim(str_replace(',11,',',',','.$info['role_menu'].','),','); | 96 | $info['role_menu'] = trim(str_replace(',11,',',',','.$info['role_menu'].','),','); |
| 105 | } | 97 | } |
| 98 | + $blogCode = $this->getIsBlog(); | ||
| 99 | + if($blogCode != 1){ | ||
| 100 | + $info['role_menu'] = trim(str_replace(',16,',',',','.$info['role_menu'].','),','); | ||
| 101 | + $info['role_menu'] = trim(str_replace(',17,',',',','.$info['role_menu'].','),','); | ||
| 102 | + } | ||
| 103 | + $uploadCode = $this->getIsUpload(); | ||
| 104 | + if($uploadCode != 1){ | ||
| 105 | + $info['role_menu'] = trim(str_replace(',41,',',',','.$info['role_menu'].','),','); | ||
| 106 | + } | ||
| 106 | $this->map = [ | 107 | $this->map = [ |
| 107 | 'status'=>0, | 108 | 'status'=>0, |
| 108 | 'is_role'=>0, | 109 | 'is_role'=>0, |
| @@ -120,10 +121,23 @@ class ComController extends BaseController | @@ -120,10 +121,23 @@ class ComController extends BaseController | ||
| 120 | * @time :2023/9/6 13:53 | 121 | * @time :2023/9/6 13:53 |
| 121 | */ | 122 | */ |
| 122 | public function getAdminMenuCondition(){ | 123 | public function getAdminMenuCondition(){ |
| 124 | + $data = []; | ||
| 123 | $this->map['status'] = 0; | 125 | $this->map['status'] = 0; |
| 124 | - $code = $this->getIsHome(); | 126 | + $code = $this->getIsHome();//是否开启首页 |
| 125 | if($code != 1){ | 127 | if($code != 1){ |
| 126 | - $this->map['id'] = ['!=',11];//排除菜单网站装修 | 128 | + $data[] = 11; |
| 129 | + } | ||
| 130 | + $blogCode = $this->getIsBlog();//是否开启blog | ||
| 131 | + if($blogCode != 1){ | ||
| 132 | + $data[] = 16; | ||
| 133 | + $data[] = 17; | ||
| 134 | + } | ||
| 135 | + $uploadCode = $this->getIsUpload();//是否开启上传 | ||
| 136 | + if($uploadCode != 1){ | ||
| 137 | + $data[] = 41; | ||
| 138 | + } | ||
| 139 | + if(!empty($data)){ | ||
| 140 | + $this->map['id'] = ['not in',$data]; | ||
| 127 | } | 141 | } |
| 128 | return $this->map; | 142 | return $this->map; |
| 129 | } | 143 | } |
| @@ -152,6 +166,34 @@ class ComController extends BaseController | @@ -152,6 +166,34 @@ class ComController extends BaseController | ||
| 152 | } | 166 | } |
| 153 | 167 | ||
| 154 | /** | 168 | /** |
| 169 | + * @remark :是否开启上传配置 | ||
| 170 | + * @name :getIsUpload | ||
| 171 | + * @author :lyh | ||
| 172 | + * @method :post | ||
| 173 | + * @time :2023/12/19 17:22 | ||
| 174 | + */ | ||
| 175 | + public function getIsUpload(){ | ||
| 176 | + if($this->user['is_upload_manage'] != 0){ | ||
| 177 | + return 1; | ||
| 178 | + } | ||
| 179 | + return 0; | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + /** | ||
| 183 | + * @remark :是否显示博客 | ||
| 184 | + * @name :getIsBlog | ||
| 185 | + * @author :lyh | ||
| 186 | + * @method :post | ||
| 187 | + * @time :2023/12/19 16:44 | ||
| 188 | + */ | ||
| 189 | + public function getIsBlog(){ | ||
| 190 | + if($this->user['is_show_blog'] != 0){ | ||
| 191 | + return 1;//不显示 | ||
| 192 | + } | ||
| 193 | + return 0; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + /** | ||
| 155 | * @name :登录用户编辑资料/修改密码 | 197 | * @name :登录用户编辑资料/修改密码 |
| 156 | * @author :liyuhang | 198 | * @author :liyuhang |
| 157 | * @method | 199 | * @method |
| @@ -9,7 +9,6 @@ use App\Http\Requests\Bside\Blog\BlogRequest; | @@ -9,7 +9,6 @@ use App\Http\Requests\Bside\Blog\BlogRequest; | ||
| 9 | use App\Models\Blog\Blog as BlogModel; | 9 | use App\Models\Blog\Blog as BlogModel; |
| 10 | use App\Models\Blog\BlogCategory; | 10 | use App\Models\Blog\BlogCategory; |
| 11 | use App\Models\Blog\BlogCategory as BlogCategoryModel; | 11 | use App\Models\Blog\BlogCategory as BlogCategoryModel; |
| 12 | -use App\Models\Product\Category; | ||
| 13 | use App\Models\RouteMap\RouteMap; | 12 | use App\Models\RouteMap\RouteMap; |
| 14 | use App\Models\User\User; | 13 | use App\Models\User\User; |
| 15 | 14 | ||
| @@ -56,12 +55,8 @@ class BlogController extends BaseController | @@ -56,12 +55,8 @@ class BlogController extends BaseController | ||
| 56 | $query = $query->where('project_id',$this->user['project_id']); | 55 | $query = $query->where('project_id',$this->user['project_id']); |
| 57 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { | 56 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { |
| 58 | $str = []; | 57 | $str = []; |
| 59 | - $this->getLastLevelIds($this->map['category_id'],$str); | ||
| 60 | - $query->where(function ($subQuery) use ($str) { | ||
| 61 | - foreach ($str as $v) { | ||
| 62 | - $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); | ||
| 63 | - } | ||
| 64 | - }); | 58 | + $this->getAllSub($this->map['category_id'],$str); |
| 59 | + $query = $query->whereIn('category_id',$str); | ||
| 65 | } | 60 | } |
| 66 | if(isset($this->map['status'])){ | 61 | if(isset($this->map['status'])){ |
| 67 | $query = $query->where('status',$this->map['status']); | 62 | $query = $query->where('status',$this->map['status']); |
| @@ -76,24 +71,22 @@ class BlogController extends BaseController | @@ -76,24 +71,22 @@ class BlogController extends BaseController | ||
| 76 | } | 71 | } |
| 77 | 72 | ||
| 78 | /** | 73 | /** |
| 79 | - * @remark :获取当前分类的最后一级id | ||
| 80 | - * @name :getLastLevelIds | 74 | + * @remark :获取当前id下所有子集 |
| 75 | + * @name :getAllSub | ||
| 81 | * @author :lyh | 76 | * @author :lyh |
| 82 | * @method :post | 77 | * @method :post |
| 83 | - * @time :2023/10/20 15:02 | 78 | + * @time :2023/10/18 15:10 |
| 84 | */ | 79 | */ |
| 85 | - public function getLastLevelIds($id, &$str = []) { | ||
| 86 | - $cateModel = new BlogCategoryModel(); | ||
| 87 | - $subList = $cateModel->where('pid', $id)->get(); | ||
| 88 | - if ($subList->isEmpty()) { | ||
| 89 | - // 如果没有子集,将当前 ID 添加到最后一级 ID 数组 | ||
| 90 | - $str[] = $id; | ||
| 91 | - } else { | ||
| 92 | - // 如果有子集,继续向下遍历 | ||
| 93 | - foreach ($subList as $v) { | ||
| 94 | - $this->getLastLevelIds($v->id, $str); | 80 | + public function getAllSub($id,&$str = []){ |
| 81 | + $cateModel = new BlogCategory(); | ||
| 82 | + $list = $cateModel->list(['pid'=>$id,'status'=>1],['id','pid']); | ||
| 83 | + if(!empty($list)){ | ||
| 84 | + foreach ($list as $v){ | ||
| 85 | + $str[] = $v['id']; | ||
| 86 | + $this->getAllSub($v['id'],$str); | ||
| 95 | } | 87 | } |
| 96 | } | 88 | } |
| 89 | + return $str; | ||
| 97 | } | 90 | } |
| 98 | 91 | ||
| 99 | /** | 92 | /** |
| @@ -158,7 +151,7 @@ class BlogController extends BaseController | @@ -158,7 +151,7 @@ class BlogController extends BaseController | ||
| 158 | public function get_category_list(){ | 151 | public function get_category_list(){ |
| 159 | $this->map['status'] = 0; | 152 | $this->map['status'] = 0; |
| 160 | $this->map['project_id'] = $this->user['project_id']; | 153 | $this->map['project_id'] = $this->user['project_id']; |
| 161 | - $blogCategoryModel = new BlogCategoryModel(); | 154 | + $blogCategoryModel = new BlogCategory(); |
| 162 | $cate_list = $blogCategoryModel->list($this->map,'sort'); | 155 | $cate_list = $blogCategoryModel->list($this->map,'sort'); |
| 163 | if($cate_list === false){ | 156 | if($cate_list === false){ |
| 164 | $this->fail('error',Code::USER_ERROR); | 157 | $this->fail('error',Code::USER_ERROR); |
| @@ -300,4 +300,8 @@ class LoginController extends BaseController | @@ -300,4 +300,8 @@ class LoginController extends BaseController | ||
| 300 | return $data; | 300 | return $data; |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | + public function ceshi(){ | ||
| 304 | + $ceshi = Translate::tran('Полностью Сварной Пластинчатый Теплообменник', 'en'); | ||
| 305 | + return $ceshi; | ||
| 306 | + } | ||
| 303 | } | 307 | } |
| @@ -8,6 +8,7 @@ use App\Http\Controllers\Bside\BaseController; | @@ -8,6 +8,7 @@ use App\Http\Controllers\Bside\BaseController; | ||
| 8 | use App\Http\Logic\Bside\Nav\NavLogic; | 8 | use App\Http\Logic\Bside\Nav\NavLogic; |
| 9 | use App\Http\Requests\Bside\Nav\NavRequest; | 9 | use App\Http\Requests\Bside\Nav\NavRequest; |
| 10 | use App\Models\Nav\BNav; | 10 | use App\Models\Nav\BNav; |
| 11 | +use App\Models\Nav\BNavGroup; | ||
| 11 | 12 | ||
| 12 | /** | 13 | /** |
| 13 | * 导航栏目 b端编辑 c端显示 | 14 | * 导航栏目 b端编辑 c端显示 |
| @@ -27,9 +28,15 @@ class NavController extends BaseController | @@ -27,9 +28,15 @@ class NavController extends BaseController | ||
| 27 | * @method :post | 28 | * @method :post |
| 28 | * @time :2023/12/4 15:00 | 29 | * @time :2023/12/4 15:00 |
| 29 | */ | 30 | */ |
| 30 | - public function index(BNav $nav){ | 31 | + public function index(BNav $nav,BNavGroup $navGroup){ |
| 31 | $this->map['project_id'] = $this->user['project_id']; | 32 | $this->map['project_id'] = $this->user['project_id']; |
| 32 | $lists = $nav->list($this->map,$this->order = ['sort','id']); | 33 | $lists = $nav->list($this->map,$this->order = ['sort','id']); |
| 34 | + //获取菜单组排序字段 | ||
| 35 | + $groupInfo = $navGroup->read(['id'=>$this->param['group_id']]); | ||
| 36 | + if(!empty($groupInfo['sort_list'])){ | ||
| 37 | + $sort_list = json_decode($groupInfo['sort_list']); | ||
| 38 | + $data = $this->findDetailsList($sort_list,$lists); | ||
| 39 | + }else{ | ||
| 33 | $data = array(); | 40 | $data = array(); |
| 34 | foreach ($lists as $v){ | 41 | foreach ($lists as $v){ |
| 35 | $v = (array)$v; | 42 | $v = (array)$v; |
| @@ -38,10 +45,36 @@ class NavController extends BaseController | @@ -38,10 +45,36 @@ class NavController extends BaseController | ||
| 38 | $data[] = $v; | 45 | $data[] = $v; |
| 39 | } | 46 | } |
| 40 | } | 47 | } |
| 48 | + } | ||
| 41 | $this->response('success',Code::SUCCESS,$data); | 49 | $this->response('success',Code::SUCCESS,$data); |
| 42 | } | 50 | } |
| 43 | 51 | ||
| 44 | - | 52 | + /** |
| 53 | + * @remark :根据固定的数组排序 | ||
| 54 | + * @name :findDetailsInList | ||
| 55 | + * @author :lyh | ||
| 56 | + * @method :post | ||
| 57 | + * @time :2023/12/18 14:54 | ||
| 58 | + */ | ||
| 59 | + public function findDetailsList($data, $detailsList) { | ||
| 60 | + $result = []; | ||
| 61 | + foreach ($data as $item) { | ||
| 62 | + $items = $item = (array)$item; | ||
| 63 | + $id = $item['id']; | ||
| 64 | + // 在给定的详情列表中查找匹配的id | ||
| 65 | + $matchingDetail = array_filter($detailsList, function ($detail) use ($id) { | ||
| 66 | + return $detail['id'] == $id; | ||
| 67 | + }); | ||
| 68 | + if (!empty($matchingDetail)) { | ||
| 69 | + $items = reset($matchingDetail); | ||
| 70 | + } | ||
| 71 | + if (!empty($item['sub'])) { | ||
| 72 | + $items['sub'] = $this->findDetailsList((array)$item['sub'], $detailsList); | ||
| 73 | + } | ||
| 74 | + $result[] = $items; | ||
| 75 | + } | ||
| 76 | + return $result; | ||
| 77 | + } | ||
| 45 | 78 | ||
| 46 | /** | 79 | /** |
| 47 | * @remark :获取当前id下的所有子集 | 80 | * @remark :获取当前id下的所有子集 |
| @@ -137,4 +170,21 @@ class NavController extends BaseController | @@ -137,4 +170,21 @@ class NavController extends BaseController | ||
| 137 | $navLogic->importNav(); | 170 | $navLogic->importNav(); |
| 138 | $this->response('success'); | 171 | $this->response('success'); |
| 139 | } | 172 | } |
| 173 | + | ||
| 174 | + /** | ||
| 175 | + * @remark :菜单列表排序 | ||
| 176 | + * @name :setSortList | ||
| 177 | + * @author :lyh | ||
| 178 | + * @method :post | ||
| 179 | + * @time :2023/12/18 13:44 | ||
| 180 | + */ | ||
| 181 | + public function setSortList(NavLogic $navLogic){ | ||
| 182 | + $this->request->validate([ | ||
| 183 | + 'id'=>'required' | ||
| 184 | + ],[ | ||
| 185 | + 'id.required' => 'ID不能为空', | ||
| 186 | + ]); | ||
| 187 | + $navLogic->setSortList(); | ||
| 188 | + $this->response('success'); | ||
| 189 | + } | ||
| 140 | } | 190 | } |
| @@ -58,12 +58,8 @@ class NewsController extends BaseController | @@ -58,12 +58,8 @@ class NewsController extends BaseController | ||
| 58 | $query = $query->where('project_id',$this->user['project_id']); | 58 | $query = $query->where('project_id',$this->user['project_id']); |
| 59 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { | 59 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { |
| 60 | $str = []; | 60 | $str = []; |
| 61 | - $this->getLastLevelIds($this->map['category_id'],$str); | ||
| 62 | - $query->where(function ($subQuery) use ($str) { | ||
| 63 | - foreach ($str as $v) { | ||
| 64 | - $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); | ||
| 65 | - } | ||
| 66 | - }); | 61 | + $this->getAllSub($this->map['category_id'],$str); |
| 62 | + $query = $query->whereIn('category_id',$str); | ||
| 67 | } | 63 | } |
| 68 | if(isset($this->map['status'])){ | 64 | if(isset($this->map['status'])){ |
| 69 | $query = $query->where('status',$this->map['status']); | 65 | $query = $query->where('status',$this->map['status']); |
| @@ -78,24 +74,22 @@ class NewsController extends BaseController | @@ -78,24 +74,22 @@ class NewsController extends BaseController | ||
| 78 | } | 74 | } |
| 79 | 75 | ||
| 80 | /** | 76 | /** |
| 81 | - * @remark :获取当前分类的最后一级id | ||
| 82 | - * @name :getLastLevelIds | 77 | + * @remark :获取当前id下所有子集 |
| 78 | + * @name :getAllSub | ||
| 83 | * @author :lyh | 79 | * @author :lyh |
| 84 | * @method :post | 80 | * @method :post |
| 85 | - * @time :2023/10/20 15:02 | 81 | + * @time :2023/10/18 15:10 |
| 86 | */ | 82 | */ |
| 87 | - public function getLastLevelIds($id, &$str = []) { | 83 | + public function getAllSub($id,&$str = []){ |
| 88 | $cateModel = new NewsCategory(); | 84 | $cateModel = new NewsCategory(); |
| 89 | - $subList = $cateModel->where('pid', $id)->get(); | ||
| 90 | - if ($subList->isEmpty()) { | ||
| 91 | - // 如果没有子集,将当前 ID 添加到最后一级 ID 数组 | ||
| 92 | - $str[] = $id; | ||
| 93 | - } else { | ||
| 94 | - // 如果有子集,继续向下遍历 | ||
| 95 | - foreach ($subList as $v) { | ||
| 96 | - $this->getLastLevelIds($v->id, $str); | 85 | + $list = $cateModel->list(['pid'=>$id,'status'=>1],['id','pid']); |
| 86 | + if(!empty($list)){ | ||
| 87 | + foreach ($list as $v){ | ||
| 88 | + $str[] = $v['id']; | ||
| 89 | + $this->getAllSub($v['id'],$str); | ||
| 97 | } | 90 | } |
| 98 | } | 91 | } |
| 92 | + return $str; | ||
| 99 | } | 93 | } |
| 100 | 94 | ||
| 101 | /** | 95 | /** |
| @@ -86,7 +86,7 @@ class CategoryController extends BaseController | @@ -86,7 +86,7 @@ class CategoryController extends BaseController | ||
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | /** | 88 | /** |
| 89 | - * @name :(添加/编辑时获取顶级分类)topList | 89 | + * @name :(添加/编辑时获取分类)topList |
| 90 | * @author :lyh | 90 | * @author :lyh |
| 91 | * @method :post | 91 | * @method :post |
| 92 | * @time :2023/6/13 9:03 | 92 | * @time :2023/6/13 9:03 |
| @@ -79,12 +79,8 @@ class ProductController extends BaseController | @@ -79,12 +79,8 @@ class ProductController extends BaseController | ||
| 79 | $query = $query->where('project_id',$this->user['project_id']); | 79 | $query = $query->where('project_id',$this->user['project_id']); |
| 80 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { | 80 | if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { |
| 81 | $str = []; | 81 | $str = []; |
| 82 | - $this->getLastLevelIds($this->map['category_id'],$str); | ||
| 83 | - $query->where(function ($subQuery) use ($str) { | ||
| 84 | - foreach ($str as $v) { | ||
| 85 | - $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); | ||
| 86 | - } | ||
| 87 | - }); | 82 | + $this->getAllSub($this->map['category_id'],$str); |
| 83 | + $query = $query->whereIn('category_id',$str); | ||
| 88 | } | 84 | } |
| 89 | if(isset($this->map['title']) && !empty($this->map['title'])){ | 85 | if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 90 | $query = $query->where('title','like','%'.$this->map['title'].'%'); | 86 | $query = $query->where('title','like','%'.$this->map['title'].'%'); |
| @@ -99,24 +95,22 @@ class ProductController extends BaseController | @@ -99,24 +95,22 @@ class ProductController extends BaseController | ||
| 99 | } | 95 | } |
| 100 | 96 | ||
| 101 | /** | 97 | /** |
| 102 | - * @remark :获取当前分类的最后一级id | ||
| 103 | - * @name :getLastLevelIds | 98 | + * @remark :获取当前id下所有子集 |
| 99 | + * @name :getAllSub | ||
| 104 | * @author :lyh | 100 | * @author :lyh |
| 105 | * @method :post | 101 | * @method :post |
| 106 | - * @time :2023/10/20 15:02 | 102 | + * @time :2023/10/18 15:10 |
| 107 | */ | 103 | */ |
| 108 | - public function getLastLevelIds($id, &$str = []) { | 104 | + public function getAllSub($id,&$str = []){ |
| 109 | $cateModel = new Category(); | 105 | $cateModel = new Category(); |
| 110 | - $subList = $cateModel->where('pid', $id)->get(); | ||
| 111 | - if ($subList->isEmpty()) { | ||
| 112 | - // 如果没有子集,将当前 ID 添加到最后一级 ID 数组 | ||
| 113 | - $str[] = $id; | ||
| 114 | - } else { | ||
| 115 | - // 如果有子集,继续向下遍历 | ||
| 116 | - foreach ($subList as $v) { | ||
| 117 | - $this->getLastLevelIds($v->id, $str); | 106 | + $list = $cateModel->list(['pid'=>$id,'status'=>1],['id','pid']); |
| 107 | + if(!empty($list)){ | ||
| 108 | + foreach ($list as $v){ | ||
| 109 | + $str[] = $v['id']; | ||
| 110 | + $this->getAllSub($v['id'],$str); | ||
| 118 | } | 111 | } |
| 119 | } | 112 | } |
| 113 | + return $str; | ||
| 120 | } | 114 | } |
| 121 | 115 | ||
| 122 | /** | 116 | /** |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :CreateKeywordLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/12/19 9:45 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Aside\Optimize; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | +use App\Models\Com\CreateKeyword; | ||
| 14 | + | ||
| 15 | +class CreateKeywordLogic extends BaseLogic | ||
| 16 | +{ | ||
| 17 | + public function __construct() | ||
| 18 | + { | ||
| 19 | + parent::__construct(); | ||
| 20 | + $this->model = new CreateKeyword(); | ||
| 21 | + $this->param = $this->requestAll; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * @remark :保存关键字 | ||
| 26 | + * @name :saveCreateKeyword | ||
| 27 | + * @author :lyh | ||
| 28 | + * @method :post | ||
| 29 | + * @time :2023/12/19 9:47 | ||
| 30 | + */ | ||
| 31 | + public function saveKeyword(){ | ||
| 32 | + $data = $this->handleParam($this->param); | ||
| 33 | + try { | ||
| 34 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 35 | + $this->model->edit($data,['id'=>$this->param['id']]); | ||
| 36 | + }else{ | ||
| 37 | + $this->model->add($data); | ||
| 38 | + } | ||
| 39 | + }catch (\Exception $e){ | ||
| 40 | + $this->fail('保存失败,请联系管理员'); | ||
| 41 | + } | ||
| 42 | + return $this->success(); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @remark :请求参数处理 | ||
| 47 | + * @name :handleParam | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2023/12/19 10:03 | ||
| 51 | + */ | ||
| 52 | + public function handleParam($param){ | ||
| 53 | + $data = [ | ||
| 54 | + 'type'=>$param['type'], | ||
| 55 | + 'name'=>$param['name'], | ||
| 56 | + 'language_id'=>$param['language_id'] ?? 0 | ||
| 57 | + ]; | ||
| 58 | + if(!isset($param['id'])){ | ||
| 59 | + $info = $this->model->read($data); | ||
| 60 | + if($info !== false){ | ||
| 61 | + $this->fail('当前名称已存在'); | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + return $this->success($data); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * @remark :创建关键词 | ||
| 69 | + * @name :createKeyword | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2023/12/19 10:48 | ||
| 73 | + */ | ||
| 74 | + public function createKeyword(){ | ||
| 75 | + $data = array(); | ||
| 76 | + if(empty($this->param['keyword'])){ | ||
| 77 | + return $this->success($data); | ||
| 78 | + } | ||
| 79 | + $prefix_keyword = $this->prefixKeyword($this->param['prefix'] ?? [],$this->param['keyword']); | ||
| 80 | + $keyword_suffix = $this->keywordSuffix($this->param['suffix'] ?? [],$this->param['keyword']); | ||
| 81 | + $prefix_keyword_suffix = $this->prefixKeywordSuffix($this->param['prefix'] ?? [],$this->param['suffix'] ?? [],$this->param['keyword']); | ||
| 82 | + $data = [ | ||
| 83 | + 'prefix_keyword'=>$prefix_keyword, | ||
| 84 | + 'keyword_suffix'=>$keyword_suffix, | ||
| 85 | + 'prefix_keyword_suffix'=>$prefix_keyword_suffix | ||
| 86 | + ]; | ||
| 87 | + return $this->success($data); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * @remark :前缀+关键词 | ||
| 92 | + * @name : | ||
| 93 | + * @author :lyh | ||
| 94 | + * @method :post | ||
| 95 | + * @time :2023/12/19 11:11 | ||
| 96 | + */ | ||
| 97 | + public function prefixKeyword($prefix,$keyword){ | ||
| 98 | + $prefix_keyword = array(); | ||
| 99 | + if(!empty($prefix)){//前缀+关键词 | ||
| 100 | + foreach ($keyword as $keywordItem){ | ||
| 101 | + foreach ($prefix as $prefixItem) { | ||
| 102 | + $prefix_keyword[] =$prefixItem.' '.$keywordItem; | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + return $this->success($prefix_keyword); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + /** | ||
| 110 | + * @remark :关键词+后缀 | ||
| 111 | + * @name : | ||
| 112 | + * @author :lyh | ||
| 113 | + * @method :post | ||
| 114 | + * @time :2023/12/19 11:11 | ||
| 115 | + */ | ||
| 116 | + public function keywordSuffix($suffix,$keyword){ | ||
| 117 | + $suffix_keyword = array(); | ||
| 118 | + if(!empty($suffix)){//前缀+关键词 | ||
| 119 | + foreach ($keyword as $keywordItem){ | ||
| 120 | + foreach ($suffix as $suffixItem) { | ||
| 121 | + $suffix_keyword[] = $keywordItem.' '.$suffixItem; | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + return $this->success($suffix_keyword); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + /** | ||
| 129 | + * @remark :前缀+关键词+后缀 | ||
| 130 | + * @name :prefixKeywordSuffix | ||
| 131 | + * @author :lyh | ||
| 132 | + * @method :post | ||
| 133 | + * @time :2023/12/19 11:59 | ||
| 134 | + */ | ||
| 135 | + public function prefixKeywordSuffix($prefix,$suffix,$keyword){ | ||
| 136 | + $prefix_keyword_suffix = array(); | ||
| 137 | + if(!empty($prefix) && !empty($suffix)){ | ||
| 138 | + foreach ($keyword as $keywordItem){ | ||
| 139 | + foreach ($prefix as $prefixItem) { | ||
| 140 | + foreach ($suffix as $suffixItem) { | ||
| 141 | + $prefix_keyword_suffix[] = $prefixItem.' '.$keywordItem.' '.$suffixItem; | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + return $this->success($prefix_keyword_suffix); | ||
| 147 | + } | ||
| 148 | +} |
| @@ -714,7 +714,7 @@ class ProjectLogic extends BaseLogic | @@ -714,7 +714,7 @@ class ProjectLogic extends BaseLogic | ||
| 714 | 'company_name'=>$projectInfo['company'], | 714 | 'company_name'=>$projectInfo['company'], |
| 715 | 'principal_mobile'=>$projectInfo['mobile'], | 715 | 'principal_mobile'=>$projectInfo['mobile'], |
| 716 | 'remark'=>'', | 716 | 'remark'=>'', |
| 717 | - 'exclusive_aicc_day'=>$projectInfo['exclusive_aicc_day'] ?: 1, | 717 | + 'exclusive_aicc_day'=>$this->param['exclusive_aicc_day'] ?: 1, |
| 718 | 'from_order_id'=>$projectInfo['from_order_id'] | 718 | 'from_order_id'=>$projectInfo['from_order_id'] |
| 719 | ]; | 719 | ]; |
| 720 | $this->toAicc($data); | 720 | $this->toAicc($data); |
| @@ -724,7 +724,7 @@ class ProjectLogic extends BaseLogic | @@ -724,7 +724,7 @@ class ProjectLogic extends BaseLogic | ||
| 724 | $data = [ | 724 | $data = [ |
| 725 | 'company_name'=>$projectInfo['company'], | 725 | 'company_name'=>$projectInfo['company'], |
| 726 | 'principal_mobile'=>$projectInfo['mobile'], | 726 | 'principal_mobile'=>$projectInfo['mobile'], |
| 727 | - 'exclusive_hagro_day'=>$projectInfo['exclusive_hagro_day'] ?: 1, | 727 | + 'exclusive_hagro_day'=>$this->param['exclusive_hagro_day'] ?: 1, |
| 728 | 'from_order_id'=>$projectInfo['from_order_id'], | 728 | 'from_order_id'=>$projectInfo['from_order_id'], |
| 729 | 'company_id'=>$projectInfo['channel']['channel_id'] | 729 | 'company_id'=>$projectInfo['channel']['channel_id'] |
| 730 | ]; | 730 | ]; |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace App\Http\Logic\Aside\Template; | 3 | namespace App\Http\Logic\Aside\Template; |
| 4 | 4 | ||
| 5 | use App\Http\Logic\Aside\BaseLogic; | 5 | use App\Http\Logic\Aside\BaseLogic; |
| 6 | +use App\Models\RouteMap\RouteMap; | ||
| 6 | use App\Models\Service\Service as ServiceSettingModel; | 7 | use App\Models\Service\Service as ServiceSettingModel; |
| 7 | use App\Models\Template\BTemplate; | 8 | use App\Models\Template\BTemplate; |
| 8 | use App\Models\Template\BTemplateCommon; | 9 | use App\Models\Template\BTemplateCommon; |
| @@ -222,6 +223,7 @@ class ATemplateLogic extends BaseLogic | @@ -222,6 +223,7 @@ class ATemplateLogic extends BaseLogic | ||
| 222 | ]; | 223 | ]; |
| 223 | $bCommonTemplateModel->add($commonData); | 224 | $bCommonTemplateModel->add($commonData); |
| 224 | } | 225 | } |
| 226 | + RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $project_id); | ||
| 225 | DB::disconnect('custom_mysql'); | 227 | DB::disconnect('custom_mysql'); |
| 226 | return $this->success(); | 228 | return $this->success(); |
| 227 | } | 229 | } |
| @@ -667,15 +667,20 @@ class BTemplateLogic extends BaseLogic | @@ -667,15 +667,20 @@ class BTemplateLogic extends BaseLogic | ||
| 667 | * @method :any | 667 | * @method :any |
| 668 | * @time :2023/7/17 16:03 | 668 | * @time :2023/7/17 16:03 |
| 669 | */ | 669 | */ |
| 670 | + /** | ||
| 671 | + * @remark :获取类型 | ||
| 672 | + * @name :getModuleType | ||
| 673 | + * @author :lyh | ||
| 674 | + * @method :any | ||
| 675 | + * @time :2023/7/17 16:03 | ||
| 676 | + */ | ||
| 670 | public function getModuleType(): array | 677 | public function getModuleType(): array |
| 671 | { | 678 | { |
| 672 | //定义数据结构 | 679 | //定义数据结构 |
| 673 | $data = $this->model->product_type; | 680 | $data = $this->model->product_type; |
| 674 | - //产品,新闻,博客,一级分类数据 | ||
| 675 | - $map = ['pid'=>0, 'project_id'=>$this->user['project_id']]; | ||
| 676 | - $productCategory = Category::where($map)->get(); | ||
| 677 | - $newCategory = NewsCategory::where($map)->get(); | ||
| 678 | - $blogCategory = BlogCategory::where($map)->get(); | 681 | + $productCategory = $this->getCategoryList((new Category()),1); |
| 682 | + $newCategory = $this->getCategoryList((new NewsCategory())); | ||
| 683 | + $blogCategory = $this->getCategoryList((new BlogCategory())); | ||
| 679 | if (!empty($productCategory)){ | 684 | if (!empty($productCategory)){ |
| 680 | foreach ($productCategory as $item){$data["products"]["category"][] =$item;} | 685 | foreach ($productCategory as $item){$data["products"]["category"][] =$item;} |
| 681 | } | 686 | } |
| @@ -690,6 +695,26 @@ class BTemplateLogic extends BaseLogic | @@ -690,6 +695,26 @@ class BTemplateLogic extends BaseLogic | ||
| 690 | } | 695 | } |
| 691 | 696 | ||
| 692 | /** | 697 | /** |
| 698 | + * @remark :获取1级+2级 | ||
| 699 | + * @name :getCategoryList | ||
| 700 | + * @author :lyh | ||
| 701 | + * @method :post | ||
| 702 | + * @time :2023/12/20 10:26 | ||
| 703 | + */ | ||
| 704 | + public function getCategoryList($categoryModel,$status = 0){ | ||
| 705 | + $data = array(); | ||
| 706 | + $list = $categoryModel->list(['pid'=>0,'status'=>$status]); | ||
| 707 | + foreach ($list as $v){ | ||
| 708 | + $data[] = $v; | ||
| 709 | + $son_list = $categoryModel->list(['pid'=>$v['id'],'status'=>$status]); | ||
| 710 | + foreach ($son_list as $v1){ | ||
| 711 | + $data[] = $v1; | ||
| 712 | + } | ||
| 713 | + } | ||
| 714 | + return $this->success($data); | ||
| 715 | + } | ||
| 716 | + | ||
| 717 | + /** | ||
| 693 | * @remark :保存html | 718 | * @remark :保存html |
| 694 | * @name :savePublicTemplateHtml | 719 | * @name :savePublicTemplateHtml |
| 695 | * @author :lyh | 720 | * @author :lyh |
| @@ -34,7 +34,6 @@ class BlogCategoryLogic extends BaseLogic | @@ -34,7 +34,6 @@ class BlogCategoryLogic extends BaseLogic | ||
| 34 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 34 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 35 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']); | 35 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']); |
| 36 | $route = $this->param['alias']; | 36 | $route = $this->param['alias']; |
| 37 | - $this->editHandleCategory($this->param['id'],$this->param['pid']); | ||
| 38 | $this->param['operator_id'] = $this->user['id']; | 37 | $this->param['operator_id'] = $this->user['id']; |
| 39 | $this->edit($this->param,['id'=>$this->param['id']]); | 38 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 40 | }else{ | 39 | }else{ |
| @@ -47,8 +46,6 @@ class BlogCategoryLogic extends BaseLogic | @@ -47,8 +46,6 @@ class BlogCategoryLogic extends BaseLogic | ||
| 47 | $id = $this->model->addReturnId($this->param); | 46 | $id = $this->model->addReturnId($this->param); |
| 48 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); | 47 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); |
| 49 | $this->edit(['alias'=>$route],['id'=>$id]); | 48 | $this->edit(['alias'=>$route],['id'=>$id]); |
| 50 | - //处理子集 | ||
| 51 | - $this->addProcessingSon($id); | ||
| 52 | } | 49 | } |
| 53 | DB::commit(); | 50 | DB::commit(); |
| 54 | }catch (\Exception $e){ | 51 | }catch (\Exception $e){ |
| @@ -61,48 +58,6 @@ class BlogCategoryLogic extends BaseLogic | @@ -61,48 +58,6 @@ class BlogCategoryLogic extends BaseLogic | ||
| 61 | } | 58 | } |
| 62 | 59 | ||
| 63 | /** | 60 | /** |
| 64 | - * @remark :编辑分类,处理博客数据 | ||
| 65 | - * @name :editCategory | ||
| 66 | - * @author :lyh | ||
| 67 | - * @method :post | ||
| 68 | - * @time :2023/10/20 9:32 | ||
| 69 | - */ | ||
| 70 | - public function editHandleCategory($id,$pid){ | ||
| 71 | - $info = $this->model->read(['id'=>$id],['id','pid']); | ||
| 72 | - if($info['pid'] != $pid){ | ||
| 73 | - //修改勒上级,先查看上级是否拥有博客 | ||
| 74 | - $blogModel = new BlogModel(); | ||
| 75 | - $blogCount = $blogModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count(); | ||
| 76 | - if($blogCount > 0){ | ||
| 77 | - //随机获取最后一级id | ||
| 78 | - $replacement = $this->getLastId($id); | ||
| 79 | - //存在博客时,移动所有博客到当前分类最后一级 | ||
| 80 | - $blogModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%') | ||
| 81 | - ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]); | ||
| 82 | - $blogModel->where('category_id', 'like', '%,' . $pid . ',%') | ||
| 83 | - ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',$replacement,')")]); | ||
| 84 | - } | ||
| 85 | - } | ||
| 86 | - return $this->success(); | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - /** | ||
| 90 | - * @remark :随机获取当前id下最后一级的id | ||
| 91 | - * @name :getLastId | ||
| 92 | - * @author :lyh | ||
| 93 | - * @method :post | ||
| 94 | - * @time :2023/10/20 9:45 | ||
| 95 | - */ | ||
| 96 | - public function getLastId($id){ | ||
| 97 | - $info = $this->model->read(['pid'=>$id],['id']); | ||
| 98 | - if($info !== false){ | ||
| 99 | - return $this->getLastId($info['id']); | ||
| 100 | - }else{ | ||
| 101 | - return $id; | ||
| 102 | - } | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - /** | ||
| 106 | * @name :详情 | 61 | * @name :详情 |
| 107 | * @return array | 62 | * @return array |
| 108 | * @author :liyuhang | 63 | * @author :liyuhang |
| @@ -248,37 +203,6 @@ class BlogCategoryLogic extends BaseLogic | @@ -248,37 +203,6 @@ class BlogCategoryLogic extends BaseLogic | ||
| 248 | } | 203 | } |
| 249 | 204 | ||
| 250 | /** | 205 | /** |
| 251 | - * @param $cate_id | ||
| 252 | - * @name :(处理子集)addProcessingSon | ||
| 253 | - * @author :lyh | ||
| 254 | - * @method :post | ||
| 255 | - * @time :2023/6/13 11:59 | ||
| 256 | - */ | ||
| 257 | - public function addProcessingSon($cate_id){ | ||
| 258 | - if(!isset($this->param['pid'])){ | ||
| 259 | - $this->param['pid'] = 0; | ||
| 260 | - } | ||
| 261 | - //判断为子分类时 | ||
| 262 | - if($this->param['pid'] != 0){ | ||
| 263 | - //查看当前上级分类下是否有其他子分类 | ||
| 264 | - $cate_info = $this->model->read(['pid' => $this->param['pid'], 'id' => ['!=', $cate_id]]); | ||
| 265 | - if ($cate_info === false) { | ||
| 266 | - //查看当前上一级分类下是否有新闻 | ||
| 267 | - $blogModel = new BlogModel(); | ||
| 268 | - $blog_count = $blogModel->where('category_id','like', '%,' . $this->param['pid'] . ',%')->count(); | ||
| 269 | - if ($blog_count > 0) { | ||
| 270 | - $replacement = ',' . $cate_id . ','; | ||
| 271 | - $old = ',' . $this->param['pid'] . ','; | ||
| 272 | - //更新所有商品到当前分类 | ||
| 273 | - $blogModel->where('category_id', 'like', '%' . $old . '%') | ||
| 274 | - ->update(['category_id' => DB::raw("REPLACE(category_id, '$old', '$replacement')")]); | ||
| 275 | - } | ||
| 276 | - } | ||
| 277 | - } | ||
| 278 | - return $this->success(); | ||
| 279 | - } | ||
| 280 | - | ||
| 281 | - /** | ||
| 282 | * @remark :删除路由 | 206 | * @remark :删除路由 |
| 283 | * @name :delRoute | 207 | * @name :delRoute |
| 284 | * @author :lyh | 208 | * @author :lyh |
| @@ -322,7 +246,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -322,7 +246,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 322 | $pid = $id; | 246 | $pid = $id; |
| 323 | } | 247 | } |
| 324 | } | 248 | } |
| 325 | - return $this->getLastCategory($return); | 249 | + return $this->getCategory($return); |
| 326 | } | 250 | } |
| 327 | 251 | ||
| 328 | /** | 252 | /** |
| @@ -332,15 +256,12 @@ class BlogCategoryLogic extends BaseLogic | @@ -332,15 +256,12 @@ class BlogCategoryLogic extends BaseLogic | ||
| 332 | * @method :post | 256 | * @method :post |
| 333 | * @time :2023/10/20 9:02 | 257 | * @time :2023/10/20 9:02 |
| 334 | */ | 258 | */ |
| 335 | - public function getLastCategory($category){ | 259 | + public function getCategory($category){ |
| 336 | $str = ''; | 260 | $str = ''; |
| 337 | foreach ($category as $v){ | 261 | foreach ($category as $v){ |
| 338 | - $info = $this->model->read(['pid'=>$v]); | ||
| 339 | - if($info === false){ | ||
| 340 | $str .= $v.','; | 262 | $str .= $v.','; |
| 341 | } | 263 | } |
| 342 | - } | ||
| 343 | - return ','.$str; | 264 | + return !empty($str) ? ','.$str : ''; |
| 344 | } | 265 | } |
| 345 | 266 | ||
| 346 | /** | 267 | /** |
| @@ -133,12 +133,9 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -133,12 +133,9 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 133 | $id = $this->model->addReturnId($this->param); | 133 | $id = $this->model->addReturnId($this->param); |
| 134 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, | 134 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, |
| 135 | $id, $this->user['project_id']); | 135 | $id, $this->user['project_id']); |
| 136 | - $this->handleAddSon($id); | ||
| 137 | $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE,$route); | 136 | $this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE,$route); |
| 138 | $this->curlDelRoute(['new_route'=>$route]); | 137 | $this->curlDelRoute(['new_route'=>$route]); |
| 139 | $this->edit(['route' => $route], ['id' => $id]); | 138 | $this->edit(['route' => $route], ['id' => $id]); |
| 140 | - //处理上级分类商品 | ||
| 141 | - $this->handleAddSon($id); | ||
| 142 | }catch (\Exception $e){ | 139 | }catch (\Exception $e){ |
| 143 | $this->fail('系统错误,请联系管理员'); | 140 | $this->fail('系统错误,请联系管理员'); |
| 144 | } | 141 | } |
| @@ -155,7 +152,6 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -155,7 +152,6 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 155 | public function categoryEdit(){ | 152 | public function categoryEdit(){ |
| 156 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, | 153 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, |
| 157 | $this->param['id'], $this->user['project_id']); | 154 | $this->param['id'], $this->user['project_id']); |
| 158 | - $this->editHandleCategory($this->param['id'],$this->param['pid']); | ||
| 159 | $this->editRoute($this->param['id'],$route); | 155 | $this->editRoute($this->param['id'],$route); |
| 160 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 156 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 161 | if($rs === false){ | 157 | if($rs === false){ |
| @@ -165,48 +161,6 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -165,48 +161,6 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 165 | } | 161 | } |
| 166 | 162 | ||
| 167 | /** | 163 | /** |
| 168 | - * @remark :编辑分类,处理博客数据 | ||
| 169 | - * @name :editCategory | ||
| 170 | - * @author :lyh | ||
| 171 | - * @method :post | ||
| 172 | - * @time :2023/10/20 9:32 | ||
| 173 | - */ | ||
| 174 | - public function editHandleCategory($id,$pid){ | ||
| 175 | - $info = $this->model->read(['id'=>$id],['id','pid']); | ||
| 176 | - if($info['pid'] != $pid){ | ||
| 177 | - //修改勒上级,先查看上级是否拥有产品 | ||
| 178 | - $contentModel = new CustomModuleContent(); | ||
| 179 | - $contentCount = $contentModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count(); | ||
| 180 | - if($contentCount > 0){ | ||
| 181 | - //随机获取最后一级id | ||
| 182 | - $replacement = $this->getLastId($id); | ||
| 183 | - //存在博客时,移动所有博客到当前分类最后一级 | ||
| 184 | - $contentModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%') | ||
| 185 | - ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]); | ||
| 186 | - $contentModel->where('category_id', 'like', '%,' . $pid . ',%') | ||
| 187 | - ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',$replacement,')")]); | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - return $this->success(); | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | - /** | ||
| 194 | - * @remark :随机获取当前id下最后一级的id | ||
| 195 | - * @name :getLastId | ||
| 196 | - * @author :lyh | ||
| 197 | - * @method :post | ||
| 198 | - * @time :2023/10/20 9:45 | ||
| 199 | - */ | ||
| 200 | - public function getLastId($id){ | ||
| 201 | - $info = $this->model->read(['pid'=>$id],['id']); | ||
| 202 | - if($info !== false){ | ||
| 203 | - return $this->getLastId($info['id']); | ||
| 204 | - }else{ | ||
| 205 | - return $id; | ||
| 206 | - } | ||
| 207 | - } | ||
| 208 | - | ||
| 209 | - /** | ||
| 210 | * @remark :查看是否编辑路由 | 164 | * @remark :查看是否编辑路由 |
| 211 | * @name :editCategoryRoute | 165 | * @name :editCategoryRoute |
| 212 | * @author :lyh | 166 | * @author :lyh |
| @@ -225,46 +179,6 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -225,46 +179,6 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 225 | } | 179 | } |
| 226 | 180 | ||
| 227 | /** | 181 | /** |
| 228 | - * @name :(添加分类时处理子集分类)addProcessingSon | ||
| 229 | - * @author :lyh | ||
| 230 | - * @method :post | ||
| 231 | - * @time :2023/6/13 11:34 | ||
| 232 | - */ | ||
| 233 | - public function handleAddSon($cate_id){ | ||
| 234 | - if(isset($this->param['pid']) && !empty($this->param['pid'])) { | ||
| 235 | - $this->param['pid'] = 0; | ||
| 236 | - } | ||
| 237 | - //判断为子分类时 | ||
| 238 | - if($this->param['pid'] != 0) { | ||
| 239 | - //查看当前上级分类下是否有其他分类 | ||
| 240 | - $cate_info = $this->model->read(['pid' => $this->param['pid'], 'id' => ['!=', $cate_id]],['id']); | ||
| 241 | - if ($cate_info === false) { | ||
| 242 | - //查看当前上一级分类下是否有关联模块内容 | ||
| 243 | - $contentModel = new CustomModuleContent(); | ||
| 244 | - $news_count = $contentModel->where('category_id','like', '%,' . $this->param['pid'] . ',%')->count(); | ||
| 245 | - if ($news_count > 0) { | ||
| 246 | - $replacement = $this->handleStr($cate_id); | ||
| 247 | - $old = $this->handleStr($this->param['pid']); | ||
| 248 | - //更新所有商品到当前分类 | ||
| 249 | - $contentModel->where('category_id', 'like', '%' . $old . '%')->update(['category_id' => DB::raw("REPLACE(category_id, '$old', '$replacement')")]); | ||
| 250 | - } | ||
| 251 | - } | ||
| 252 | - } | ||
| 253 | - return $this->success(); | ||
| 254 | - } | ||
| 255 | - | ||
| 256 | - /** | ||
| 257 | - * @remark :处理字符串 | ||
| 258 | - * @name :handleStr | ||
| 259 | - * @author :lyh | ||
| 260 | - * @method :post | ||
| 261 | - * @time :2023/12/5 18:03 | ||
| 262 | - */ | ||
| 263 | - public function handleStr($str){ | ||
| 264 | - return ',' . $str . ','; | ||
| 265 | - } | ||
| 266 | - | ||
| 267 | - /** | ||
| 268 | * @remark :删除数据 | 182 | * @remark :删除数据 |
| 269 | * @name :ModuleDel | 183 | * @name :ModuleDel |
| 270 | * @author :lyh | 184 | * @author :lyh |
| @@ -192,7 +192,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -192,7 +192,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 192 | $param['project_id'] = $this->user['project_id']; | 192 | $param['project_id'] = $this->user['project_id']; |
| 193 | } | 193 | } |
| 194 | if(isset($param['category_id']) && !empty($param['category_id'])){ | 194 | if(isset($param['category_id']) && !empty($param['category_id'])){ |
| 195 | - $param['category_id'] = $this->getLastCategory($param['category_id']); | 195 | + $param['category_id'] = $this->getCategory($param['category_id']); |
| 196 | } | 196 | } |
| 197 | if(isset($param['image']) && !empty($param['image'])){ | 197 | if(isset($param['image']) && !empty($param['image'])){ |
| 198 | $param['image'] = str_replace_url($param['image']); | 198 | $param['image'] = str_replace_url($param['image']); |
| @@ -219,22 +219,18 @@ class CustomModuleContentLogic extends BaseLogic | @@ -219,22 +219,18 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | /** | 221 | /** |
| 222 | - * @remark :获取最后一级分类id | 222 | + * @remark :处理分类 |
| 223 | * @name :getLastCategory | 223 | * @name :getLastCategory |
| 224 | * @author :lyh | 224 | * @author :lyh |
| 225 | * @method :post | 225 | * @method :post |
| 226 | * @time :2023/10/20 9:02 | 226 | * @time :2023/10/20 9:02 |
| 227 | */ | 227 | */ |
| 228 | - public function getLastCategory($category){ | 228 | + public function getCategory($category){ |
| 229 | $str = ''; | 229 | $str = ''; |
| 230 | - $cateModel = new CustomModuleCategory(); | ||
| 231 | foreach ($category as $v){ | 230 | foreach ($category as $v){ |
| 232 | - $info = $cateModel->read(['pid'=>$v]); | ||
| 233 | - if($info === false){ | ||
| 234 | $str .= $v.','; | 231 | $str .= $v.','; |
| 235 | } | 232 | } |
| 236 | - } | ||
| 237 | - return ','.$str; | 233 | + return !empty($str) ? ','.$str : ''; |
| 238 | } | 234 | } |
| 239 | 235 | ||
| 240 | /** | 236 | /** |
| @@ -29,12 +29,21 @@ class ImportLogic extends BaseLogic | @@ -29,12 +29,21 @@ class ImportLogic extends BaseLogic | ||
| 29 | if (end($ext) != 'csv') { | 29 | if (end($ext) != 'csv') { |
| 30 | $this->fail('导入文件格式必须为csv'); | 30 | $this->fail('导入文件格式必须为csv'); |
| 31 | } | 31 | } |
| 32 | + $domain = $this->param['domain']; | ||
| 33 | + if (strpos($domain, 'https') === false || strpos($domain, 'http') == false) { | ||
| 34 | + $this->fail('请输入完整的采集页面地址'); | ||
| 35 | + } | ||
| 36 | + $domain_arr = parse_url($domain); | ||
| 37 | + if (!isset($domain_arr['host'])) { | ||
| 38 | + $this->fail('采集页面地址输入有误'); | ||
| 39 | + } | ||
| 32 | 40 | ||
| 41 | + $this->param['domain'] = $domain_arr['host']; | ||
| 33 | $this->param['project_id'] = $this->user['project_id']; | 42 | $this->param['project_id'] = $this->user['project_id']; |
| 34 | $this->param['user_id'] = $this->user['id']; | 43 | $this->param['user_id'] = $this->user['id']; |
| 35 | $this->param['status'] = 9; | 44 | $this->param['status'] = 9; |
| 36 | $rs = $this->model->add($this->param); | 45 | $rs = $this->model->add($this->param); |
| 37 | - if($rs === false){ | 46 | + if ($rs === false) { |
| 38 | $this->fail('error'); | 47 | $this->fail('error'); |
| 39 | } | 48 | } |
| 40 | return $this->success(); | 49 | return $this->success(); |
| @@ -250,7 +250,21 @@ class NavLogic extends BaseLogic | @@ -250,7 +250,21 @@ class NavLogic extends BaseLogic | ||
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | - | 253 | + /** |
| 254 | + * @remark :排序字段 | ||
| 255 | + * @name :setSortList | ||
| 256 | + * @author :lyh | ||
| 257 | + * @method :post | ||
| 258 | + * @time :2023/12/18 13:47 | ||
| 259 | + */ | ||
| 260 | + public function setSortList(){ | ||
| 261 | + $navGroupModel = new BNavGroup(); | ||
| 262 | + if(!empty($this->param['sort_list'])){ | ||
| 263 | + $this->param['sort_list'] = json_encode($this->param['sort_list']); | ||
| 264 | + } | ||
| 265 | + $navGroupModel->edit(['sort_list'=>$this->param['sort_list']],['id'=>$this->param['id']]); | ||
| 266 | + return $this->success(); | ||
| 267 | + } | ||
| 254 | 268 | ||
| 255 | 269 | ||
| 256 | 270 |
| @@ -46,7 +46,6 @@ class NewsCategoryLogic extends BaseLogic | @@ -46,7 +46,6 @@ class NewsCategoryLogic extends BaseLogic | ||
| 46 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 46 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 47 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']); | 47 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']); |
| 48 | $route = $this->param['alias']; | 48 | $route = $this->param['alias']; |
| 49 | - $this->editHandleCategory($this->param['id'],$this->param['pid']); | ||
| 50 | $this->param['operator_id'] = $this->user['id']; | 49 | $this->param['operator_id'] = $this->user['id']; |
| 51 | $this->edit($this->param,['id'=>$this->param['id']]); | 50 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 52 | }else{ | 51 | }else{ |
| @@ -57,8 +56,6 @@ class NewsCategoryLogic extends BaseLogic | @@ -57,8 +56,6 @@ class NewsCategoryLogic extends BaseLogic | ||
| 57 | $id = $this->model->addReturnId($this->param); | 56 | $id = $this->model->addReturnId($this->param); |
| 58 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 57 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| 59 | $this->model->edit(['alias'=>$route],['id'=>$id]); | 58 | $this->model->edit(['alias'=>$route],['id'=>$id]); |
| 60 | - //当父级分类拥有产品时,处理子集 | ||
| 61 | - $this->addProcessingSon($id); | ||
| 62 | } | 59 | } |
| 63 | DB::commit(); | 60 | DB::commit(); |
| 64 | }catch (\Exception $e){ | 61 | }catch (\Exception $e){ |
| @@ -71,49 +68,6 @@ class NewsCategoryLogic extends BaseLogic | @@ -71,49 +68,6 @@ class NewsCategoryLogic extends BaseLogic | ||
| 71 | } | 68 | } |
| 72 | 69 | ||
| 73 | /** | 70 | /** |
| 74 | - * @remark :编辑分类,处理博客数据 | ||
| 75 | - * @name :editCategory | ||
| 76 | - * @author :lyh | ||
| 77 | - * @method :post | ||
| 78 | - * @time :2023/10/20 9:32 | ||
| 79 | - */ | ||
| 80 | - public function editHandleCategory($id,$pid){ | ||
| 81 | - $info = $this->model->read(['id'=>$id],['id','pid']); | ||
| 82 | - if($info['pid'] != $pid){ | ||
| 83 | - //修改勒上级,先查看上级是否拥有博客 | ||
| 84 | - $newsModel = new NewsModel(); | ||
| 85 | - $newsCount = $newsModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count(); | ||
| 86 | - //随机获取最后一级id | ||
| 87 | - $replacement = $this->getLastId($id); | ||
| 88 | - if($newsCount > 0){ | ||
| 89 | - //存在博客时,移动所有博客到当前分类最后一级 | ||
| 90 | - $newsModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%') | ||
| 91 | - ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]); | ||
| 92 | - $newsModel->where('category_id', 'like', '%,' . $pid . ',%') | ||
| 93 | - ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',$replacement,')")]); | ||
| 94 | - } | ||
| 95 | - } | ||
| 96 | - return $this->success(); | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - /** | ||
| 100 | - * @remark :随机获取当前id下最后一级的id | ||
| 101 | - * @name :getLastId | ||
| 102 | - * @author :lyh | ||
| 103 | - * @method :post | ||
| 104 | - * @time :2023/10/20 9:45 | ||
| 105 | - */ | ||
| 106 | - public function getLastId($id){ | ||
| 107 | - $info = $this->model->read(['pid'=>$id],['id']); | ||
| 108 | - if($info !== false){ | ||
| 109 | - return $this->getLastId($info['id']); | ||
| 110 | - }else{ | ||
| 111 | - return $id; | ||
| 112 | - } | ||
| 113 | - } | ||
| 114 | - | ||
| 115 | - | ||
| 116 | - /** | ||
| 117 | * @remark :修改状态 | 71 | * @remark :修改状态 |
| 118 | * @name :status_news_category | 72 | * @name :status_news_category |
| 119 | * @author :lyh | 73 | * @author :lyh |
| @@ -231,36 +185,6 @@ class NewsCategoryLogic extends BaseLogic | @@ -231,36 +185,6 @@ class NewsCategoryLogic extends BaseLogic | ||
| 231 | } | 185 | } |
| 232 | 186 | ||
| 233 | /** | 187 | /** |
| 234 | - * @name :(添加分类时处理子集分类)addProcessingSon | ||
| 235 | - * @author :lyh | ||
| 236 | - * @method :post | ||
| 237 | - * @time :2023/6/13 11:34 | ||
| 238 | - */ | ||
| 239 | - public function addProcessingSon($cate_id){ | ||
| 240 | - if(isset($this->param['pid']) && !empty($this->param['pid'])) { | ||
| 241 | - $this->param['pid'] = 0; | ||
| 242 | - } | ||
| 243 | - //判断为子分类时 | ||
| 244 | - if($this->param['pid'] != 0) { | ||
| 245 | - //查看当前上级分类下是否有其他分类 | ||
| 246 | - $cate_info = $this->model->read(['pid' => $this->param['pid'], 'id' => ['!=', $cate_id]]); | ||
| 247 | - if ($cate_info === false) { | ||
| 248 | - //查看当前上一级分类下是否有新闻 | ||
| 249 | - $newsModel = new NewsModel(); | ||
| 250 | - $news_count = $newsModel->where('category_id','like', '%,' . $this->param['pid'] . ',%')->count(); | ||
| 251 | - if ($news_count > 0) { | ||
| 252 | - $replacement = ',' . $cate_id . ','; | ||
| 253 | - $old = ',' . $this->param['pid'] . ','; | ||
| 254 | - //更新所有商品到当前分类 | ||
| 255 | - $newsModel->where('category_id', 'like', '%' . $old . '%') | ||
| 256 | - ->update(['category_id' => DB::raw("REPLACE(category_id, '$old', '$replacement')")]); | ||
| 257 | - } | ||
| 258 | - } | ||
| 259 | - } | ||
| 260 | - return $this->success(); | ||
| 261 | - } | ||
| 262 | - | ||
| 263 | - /** | ||
| 264 | * @remark :删除路由 | 188 | * @remark :删除路由 |
| 265 | * @name :delRoute | 189 | * @name :delRoute |
| 266 | * @author :lyh | 190 | * @author :lyh |
| @@ -303,7 +227,7 @@ class NewsCategoryLogic extends BaseLogic | @@ -303,7 +227,7 @@ class NewsCategoryLogic extends BaseLogic | ||
| 303 | $pid = $id; | 227 | $pid = $id; |
| 304 | } | 228 | } |
| 305 | } | 229 | } |
| 306 | - return $this->getLastCategory($return); | 230 | + return $this->getCategory($return); |
| 307 | } | 231 | } |
| 308 | 232 | ||
| 309 | /** | 233 | /** |
| @@ -313,15 +237,12 @@ class NewsCategoryLogic extends BaseLogic | @@ -313,15 +237,12 @@ class NewsCategoryLogic extends BaseLogic | ||
| 313 | * @method :post | 237 | * @method :post |
| 314 | * @time :2023/10/20 9:02 | 238 | * @time :2023/10/20 9:02 |
| 315 | */ | 239 | */ |
| 316 | - public function getLastCategory($category){ | 240 | + public function getCategory($category){ |
| 317 | $str = ''; | 241 | $str = ''; |
| 318 | foreach ($category as $v){ | 242 | foreach ($category as $v){ |
| 319 | - $info = $this->model->read(['pid'=>$v]); | ||
| 320 | - if($info === false){ | ||
| 321 | $str .= $v.','; | 243 | $str .= $v.','; |
| 322 | } | 244 | } |
| 323 | - } | ||
| 324 | - return ','.$str; | 245 | + return !empty($str) ? ','.$str : ''; |
| 325 | } | 246 | } |
| 326 | 247 | ||
| 327 | /** | 248 | /** |
| @@ -167,36 +167,32 @@ class NewsLogic extends BaseLogic | @@ -167,36 +167,32 @@ class NewsLogic extends BaseLogic | ||
| 167 | if(isset($this->param['id'])){ | 167 | if(isset($this->param['id'])){ |
| 168 | $param['operator_id'] = $this->user['id']; | 168 | $param['operator_id'] = $this->user['id']; |
| 169 | if(isset($param['category_id']) && !empty($param['category_id'])){ | 169 | if(isset($param['category_id']) && !empty($param['category_id'])){ |
| 170 | - $param['category_id'] = $this->getLastCategory($param['category_id']); | 170 | + $param['category_id'] = $this->getCategory($param['category_id']); |
| 171 | } | 171 | } |
| 172 | }else{ | 172 | }else{ |
| 173 | $param['create_id'] = $this->user['id']; | 173 | $param['create_id'] = $this->user['id']; |
| 174 | $param['operator_id'] = $this->user['id']; | 174 | $param['operator_id'] = $this->user['id']; |
| 175 | $param['project_id'] = $this->user['project_id']; | 175 | $param['project_id'] = $this->user['project_id']; |
| 176 | if(isset($param['category_id']) && !empty($param['category_id'])){ | 176 | if(isset($param['category_id']) && !empty($param['category_id'])){ |
| 177 | - $param['category_id'] = $this->getLastCategory($param['category_id']); | 177 | + $param['category_id'] = $this->getCategory($param['category_id']); |
| 178 | } | 178 | } |
| 179 | } | 179 | } |
| 180 | return $this->success($param); | 180 | return $this->success($param); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | /** | 183 | /** |
| 184 | - * @remark :获取最后一级分类id | 184 | + * @remark :获取分类(字符串) |
| 185 | * @name :getLastCategory | 185 | * @name :getLastCategory |
| 186 | * @author :lyh | 186 | * @author :lyh |
| 187 | * @method :post | 187 | * @method :post |
| 188 | * @time :2023/10/20 9:02 | 188 | * @time :2023/10/20 9:02 |
| 189 | */ | 189 | */ |
| 190 | - public function getLastCategory($category){ | 190 | + public function getCategory($category){ |
| 191 | $str = ''; | 191 | $str = ''; |
| 192 | - $cateModel = new NewsCategoryModel(); | ||
| 193 | foreach ($category as $v){ | 192 | foreach ($category as $v){ |
| 194 | - $info = $cateModel->read(['pid'=>$v]); | ||
| 195 | - if($info === false){ | ||
| 196 | $str .= $v.','; | 193 | $str .= $v.','; |
| 197 | } | 194 | } |
| 198 | - } | ||
| 199 | - return ','.$str; | 195 | + return !empty($str) ? ','.$str : ''; |
| 200 | } | 196 | } |
| 201 | 197 | ||
| 202 | /** | 198 | /** |
| @@ -115,16 +115,12 @@ class CategoryLogic extends BaseLogic | @@ -115,16 +115,12 @@ class CategoryLogic extends BaseLogic | ||
| 115 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 115 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 116 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']); | 116 | $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']); |
| 117 | $route = $this->param['route']; | 117 | $route = $this->param['route']; |
| 118 | - //处理子集 | ||
| 119 | - $this->editHandleCategory($this->param['id'],$this->param['pid']); | ||
| 120 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 118 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 121 | }else{ | 119 | }else{ |
| 122 | $this->param['project_id'] = $this->user['project_id']; | 120 | $this->param['project_id'] = $this->user['project_id']; |
| 123 | $id = $this->model->addReturnId($this->param); | 121 | $id = $this->model->addReturnId($this->param); |
| 124 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); | 122 | $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); |
| 125 | $this->edit(['route'=>$route],['id'=>$id]); | 123 | $this->edit(['route'=>$route],['id'=>$id]); |
| 126 | - //处理子集 | ||
| 127 | - $this->addProcessingSon($id); | ||
| 128 | } | 124 | } |
| 129 | //清除缓存 | 125 | //清除缓存 |
| 130 | Common::del_user_cache('product_category',$this->user['project_id']); | 126 | Common::del_user_cache('product_category',$this->user['project_id']); |
| @@ -139,90 +135,6 @@ class CategoryLogic extends BaseLogic | @@ -139,90 +135,6 @@ class CategoryLogic extends BaseLogic | ||
| 139 | } | 135 | } |
| 140 | 136 | ||
| 141 | /** | 137 | /** |
| 142 | - * @param $cate_id | ||
| 143 | - * @name :(处理子集)addProcessingSon | ||
| 144 | - * @author :lyh | ||
| 145 | - * @method :post | ||
| 146 | - * @time :2023/6/13 11:59 | ||
| 147 | - */ | ||
| 148 | - public function addProcessingSon($cate_id){ | ||
| 149 | - if(!isset($this->param['pid'])){ | ||
| 150 | - $this->param['pid'] = 0; | ||
| 151 | - } | ||
| 152 | - //判断为子分类时 | ||
| 153 | - if($this->param['pid'] != 0){ | ||
| 154 | - //查看当前上级分类下是否有其他子分类 | ||
| 155 | - $cate_info = $this->model->read(['pid' => $this->param['pid'], 'id' => ['!=', $cate_id]]); | ||
| 156 | - if ($cate_info === false) { | ||
| 157 | - $productModel = new Product(); | ||
| 158 | - $blog_count = $productModel->where('category_id','like', '%,' . $this->param['pid'] . ',%')->count(); | ||
| 159 | - if ($blog_count > 0) { | ||
| 160 | - $replacement = ',' . $cate_id . ','; | ||
| 161 | - $old = ',' . $this->param['pid'] . ','; | ||
| 162 | - //更新所有商品到当前分类 | ||
| 163 | - $productModel->where('category_id', 'like', '%' . $old . '%') | ||
| 164 | - ->update(['category_id' => DB::raw("REPLACE(category_id, '$old', '$replacement')")]); | ||
| 165 | - //同步更新关联表 | ||
| 166 | - $categoryRelatedModel = new CategoryRelated(); | ||
| 167 | - $categoryRelatedModel->edit(['category_id'=>$cate_id],['category_id'=>$this->param['pid']]); | ||
| 168 | - } | ||
| 169 | - } | ||
| 170 | - } | ||
| 171 | - return $this->success(); | ||
| 172 | - } | ||
| 173 | - | ||
| 174 | - /** | ||
| 175 | - * @remark :编辑分类,处理博客数据 | ||
| 176 | - * @name :editCategory | ||
| 177 | - * @author :lyh | ||
| 178 | - * @method :post | ||
| 179 | - * @time :2023/10/20 9:32 | ||
| 180 | - */ | ||
| 181 | - public function editHandleCategory($id,$pid){ | ||
| 182 | - $info = $this->model->read(['id'=>$id],['id','pid']); | ||
| 183 | - if($info['pid'] != $pid){ | ||
| 184 | - //修改勒上级,先查看上级是否拥有博客 | ||
| 185 | - $productModel = new Product(); | ||
| 186 | - $blogCount = $productModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count(); | ||
| 187 | - if($blogCount > 0){ | ||
| 188 | - //随机获取最后一级id | ||
| 189 | - $replacement = $this->getLastId($id); | ||
| 190 | - //存在博客时,移动所有博客到当前分类最后一级 | ||
| 191 | - $productModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%') | ||
| 192 | - ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]); | ||
| 193 | - $productModel->where('category_id', 'like', '%,' . $pid . ',%') | ||
| 194 | - ->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',$replacement,')")]); | ||
| 195 | - //同步更新关联表 | ||
| 196 | - $categoryRelatedModel = new CategoryRelated(); | ||
| 197 | - $cateRelateList = $categoryRelatedModel->list(['category_id'=>$pid]); | ||
| 198 | - if(!empty($cateRelateList)){ | ||
| 199 | - foreach ($cateRelateList as $v){ | ||
| 200 | - $categoryRelatedModel->del(['category_id'=>$replacement,'product_id'=>$v['product_id']]); | ||
| 201 | - } | ||
| 202 | - } | ||
| 203 | - $categoryRelatedModel->edit(['category_id'=>$replacement],['category_id'=>$pid]); | ||
| 204 | - } | ||
| 205 | - } | ||
| 206 | - return $this->success(); | ||
| 207 | - } | ||
| 208 | - | ||
| 209 | - /** | ||
| 210 | - * @remark :随机获取当前id下最后一级的id | ||
| 211 | - * @name :getLastId | ||
| 212 | - * @author :lyh | ||
| 213 | - * @method :post | ||
| 214 | - * @time :2023/10/20 9:45 | ||
| 215 | - */ | ||
| 216 | - public function getLastId($id){ | ||
| 217 | - $info = $this->model->read(['pid'=>$id],['id']); | ||
| 218 | - if($info !== false){ | ||
| 219 | - return $this->getLastId($info['id']); | ||
| 220 | - }else{ | ||
| 221 | - return $id; | ||
| 222 | - } | ||
| 223 | - } | ||
| 224 | - | ||
| 225 | - /** | ||
| 226 | * @remark :删除 | 138 | * @remark :删除 |
| 227 | * @name :delete | 139 | * @name :delete |
| 228 | * @author :lyh | 140 | * @author :lyh |
| @@ -309,13 +221,10 @@ class CategoryLogic extends BaseLogic | @@ -309,13 +221,10 @@ class CategoryLogic extends BaseLogic | ||
| 309 | $str = ''; | 221 | $str = ''; |
| 310 | if(isset($category) && !empty($category)){ | 222 | if(isset($category) && !empty($category)){ |
| 311 | foreach ($category as $v){ | 223 | foreach ($category as $v){ |
| 312 | - $info = $this->model->read(['pid'=>$v]); | ||
| 313 | - if($info === false){ | ||
| 314 | $str .= $v.','; | 224 | $str .= $v.','; |
| 315 | } | 225 | } |
| 316 | } | 226 | } |
| 317 | - } | ||
| 318 | - return ','.$str; | 227 | + return !empty($str) ? ','.$str : ''; |
| 319 | } | 228 | } |
| 320 | 229 | ||
| 321 | /** | 230 | /** |
| @@ -95,7 +95,7 @@ class ProductLogic extends BaseLogic | @@ -95,7 +95,7 @@ class ProductLogic extends BaseLogic | ||
| 95 | public function handleCategory(){ | 95 | public function handleCategory(){ |
| 96 | $category_ids = []; | 96 | $category_ids = []; |
| 97 | if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | 97 | if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { |
| 98 | - $category_ids = $this->getLastCategoryArr($this->param['category_id']); | 98 | + $category_ids = $this->param['category_id']; |
| 99 | $this->param['category_id'] = ','.implode(',',$category_ids).','; | 99 | $this->param['category_id'] = ','.implode(',',$category_ids).','; |
| 100 | }else{ | 100 | }else{ |
| 101 | $this->param['category_id'] = ''; | 101 | $this->param['category_id'] = ''; |
| @@ -176,7 +176,7 @@ class ProductLogic extends BaseLogic | @@ -176,7 +176,7 @@ class ProductLogic extends BaseLogic | ||
| 176 | * @time :2023/10/26 9:49 | 176 | * @time :2023/10/26 9:49 |
| 177 | */ | 177 | */ |
| 178 | public function editList(){ | 178 | public function editList(){ |
| 179 | - $this->param['category_id'] = $this->getLastCategory($this->param['category_id']); | 179 | + $this->param['category_id'] = $this->handleListCategory($this->param['category_id']); |
| 180 | $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); | 180 | $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); |
| 181 | if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ | 181 | if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ |
| 182 | foreach ($this->param['gallery'] as $k => $v){ | 182 | foreach ($this->param['gallery'] as $k => $v){ |
| @@ -186,7 +186,7 @@ class ProductLogic extends BaseLogic | @@ -186,7 +186,7 @@ class ProductLogic extends BaseLogic | ||
| 186 | $this->param['thumb'] = Arr::a2s($this->param['gallery'][0] ?? []); | 186 | $this->param['thumb'] = Arr::a2s($this->param['gallery'][0] ?? []); |
| 187 | $this->param['gallery'] = Arr::a2s($this->param['gallery'] ?? []); | 187 | $this->param['gallery'] = Arr::a2s($this->param['gallery'] ?? []); |
| 188 | }else{ | 188 | }else{ |
| 189 | - $this->param['thumb'] = Arr::a2s([]); | 189 | + unset($this->param['thumb']); |
| 190 | } | 190 | } |
| 191 | try { | 191 | try { |
| 192 | if(isset($this->param['route']) && !empty($this->param['route'])){ | 192 | if(isset($this->param['route']) && !empty($this->param['route'])){ |
| @@ -195,7 +195,7 @@ class ProductLogic extends BaseLogic | @@ -195,7 +195,7 @@ class ProductLogic extends BaseLogic | ||
| 195 | } | 195 | } |
| 196 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 196 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 197 | }catch (\Exception $e){ | 197 | }catch (\Exception $e){ |
| 198 | - $this->fail('系统错误,请连续管理员');; | 198 | + $this->fail('系统错误,请连续管理员'); |
| 199 | } | 199 | } |
| 200 | return $this->success(); | 200 | return $this->success(); |
| 201 | } | 201 | } |
| @@ -276,24 +276,20 @@ class ProductLogic extends BaseLogic | @@ -276,24 +276,20 @@ class ProductLogic extends BaseLogic | ||
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | /** | 278 | /** |
| 279 | - * @remark :获取最后一级分类id(字符串) | 279 | + * @remark :列表标记处理分类(字符串) |
| 280 | * @name :getLastCategory | 280 | * @name :getLastCategory |
| 281 | * @author :lyh | 281 | * @author :lyh |
| 282 | * @method :post | 282 | * @method :post |
| 283 | * @time :2023/10/20 9:02 | 283 | * @time :2023/10/20 9:02 |
| 284 | */ | 284 | */ |
| 285 | - public function getLastCategory($category){ | 285 | + public function handleListCategory($category){ |
| 286 | $str = ''; | 286 | $str = ''; |
| 287 | if(isset($category) && !empty($category)){ | 287 | if(isset($category) && !empty($category)){ |
| 288 | - $cateModel = new Category(); | ||
| 289 | foreach ($category as $v){ | 288 | foreach ($category as $v){ |
| 290 | - $info = $cateModel->read(['pid'=>$v]); | ||
| 291 | - if($info === false){ | ||
| 292 | $str .= $v.','; | 289 | $str .= $v.','; |
| 293 | } | 290 | } |
| 294 | } | 291 | } |
| 295 | - } | ||
| 296 | - return ','.$str; | 292 | + return !empty($str) ? ','.$str : ''; |
| 297 | } | 293 | } |
| 298 | 294 | ||
| 299 | /** | 295 | /** |
| @@ -306,14 +302,10 @@ class ProductLogic extends BaseLogic | @@ -306,14 +302,10 @@ class ProductLogic extends BaseLogic | ||
| 306 | public function getLastCategoryArr($category){ | 302 | public function getLastCategoryArr($category){ |
| 307 | $arr = []; | 303 | $arr = []; |
| 308 | if(isset($category) && !empty($category)){ | 304 | if(isset($category) && !empty($category)){ |
| 309 | - $cateModel = new Category(); | ||
| 310 | foreach ($category as $v){ | 305 | foreach ($category as $v){ |
| 311 | - $info = $cateModel->read(['pid'=>$v]); | ||
| 312 | - if($info === false){ | ||
| 313 | $arr[] = $v; | 306 | $arr[] = $v; |
| 314 | } | 307 | } |
| 315 | } | 308 | } |
| 316 | - } | ||
| 317 | return $arr; | 309 | return $arr; |
| 318 | } | 310 | } |
| 319 | 311 |
| @@ -165,7 +165,9 @@ class UserLoginLogic | @@ -165,7 +165,9 @@ class UserLoginLogic | ||
| 165 | $info['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? '')); | 165 | $info['domain'] = (!empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? '')); |
| 166 | $info['is_customized'] = $project['is_customized']; | 166 | $info['is_customized'] = $project['is_customized']; |
| 167 | $info['is_upload_manage'] = $project['is_upload_manage']; | 167 | $info['is_upload_manage'] = $project['is_upload_manage']; |
| 168 | + $info['is_show_blog'] = $project['is_show_blog']; | ||
| 168 | $info['upload_config'] = $project['upload_config']; | 169 | $info['upload_config'] = $project['upload_config']; |
| 170 | + $info['main_lang_id'] = $project['main_lang_id']; | ||
| 169 | $info['image_max'] = $project['image_max']; | 171 | $info['image_max'] = $project['image_max']; |
| 170 | $info['is_update_language'] = $project['is_update_language']; | 172 | $info['is_update_language'] = $project['is_update_language']; |
| 171 | $info['configuration'] = $project['deploy_build']['configuration']; | 173 | $info['configuration'] = $project['deploy_build']['configuration']; |
| @@ -199,7 +201,9 @@ class UserLoginLogic | @@ -199,7 +201,9 @@ class UserLoginLogic | ||
| 199 | ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? '')); | 201 | ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ($project['deploy_build']['test_domain'] ?? '')); |
| 200 | $info['is_customized'] = $project['is_customized']; | 202 | $info['is_customized'] = $project['is_customized']; |
| 201 | $info['is_upload_manage'] = $project['is_upload_manage']; | 203 | $info['is_upload_manage'] = $project['is_upload_manage']; |
| 204 | + $info['is_show_blog'] = $project['is_show_blog']; | ||
| 202 | $info['upload_config'] = $project['upload_config']; | 205 | $info['upload_config'] = $project['upload_config']; |
| 206 | + $info['main_lang_id'] = $project['main_lang_id']; | ||
| 203 | $info['image_max'] = $project['image_max']; | 207 | $info['image_max'] = $project['image_max']; |
| 204 | $info['is_update_language'] = $project['is_update_language']; | 208 | $info['is_update_language'] = $project['is_update_language']; |
| 205 | $info['configuration'] = $project['deploy_build']['configuration']; | 209 | $info['configuration'] = $project['deploy_build']['configuration']; |
| @@ -35,6 +35,7 @@ class ImportTaskRequest extends FormRequest | @@ -35,6 +35,7 @@ class ImportTaskRequest extends FormRequest | ||
| 35 | return [ | 35 | return [ |
| 36 | 'type' => ['required', Rule::in([ImportTask::TYPE_PROJECT, ImportTask::TYPE_NEWS, ImportTask::TYPE_BLOG])], | 36 | 'type' => ['required', Rule::in([ImportTask::TYPE_PROJECT, ImportTask::TYPE_NEWS, ImportTask::TYPE_BLOG])], |
| 37 | 'file_url' => ['required'], | 37 | 'file_url' => ['required'], |
| 38 | + 'domain' => ['required'], | ||
| 38 | ]; | 39 | ]; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| @@ -44,6 +45,7 @@ class ImportTaskRequest extends FormRequest | @@ -44,6 +45,7 @@ class ImportTaskRequest extends FormRequest | ||
| 44 | 'type.required' => '导入类型必须', | 45 | 'type.required' => '导入类型必须', |
| 45 | 'type.in' => '导入类型错误', | 46 | 'type.in' => '导入类型错误', |
| 46 | 'file_url.required' => '文件地址必须', | 47 | 'file_url.required' => '文件地址必须', |
| 48 | + 'domain.required' => '采集页面地址必须填写', | ||
| 47 | ]; | 49 | ]; |
| 48 | } | 50 | } |
| 49 | } | 51 | } |
app/Models/Com/CreateKeyword.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :CreateKeyword.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/12/19 9:34 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Com; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :关键字 | ||
| 16 | + * @name :CreateKeyword | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2023/12/19 9:34 | ||
| 20 | + */ | ||
| 21 | +class CreateKeyword extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_create_keyword'; | ||
| 24 | +} |
app/Models/Com/UpdateVisit.php
0 → 100644
| @@ -58,15 +58,14 @@ class RouteMap extends Base | @@ -58,15 +58,14 @@ class RouteMap extends Base | ||
| 58 | $i=1; | 58 | $i=1; |
| 59 | $sign = generateRoute($title); | 59 | $sign = generateRoute($title); |
| 60 | $info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first(); | 60 | $info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first(); |
| 61 | - if($info === false){ | 61 | + $suffix = ''; |
| 62 | + if(empty($info)){ | ||
| 62 | if($source == self::SOURCE_PRODUCT_KEYWORD){ | 63 | if($source == self::SOURCE_PRODUCT_KEYWORD){ |
| 63 | $suffix = '-tag'; | 64 | $suffix = '-tag'; |
| 64 | } | 65 | } |
| 65 | if($source == self::SOURCE_PRODUCT){ | 66 | if($source == self::SOURCE_PRODUCT){ |
| 66 | $suffix = '-product'; | 67 | $suffix = '-product'; |
| 67 | } | 68 | } |
| 68 | - }else{ | ||
| 69 | - $suffix = ''; | ||
| 70 | } | 69 | } |
| 71 | $route = $sign.$suffix; | 70 | $route = $sign.$suffix; |
| 72 | while(self::isExist($route, $source_id, $project_id)){ | 71 | while(self::isExist($route, $source_id, $project_id)){ |
| @@ -140,45 +139,6 @@ class RouteMap extends Base | @@ -140,45 +139,6 @@ class RouteMap extends Base | ||
| 140 | return $route; | 139 | return $route; |
| 141 | } | 140 | } |
| 142 | 141 | ||
| 143 | - | ||
| 144 | -// /** | ||
| 145 | -// * @remark :产品新增单独处理路由 | ||
| 146 | -// * @name :setProductRoute | ||
| 147 | -// * @author :lyh | ||
| 148 | -// * @method :post | ||
| 149 | -// * @time :2023/11/21 18:48 | ||
| 150 | -// */ | ||
| 151 | -// public static function setProductRoute($route,$i = 0){ | ||
| 152 | -// $routes = $route.'-'.$i.'-product'; | ||
| 153 | -// $routeMapModel = new RouteMap(); | ||
| 154 | -// $routeInfo = $routeMapModel->read(['route'=>$routes]); | ||
| 155 | -// if($routeInfo === false){ | ||
| 156 | -// return $routes; | ||
| 157 | -// }else{ | ||
| 158 | -// $i = $i + 1; | ||
| 159 | -// return self::setProductRoute($route,$i); | ||
| 160 | -// } | ||
| 161 | -// } | ||
| 162 | -// | ||
| 163 | -// /** | ||
| 164 | -// * @remark :关键字新增单独处理路由 | ||
| 165 | -// * @name :setProductRoute | ||
| 166 | -// * @author :lyh | ||
| 167 | -// * @method :post | ||
| 168 | -// * @time :2023/11/21 18:48 | ||
| 169 | -// */ | ||
| 170 | -// public static function setKeywordRoute($route,$i = 0){ | ||
| 171 | -// $routes = $route.'-'.$i.'-tag'; | ||
| 172 | -// $routeMapModel = new RouteMap(); | ||
| 173 | -// $routeInfo = $routeMapModel->read(['route'=>$routes]); | ||
| 174 | -// if($routeInfo === false){ | ||
| 175 | -// return $routes; | ||
| 176 | -// }else{ | ||
| 177 | -// $i = $i + 1; | ||
| 178 | -// return self::setKeywordRoute($route,$i); | ||
| 179 | -// } | ||
| 180 | -// } | ||
| 181 | - | ||
| 182 | /** | 142 | /** |
| 183 | * @param $route | 143 | * @param $route |
| 184 | * @param $project_id | 144 | * @param $project_id |
| @@ -259,6 +259,13 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -259,6 +259,13 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 259 | Route::any('/saveAiPrefix', [Aside\Optimize\OptimizeController::class, 'saveAiPrefix'])->name('admin.optimize_saveAiPrefix');//保存Ai前后缀 | 259 | Route::any('/saveAiPrefix', [Aside\Optimize\OptimizeController::class, 'saveAiPrefix'])->name('admin.optimize_saveAiPrefix');//保存Ai前后缀 |
| 260 | Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关 | 260 | Route::any('/setRobots', [Aside\Optimize\OptimizeController::class, 'setRobots'])->name('admin.optimize_setRobots');//设置robots开关 |
| 261 | }); | 261 | }); |
| 262 | + //生成关键字 | ||
| 263 | + Route::prefix('create_keyword')->group(function () { | ||
| 264 | + Route::any('/', [Aside\Optimize\CreateKeywordController::class, 'lists'])->name('admin.create_keywords_lists');//创建关键字获取语种+前后缀 | ||
| 265 | + Route::any('/save', [Aside\Optimize\CreateKeywordController::class, 'save'])->name('admin.create_keywords_save');//保存关键字获取语种+前后缀 | ||
| 266 | + Route::any('/createKeyword', [Aside\Optimize\CreateKeywordController::class, 'createKeyword'])->name('admin.create_keywords_createKeyword');//保存关键字获取语种+前后缀 | ||
| 267 | + }); | ||
| 268 | + | ||
| 262 | 269 | ||
| 263 | //优化中台 | 270 | //优化中台 |
| 264 | Route::prefix('keyword')->group(function () { | 271 | Route::prefix('keyword')->group(function () { |
| @@ -373,6 +373,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -373,6 +373,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 373 | Route::get('/default-urls', [\App\Http\Controllers\Bside\Nav\NavController::class, 'urls'])->name('nav_default-urls'); | 373 | Route::get('/default-urls', [\App\Http\Controllers\Bside\Nav\NavController::class, 'urls'])->name('nav_default-urls'); |
| 374 | Route::post('/sort', [\App\Http\Controllers\Bside\Nav\NavController::class, 'sort'])->name('nav_sort'); | 374 | Route::post('/sort', [\App\Http\Controllers\Bside\Nav\NavController::class, 'sort'])->name('nav_sort'); |
| 375 | Route::post('/import', [\App\Http\Controllers\Bside\Nav\NavController::class, 'import'])->name('nav_import'); | 375 | Route::post('/import', [\App\Http\Controllers\Bside\Nav\NavController::class, 'import'])->name('nav_import'); |
| 376 | + Route::post('/setSortList', [\App\Http\Controllers\Bside\Nav\NavController::class, 'setSortList'])->name('nav_setSortList'); | ||
| 376 | }); | 377 | }); |
| 377 | 378 | ||
| 378 | //排名数据 | 379 | //排名数据 |
-
请 注册 或 登录 后发表评论