作者 赵彬吉
  1 +<?php
  2 +
  3 +namespace App\Console\Commands;
  4 +
  5 +use App\Models\ProjectAssociation\ProjectAssociation;
  6 +use App\Models\File\DataFile;
  7 +use Dompdf\Dompdf;
  8 +use Dompdf\Options;
  9 +use Illuminate\Console\Command;
  10 +
  11 +class ProjectFilePDF extends Command
  12 +{
  13 + /**
  14 + * The name and signature of the console command.
  15 + *
  16 + * @var string
  17 + */
  18 + protected $signature = 'project_file_pdf';
  19 +
  20 + /**
  21 + * The console command description.
  22 + *
  23 + * @var string
  24 + */
  25 + protected $description = '网站项目数据,生成PDF文件';
  26 +
  27 + protected $AiccWechat;
  28 +
  29 + protected $DataFile;
  30 +
  31 + protected $time;
  32 +
  33 + /**
  34 + * Create a new command instance.
  35 + *
  36 + * @return void
  37 + */
  38 + public function __construct()
  39 + {
  40 + $this->AiccWechat = new ProjectAssociation();
  41 + $this->DataFile = new DataFile();
  42 + $this->time = date("Y-m-d");
  43 + parent::__construct();
  44 + }
  45 +
  46 + /**
  47 + * Execute the console command.
  48 + *
  49 + * @return int
  50 + */
  51 + public function handle()
  52 + {
  53 + $data = $this->get_data();
  54 + # 详细数据
  55 + $items = $data['items'];
  56 + # 总分页
  57 + $totalPage = $data['totalPage'];
  58 + $this->dataPush($items);
  59 + if ($totalPage > 1) {
  60 + for ($page = 2; $page <= $totalPage; $page++) {
  61 + $da = $this->get_data();
  62 + $this->dataPush($da['items']);
  63 + }
  64 + }
  65 + $this->info('生成pdf完成');
  66 + return 0;
  67 + }
  68 +
  69 + /**
  70 + * 数据生成并保存
  71 + * @param array $items
  72 + * @return void
  73 + */
  74 + public function dataPush(array $items)
  75 + {
  76 + foreach ($items as $item) {
  77 + $project_id = $item->project_id;
  78 + $application_id = $item->wx_id;
  79 + $wx_user_id = $item->wx_user_id;
  80 + // todo 根据项目查询数据
  81 + $project_data = [];
  82 + $html = $this->html($project_data);
  83 + $filename = hash('md5', $this->time . '-' . $project_id . '-' . $application_id);
  84 + $file_path = $this->savePDF($html, $filename);
  85 + $this->DataFile->saveData(compact('project_id', 'application_id', 'file_path') + ['time' => $this->time]);
  86 + }
  87 + }
  88 +
  89 +
  90 + public function get_data($page = 1, $perPage = 20)
  91 + {
  92 + $data = $this->AiccWechat->allData($page, $perPage);
  93 + # 总条数
  94 + $total = $data['total'];
  95 + if (empty($total)) {
  96 + $this->error('暂无绑定AICC微信数据');
  97 + return 0;
  98 + }
  99 + # 详细数据
  100 + $items = $data['items'];
  101 + # 总分页
  102 + $totalPage = $data['totalPage'];
  103 + # 当前页
  104 + $currentPage = $data['currentPage'];
  105 + return compact('total', 'items', 'totalPage', 'currentPage');
  106 + }
  107 +
  108 + public function savePDF($html, $filename)
  109 + {
  110 + // todo 生成中文有问题
  111 + # 实例化并使用dompdf类
  112 + $options = new Options();
  113 + $options->setDefaultFont('arial');
  114 + $dompdf = new Dompdf($options);
  115 + $dompdf->loadHtml($html);
  116 + #(可选)设置纸张大小和方向
  117 + $dompdf->setPaper('A4', 'landscape');
  118 +
  119 + # 将HTML渲染为PDF
  120 + $dompdf->render();
  121 +
  122 + // 获取PDF内容
  123 + $pdfContent = $dompdf->output();
  124 +
  125 + // 指定保存路径和文件名
  126 + $savePath = public_path('PDF/' . $filename . '.pdf');
  127 +
  128 + // 将PDF内容保存到文件
  129 + file_put_contents($savePath, $pdfContent);
  130 +
  131 + // 输出保存成功消息
  132 + return $savePath;
  133 + }
  134 +
  135 + /**
  136 + * 根据数据生成 Html
  137 + * @param $item
  138 + * @return string
  139 + */
  140 + protected function html($item)
  141 + {
  142 + $html = '<html>';
  143 + $html .= '<body style="font-family:arial">';
  144 + $html .= '<h1>Hello, World!</h1>';
  145 + $html .= '<p>中文内容</p>';
  146 + $html .= '</body>';
  147 + $html .= '</html>';
  148 + return $html;
  149 + }
  150 +}
@@ -80,21 +80,21 @@ class ProjectUpdate extends Command @@ -80,21 +80,21 @@ class ProjectUpdate extends Command
80 //获取网站配置 80 //获取网站配置
81 $link_type = 0; 81 $link_type = 0;
82 $url_web_config = 'https://' . $domain_arr['host'] . '/wp-content/cache/user_config.text'; 82 $url_web_config = 'https://' . $domain_arr['host'] . '/wp-content/cache/user_config.text';
83 - $data_config = http_get($url_web_config, ['charset' => 'UTF-8']); 83 + $data_config = curl_c($url_web_config);
84 if ($data_config) { 84 if ($data_config) {
85 $link_type = $data_config['link_type']; 85 $link_type = $data_config['link_type'];
86 } 86 }
87 //获取所有语种 87 //获取所有语种
88 $language_list = []; 88 $language_list = [];
89 $url_language = 'https://' . $domain_arr['host'] . '/wp-content/plugins/proofreading/json/user_language.json'; 89 $url_language = 'https://' . $domain_arr['host'] . '/wp-content/plugins/proofreading/json/user_language.json';
90 - $data_language = http_get($url_language, ['charset' => 'UTF-8']); 90 + $data_language = curl_c($url_language);
91 if ($data_language) { 91 if ($data_language) {
92 $language_list = array_column($data_language, 'short'); 92 $language_list = array_column($data_language, 'short');
93 } 93 }
94 //获取所有页面 94 //获取所有页面
95 $page_list = []; 95 $page_list = [];
96 $url_page = 'https://' . $domain_arr['host'] . '/wp-content/cache/pages_list.json'; 96 $url_page = 'https://' . $domain_arr['host'] . '/wp-content/cache/pages_list.json';
97 - $data_page = http_get($url_page, ['charset' => 'UTF-8']); 97 + $data_page = curl_c($url_page);
98 if ($data_page) { 98 if ($data_page) {
99 $page_list = array_column($data_page, 'path'); 99 $page_list = array_column($data_page, 'path');
100 } 100 }
@@ -105,7 +105,7 @@ class ProjectUpdate extends Command @@ -105,7 +105,7 @@ class ProjectUpdate extends Command
105 if ($api_type == 'category') { 105 if ($api_type == 'category') {
106 //分类 106 //分类
107 $url = $api_url . '?' . http_build_query(['w' => 'category']); 107 $url = $api_url . '?' . http_build_query(['w' => 'category']);
108 - $data = http_get($url, ['charset' => 'UTF-8']); 108 + $data = curl_c($url);
109 if (isset($data['code']) && $data['code'] == 200) { 109 if (isset($data['code']) && $data['code'] == 200) {
110 $items = $data['data'] ?? []; 110 $items = $data['data'] ?? [];
111 $this->category_insert($project_id, $items, 0); 111 $this->category_insert($project_id, $items, 0);
@@ -115,14 +115,14 @@ class ProjectUpdate extends Command @@ -115,14 +115,14 @@ class ProjectUpdate extends Command
115 } elseif ($api_type == 'tag') { 115 } elseif ($api_type == 'tag') {
116 //关键词 116 //关键词
117 $url = $api_url . '?' . http_build_query(['w' => 'tag', 'page' => 1, 'pagesize' => 0]); 117 $url = $api_url . '?' . http_build_query(['w' => 'tag', 'page' => 1, 'pagesize' => 0]);
118 - $data = http_get($url, ['charset' => 'UTF-8']); 118 + $data = curl_c($url);
119 if (isset($data['code']) && $data['code'] == 200) { 119 if (isset($data['code']) && $data['code'] == 200) {
120 $count = $data['data']['count'] ?? 0; 120 $count = $data['data']['count'] ?? 0;
121 121
122 $total_page = ceil($count / $page_size); 122 $total_page = ceil($count / $page_size);
123 for ($page = 1; $page <= $total_page; $page++) { 123 for ($page = 1; $page <= $total_page; $page++) {
124 $url_page = $api_url . '?' . http_build_query(['w' => 'tag', 'page' => $page, 'pagesize' => $page_size]); 124 $url_page = $api_url . '?' . http_build_query(['w' => 'tag', 'page' => $page, 'pagesize' => $page_size]);
125 - $data_page = http_get($url_page, ['charset' => 'UTF-8']); 125 + $data_page = curl_c($url_page);
126 if (isset($data_page['code']) && $data_page['code'] == 200) { 126 if (isset($data_page['code']) && $data_page['code'] == 200) {
127 $items = $data_page['data']['data'] ?? []; 127 $items = $data_page['data']['data'] ?? [];
128 128
@@ -132,6 +132,7 @@ class ProjectUpdate extends Command @@ -132,6 +132,7 @@ class ProjectUpdate extends Command
132 $keyword = $model->read(['title' => $item['name']], 'id'); 132 $keyword = $model->read(['title' => $item['name']], 'id');
133 if (!$keyword) { 133 if (!$keyword) {
134 try { 134 try {
  135 + $item['name'] = $this->special2str($item['name']);
135 $id = $model->addReturnId([ 136 $id = $model->addReturnId([
136 'project_id' => $project_id, 137 'project_id' => $project_id,
137 'title' => $item['name'], 138 'title' => $item['name'],
@@ -139,7 +140,7 @@ class ProjectUpdate extends Command @@ -139,7 +140,7 @@ class ProjectUpdate extends Command
139 'seo_keywords' => $item['seo_keywords'] ?? '', 140 'seo_keywords' => $item['seo_keywords'] ?? '',
140 'seo_description' => $item['seo_description'] ?? '', 141 'seo_description' => $item['seo_description'] ?? '',
141 ]); 142 ]);
142 - $route = RouteMap::setRoute($item['url'] ? $this->get_url_route($item['url']) : $item['name'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id); 143 + $route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id);
143 $model->edit(['route' => $route], ['id' => $id]); 144 $model->edit(['route' => $route], ['id' => $id]);
144 } catch (\Exception $e) { 145 } catch (\Exception $e) {
145 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; 146 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
@@ -160,7 +161,7 @@ class ProjectUpdate extends Command @@ -160,7 +161,7 @@ class ProjectUpdate extends Command
160 } elseif ($api_type == 'website_info') { 161 } elseif ($api_type == 'website_info') {
161 //网站信息 162 //网站信息
162 $url = $api_url . '?' . http_build_query(['w' => 'website_info']); 163 $url = $api_url . '?' . http_build_query(['w' => 'website_info']);
163 - $data = http_get($url, ['charset' => 'UTF-8']); 164 + $data = curl_c($url);
164 if (isset($data['code']) && $data['code'] == 200) { 165 if (isset($data['code']) && $data['code'] == 200) {
165 $phones = $data['data']['phones'] ?? ''; 166 $phones = $data['data']['phones'] ?? '';
166 $emails = $data['data']['emails'] ?? ''; 167 $emails = $data['data']['emails'] ?? '';
@@ -212,14 +213,14 @@ class ProjectUpdate extends Command @@ -212,14 +213,14 @@ class ProjectUpdate extends Command
212 } elseif ($api_type == 'post') { 213 } elseif ($api_type == 'post') {
213 //产品 214 //产品
214 $url = $api_url . '?' . http_build_query(['w' => 'post', 'page' => 1, 'pagesize' => 0]); 215 $url = $api_url . '?' . http_build_query(['w' => 'post', 'page' => 1, 'pagesize' => 0]);
215 - $data = http_get($url, ['charset' => 'UTF-8']); 216 + $data = curl_c($url);
216 if (isset($data['code']) && $data['code'] == 200) { 217 if (isset($data['code']) && $data['code'] == 200) {
217 $count = $data['data']['count'] ?? 0; 218 $count = $data['data']['count'] ?? 0;
218 219
219 $total_page = ceil($count / $page_size); 220 $total_page = ceil($count / $page_size);
220 for ($page = 1; $page <= $total_page; $page++) { 221 for ($page = 1; $page <= $total_page; $page++) {
221 $url_page = $api_url . '?' . http_build_query(['w' => 'post', 'page' => $page, 'pagesize' => $page_size]); 222 $url_page = $api_url . '?' . http_build_query(['w' => 'post', 'page' => $page, 'pagesize' => $page_size]);
222 - $data_page = http_get($url_page, ['charset' => 'UTF-8']); 223 + $data_page = curl_c($url_page);
223 if (isset($data_page['code']) && $data_page['code'] == 200) { 224 if (isset($data_page['code']) && $data_page['code'] == 200) {
224 $items = $data_page['data']['data'] ?? []; 225 $items = $data_page['data']['data'] ?? [];
225 226
@@ -256,6 +257,7 @@ class ProjectUpdate extends Command @@ -256,6 +257,7 @@ class ProjectUpdate extends Command
256 } 257 }
257 } 258 }
258 try { 259 try {
  260 + $item['ttile'] = $this->special2str($item['ttile']);
259 $id = $model->addReturnId([ 261 $id = $model->addReturnId([
260 'project_id' => $project_id, 262 'project_id' => $project_id,
261 'title' => $item['ttile'], 263 'title' => $item['ttile'],
@@ -271,7 +273,7 @@ class ProjectUpdate extends Command @@ -271,7 +273,7 @@ class ProjectUpdate extends Command
271 ]), 273 ]),
272 'status' => Product::STATUS_ON 274 'status' => Product::STATUS_ON
273 ]); 275 ]);
274 - $route = RouteMap::setRoute($item['url'] ? $this->get_url_route($item['url']) : $item['ttile'], RouteMap::SOURCE_PRODUCT, $id, $project_id); 276 + $route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT, $id, $project_id);
275 $model->edit(['route' => $route], ['id' => $id]); 277 $model->edit(['route' => $route], ['id' => $id]);
276 } catch (\Exception $e) { 278 } catch (\Exception $e) {
277 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; 279 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
@@ -292,14 +294,14 @@ class ProjectUpdate extends Command @@ -292,14 +294,14 @@ class ProjectUpdate extends Command
292 } elseif ($api_type == 'news' || $api_type == 'blog') { 294 } elseif ($api_type == 'news' || $api_type == 'blog') {
293 //新闻或博客 295 //新闻或博客
294 $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); 296 $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]);
295 - $data = http_get($url, ['charset' => 'UTF-8']); 297 + $data = curl_c($url);
296 if (isset($data['code']) && $data['code'] == 200) { 298 if (isset($data['code']) && $data['code'] == 200) {
297 $count = $data['data']['count'] ?? 0; 299 $count = $data['data']['count'] ?? 0;
298 300
299 $total_page = ceil($count / $page_size); 301 $total_page = ceil($count / $page_size);
300 for ($page = 1; $page <= $total_page; $page++) { 302 for ($page = 1; $page <= $total_page; $page++) {
301 $url_page = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => $page, 'pagesize' => $page_size]); 303 $url_page = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => $page, 'pagesize' => $page_size]);
302 - $data_page = http_get($url_page, ['charset' => 'UTF-8']); 304 + $data_page = curl_c($url_page);
303 if (isset($data_page['code']) && $data_page['code'] == 200) { 305 if (isset($data_page['code']) && $data_page['code'] == 200) {
304 $items = $data_page['data']['data'] ?? []; 306 $items = $data_page['data']['data'] ?? [];
305 307
@@ -315,6 +317,7 @@ class ProjectUpdate extends Command @@ -315,6 +317,7 @@ class ProjectUpdate extends Command
315 $news = $model->read(['name' => $item['ttile']], 'id'); 317 $news = $model->read(['name' => $item['ttile']], 'id');
316 if (!$news) { 318 if (!$news) {
317 try { 319 try {
  320 + $item['ttile'] = $this->special2str($item['ttile']);
318 $id = $model->addReturnId([ 321 $id = $model->addReturnId([
319 'project_id' => $project_id, 322 'project_id' => $project_id,
320 'name' => $item['ttile'], 323 'name' => $item['ttile'],
@@ -325,7 +328,7 @@ class ProjectUpdate extends Command @@ -325,7 +328,7 @@ class ProjectUpdate extends Command
325 'image' => $item['images'][0] ?? '', 328 'image' => $item['images'][0] ?? '',
326 'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE 329 'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE
327 ]); 330 ]);
328 - $route = RouteMap::setRoute($item['url'] ? $this->get_url_route($item['url']) : $item['ttile'], $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id); 331 + $route = $this->set_map($this->get_url_route($item['url']), $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id);
329 $model->edit(['url' => $route], ['id' => $id]); 332 $model->edit(['url' => $route], ['id' => $id]);
330 } catch (\Exception $e) { 333 } catch (\Exception $e) {
331 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; 334 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
@@ -346,14 +349,14 @@ class ProjectUpdate extends Command @@ -346,14 +349,14 @@ class ProjectUpdate extends Command
346 } else { 349 } else {
347 //单页 350 //单页
348 $url = $api_url . '?' . http_build_query(['w' => 'page', 'page' => 1, 'pagesize' => 0]); 351 $url = $api_url . '?' . http_build_query(['w' => 'page', 'page' => 1, 'pagesize' => 0]);
349 - $data = http_get($url, ['charset' => 'UTF-8']); 352 + $data = curl_c($url);
350 if (isset($data['code']) && $data['code'] == 200) { 353 if (isset($data['code']) && $data['code'] == 200) {
351 $count = $data['data']['count'] ?? 0; 354 $count = $data['data']['count'] ?? 0;
352 355
353 $total_page = ceil($count / $page_size); 356 $total_page = ceil($count / $page_size);
354 for ($page = 1; $page <= $total_page; $page++) { 357 for ($page = 1; $page <= $total_page; $page++) {
355 $url_page = $api_url . '?' . http_build_query(['w' => 'page', 'page' => $page, 'pagesize' => $page_size]); 358 $url_page = $api_url . '?' . http_build_query(['w' => 'page', 'page' => $page, 'pagesize' => $page_size]);
356 - $data_page = http_get($url_page, ['charset' => 'UTF-8']); 359 + $data_page = curl_c($url_page);
357 if (isset($data_page['code']) && $data_page['code'] == 200) { 360 if (isset($data_page['code']) && $data_page['code'] == 200) {
358 $items = $data_page['data']['data'] ?? []; 361 $items = $data_page['data']['data'] ?? [];
359 362
@@ -364,6 +367,7 @@ class ProjectUpdate extends Command @@ -364,6 +367,7 @@ class ProjectUpdate extends Command
364 $custom = $model->read(['name' => $item['ttile']], 'id'); 367 $custom = $model->read(['name' => $item['ttile']], 'id');
365 if (!$custom) { 368 if (!$custom) {
366 try { 369 try {
  370 + $item['ttile'] = $this->special2str($item['ttile']);
367 $id = $model->addReturnId([ 371 $id = $model->addReturnId([
368 'project_id' => $project_id, 372 'project_id' => $project_id,
369 'name' => $item['ttile'], 373 'name' => $item['ttile'],
@@ -373,7 +377,7 @@ class ProjectUpdate extends Command @@ -373,7 +377,7 @@ class ProjectUpdate extends Command
373 'html' => $item['content'] ?? '', 377 'html' => $item['content'] ?? '',
374 'status' => 1 378 'status' => 1
375 ]); 379 ]);
376 - $route = RouteMap::setRoute($item['url'] ? $this->get_url_route($item['url']) : $item['ttile'], RouteMap::SOURCE_PAGE, $id, $project_id); 380 + $route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PAGE, $id, $project_id);
377 $model->edit(['url' => $route], ['id' => $id]); 381 $model->edit(['url' => $route], ['id' => $id]);
378 } catch (\Exception $e) { 382 } catch (\Exception $e) {
379 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; 383 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL;
@@ -429,8 +433,19 @@ class ProjectUpdate extends Command @@ -429,8 +433,19 @@ class ProjectUpdate extends Command
429 //获取地址路由 433 //获取地址路由
430 protected function get_url_route($url) 434 protected function get_url_route($url)
431 { 435 {
432 - $arr = explode('/', $url);  
433 - return $arr[count($arr) - 2]; 436 + $arr = parse_url($url);
  437 + if (empty($arr['path'])) {
  438 + return '';
  439 + }
  440 + $path = $arr['path'];
  441 +
  442 + if (strpos($path, '.') !== false) {
  443 + $path = substr($path, 0, strpos($path, '.'));
  444 + }
  445 +
  446 + $path_arr = explode('/', $path);
  447 +
  448 + return end($path_arr) ? end($path_arr) : $path_arr[count($path_arr) - 2];
434 } 449 }
435 450
436 //多级分类入库 451 //多级分类入库
@@ -442,6 +457,7 @@ class ProjectUpdate extends Command @@ -442,6 +457,7 @@ class ProjectUpdate extends Command
442 $parent = $model->read(['pid' => $pid, 'title' => $item['name']], 'id'); 457 $parent = $model->read(['pid' => $pid, 'title' => $item['name']], 'id');
443 if (!$parent) { 458 if (!$parent) {
444 try { 459 try {
  460 + $item['name'] = $this->special2str($item['name']);
445 $parent_id = $model->addReturnId([ 461 $parent_id = $model->addReturnId([
446 'project_id' => $project_id, 462 'project_id' => $project_id,
447 'title' => $item['name'], 463 'title' => $item['name'],
@@ -449,7 +465,7 @@ class ProjectUpdate extends Command @@ -449,7 +465,7 @@ class ProjectUpdate extends Command
449 'keywords' => $item['keywords'] ?? '', 465 'keywords' => $item['keywords'] ?? '',
450 'describe' => $item['description'] ?? '' 466 'describe' => $item['description'] ?? ''
451 ]); 467 ]);
452 - $route = RouteMap::setRoute($item['url'] ? $this->get_url_route($item['url']) : $item['name'], RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id); 468 + $route = $this->set_map($this->get_url_route($item['url']), RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id);
453 $model->edit(['route' => $route], ['id' => $parent_id]); 469 $model->edit(['route' => $route], ['id' => $parent_id]);
454 } catch (\Exception $e) { 470 } catch (\Exception $e) {
455 echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL; 471 echo 'date:' . date('Y-m-d H:i:s') . ', category_insert error: ' . $e->getMessage() . PHP_EOL;
@@ -477,4 +493,51 @@ class ProjectUpdate extends Command @@ -477,4 +493,51 @@ class ProjectUpdate extends Command
477 493
478 return []; 494 return [];
479 } 495 }
  496 +
  497 + //特殊字符转换
  498 + protected function special2str($str)
  499 + {
  500 + if (strpos($str, ';') === false) {
  501 + return $str;
  502 + }
  503 +
  504 + $list = [
  505 + '&lt;' => '<',
  506 + '&gt;' => '>',
  507 + '&amp;' => '&',
  508 + '&acute;' => '´',
  509 + '&quot;' => '“',
  510 + '&nbsp;' => ' '
  511 + ];
  512 +
  513 + foreach ($list as $k => $v) {
  514 + $str = str_replace($k, $v, $str);
  515 + }
  516 +
  517 + return $str;
  518 + }
  519 +
  520 + //路由入库
  521 + protected function set_map($route, $source, $source_id, $project_id)
  522 + {
  523 + if (empty($route)) {
  524 + return '';
  525 + }
  526 +
  527 + $route_map = new RouteMap();
  528 + $route_map->project_id = $project_id;
  529 + $route_map->source = $source;
  530 + $route_map->source_id = $source_id;
  531 + $route_map->route = $route;
  532 +
  533 + if ($source == RouteMap::SOURCE_NEWS) {
  534 + $route_map->path = RouteMap::SOURCE_NEWS;
  535 + } elseif ($source == RouteMap::SOURCE_BLOG) {
  536 + $route_map->path = RouteMap::SOURCE_BLOG;
  537 + }
  538 +
  539 + $route_map->save();
  540 +
  541 + return $route;
  542 + }
480 } 543 }
@@ -59,11 +59,11 @@ class UpdateRoute extends Command @@ -59,11 +59,11 @@ class UpdateRoute extends Command
59 echo date('Y-m-d H:i:s') . ' start: 项目id为' . $v['id'] . PHP_EOL; 59 echo date('Y-m-d H:i:s') . ' start: 项目id为' . $v['id'] . PHP_EOL;
60 ProjectServer::useProject($v['id']); 60 ProjectServer::useProject($v['id']);
61 $this->setProductRoute($v['id']); 61 $this->setProductRoute($v['id']);
62 - $this->setProductKeywordRoute($v['id']);  
63 - $this->setBlogRoute($v['id']);  
64 - $this->setNewsRoute($v['id']);  
65 - $this->setBlogCateRoute($v['id']);  
66 - $this->setNewsCateRoute($v['id']); 62 +// $this->setProductKeywordRoute($v['id']);
  63 +// $this->setBlogRoute($v['id']);
  64 +// $this->setNewsRoute($v['id']);
  65 +// $this->setBlogCateRoute($v['id']);
  66 +// $this->setNewsCateRoute($v['id']);
67 DB::disconnect('custom_mysql'); 67 DB::disconnect('custom_mysql');
68 } 68 }
69 echo date('Y-m-d H:i:s') . ' end: 项目id为' . $v['id'] . PHP_EOL; 69 echo date('Y-m-d H:i:s') . ' end: 项目id为' . $v['id'] . PHP_EOL;
@@ -80,16 +80,47 @@ class UpdateRoute extends Command @@ -80,16 +80,47 @@ class UpdateRoute extends Command
80 $productModel = new Product(); 80 $productModel = new Product();
81 $productList = $productModel->list(['status'=>['!=',2]],'id',['id','route']); 81 $productList = $productModel->list(['status'=>['!=',2]],'id',['id','route']);
82 foreach ($productList as $v){ 82 foreach ($productList as $v){
83 - $route = preg_replace('/-product.*/', '', $v['route']);  
84 - $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $project_id);  
85 - $route = $route.'-product'; 83 + $route = preg_replace('/-2-1-product.*/', '', $v['route']);
  84 + $route = preg_replace('/-1-1-product.*/', '', $route);
  85 + $route = preg_replace('/-2-product.*/', '', $route);
  86 + $route = preg_replace('/-1-product.*/', '', $route);
  87 + $route = preg_replace('/-product.*/', '', $route);
  88 + $i = 0;
  89 + $routes = $this->productRoute($route,$v['id'],$i);
  90 + $route = RouteMap::setRoute($routes, RouteMap::SOURCE_PRODUCT, $v['id'], $project_id);
  91 + echo date('Y-m-d H:i:s') . ' 路由表返回的route:' . $route . PHP_EOL;
86 $productModel->edit(['route'=>$route],['id'=>$v['id']]); 92 $productModel->edit(['route'=>$route],['id'=>$v['id']]);
87 - RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $project_id);  
88 } 93 }
89 return true; 94 return true;
90 } 95 }
91 96
92 /** 97 /**
  98 + * @remark :产品新增单独处理路由
  99 + * @name :setProductRoute
  100 + * @author :lyh
  101 + * @method :post
  102 + * @time :2023/11/21 18:48
  103 + */
  104 + public function productRoute($route,$id,$i){
  105 + echo date('Y-m-d H:i:s') . ' 打印$i:' . $i . PHP_EOL;
  106 + if($i == 0){
  107 + $routes = $route.'-product';
  108 + }else{
  109 + $routes = $route.'-'.$i.'-product';
  110 + }
  111 + $routeMapModel = new RouteMap();
  112 + $routeInfo = $routeMapModel->read(['route'=>$routes,'source'=>'product','source_id'=>['!=',$id]]);
  113 + if($routeInfo == false){
  114 + echo date('Y-m-d H:i:s') . ' route:' . $routes . PHP_EOL;
  115 + return $routes;
  116 + }else{
  117 + echo date('Y-m-d H:i:s') . ' 数据:' . $routeInfo['id'] . PHP_EOL;
  118 + $i = $i + 1;
  119 + return $this->productRoute($route,$id,$i);
  120 + }
  121 + }
  122 +
  123 + /**
93 * @remark :设置路由 124 * @remark :设置路由
94 * @name :setRoute 125 * @name :setRoute
95 * @author :lyh 126 * @author :lyh
  1 +<?php
  2 +
  3 +namespace App\Console\Commands;
  4 +
  5 +use App\Models\File\DataFile;
  6 +use Illuminate\Console\Command;
  7 +
  8 +class WebsiteData extends Command
  9 +{
  10 + /**
  11 + * The name and signature of the console command.
  12 + *
  13 + * @var string
  14 + */
  15 + protected $signature = 'website_data';
  16 +
  17 + /**
  18 + * The console command description.
  19 + *
  20 + * @var string
  21 + */
  22 + protected $description = '向AICC推送数据';
  23 +
  24 + /**
  25 + * Create a new command instance.
  26 + *
  27 + * @return void
  28 + */
  29 + public function __construct()
  30 + {
  31 + parent::__construct();
  32 + }
  33 +
  34 + /**
  35 + * Execute the console command.
  36 + *
  37 + * @return int
  38 + */
  39 + public function handle()
  40 + {
  41 + $DataFile = new DataFile();
  42 + $data = $DataFile->allData();
  43 + # 详细数据
  44 + $items = $data['items'];
  45 + # 总分页
  46 + $totalPage = $data['totalPage'];
  47 + $this->post_data($items);
  48 + if ($totalPage > 1) {
  49 + for ($page = 2; $page <= $totalPage; $page++) {
  50 + $da = $DataFile->allData($page);
  51 + $this->post_data($da['items']);
  52 + }
  53 + }
  54 + $this->info('项目文件数据推送完成!');
  55 + return 0;
  56 + }
  57 +
  58 + public function post_data($data)
  59 + {
  60 + $url = env('AICC_URL');
  61 + return http_post("{$url}/api/save_file_data", json_encode(compact('data')));
  62 + }
  63 +
  64 +}
@@ -38,6 +38,8 @@ class Kernel extends ConsoleKernel @@ -38,6 +38,8 @@ class Kernel extends ConsoleKernel
38 $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息 38 $schedule->command('last_inquiry')->dailyAt('04:00')->withoutOverlapping(1);// 最近一次询盘信息
39 $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新 39 $schedule->command('update_progress')->everyThirtyMinutes()->withoutOverlapping(1);//监控更新
40 $schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK 40 $schedule->command('update_seo_tdk_crontab')->dailyAt('00:00')->withoutOverlapping(1); //更新上线项目TDK
  41 + $schedule->command('website_data')->everyMinute()->withoutOverlapping(1); // 向AICC推送数据
  42 + $schedule->command('project_file_pdf')->everyMinute()->withoutOverlapping(1); // 网站项目数据,生成PDF文件
41 } 43 }
42 44
43 /** 45 /**
@@ -108,6 +108,36 @@ if (!function_exists('http_get')) { @@ -108,6 +108,36 @@ if (!function_exists('http_get')) {
108 } 108 }
109 } 109 }
110 110
  111 +if (!function_exists('curl_c')) {
  112 + /**
  113 + * @param $url
  114 + * @return []
  115 + * @author Akun
  116 + * @date 2023/11/22 11:33
  117 + */
  118 + function curl_c($url){
  119 + $header = array(
  120 + 'Expect:',
  121 + 'Content-Type: application/json; charset=utf-8'
  122 + );
  123 + $ch = curl_init($url);
  124 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  125 + curl_setopt($ch, CURLOPT_HEADER, false);
  126 + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  127 + curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246');
  128 + curl_setopt($ch, CURLOPT_AUTOREFERER, true);
  129 + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
  130 + curl_setopt($ch, CURLOPT_TIMEOUT, 120);
  131 + curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
  132 + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  133 + curl_setopt($ch, CURLOPT_SSLVERSION, 'all');
  134 + curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  135 + $content = curl_exec($ch);
  136 + curl_close($ch);
  137 + return json_decode($content, true);
  138 + }
  139 +}
  140 +
111 141
112 if (!function_exists('_get_child')) { 142 if (!function_exists('_get_child')) {
113 /** 143 /**
@@ -25,6 +25,7 @@ class ATemplateController extends BaseController @@ -25,6 +25,7 @@ class ATemplateController extends BaseController
25 */ 25 */
26 public function lists(ATemplateLogic $aTemplateLogic){ 26 public function lists(ATemplateLogic $aTemplateLogic){
27 $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; 27 $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id'];
  28 + $this->map['project_id'] = 0;
28 $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); 29 $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed);
29 if(!empty($lists) && !empty($lists['list'])){ 30 if(!empty($lists) && !empty($lists['list'])){
30 foreach ($lists['list'] as $k => $v){ 31 foreach ($lists['list'] as $k => $v){
@@ -300,4 +300,24 @@ class LoginController extends BaseController @@ -300,4 +300,24 @@ class LoginController extends BaseController
300 return $data; 300 return $data;
301 } 301 }
302 302
  303 + public function ceshi(){
  304 + $url = 'https://demo.globalso.site/';
  305 + $contextOptions = [
  306 + 'ssl' => [
  307 + 'verify_peer' => false,
  308 + 'verify_peer_name' => false,
  309 + ],
  310 + ];
  311 + $context = stream_context_create($contextOptions);
  312 + $sourceCode = file_get_contents($url, false, $context);
  313 + $pattern = '/<style\b[^>]*>(.*?)<\/style>/s'; // 定义匹配`<style>`标签及其内容的正则表达式
  314 + $strippedContent = preg_replace($pattern, '', $sourceCode); // 删除`<style>`标签及其内容
  315 + $pattern = '/<link\b[^>]*>/'; // 定义匹配 `<link>` 标签的正则表达式
  316 + $strippedContent = preg_replace($pattern, '', $strippedContent); // 删除 `<link>` 标签
  317 + $pattern = '/>([^<]+)</'; // 定义匹配中间内容不是标签的正则表达式
  318 + $matches = array();
  319 + preg_match_all($pattern, $strippedContent, $matches);
  320 + $textContentArray = $matches[1];
  321 + var_dump($textContentArray);
  322 + }
303 } 323 }
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\ProjectAssociation;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Exceptions\BsideGlobalException;
  7 +use App\Http\Controllers\Bside\BaseController;
  8 +use App\Http\Logic\Aside\ProjectAssociation\ProjectAssociationLogic;
  9 +use Illuminate\Http\Request;
  10 +use Psr\Container\ContainerExceptionInterface;
  11 +use Psr\Container\NotFoundExceptionInterface;
  12 +
  13 +class ProjectAssociationController extends BaseController
  14 +{
  15 + private $ProjectAssociationLogic;
  16 +
  17 + public function __construct(Request $request)
  18 + {
  19 + $this->ProjectAssociationLogic = new ProjectAssociationLogic();
  20 + parent::__construct($request);
  21 + }
  22 +
  23 + /**
  24 + * V6与AICC数据关联
  25 + * @return void
  26 + * @throws BsideGlobalException
  27 + */
  28 + public function saveWeChatData()
  29 + {
  30 + $project_id = (int)request()->post('project_id', 0);
  31 + if (empty($project_id)) {
  32 + $this->fail('请选择项目!', Code::USER_PARAMS_ERROE);
  33 + }
  34 + $status = (bool)request()->post('status', 1); # 1 - 正常, 0 - 禁用
  35 + $wx_user_id = (int)request()->post('user_id', 0);
  36 + if (empty($wx_user_id) && $status) {
  37 + $this->fail('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE);
  38 + }
  39 + $wx_id = (int)request()->post('wx_id', 0);
  40 + if (empty($wx_id) && $status) {
  41 + $this->fail('请选择要绑定的AICC项目!', Code::USER_PARAMS_ERROE);
  42 + }
  43 + $wx_nickname = request()->post('nickname', '');
  44 + $wx_user_name = request()->post('user_name', '');
  45 + $wx_image = request()->post('image', '');
  46 + $data = compact('project_id', 'wx_id', 'wx_nickname', 'wx_user_id', 'wx_user_name', 'wx_image');
  47 + $this->ProjectAssociationLogic->saveWeChatData($data);
  48 + $this->response('success');
  49 + }
  50 +}
@@ -51,4 +51,17 @@ class ProofreadingController extends BaseController @@ -51,4 +51,17 @@ class ProofreadingController extends BaseController
51 $list = $proofreadingLogic->countryLanguageList($this->map,$this->order); 51 $list = $proofreadingLogic->countryLanguageList($this->map,$this->order);
52 $this->response('success',Code::SUCCESS,$list); 52 $this->response('success',Code::SUCCESS,$list);
53 } 53 }
  54 +
  55 + /**
  56 + * @remark :获取Url内容
  57 + * @name :getUrlRead
  58 + * @author :lyh
  59 + * @method :post
  60 + * @time :2023/11/22 10:02
  61 + */
  62 + public function getUrlRead($url){
  63 + $sourceCode = file_get_contents($url);
  64 + $strippedContent = strip_tags($sourceCode); // 删除所有HTML标签
  65 + var_dump($strippedContent);
  66 + }
54 } 67 }
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Template; @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Bside\Template;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic; 7 use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic;
  8 +use App\Models\Template\BModuleProject;
8 9
9 /** 10 /**
10 * @remark :左侧模块管理 11 * @remark :左侧模块管理
@@ -25,7 +26,12 @@ class BTemplateModuleController extends BaseController @@ -25,7 +26,12 @@ class BTemplateModuleController extends BaseController
25 if(!isset($this->map['test_model'])){ 26 if(!isset($this->map['test_model'])){
26 $this->map['test_model'] = 0; 27 $this->map['test_model'] = 0;
27 } 28 }
  29 + $data = [];
28 $list = $BTemplateModuleLogic->ModuleList($this->map,$this->order); 30 $list = $BTemplateModuleLogic->ModuleList($this->map,$this->order);
  31 +// $data['list'] = $list;
  32 +// $moduleProjectModel = new BModuleProject();
  33 +// $module_list = $moduleProjectModel->list(['project_id'=>$this->user['project_id']]);
  34 +// $data['module_list'] = $module_list;
29 $this->response('success',Code::SUCCESS,$list); 35 $this->response('success',Code::SUCCESS,$list);
30 } 36 }
31 37
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Aside\ProjectAssociation;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Logic\Logic;
  7 +use App\Models\ProjectAssociation\ProjectAssociation;
  8 +use Illuminate\Support\Facades\DB;
  9 +
  10 +class ProjectAssociationLogic extends Logic
  11 +{
  12 + public function saveWeChatData($data)
  13 + {
  14 + $wx = new ProjectAssociation();
  15 + DB::beginTransaction();
  16 + try {
  17 + $status = $wx->saveData($data);
  18 + DB::commit();
  19 + } catch (\Exception $e) {
  20 + DB::rollBack();
  21 + $e->getMessage();
  22 + errorLog('V6与AICC关联失败', $wx, $e);
  23 + $this->fail('请检查操作是否正确!', Code::SERVER_MYSQL_ERROR);
  24 + }
  25 + return $status;
  26 + }
  27 +}
@@ -366,7 +366,8 @@ class ProductLogic extends BaseLogic @@ -366,7 +366,8 @@ class ProductLogic extends BaseLogic
366 $info = $this->model->read(['id'=>$this->param['id']]); 366 $info = $this->model->read(['id'=>$this->param['id']]);
367 $param = $this->setProductParams($info); 367 $param = $this->setProductParams($info);
368 $save_id = $this->model->insertGetId($param); 368 $save_id = $this->model->insertGetId($param);
369 - $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']); 369 + $route = preg_replace('/-product.*/', '', $param['route']);
  370 + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']);
370 $this->model->edit(['route'=>$route],['id'=>$save_id]); 371 $this->model->edit(['route'=>$route],['id'=>$save_id]);
371 //同步可视化装修数据 372 //同步可视化装修数据
372 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id); 373 $this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
  1 +<?php
  2 +
  3 +namespace App\Models\File;
  4 +
  5 +use App\Models\Base;
  6 +
  7 +class DataFile extends Base
  8 +{
  9 + protected $table = 'gl_data_file';
  10 +
  11 + public function saveData(array $data): bool
  12 + {
  13 + $project_id = (int)$data['project_id'] ?? 0;
  14 + $isRes = self::query()->where('project_id', $project_id)->where('created_at', 'like', $data['time'] . '%')->first();
  15 + if (!$isRes) {
  16 + $isRes = new self();
  17 + $isRes->project_id = $project_id;
  18 + }
  19 + $isRes->file_path = $data['file_path'];
  20 + $isRes->application_id = $data['application_id'];
  21 + return $isRes->save();
  22 + }
  23 +
  24 + /**
  25 + * @param int $page
  26 + * @param int $perPage
  27 + * @return array
  28 + */
  29 + public function allData(int $page = 1, int $perPage = 15)
  30 + {
  31 + $lists = self::query()->paginate($perPage, ['*'], 'page', $page);
  32 + $items = $lists->Items();
  33 + $totalPage = $lists->lastPage();
  34 + $total = $lists->total();
  35 + $currentPage = $lists->currentPage();
  36 + return compact('total', 'items', 'totalPage', 'currentPage');
  37 + }
  38 +
  39 +}
  1 +<?php
  2 +
  3 +namespace App\Models\ProjectAssociation;
  4 +
  5 +use Illuminate\Database\Eloquent\Builder;
  6 +use Illuminate\Database\Eloquent\Model;
  7 +
  8 +class ProjectAssociation extends Model
  9 +{
  10 + protected $table = 'gl_project_association';
  11 +
  12 + /**
  13 + * 保存|修改数据
  14 + * @param array $data
  15 + * @return bool
  16 + */
  17 + public function saveData(array $data): bool
  18 + {
  19 + $project_id = (int)$data['project_id'] ?? 0;
  20 + $isRes = self::query()->where('project_id', $project_id)->first();
  21 + if (!$isRes) {
  22 + $isRes = new self();
  23 + $isRes->project_id = $project_id;
  24 + }
  25 + $isRes->wx_id = $data['wx_id'];
  26 + $isRes->wx_nickname = $data['wx_nickname'];
  27 + $isRes->wx_user_id = $data['wx_user_id'];
  28 + $isRes->wx_user_name = $data['wx_user_name'];
  29 + $isRes->wx_image = $data['wx_image'];
  30 + return $isRes->save();
  31 + }
  32 +
  33 + /**
  34 + * 检查项目是否存在
  35 + * @param $project_id
  36 + * @return Builder|Model|object|null
  37 + */
  38 + public function check($project_id)
  39 + {
  40 + return self::query()->where('project_id', $project_id)->first();
  41 + }
  42 +
  43 + /**
  44 + * @param int $page
  45 + * @param int $perPage
  46 + * @return array
  47 + */
  48 + public function allData(int $page = 1, int $perPage = 15)
  49 + {
  50 + $status = 1; # 1 - 正常, 0 - 禁用
  51 + $lists = self::query()->where('status', $status)
  52 + ->whereNotNull('project_id')
  53 + ->whereNotNull('wx_user_id')
  54 + ->paginate($perPage, ['project_id', 'wx_id', 'wx_user_id'], 'page', $page);
  55 + $items = $lists->Items();
  56 + $totalPage = $lists->lastPage();
  57 + $total = $lists->total();
  58 + $currentPage = $lists->currentPage();
  59 + return compact('total', 'items', 'totalPage', 'currentPage');
  60 + }
  61 +}
@@ -56,10 +56,12 @@ class RouteMap extends Base @@ -56,10 +56,12 @@ class RouteMap extends Base
56 $i=1; 56 $i=1;
57 $sign = generateRoute($title); 57 $sign = generateRoute($title);
58 $route = $sign; 58 $route = $sign;
  59 + if($source != BTemplate::SOURCE_PRODUCT){
59 while(self::isExist($route, $source, $source_id, $project_id)){ 60 while(self::isExist($route, $source, $source_id, $project_id)){
60 $route = $sign .'-'.$i; 61 $route = $sign .'-'.$i;
61 $i++; 62 $i++;
62 } 63 }
  64 + }
63 return $route; 65 return $route;
64 } 66 }
65 67
@@ -151,11 +153,11 @@ class RouteMap extends Base @@ -151,11 +153,11 @@ class RouteMap extends Base
151 * @time :2023/11/21 18:48 153 * @time :2023/11/21 18:48
152 */ 154 */
153 public static function setProductRoute($route,$i = 0){ 155 public static function setProductRoute($route,$i = 0){
154 - $route = $route.'-product'; 156 + $routes = $route.'-product';
155 $routeMapModel = new RouteMap(); 157 $routeMapModel = new RouteMap();
156 - $routeInfo = $routeMapModel->read(['route'=>$route]); 158 + $routeInfo = $routeMapModel->read(['route'=>$routes]);
157 if($routeInfo === false){ 159 if($routeInfo === false){
158 - return $route; 160 + return $routes;
159 }else{ 161 }else{
160 $i = $i + 1; 162 $i = $i + 1;
161 $route = $route.'-'.$i; 163 $route = $route.'-'.$i;
@@ -171,11 +173,11 @@ class RouteMap extends Base @@ -171,11 +173,11 @@ class RouteMap extends Base
171 * @time :2023/11/21 18:48 173 * @time :2023/11/21 18:48
172 */ 174 */
173 public static function setKeywordRoute($route,$i = 0){ 175 public static function setKeywordRoute($route,$i = 0){
174 - $route = $route.'-tag'; 176 + $routes = $route.'-tag';
175 $routeMapModel = new RouteMap(); 177 $routeMapModel = new RouteMap();
176 - $routeInfo = $routeMapModel->read(['route'=>$route]); 178 + $routeInfo = $routeMapModel->read(['route'=>$routes]);
177 if($routeInfo === false){ 179 if($routeInfo === false){
178 - return $route; 180 + return $routes;
179 }else{ 181 }else{
180 $i = $i + 1; 182 $i = $i + 1;
181 $route = $route.'-'.$i; 183 $route = $route.'-'.$i;
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 "bensampo/laravel-enum": "^4.2", 8 "bensampo/laravel-enum": "^4.2",
9 "beyondcode/laravel-websockets": "^1.14", 9 "beyondcode/laravel-websockets": "^1.14",
10 "doctrine/dbal": "^3.6", 10 "doctrine/dbal": "^3.6",
  11 + "dompdf/dompdf": "^2.0",
11 "fruitcake/laravel-cors": "^2.0", 12 "fruitcake/laravel-cors": "^2.0",
12 "guzzlehttp/guzzle": "^7.0.1", 13 "guzzlehttp/guzzle": "^7.0.1",
13 "hashids/hashids": "^4.1", 14 "hashids/hashids": "^4.1",
@@ -13,6 +13,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -13,6 +13,7 @@ Route::middleware(['aloginauth'])->group(function () {
13 Route::any('/editPassword', [Aside\Com\IndexController::class, 'editPassword'])->name('admin.editPassword.white'); 13 Route::any('/editPassword', [Aside\Com\IndexController::class, 'editPassword'])->name('admin.editPassword.white');
14 Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white'); 14 Route::get('/logout', [Aside\LoginController::class, 'logout'])->name('admin.logout.white');
15 Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址 15 Route::any('/getAccessAddress', [Aside\LoginController::class, 'getAccessAddress'])->name('admin.getAccessAddress');//获取B端地址
  16 + Route::post('/aicc/wechat', [\App\Http\Controllers\Bside\ProjectAssociation\ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat');
16 //会员相关 17 //会员相关
17 Route::prefix('user')->group(function () { 18 Route::prefix('user')->group(function () {
18 //会员管理 19 //会员管理