作者 zhl

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

正在显示 39 个修改的文件 包含 508 行增加171 行删除
@@ -57,7 +57,9 @@ class RemainDay extends Command @@ -57,7 +57,9 @@ class RemainDay extends Command
57 foreach ($list as $item){ 57 foreach ($list as $item){
58 if($item['type'] == Project::TYPE_TWO){ 58 if($item['type'] == Project::TYPE_TWO){
59 //排名达标天数 59 //排名达标天数
60 - $compliance_day = GoogleRankModel::where(['project_id' => $item['id'], 'lang' => ''])->value('compliance_day') ?: 0; 60 +// $compliance_day = GoogleRankModel::where(['project_id' => $item['id'], 'lang' => ''])->value('compliance_day') ?: 0;
  61 + //获取当前项目的达标天数
  62 + $compliance_day = Project::where(['id' => $item['id']])->value('finish_remain_day') ?: 0;
61 $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; 63 $remain_day = $item['deploy_build']['service_duration'] - $compliance_day;
62 }else{ 64 }else{
63 //审核上线后开始 65 //审核上线后开始
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :SyncMobile.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/12/25 15:00
  8 + */
  9 +
  10 +namespace App\Console\Commands;
  11 +
  12 +use App\Models\User\User;
  13 +use Illuminate\Console\Command;
  14 +use Illuminate\Support\Facades\DB;
  15 +
  16 +class SyncMobile extends Command
  17 +{
  18 + /**
  19 + * The name and signature of the console command.
  20 + *
  21 + * @var string
  22 + */
  23 + protected $signature = 'sync_manager';
  24 +
  25 + /**
  26 + * The console command description.
  27 + *
  28 + * @var string
  29 + */
  30 + protected $description = '同步手机号码库';
  31 +
  32 + /**
  33 + * @remark :统一更新路由
  34 + * @name :handle
  35 + * @author :lyh
  36 + * @method :post
  37 + * @time :2023/11/20 15:13
  38 + */
  39 + public function handle(){
  40 + $url = 'https://www.quanqiusou.cn/extend_api/saas/get_phone.php';
  41 + $data = curlGet($url);//TODO::获取号码库
  42 + DB::table('gl_mobile')->delete();
  43 + $create_time = date('Y-m-d H:i:s');
  44 + foreach ($data as $v){
  45 + $param = [
  46 + 'mobile'=>$v,
  47 + 'created_at'=>$create_time
  48 + ];
  49 + DB::table('gl_mobile')->insert($param);
  50 + }
  51 + if(!empty($data)){
  52 + $userModel = new User();
  53 + try {
  54 + $userModel->edit(['status'=>1],['project_id'=>1,'mobile'=>['not in',$data]]);
  55 + $userModel->edit(['status'=>0],['project_id'=>1,'mobile'=>['in',$data]]);
  56 + }catch (\Exception $e){
  57 + echo date('Y-m-d H:i:s') . 'error' . PHP_EOL;
  58 + }
  59 + }
  60 + }
  61 +
  62 +}
@@ -9,6 +9,7 @@ use App\Models\Channel\Channel; @@ -9,6 +9,7 @@ use App\Models\Channel\Channel;
9 use App\Models\Com\NoticeLog; 9 use App\Models\Com\NoticeLog;
10 use App\Models\Com\UpdateLog; 10 use App\Models\Com\UpdateLog;
11 use App\Models\Com\UpdateVisit; 11 use App\Models\Com\UpdateVisit;
  12 +use App\Models\Manage\Mobile;
12 use App\Models\Project\After; 13 use App\Models\Project\After;
13 use App\Models\Project\DeployBuild; 14 use App\Models\Project\DeployBuild;
14 use App\Models\Project\DeployOptimize; 15 use App\Models\Project\DeployOptimize;
@@ -201,7 +202,7 @@ class SyncProject extends Command @@ -201,7 +202,7 @@ class SyncProject extends Command
201 'is_upgrade'=>$is_update, 202 'is_upgrade'=>$is_update,
202 ], 203 ],
203 'deploy_build' => [ 204 'deploy_build' => [
204 - 'service_duration' => $param['years'], 205 + 'service_duration' => $param['years'] ?? 0,
205 'plan' => $this->versionData($param['plan_marketing']), 206 'plan' => $this->versionData($param['plan_marketing']),
206 'login_mobile'=>$param['principal_mobile'] 207 'login_mobile'=>$param['principal_mobile']
207 ], 208 ],
@@ -456,17 +457,23 @@ class SyncProject extends Command @@ -456,17 +457,23 @@ class SyncProject extends Command
456 */ 457 */
457 public function createUser($mobile,$project_id,$lead_name){ 458 public function createUser($mobile,$project_id,$lead_name){
458 $userModel = new UserModel(); 459 $userModel = new UserModel();
459 - //查看当前用户是否存在  
460 - $info = $userModel->read(['mobile'=>$mobile,'project_id'=>$project_id]);  
461 - if($info === false){  
462 - $data = [  
463 - 'mobile'=>$mobile,  
464 - 'password'=>base64_encode(md5('123456')),  
465 - 'project_id'=>$project_id,  
466 - 'name'=>$lead_name,  
467 - 'type'=>UserModel::TYPE_ONE  
468 - ];  
469 - $userModel->add($data); 460 + //查看当前项目是否存在号码库中
  461 + $mobileModel = new Mobile();
  462 + $mobileInfo = $mobileModel->read(['mobile'=>$mobile]);
  463 + if($mobileInfo === false){
  464 + //查看当前用户是否存在
  465 + $info = $userModel->read(['mobile'=>$mobile,'project_id'=>$project_id]);
  466 + if($info === false){
  467 + $data = [
  468 + 'mobile'=>$mobile,
  469 + 'password'=>base64_encode(md5('123456')),
  470 + 'project_id'=>$project_id,
  471 + 'name'=>$lead_name,
  472 + 'type'=>UserModel::TYPE_ONE
  473 + ];
  474 + $userModel->add($data);
  475 + }
470 } 476 }
  477 + return true;
471 } 478 }
472 } 479 }
@@ -41,45 +41,82 @@ class HtmlCustomCollect extends Command @@ -41,45 +41,82 @@ class HtmlCustomCollect extends Command
41 { 41 {
42 ini_set('memory_limit', '512M'); 42 ini_set('memory_limit', '512M');
43 43
44 - $project_id = 633;  
45 - $project_site = 'v6-ke5nz.globalso.site'; 44 + $project_id = 517;
  45 + $project_site = 'v6-1gee9.globalso.site';
46 $pages = [ 46 $pages = [
47 - 'https://www.mach-sales.com/case_catalog/cases/',  
48 - 'https://www.mach-sales.com/case_catalog/cases/page/2/',  
49 - 'https://www.mach-sales.com/case_catalog/cases/page/3/',  
50 - 'https://www.mach-sales.com/case/growing-with-customers-from-small-motors-to-big-drivers/',  
51 - 'https://www.mach-sales.com/case/growing-together-with-customers-the-journey-of-intelligent-manufacturing-in-a-modernized-factory/',  
52 - 'https://www.mach-sales.com/case/%e3%80%90growing-together-with-customers%e3%80%91-the-evolutionary-journey-of-a-baking-brand/',  
53 - 'https://www.mach-sales.com/case/sumecs-footprints-in-belt-and-road-singapore/',  
54 - 'https://www.mach-sales.com/case/sumecs-footprints-in-belt-and-road-southeast-asia/',  
55 - 'https://www.mach-sales.com/case/naming-and-delivery-of-a-new-ship-1/',  
56 - 'https://www.mach-sales.com/case/a-newly-signed-contract-cable-manufacturing-equipment/',  
57 - 'https://www.mach-sales.com/case/its-amazing-that-the-glass-can-also-save-energy/',  
58 - 'https://www.mach-sales.com/case/%e3%80%90grow-with-customers%e3%80%91better-service-for-papermaking-equipment-procurement/',  
59 - 'https://www.mach-sales.com/case/expansion-of-blower-equipment-contributes-to-environmental-protection/',  
60 - 'https://www.mach-sales.com/case/new-ship-type-new-contract/',  
61 - 'https://www.mach-sales.com/case/new-arrival-introducing-the-latest-ship-model/',  
62 - 'https://www.mach-sales.com/case/another-contract-signed-in-the-philippines/',  
63 - 'https://www.mach-sales.com/case/the-road-to-going-global-is-supported-by-sumec-services/',  
64 - 'https://www.mach-sales.com/case/sumec-textile-launches-sun-protection-series-in-collaboration-with-skechers-kids/',  
65 - 'https://www.mach-sales.com/case/footwear-manufacturing-equipment-new-contract/',  
66 - 'https://www.mach-sales.com/case/sumec-energy-company-has-successfully-signed-a-photovoltaic-component-supply-agreement-with-wattkraft-a-german-engineering-system-integrator/',  
67 - 'https://www.mach-sales.com/case/sumec-technology-company-successfully-signed-a-contract-for-the-equipment-related-to-the-high-strength-particleboard-project/',  
68 - 'https://www.mach-sales.com/case/%e3%80%90growing-together-with-our-customers%e3%80%91together-on-the-road-to-transformation/',  
69 - 'https://www.mach-sales.com/case/new-signing/',  
70 - 'https://www.mach-sales.com/case/complete-the-last-mile-equipment-procurement-from-around-the-world/',  
71 - 'https://www.mach-sales.com/case/science-and-technology-to-rejuvenate-agriculture-this-plant-factory-is-not-simple/',  
72 - 'https://www.mach-sales.com/case/new-cooperation-high-end-equipment-going-global/',  
73 - 'https://www.mach-sales.com/case/a-new-cooperation-with-an-annual-output-of-40000-tons/',  
74 - 'https://www.mach-sales.com/case/a-new-contract-cooperation-upgrades/',  
75 - 'https://www.mach-sales.com/case/annual-output-of-50000-tons-this-bopp-film-production-line-was-officially-put-into-operation/',  
76 - 'https://www.mach-sales.com/case/this-is-sumec-speed/',  
77 - 'https://www.mach-sales.com/case/the-first-order-of-a-new-semiconductor-brand-equipment-direct-sales-bear-fruit-again/',  
78 - 'https://www.mach-sales.com/case/sumec-touch-world-celebrates-its-5th-anniversary-with-well-known-suppliers/',  
79 - 'https://www.mach-sales.com/case/from-traditional-agency-to-digital-service/',  
80 - 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/' 47 + 'https://www.beifa.group/help/send-results/',
  48 + 'https://www.beifa.group/help/terms-of-use/',
  49 + 'https://www.beifa.group/help/position-3/',
  50 + 'https://www.beifa.group/help/position-2/',
  51 + 'https://www.beifa.group/help/position-1/',
  52 + 'https://www.beifa.group/help/social-media/',
  53 + 'https://www.beifa.group/help/globle-exibition-2/',
  54 + 'https://www.beifa.group/help/job/',
  55 + 'https://www.beifa.group/help/vr/',
  56 + 'https://www.beifa.group/help/on-live-video/',
  57 + 'https://www.beifa.group/help/honor/',
  58 + 'https://www.beifa.group/help/certification/',
  59 + 'https://www.beifa.group/help/quanity-control/',
  60 + 'https://www.beifa.group/help/testing-center/',
  61 + 'https://www.beifa.group/help/rd/',
  62 + 'https://www.beifa.group/help/design-trend/',
  63 + 'https://www.beifa.group/help/partner/',
  64 + 'https://www.beifa.group/help/social-responsibility/',
  65 + 'https://www.beifa.group/help/contact/',
81 ]; 66 ];
82 67
  68 +// $project_id = 586;
  69 +// $project_site = 'v6-m605x.globalso.site';
  70 +// $pages = [
  71 +// 'https://www.citymax-group.com/case/',
  72 +// 'https://www.citymax-group.com/case_catalog/crop-classification/',
  73 +// 'https://www.citymax-group.com/case_catalog/field-crops/',
  74 +// 'https://www.citymax-group.com/case_catalog/fruits/',
  75 +// 'https://www.citymax-group.com/case_catalog/vegetables/',
  76 +// 'https://www.citymax-group.com/case/report-on-use-of-citymax-products-on-grapes-2/',
  77 +// 'https://www.citymax-group.com/case/report-on-use-of-citymax-products-on-cucumber/',
  78 +// 'https://www.citymax-group.com/case/field-experiment-crop-lettuce/',
  79 +// ];
  80 +
  81 +// $project_id = 633;
  82 +// $project_site = 'v6-ke5nz.globalso.site';
  83 +// $pages = [
  84 +// 'https://www.mach-sales.com/case_catalog/cases/',
  85 +// 'https://www.mach-sales.com/case_catalog/cases/page/2/',
  86 +// 'https://www.mach-sales.com/case_catalog/cases/page/3/',
  87 +// 'https://www.mach-sales.com/case/growing-with-customers-from-small-motors-to-big-drivers/',
  88 +// 'https://www.mach-sales.com/case/growing-together-with-customers-the-journey-of-intelligent-manufacturing-in-a-modernized-factory/',
  89 +// 'https://www.mach-sales.com/case/%e3%80%90growing-together-with-customers%e3%80%91-the-evolutionary-journey-of-a-baking-brand/',
  90 +// 'https://www.mach-sales.com/case/sumecs-footprints-in-belt-and-road-singapore/',
  91 +// 'https://www.mach-sales.com/case/sumecs-footprints-in-belt-and-road-southeast-asia/',
  92 +// 'https://www.mach-sales.com/case/naming-and-delivery-of-a-new-ship-1/',
  93 +// 'https://www.mach-sales.com/case/a-newly-signed-contract-cable-manufacturing-equipment/',
  94 +// 'https://www.mach-sales.com/case/its-amazing-that-the-glass-can-also-save-energy/',
  95 +// 'https://www.mach-sales.com/case/%e3%80%90grow-with-customers%e3%80%91better-service-for-papermaking-equipment-procurement/',
  96 +// 'https://www.mach-sales.com/case/expansion-of-blower-equipment-contributes-to-environmental-protection/',
  97 +// 'https://www.mach-sales.com/case/new-ship-type-new-contract/',
  98 +// 'https://www.mach-sales.com/case/new-arrival-introducing-the-latest-ship-model/',
  99 +// 'https://www.mach-sales.com/case/another-contract-signed-in-the-philippines/',
  100 +// 'https://www.mach-sales.com/case/the-road-to-going-global-is-supported-by-sumec-services/',
  101 +// 'https://www.mach-sales.com/case/sumec-textile-launches-sun-protection-series-in-collaboration-with-skechers-kids/',
  102 +// 'https://www.mach-sales.com/case/footwear-manufacturing-equipment-new-contract/',
  103 +// 'https://www.mach-sales.com/case/sumec-energy-company-has-successfully-signed-a-photovoltaic-component-supply-agreement-with-wattkraft-a-german-engineering-system-integrator/',
  104 +// 'https://www.mach-sales.com/case/sumec-technology-company-successfully-signed-a-contract-for-the-equipment-related-to-the-high-strength-particleboard-project/',
  105 +// 'https://www.mach-sales.com/case/%e3%80%90growing-together-with-our-customers%e3%80%91together-on-the-road-to-transformation/',
  106 +// 'https://www.mach-sales.com/case/new-signing/',
  107 +// 'https://www.mach-sales.com/case/complete-the-last-mile-equipment-procurement-from-around-the-world/',
  108 +// 'https://www.mach-sales.com/case/science-and-technology-to-rejuvenate-agriculture-this-plant-factory-is-not-simple/',
  109 +// 'https://www.mach-sales.com/case/new-cooperation-high-end-equipment-going-global/',
  110 +// 'https://www.mach-sales.com/case/a-new-cooperation-with-an-annual-output-of-40000-tons/',
  111 +// 'https://www.mach-sales.com/case/a-new-contract-cooperation-upgrades/',
  112 +// 'https://www.mach-sales.com/case/annual-output-of-50000-tons-this-bopp-film-production-line-was-officially-put-into-operation/',
  113 +// 'https://www.mach-sales.com/case/this-is-sumec-speed/',
  114 +// 'https://www.mach-sales.com/case/the-first-order-of-a-new-semiconductor-brand-equipment-direct-sales-bear-fruit-again/',
  115 +// 'https://www.mach-sales.com/case/sumec-touch-world-celebrates-its-5th-anniversary-with-well-known-suppliers/',
  116 +// 'https://www.mach-sales.com/case/from-traditional-agency-to-digital-service/',
  117 +// 'https://www.mach-sales.com/case/cooperation-win-win-and-starting-anew-sumec-creates-a-new-sample-of-strong-enterprise-cooperation/'
  118 +// ];
  119 +
83 // $project_id = 437; 120 // $project_id = 437;
84 // $project_site = 'v6-1500k.globalso.site'; 121 // $project_site = 'v6-1500k.globalso.site';
85 // $pages = [ 122 // $pages = [
@@ -40,7 +40,7 @@ class ProjectReset extends Command @@ -40,7 +40,7 @@ class ProjectReset extends Command
40 //关闭数据库 40 //关闭数据库
41 DB::disconnect('custom_mysql'); 41 DB::disconnect('custom_mysql');
42 42
43 - UpdateLog::where('project_id', $project_id)->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update(['collect_status' => 0]); 43 + UpdateLog::where('project_id', $project_id)->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update(['status' => 0, 'collect_status' => 0]);
44 44
45 echo $project_id . ',重置成功' . PHP_EOL; 45 echo $project_id . ',重置成功' . PHP_EOL;
46 } 46 }
@@ -331,7 +331,7 @@ class ProjectUpdate extends Command @@ -331,7 +331,7 @@ class ProjectUpdate extends Command
331 $category_id = ''; 331 $category_id = '';
332 if ($api_type == 'news' && ($item['category'] ?? [])) { 332 if ($api_type == 'news' && ($item['category'] ?? [])) {
333 $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); 333 $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]);
334 - $category_id = $logic->getLastCategory(array_column($category_arr, 'id')); 334 + $category_id = $logic->getCategory(array_column($category_arr, 'id'));
335 } 335 }
336 try { 336 try {
337 $item['ttile'] = $this->special2str($item['ttile'] ?? ''); 337 $item['ttile'] = $this->special2str($item['ttile'] ?? '');
@@ -40,6 +40,7 @@ class Kernel extends ConsoleKernel @@ -40,6 +40,7 @@ class Kernel extends ConsoleKernel
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')->dailyAt('01:00')->withoutOverlapping(1); // 向AICC推送数据 41 $schedule->command('website_data')->dailyAt('01:00')->withoutOverlapping(1); // 向AICC推送数据
42 $schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件 42 $schedule->command('project_file_pdf')->dailyAt('00:00')->withoutOverlapping(1); // 网站项目数据,生成PDF文件
  43 + $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
43 } 44 }
44 45
45 /** 46 /**
@@ -74,7 +74,7 @@ class Handler extends ExceptionHandler @@ -74,7 +74,7 @@ class Handler extends ExceptionHandler
74 } 74 }
75 //验证错误(非手动抛出) 75 //验证错误(非手动抛出)
76 elseif ($exception instanceof ValidationException) { 76 elseif ($exception instanceof ValidationException) {
77 - LogUtils::error("参数验证失败", [], $exceptionMessage); 77 +// LogUtils::error("参数验证失败", [], $exceptionMessage);
78 } 78 }
79 //Redis错误(非手动抛出) 79 //Redis错误(非手动抛出)
80 elseif ($exception instanceof \RedisException) { 80 elseif ($exception instanceof \RedisException) {
@@ -8,9 +8,8 @@ use App\Utils\LogUtils; @@ -8,9 +8,8 @@ use App\Utils\LogUtils;
8 use GuzzleHttp\Client; 8 use GuzzleHttp\Client;
9 use GuzzleHttp\Exception\GuzzleException; 9 use GuzzleHttp\Exception\GuzzleException;
10 use Illuminate\Support\Carbon; 10 use Illuminate\Support\Carbon;
11 -use App\Models\File\File;  
12 -use Illuminate\Support\Facades\Cache;  
13 use Illuminate\Support\Facades\Redis; 11 use Illuminate\Support\Facades\Redis;
  12 +use App\Models\User\User;
14 13
15 define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/'); 14 define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/');
16 /** 15 /**
@@ -24,7 +23,8 @@ define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/'); @@ -24,7 +23,8 @@ define('HTTP_OPENAI_URL', 'http://openai.waimaoq.com/');
24 if (!function_exists('generateRoute')) { 23 if (!function_exists('generateRoute')) {
25 function generateRoute($string) 24 function generateRoute($string)
26 { 25 {
27 - return trim(strtolower(preg_replace('/[\W]+/', '-', trim($string))), '-'); 26 + //TODO::html结尾,htm结尾,只处理.htm前面的内容
  27 + return trim(strtolower(preg_replace('/[^\w.]+/', '-', trim($string))), '-');
28 } 28 }
29 } 29 }
30 30
@@ -460,7 +460,6 @@ if (!function_exists('getImageUrl')) { @@ -460,7 +460,6 @@ if (!function_exists('getImageUrl')) {
460 foreach ($path as $v){ 460 foreach ($path as $v){
461 $url[] = getImageUrl($v); 461 $url[] = getImageUrl($v);
462 } 462 }
463 - $url = array_filter($url);  
464 }else{ 463 }else{
465 if(empty($path)){ 464 if(empty($path)){
466 return ''; 465 return '';
@@ -31,7 +31,7 @@ class CreateKeywordController extends BaseController @@ -31,7 +31,7 @@ class CreateKeywordController extends BaseController
31 * @time :2023/12/19 9:31 31 * @time :2023/12/19 9:31
32 */ 32 */
33 public function lists(CreateKeyword $createKeyword){ 33 public function lists(CreateKeyword $createKeyword){
34 - $list = $createKeyword->list($this->map); 34 + $list = $createKeyword->list($this->map,'id',['*'],'asc');
35 $this->response('success',Code::SUCCESS,$list); 35 $this->response('success',Code::SUCCESS,$list);
36 } 36 }
37 37
@@ -37,7 +37,8 @@ class OptimizeController extends BaseController @@ -37,7 +37,8 @@ class OptimizeController extends BaseController
37 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 37 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
38 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 38 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
39 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id'); 39 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id');
40 - $query = $this->searchParam($query)->orderByRaw('CASE WHEN gl_project_deploy_optimize.start_date IS NULL THEN 0 ELSE 1 END') 40 + $query = $this->searchParam($query)->orderByRaw("FIELD(gl_project.level, '2') DESC")
  41 + ->orderByRaw('CASE WHEN gl_project_deploy_optimize.start_date IS NULL THEN 0 ELSE 1 END')
41 ->orderBy('gl_project_deploy_optimize.start_date','desc'); 42 ->orderBy('gl_project_deploy_optimize.start_date','desc');
42 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray(); 43 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
43 if(!empty($lists) && !empty($lists['list'])){ 44 if(!empty($lists) && !empty($lists['list'])){
@@ -187,6 +188,7 @@ class OptimizeController extends BaseController @@ -187,6 +188,7 @@ class OptimizeController extends BaseController
187 $query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%'); 188 $query = $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['test_domain'].'%');
188 } 189 }
189 $query = $query->whereIn('gl_project.type',[2,4]);//TODO::2,4代表优化项目 190 $query = $query->whereIn('gl_project.type',[2,4]);//TODO::2,4代表优化项目
  191 + $query = $query->where('gl_project_online_check.qa_status',1);
190 return $query; 192 return $query;
191 } 193 }
192 194
@@ -124,8 +124,6 @@ class ProjectController extends BaseController @@ -124,8 +124,6 @@ class ProjectController extends BaseController
124 public function searchUpgrade(&$query){ 124 public function searchUpgrade(&$query){
125 if(isset($this->map['is_upgrade'])){ 125 if(isset($this->map['is_upgrade'])){
126 $query->where('gl_project.is_upgrade', $this->map['is_upgrade']); 126 $query->where('gl_project.is_upgrade', $this->map['is_upgrade']);
127 - }else{  
128 - $query->where('gl_project.is_upgrade', 0);  
129 } 127 }
130 return $query; 128 return $query;
131 } 129 }
@@ -352,9 +350,8 @@ class ProjectController extends BaseController @@ -352,9 +350,8 @@ class ProjectController extends BaseController
352 * @method :post 350 * @method :post
353 * @time :2023/8/17 16:42 351 * @time :2023/8/17 16:42
354 */ 352 */
355 - public function save(ProjectRequest $request, ProjectLogic $logic) 353 + public function save(ProjectLogic $logic)
356 { 354 {
357 - $request->validated();  
358 $logic->projectSave(); 355 $logic->projectSave();
359 $this->response('success'); 356 $this->response('success');
360 } 357 }
@@ -55,6 +55,7 @@ class BlogController extends BaseController @@ -55,6 +55,7 @@ class BlogController extends BaseController
55 $query = $query->where('project_id',$this->user['project_id']); 55 $query = $query->where('project_id',$this->user['project_id']);
56 if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { 56 if (isset($this->map['category_id']) && !empty($this->map['category_id'])) {
57 $str = []; 57 $str = [];
  58 + $str[] = $this->map['category_id'];
58 $this->getAllSub($this->map['category_id'],$str); 59 $this->getAllSub($this->map['category_id'],$str);
59 $query->where(function ($subQuery) use ($str) { 60 $query->where(function ($subQuery) use ($str) {
60 foreach ($str as $v) { 61 foreach ($str as $v) {
@@ -83,7 +84,7 @@ class BlogController extends BaseController @@ -83,7 +84,7 @@ class BlogController extends BaseController
83 */ 84 */
84 public function getAllSub($id,&$str = []){ 85 public function getAllSub($id,&$str = []){
85 $cateModel = new BlogCategory(); 86 $cateModel = new BlogCategory();
86 - $list = $cateModel->list(['pid'=>$id,'status'=>1],['id','pid']); 87 + $list = $cateModel->list(['pid'=>$id,'status'=>0],['id','pid']);
87 if(!empty($list)){ 88 if(!empty($list)){
88 foreach ($list as $v){ 89 foreach ($list as $v){
89 $str[] = $v['id']; 90 $str[] = $v['id'];
@@ -90,13 +90,13 @@ class CustomModuleExtentController extends BaseController @@ -90,13 +90,13 @@ class CustomModuleExtentController extends BaseController
90 * @method :post 90 * @method :post
91 * @time :2023/12/21 9:25 91 * @time :2023/12/21 9:25
92 */ 92 */
93 - public function extendContent(CustomModuleExtentContent $content){ 93 + public function extendContent(CustomModuleExtend $extend){
94 $this->request->validate([ 94 $this->request->validate([
95 'module_id'=>['required'], 95 'module_id'=>['required'],
96 ],[ 96 ],[
97 'module_id.required' => 'module_id不能为空', 97 'module_id.required' => 'module_id不能为空',
98 ]); 98 ]);
99 - $lists = $content->list($this->map); 99 + $lists = $extend->list($this->map,'created_at');
100 $this->response('success',Code::SUCCESS,$lists); 100 $this->response('success',Code::SUCCESS,$lists);
101 } 101 }
102 102
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ProjectKeywordController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/12/26 9:22
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Keyword;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Models\Project\DeployOptimize;
  15 +
  16 +class ProjectKeywordController extends BaseController
  17 +{
  18 + /**
  19 + * @remark :获取搜索关键词
  20 + * @name :searchKeywords
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2023/12/26 10:07
  24 + */
  25 + public function searchKeywords(DeployOptimize $deployOptimize){
  26 + $data = [];
  27 + $info = $deployOptimize->read(['project_id'=>$this->user['project_id']]);
  28 + if($info === false){
  29 + $this->response('success');
  30 + }
  31 + $data['search_keywords'] = $info['search_keywords'];
  32 + $data['customer_keywords'] = $info['customer_keywords'];
  33 + $this->response('success',Code::SUCCESS,$data);
  34 + }
  35 +
  36 +}
@@ -215,9 +215,11 @@ class NavController extends BaseController @@ -215,9 +215,11 @@ class NavController extends BaseController
215 */ 215 */
216 public function setSortList(NavLogic $navLogic){ 216 public function setSortList(NavLogic $navLogic){
217 $this->request->validate([ 217 $this->request->validate([
218 - 'id'=>'required' 218 + 'id'=>'required',
  219 + 'sort_list'=>'required',
219 ],[ 220 ],[
220 'id.required' => 'ID不能为空', 221 'id.required' => 'ID不能为空',
  222 + 'sort_list.required' => '排序不能为空',
221 ]); 223 ]);
222 $navLogic->setSortList(); 224 $navLogic->setSortList();
223 $this->response('success'); 225 $this->response('success');
@@ -9,6 +9,8 @@ use App\Http\Requests\Bside\News\NewsRequest; @@ -9,6 +9,8 @@ use App\Http\Requests\Bside\News\NewsRequest;
9 use App\Models\News\News as NewsModel; 9 use App\Models\News\News as NewsModel;
10 use App\Models\News\NewsCategory; 10 use App\Models\News\NewsCategory;
11 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
  12 +use App\Models\Template\BTemplate;
  13 +use App\Models\Template\Setting;
12 use App\Models\User\User; 14 use App\Models\User\User;
13 15
14 16
@@ -33,19 +35,45 @@ class NewsController extends BaseController @@ -33,19 +35,45 @@ class NewsController extends BaseController
33 $lists = $lists->toArray(); 35 $lists = $lists->toArray();
34 // //获取当前项目的所有分类 36 // //获取当前项目的所有分类
35 $data = $this->getCategoryList(); 37 $data = $this->getCategoryList();
  38 + //获取当前用户选择的模版
  39 + $templateSettingModel = new Setting();
  40 + $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);
36 $user = new User(); 41 $user = new User();
37 foreach ($lists['list'] as $k => $v){ 42 foreach ($lists['list'] as $k => $v){
38 $v['category_name'] = $this->categoryName($v['category_id'],$data); 43 $v['category_name'] = $this->categoryName($v['category_id'],$data);
39 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); 44 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']);
40 $v['image_link'] = getImageUrl($v['image']); 45 $v['image_link'] = getImageUrl($v['image']);
41 $v['operator_name'] = $user->getName($v['operator_id']); 46 $v['operator_name'] = $user->getName($v['operator_id']);
  47 + $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']);
42 $lists['list'][$k] = $v; 48 $lists['list'][$k] = $v;
43 } 49 }
44 } 50 }
45 $this->response('success',Code::SUCCESS,$lists); 51 $this->response('success',Code::SUCCESS,$lists);
46 } 52 }
47 53
48 - 54 + /**
  55 + * @remark :查看产品是否已装修
  56 + * @name :getProductIsRenovation
  57 + * @author :lyh
  58 + * @method :post
  59 + * @time :2023/9/13 14:02
  60 + */
  61 + public function getProductIsRenovation($info,$id){
  62 + if($info !== false){
  63 + $webTemplateModel = new BTemplate();
  64 + $param = [
  65 + 'source'=>4,
  66 + 'project_id'=>$this->user['project_id'],
  67 + 'source_id'=>$id,
  68 + 'template_id'=>$info['template_id']
  69 + ];
  70 + $templateInfo = $webTemplateModel->read($param);
  71 + if($templateInfo !== false){
  72 + return 1;
  73 + }
  74 + }
  75 + return 0;
  76 + }
49 77
50 /** 78 /**
51 * @remark :处理列表返回参数 79 * @remark :处理列表返回参数
@@ -58,7 +86,9 @@ class NewsController extends BaseController @@ -58,7 +86,9 @@ class NewsController extends BaseController
58 $query = $query->where('project_id',$this->user['project_id']); 86 $query = $query->where('project_id',$this->user['project_id']);
59 if (isset($this->map['category_id']) && !empty($this->map['category_id'])) { 87 if (isset($this->map['category_id']) && !empty($this->map['category_id'])) {
60 $str = []; 88 $str = [];
  89 + $str[] = $this->map['category_id'];
61 $this->getAllSub($this->map['category_id'],$str); 90 $this->getAllSub($this->map['category_id'],$str);
  91 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($str, true) . PHP_EOL, FILE_APPEND);
62 $query->where(function ($subQuery) use ($str) { 92 $query->where(function ($subQuery) use ($str) {
63 foreach ($str as $v) { 93 foreach ($str as $v) {
64 $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]); 94 $subQuery->orWhereRaw("FIND_IN_SET(?, category_id) > 0", [$v]);
@@ -86,7 +116,7 @@ class NewsController extends BaseController @@ -86,7 +116,7 @@ class NewsController extends BaseController
86 */ 116 */
87 public function getAllSub($id,&$str = []){ 117 public function getAllSub($id,&$str = []){
88 $cateModel = new NewsCategory(); 118 $cateModel = new NewsCategory();
89 - $list = $cateModel->list(['pid'=>$id,'status'=>1],['id','pid']); 119 + $list = $cateModel->list(['pid'=>$id,'status'=>0],['id','pid']);
90 if(!empty($list)){ 120 if(!empty($list)){
91 foreach ($list as $v){ 121 foreach ($list as $v){
92 $str[] = $v['id']; 122 $str[] = $v['id'];
@@ -62,7 +62,6 @@ class CategoryController extends BaseController @@ -62,7 +62,6 @@ class CategoryController extends BaseController
62 if(!empty($this->map['title'])){ 62 if(!empty($this->map['title'])){
63 $this->map['title'] = ['like','%'.$this->map['title'].'%']; 63 $this->map['title'] = ['like','%'.$this->map['title'].'%'];
64 } 64 }
65 - $this->map['project_id'] = $this->user['project_id'];  
66 return $this->map; 65 return $this->map;
67 } 66 }
68 67
@@ -79,6 +79,7 @@ class ProductController extends BaseController @@ -79,6 +79,7 @@ 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 + $str[] = $this->map['category_id'];
82 $this->getAllSub($this->map['category_id'],$str); 83 $this->getAllSub($this->map['category_id'],$str);
83 $query->where(function ($subQuery) use ($str) { 84 $query->where(function ($subQuery) use ($str) {
84 foreach ($str as $v) { 85 foreach ($str as $v) {
@@ -134,6 +134,12 @@ class LoginLogic extends BaseLogic @@ -134,6 +134,12 @@ class LoginLogic extends BaseLogic
134 } 134 }
135 //获取超级管理员登录 135 //获取超级管理员登录
136 if(isset($this->param['project_id']) && !empty($this->param['project_id'])){ 136 if(isset($this->param['project_id']) && !empty($this->param['project_id'])){
  137 + //查看当前项目是否有超级管理员
  138 + $userModel = new User();
  139 + $userinfo = $userModel->read(['project_id'=>$this->param['project_id'],'role_id'=>0]);
  140 + if($userinfo === false){
  141 + $this->fail('未添加超级管理员账号,请添加后在进入账号.');
  142 + }
137 $data['autologin_code'] = $encrypt->lock_url(json_encode(['project_id'=>$this->param['project_id'],'manager_id'=>$this->manager['id']]),$info['values']); 143 $data['autologin_code'] = $encrypt->lock_url(json_encode(['project_id'=>$this->param['project_id'],'manager_id'=>$this->manager['id']]),$info['values']);
138 } 144 }
139 //使用用户登录 145 //使用用户登录
@@ -30,14 +30,30 @@ class KeywordPrefixLogic extends BaseLogic @@ -30,14 +30,30 @@ class KeywordPrefixLogic extends BaseLogic
30 * @time :2023/9/6 14:42 30 * @time :2023/9/6 14:42
31 */ 31 */
32 public function prefixSave(){ 32 public function prefixSave(){
33 - try {  
34 - if(isset($this->param['id']) && !empty($this->param['id'])){  
35 - $this->model->edit($this->param,['id'=>$this->param['id']]);  
36 - }else{  
37 - $this->model->add($this->param); 33 + if(isset($this->param['id']) && !empty($this->param['id'])){
  34 + $condition = [
  35 + 'keyword'=>$this->param['keyword'],
  36 + 'id'=>['!=',$this->param['id']]
  37 + ];
  38 + $prefixInfo = $this->model->read($condition);
  39 + if($prefixInfo !== false){
  40 + $this->fail('当前关键字已存在');
38 } 41 }
39 - }catch (\Exception $e){  
40 - $this->fail('error'); 42 + $data = [
  43 + 'keyword'=>$this->param['keyword']
  44 + ];
  45 + $this->model->edit($data,['id'=>$this->param['id']]);
  46 + }else{
  47 + $data = [
  48 + 'project_id'=>$this->param['project_id'] ?? 0,
  49 + 'keyword'=>$this->param['keyword'],
  50 + 'type'=>$this->param['type']
  51 + ];
  52 + $prefixInfo = $this->model->read($data);
  53 + if($prefixInfo !== false){
  54 + $this->fail('当前关键字已存在');
  55 + }
  56 + $this->model->add($data);
41 } 57 }
42 return $this->success(); 58 return $this->success();
43 } 59 }
@@ -73,6 +73,7 @@ class ProjectLogic extends BaseLogic @@ -73,6 +73,7 @@ class ProjectLogic extends BaseLogic
73 if($info['extend_type'] != 0){ 73 if($info['extend_type'] != 0){
74 $info['type'] = $info['extend_type']; 74 $info['type'] = $info['extend_type'];
75 } 75 }
  76 + $info['domain_url'] = (new DomainInfo())->getDomain($info['deploy_optimize']['domain'] ?? 0);
76 //升级项目初始上传配置 77 //升级项目初始上传配置
77 if(empty($info['upload_config'])){ 78 if(empty($info['upload_config'])){
78 $info['upload_config'] =["upload_max_num"=>100, "allow_file_type"=>"doc,docx,xls,xlsx,pdf,txt,csv,png,jpg,jpeg", "upload_max_size"=>5]; 79 $info['upload_config'] =["upload_max_num"=>100, "allow_file_type"=>"doc,docx,xls,xlsx,pdf,txt,csv,png,jpg,jpeg", "upload_max_size"=>5];
@@ -143,7 +144,7 @@ class ProjectLogic extends BaseLogic @@ -143,7 +144,7 @@ class ProjectLogic extends BaseLogic
143 DB::commit(); 144 DB::commit();
144 }catch (\Exception $e){ 145 }catch (\Exception $e){
145 DB::rollBack(); 146 DB::rollBack();
146 - $this->fail('请填写完整后再提交'); 147 + $this->fail('保存失败,请联系管理员');
147 } 148 }
148 (new SyncService())->projectAcceptAddress($this->param['id']); 149 (new SyncService())->projectAcceptAddress($this->param['id']);
149 return $this->success(); 150 return $this->success();
@@ -174,8 +175,6 @@ class ProjectLogic extends BaseLogic @@ -174,8 +175,6 @@ class ProjectLogic extends BaseLogic
174 } 175 }
175 } 176 }
176 $param['notice_file'] = Arr::a2s($param['notice_file']); 177 $param['notice_file'] = Arr::a2s($param['notice_file']);
177 - }else{  
178 - unset($param['notice_file']);  
179 } 178 }
180 if(isset($param['confirm_file']) && !empty($param['confirm_file'])){ 179 if(isset($param['confirm_file']) && !empty($param['confirm_file'])){
181 foreach ($param['confirm_file'] as &$v2) { 180 foreach ($param['confirm_file'] as &$v2) {
@@ -184,11 +183,10 @@ class ProjectLogic extends BaseLogic @@ -184,11 +183,10 @@ class ProjectLogic extends BaseLogic
184 } 183 }
185 } 184 }
186 $param['confirm_file'] = Arr::a2s($param['confirm_file']); 185 $param['confirm_file'] = Arr::a2s($param['confirm_file']);
187 - }else{  
188 - unset($param['confirm_file']);  
189 } 186 }
  187 + $param['remain_day'] = $param['deploy_build']['service_duration'] - $param['finish_remain_day'];
  188 + $param['remain_day'] = ($param['remain_day'] > 0) ? $param['remain_day'] : 0;
190 unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'],$param['online_check'],$param['project_after']); 189 unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'],$param['online_check'],$param['project_after']);
191 -  
192 //文件上传默认值 190 //文件上传默认值
193 if($param['is_upload_manage']){ 191 if($param['is_upload_manage']){
194 $param['upload_config'] = [ 192 $param['upload_config'] = [
@@ -382,8 +380,8 @@ class ProjectLogic extends BaseLogic @@ -382,8 +380,8 @@ class ProjectLogic extends BaseLogic
382 */ 380 */
383 public function createUser($mobile,$project_id,$lead_name){ 381 public function createUser($mobile,$project_id,$lead_name){
384 $userModel = new UserModel(); 382 $userModel = new UserModel();
385 - //查看当前用户是否存在  
386 - $info = $userModel->read(['mobile'=>$mobile,'project_id'=>$project_id]); 383 + //查看当前项目是否存在超级管理员
  384 + $info = $userModel->read(['role_id'=>0,'project_id'=>$project_id]);
387 if($info === false){ 385 if($info === false){
388 $data = [ 386 $data = [
389 'mobile'=>$mobile, 387 'mobile'=>$mobile,
@@ -395,6 +393,8 @@ class ProjectLogic extends BaseLogic @@ -395,6 +393,8 @@ class ProjectLogic extends BaseLogic
395 'create_id'=>$this->manager['id'] ?? 0, 393 'create_id'=>$this->manager['id'] ?? 0,
396 ]; 394 ];
397 $userModel->add($data); 395 $userModel->add($data);
  396 + }else{
  397 + $userModel->edit(['mobile'=>$mobile,'name'=>$lead_name],['id'=>$info['id']]);
398 } 398 }
399 return $this->success(); 399 return $this->success();
400 } 400 }
@@ -6,6 +6,7 @@ use App\Helper\Common; @@ -6,6 +6,7 @@ use App\Helper\Common;
6 use App\Http\Logic\Aside\BaseLogic; 6 use App\Http\Logic\Aside\BaseLogic;
7 use App\Models\Manage\Manage; 7 use App\Models\Manage\Manage;
8 use App\Models\Manage\MenuSpecial; 8 use App\Models\Manage\MenuSpecial;
  9 +use App\Models\Manage\Mobile;
9 use App\Models\Project\Project; 10 use App\Models\Project\Project;
10 use App\Models\User\ProjectRole; 11 use App\Models\User\ProjectRole;
11 use App\Models\User\User; 12 use App\Models\User\User;
@@ -54,6 +55,9 @@ class UserLogic extends BaseLogic @@ -54,6 +55,9 @@ class UserLogic extends BaseLogic
54 $this->param = $this->editPassword($this->param); 55 $this->param = $this->editPassword($this->param);
55 $rs = $this->model->edit($this->param, ['id' => $this->param['id']]); 56 $rs = $this->model->edit($this->param, ['id' => $this->param['id']]);
56 } else { 57 } else {
  58 + $mobileModel = new Mobile();
  59 + //查看当前手机号码是否存在于手机号码库
  60 + $mobileInfo = $mobileModel->read(['mobile'=>$this->param['mobile']]);
57 $this->param['password'] = base64_encode(md5($this->param['password'])); 61 $this->param['password'] = base64_encode(md5($this->param['password']));
58 $rs = $this->model->add($this->param); 62 $rs = $this->model->add($this->param);
59 } 63 }
@@ -104,7 +108,6 @@ class UserLogic extends BaseLogic @@ -104,7 +108,6 @@ class UserLogic extends BaseLogic
104 if($param['role_id'] == $this->model::ROLE_MANAGER){ 108 if($param['role_id'] == $this->model::ROLE_MANAGER){
105 if(isset($param['id']) && !empty($param['id'])){ 109 if(isset($param['id']) && !empty($param['id'])){
106 $condition = [ 110 $condition = [
107 - 'mobile' => $param['mobile'],  
108 'project_id'=>$param['project_id'], 111 'project_id'=>$param['project_id'],
109 'id' => ['!=', $param['id']], 112 'id' => ['!=', $param['id']],
110 'role_id'=>$this->model::ROLE_MANAGER 113 'role_id'=>$this->model::ROLE_MANAGER
@@ -149,16 +152,19 @@ class UserLogic extends BaseLogic @@ -149,16 +152,19 @@ class UserLogic extends BaseLogic
149 public function user_del() 152 public function user_del()
150 { 153 {
151 foreach ($this->param['id'] as $id){ 154 foreach ($this->param['id'] as $id){
152 - $info = $this->model->read(['id'=>$id],['id','role_id']);  
153 - if($info['role_id'] != 0){  
154 - $rs = $this->model->del(['id'=>$id]);  
155 - if($rs === false){  
156 - $this->fail('系统错误,请联系管理员'); 155 + $info = $this->model->read(['id'=>$id],['id','role_id','project_id']);
  156 + if($info['role_id'] == 0) {
  157 + //查看当前项目是否有其他的超级管理员
  158 + $roleInfo = $this->model->read(['id' => ['!=', $id], 'role_id' => 0,'project_id'=>$info['project_id']]);
  159 + if ($roleInfo === false) {
  160 + $this->fail('唯一超级管理员,禁止删除');
157 } 161 }
158 - Common::del_user_cache($this->model, $id, 'A');  
159 - }else{  
160 - $this->fail('超级管理员不允许删除');  
161 } 162 }
  163 + $rs = $this->model->del(['id' => $id]);
  164 + if ($rs === false) {
  165 + $this->fail('系统错误,请联系管理员');
  166 + }
  167 + Common::del_user_cache($this->model, $id, 'A');
162 } 168 }
163 return $this->success(); 169 return $this->success();
164 } 170 }
@@ -192,7 +198,7 @@ class UserLogic extends BaseLogic @@ -192,7 +198,7 @@ class UserLogic extends BaseLogic
192 $roleInfo = $roleModel->where('project_id',$this->param['project_id'])->orderBy('id','asc')->first(); 198 $roleInfo = $roleModel->where('project_id',$this->param['project_id'])->orderBy('id','asc')->first();
193 $info = $this->model->read(['role_id'=>0]); 199 $info = $this->model->read(['role_id'=>0]);
194 if(empty($info) || empty($roleInfo)){ 200 if(empty($info) || empty($roleInfo)){
195 - $this->fail('系统错误,请联系管理员'); 201 + $this->fail('请先添加角色');
196 } 202 }
197 try { 203 try {
198 $this->model->edit(['role_id'=>$roleInfo['id']],['id'=>$info['id']]); 204 $this->model->edit(['role_id'=>$roleInfo['id']],['id'=>$info['id']]);
@@ -89,7 +89,7 @@ class BTemplateLogic extends BaseLogic @@ -89,7 +89,7 @@ class BTemplateLogic extends BaseLogic
89 $type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型 89 $type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型
90 $commonInfo = $this->getCommonPage($type,$this->user['project_id'],0);//获取定制头部 90 $commonInfo = $this->getCommonPage($type,$this->user['project_id'],0);//获取定制头部
91 $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); 91 $html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
92 - return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id']]); 92 + return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
93 } 93 }
94 $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; 94 $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']];
95 } 95 }
@@ -98,7 +98,10 @@ class BTemplateLogic extends BaseLogic @@ -98,7 +98,10 @@ class BTemplateLogic extends BaseLogic
98 $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; 98 $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
99 $html = $this->getHeadFooter($html); 99 $html = $this->getHeadFooter($html);
100 $result = ['html'=>$html,'template_id'=>$template_id]; 100 $result = ['html'=>$html,'template_id'=>$template_id];
101 - if($templateInfo !== false){$result['id'] = $templateInfo['id'];} 101 + if($templateInfo !== false){
  102 + $result['id'] = $templateInfo['id'];
  103 + $result['updated_at'] = $templateInfo['updated_at'];
  104 + }
102 return $this->success($result); 105 return $this->success($result);
103 } 106 }
104 107
@@ -661,14 +664,6 @@ class BTemplateLogic extends BaseLogic @@ -661,14 +664,6 @@ class BTemplateLogic extends BaseLogic
661 return $this->success($list); 664 return $this->success($list);
662 } 665 }
663 666
664 -  
665 - /**  
666 - * @remark :获取类型  
667 - * @name :getModuleType  
668 - * @author :lyh  
669 - * @method :any  
670 - * @time :2023/7/17 16:03  
671 - */  
672 /** 667 /**
673 * @remark :获取类型 668 * @remark :获取类型
674 * @name :getModuleType 669 * @name :getModuleType
@@ -695,6 +690,13 @@ class BTemplateLogic extends BaseLogic @@ -695,6 +690,13 @@ class BTemplateLogic extends BaseLogic
695 return $this->success($data); 690 return $this->success($data);
696 } 691 }
697 692
  693 + /**
  694 + * @remark :获取类型
  695 + * @name :getModuleTypes
  696 + * @author :lyh
  697 + * @method :post
  698 + * @time :2023/12/26 14:18
  699 + */
698 public function getModuleTypes(){ 700 public function getModuleTypes(){
699 $data['module'] = ['默认','产品','新闻','博客','产品分类']; 701 $data['module'] = ['默认','产品','新闻','博客','产品分类'];
700 $data = [ 702 $data = [
@@ -709,7 +711,7 @@ class BTemplateLogic extends BaseLogic @@ -709,7 +711,7 @@ class BTemplateLogic extends BaseLogic
709 $moduleModel = new CustomModule(); 711 $moduleModel = new CustomModule();
710 $moduleList = $moduleModel->list(['status'=>0]); 712 $moduleList = $moduleModel->list(['status'=>0]);
711 foreach ($moduleList as $v){ 713 foreach ($moduleList as $v){
712 - $moduleCategory = $this->getCategoryList((new CustomModuleCategory()),0,['id','name','pid']); 714 + $moduleCategory = $this->getCategoryModuleList((new CustomModuleCategory()),$v['id'],0,['id','name','pid']);
713 $categoryList = [["id"=>"all", "name"=>"全部"], ["id"=>"new", "name"=>"最新"]]; 715 $categoryList = [["id"=>"all", "name"=>"全部"], ["id"=>"new", "name"=>"最新"]];
714 foreach ($moduleCategory as $values){ 716 foreach ($moduleCategory as $values){
715 $categoryList[] = $values; 717 $categoryList[] = $values;
@@ -782,6 +784,26 @@ class BTemplateLogic extends BaseLogic @@ -782,6 +784,26 @@ class BTemplateLogic extends BaseLogic
782 } 784 }
783 785
784 /** 786 /**
  787 + * @remark :获取1级+2级
  788 + * @name :getCategoryList
  789 + * @author :lyh
  790 + * @method :post
  791 + * @time :2023/12/20 10:26
  792 + */
  793 + public function getCategoryModuleList($categoryModel,$module_id,$status = 0,$filed = ['*']){
  794 + $data = array();
  795 + $list = $categoryModel->list(['pid'=>0, 'module_id'=>$module_id , 'status'=>$status],['sort','id'],$filed);
  796 + foreach ($list as $v){
  797 + $data[] = $v;
  798 + $son_list = $categoryModel->list(['pid'=>$v['id'],'module_id'=>$module_id,'status'=>$status],['sort','id'],$filed);
  799 + foreach ($son_list as $v1){
  800 + $data[] = $v1;
  801 + }
  802 + }
  803 + return $this->success($data);
  804 + }
  805 +
  806 + /**
785 * @remark :保存html 807 * @remark :保存html
786 * @name :savePublicTemplateHtml 808 * @name :savePublicTemplateHtml
787 * @author :lyh 809 * @author :lyh
@@ -819,8 +841,11 @@ class BTemplateLogic extends BaseLogic @@ -819,8 +841,11 @@ class BTemplateLogic extends BaseLogic
819 $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom); 841 $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
820 //获取设置的默认中间部分 842 //获取设置的默认中间部分
821 $bTemplateMainModel = new BTemplateMain(); 843 $bTemplateMainModel = new BTemplateMain();
822 - $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 844 + $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom]);
823 if($mainInfo === false){ 845 if($mainInfo === false){
  846 + if($is_custom == BTemplate::SOURCE_CUSTOM) {
  847 + $this->param['type'] = BTemplate::TYPE_CUSTOM_DETAIL;
  848 + }
824 $main_html = $this->getModule($this->param['type']); 849 $main_html = $this->getModule($this->param['type']);
825 $main_style = "<style id='globalsojs-styles'></style>"; 850 $main_style = "<style id='globalsojs-styles'></style>";
826 }else{ 851 }else{
@@ -63,23 +63,22 @@ class CustomTemplateLogic extends BaseLogic @@ -63,23 +63,22 @@ class CustomTemplateLogic extends BaseLogic
63 * @time :2023/6/29 16:21 63 * @time :2023/6/29 16:21
64 */ 64 */
65 public function customTemplateSave(){ 65 public function customTemplateSave(){
66 - try {  
67 - $this->param['url'] = str_replace_url($this->param['url']);  
68 - if(isset($this->param['id']) && !empty($this->param['id'])){  
69 - $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);  
70 - $this->editCustomRoute($this->param['url']);  
71 - $this->model->edit($this->param,['id'=>$this->param['id']]);  
72 - }else{  
73 - if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){  
74 - $this->fail('404页面已存在');  
75 - }  
76 - $this->param['project_id'] = $this->user['project_id'];  
77 - $id = $this->model->addReturnId($this->param);  
78 - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);  
79 - $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);  
80 - $this->model->edit(['url'=>$route],['id'=>$id]); 66 + $this->param['url'] = str_replace_url($this->param['url']);
  67 + if(isset($this->param['id']) && !empty($this->param['id'])){
  68 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);
  69 + $this->editCustomRoute($this->param['url']);
  70 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  71 + }else{
  72 + if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
  73 + $this->fail('404页面已存在');
81 } 74 }
82 - }catch (\Exception $e){ 75 + $this->param['project_id'] = $this->user['project_id'];
  76 + $id = $this->model->addReturnId($this->param);
  77 + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
  78 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
  79 + $rs = $this->model->edit(['url'=>$route],['id'=>$id]);
  80 + }
  81 + if($rs === false){
83 $this->fail('保存失败,请联系管理员'); 82 $this->fail('保存失败,请联系管理员');
84 } 83 }
85 return $this->success(); 84 return $this->success();
@@ -95,6 +94,9 @@ class CustomTemplateLogic extends BaseLogic @@ -95,6 +94,9 @@ class CustomTemplateLogic extends BaseLogic
95 public function saveHtml(){ 94 public function saveHtml(){
96 $html = $this->param['html']; 95 $html = $this->param['html'];
97 $info = $this->model->read(['id'=>$this->param['id']],['id','is_visualization','url']); 96 $info = $this->model->read(['id'=>$this->param['id']],['id','is_visualization','url']);
  97 + if($info === false){
  98 + $this->fail('当前数据不存在或已被删除');
  99 + }
98 if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){//非定制项目+可视化页面 100 if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){//非定制项目+可视化页面
99 //获取设置的默认模版 101 //获取设置的默认模版
100 $bSettingModel = new Setting(); 102 $bSettingModel = new Setting();
@@ -208,13 +210,13 @@ class CustomTemplateLogic extends BaseLogic @@ -208,13 +210,13 @@ class CustomTemplateLogic extends BaseLogic
208 */ 210 */
209 public function editCustomRoute($route){ 211 public function editCustomRoute($route){
210 $info = $this->model->read(['id'=>$this->param['id']]); 212 $info = $this->model->read(['id'=>$this->param['id']]);
211 - if($info['url'] == $this->model::NOT_FOUND_PAGE_URL && $route['url'] != '404'){  
212 - $this->fail('404页面链接不可修改');  
213 - }  
214 - if($info['url'] != $route){  
215 - $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);  
216 - $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$route]); 213 + if($info['url'] == $this->model::NOT_FOUND_PAGE_URL){
  214 + if($route != '404'){
  215 + $this->fail('不可删除, 只可以修改tdk');
  216 + }
217 } 217 }
  218 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
  219 + $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$route]);
218 return true; 220 return true;
219 } 221 }
220 222
@@ -38,6 +38,7 @@ class BlogLogic extends BaseLogic @@ -38,6 +38,7 @@ class BlogLogic extends BaseLogic
38 $route = $this->param['url']; 38 $route = $this->param['url'];
39 $this->edit($this->param,['id'=>$this->param['id']]); 39 $this->edit($this->param,['id'=>$this->param['id']]);
40 }else{ 40 }else{
  41 + $this->param['sort'] = $this->setNewsSort();
41 $id = $this->model->addReturnId($this->param); 42 $id = $this->model->addReturnId($this->param);
42 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); 43 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
43 $this->edit(['url'=>$route],['id'=>$id]); 44 $this->edit(['url'=>$route],['id'=>$id]);
@@ -53,6 +54,22 @@ class BlogLogic extends BaseLogic @@ -53,6 +54,22 @@ class BlogLogic extends BaseLogic
53 } 54 }
54 55
55 /** 56 /**
  57 + * @remark :设置最新产品的sort排序
  58 + * @name :setNewsSort
  59 + * @author :lyh
  60 + * @method :post
  61 + * @time :2023/12/25 9:27
  62 + */
  63 + public function setNewsSort(){
  64 + $info = $this->model->orderBy('sort','desc')->first();
  65 + if(empty($info)){
  66 + return 1;
  67 + }
  68 + $sort = $info['sort']+1;
  69 + return $sort;
  70 + }
  71 +
  72 + /**
56 * @name :编辑seo 73 * @name :编辑seo
57 * @return void 74 * @return void
58 * @author :liyuhang 75 * @author :liyuhang
@@ -153,14 +170,14 @@ class BlogLogic extends BaseLogic @@ -153,14 +170,14 @@ class BlogLogic extends BaseLogic
153 if(isset($this->param['id'])){ 170 if(isset($this->param['id'])){
154 $param['operator_id'] = $this->user['id']; 171 $param['operator_id'] = $this->user['id'];
155 if(isset($param['category_id']) && !empty($param['category_id'])){ 172 if(isset($param['category_id']) && !empty($param['category_id'])){
156 - $param['category_id'] = $this->getLastCategory($param['category_id']); 173 + $param['category_id'] = $this->getCategory($param['category_id']);
157 } 174 }
158 }else{ 175 }else{
159 $param['create_id'] = $this->user['id']; 176 $param['create_id'] = $this->user['id'];
160 $param['operator_id'] = $this->user['id']; 177 $param['operator_id'] = $this->user['id'];
161 $param['project_id'] = $this->user['project_id']; 178 $param['project_id'] = $this->user['project_id'];
162 if(isset($param['category_id']) && !empty($param['category_id'])){ 179 if(isset($param['category_id']) && !empty($param['category_id'])){
163 - $param['category_id'] = $this->getLastCategory($param['category_id']); 180 + $param['category_id'] = $this->getCategory($param['category_id']);
164 } 181 }
165 } 182 }
166 return $this->success($param); 183 return $this->success($param);
@@ -173,16 +190,12 @@ class BlogLogic extends BaseLogic @@ -173,16 +190,12 @@ class BlogLogic extends BaseLogic
173 * @method :post 190 * @method :post
174 * @time :2023/10/20 9:02 191 * @time :2023/10/20 9:02
175 */ 192 */
176 - public function getLastCategory($category){ 193 + public function getCategory($category){
177 $str = ''; 194 $str = '';
178 - $cateModel = new BlogCategoryModel();  
179 foreach ($category as $v){ 195 foreach ($category as $v){
180 - $info = $cateModel->read(['pid'=>$v]);  
181 - if($info === false){  
182 $str .= $v.','; 196 $str .= $v.',';
183 - }  
184 } 197 }
185 - return ','.$str; 198 + return !empty($str) ? ','.$str : '';
186 } 199 }
187 200
188 /** 201 /**
@@ -149,6 +149,7 @@ class CustomModuleContentLogic extends BaseLogic @@ -149,6 +149,7 @@ class CustomModuleContentLogic extends BaseLogic
149 */ 149 */
150 public function contentAdd(){ 150 public function contentAdd(){
151 try { 151 try {
  152 + $this->param['sort'] = $this->setNewsSort();
152 $id = $this->model->addReturnId($this->param); 153 $id = $this->model->addReturnId($this->param);
153 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE, 154 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE,
154 $id, $this->user['project_id']); 155 $id, $this->user['project_id']);
@@ -162,6 +163,22 @@ class CustomModuleContentLogic extends BaseLogic @@ -162,6 +163,22 @@ class CustomModuleContentLogic extends BaseLogic
162 } 163 }
163 164
164 /** 165 /**
  166 + * @remark :设置最新产品的sort排序
  167 + * @name :setNewsSort
  168 + * @author :lyh
  169 + * @method :post
  170 + * @time :2023/12/25 9:27
  171 + */
  172 + public function setNewsSort(){
  173 + $info = $this->model->orderBy('sort','desc')->first();
  174 + if(empty($info)){
  175 + return 1;
  176 + }
  177 + $sort = $info['sort']+1;
  178 + return $sort;
  179 + }
  180 +
  181 + /**
165 * @remark :编辑数据 182 * @remark :编辑数据
166 * @name :contentEdit 183 * @name :contentEdit
167 * @author :lyh 184 * @author :lyh
@@ -281,6 +298,7 @@ class CustomModuleContentLogic extends BaseLogic @@ -281,6 +298,7 @@ class CustomModuleContentLogic extends BaseLogic
281 } 298 }
282 $v['project_id'] = $this->user['project_id']; 299 $v['project_id'] = $this->user['project_id'];
283 $v['content_id'] = $content_id; 300 $v['content_id'] = $content_id;
  301 + $v['module_id'] = $content_id;
284 return $this->success($v); 302 return $this->success($v);
285 } 303 }
286 304
@@ -30,7 +30,7 @@ class ImportLogic extends BaseLogic @@ -30,7 +30,7 @@ class ImportLogic extends BaseLogic
30 $this->fail('导入文件格式必须为csv'); 30 $this->fail('导入文件格式必须为csv');
31 } 31 }
32 $domain = $this->param['domain']; 32 $domain = $this->param['domain'];
33 - if (strpos($domain, 'https') === false || strpos($domain, 'http') == false) { 33 + if (strpos($domain, 'https') === false && strpos($domain, 'http') == false) {
34 $this->fail('请输入完整的采集页面地址'); 34 $this->fail('请输入完整的采集页面地址');
35 } 35 }
36 $domain_arr = parse_url($domain); 36 $domain_arr = parse_url($domain);
@@ -41,7 +41,6 @@ class ImportLogic extends BaseLogic @@ -41,7 +41,6 @@ class ImportLogic extends BaseLogic
41 $this->param['domain'] = $domain_arr['host']; 41 $this->param['domain'] = $domain_arr['host'];
42 $this->param['project_id'] = $this->user['project_id']; 42 $this->param['project_id'] = $this->user['project_id'];
43 $this->param['user_id'] = $this->user['id']; 43 $this->param['user_id'] = $this->user['id'];
44 - $this->param['status'] = 9;  
45 $rs = $this->model->add($this->param); 44 $rs = $this->model->add($this->param);
46 if ($rs === false) { 45 if ($rs === false) {
47 $this->fail('error'); 46 $this->fail('error');
@@ -122,6 +122,7 @@ class NavLogic extends BaseLogic @@ -122,6 +122,7 @@ class NavLogic extends BaseLogic
122 'target'=>$param['target'] ?? 1, 122 'target'=>$param['target'] ?? 1,
123 'remark'=>$param['remark'] ?? '', 123 'remark'=>$param['remark'] ?? '',
124 'group_id'=>$param['group_id'], 124 'group_id'=>$param['group_id'],
  125 + 'show'=>$param['show'] ?? 0,
125 ]; 126 ];
126 return $this->success($data); 127 return $this->success($data);
127 } 128 }
@@ -265,8 +266,4 @@ class NavLogic extends BaseLogic @@ -265,8 +266,4 @@ class NavLogic extends BaseLogic
265 $navGroupModel->edit(['sort_list'=>$this->param['sort_list']],['id'=>$this->param['id']]); 266 $navGroupModel->edit(['sort_list'=>$this->param['sort_list']],['id'=>$this->param['id']]);
266 return $this->success(); 267 return $this->success();
267 } 268 }
268 -  
269 -  
270 -  
271 -  
272 } 269 }
@@ -68,6 +68,7 @@ class NewsLogic extends BaseLogic @@ -68,6 +68,7 @@ class NewsLogic extends BaseLogic
68 $route = $this->param['url']; 68 $route = $this->param['url'];
69 $this->edit($this->param, ['id' => $this->param['id']]); 69 $this->edit($this->param, ['id' => $this->param['id']]);
70 } else { 70 } else {
  71 + $this->param['sort'] = $this->setNewsSort();
71 $id = $this->model->addReturnId($this->param); 72 $id = $this->model->addReturnId($this->param);
72 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); 73 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
73 $this->edit(['url' => $route], ['id' => $id]); 74 $this->edit(['url' => $route], ['id' => $id]);
@@ -84,6 +85,22 @@ class NewsLogic extends BaseLogic @@ -84,6 +85,22 @@ class NewsLogic extends BaseLogic
84 } 85 }
85 86
86 /** 87 /**
  88 + * @remark :设置最新产品的sort排序
  89 + * @name :setNewsSort
  90 + * @author :lyh
  91 + * @method :post
  92 + * @time :2023/12/25 9:27
  93 + */
  94 + public function setNewsSort(){
  95 + $info = $this->model->orderBy('sort','desc')->first();
  96 + if(empty($info)){
  97 + return 1;
  98 + }
  99 + $sort = $info['sort']+1;
  100 + return $sort;
  101 + }
  102 +
  103 + /**
87 * @name :编辑seo 104 * @name :编辑seo
88 * @return void 105 * @return void
89 * @author :liyuhang 106 * @author :liyuhang
@@ -99,6 +99,7 @@ class CategoryLogic extends BaseLogic @@ -99,6 +99,7 @@ class CategoryLogic extends BaseLogic
99 $info = $this->model->read(['id'=>$id]); 99 $info = $this->model->read(['id'=>$id]);
100 $info['url'] = $info['route']; 100 $info['url'] = $info['route'];
101 $info['image_link'] = getImageUrl($info['image']); 101 $info['image_link'] = getImageUrl($info['image']);
  102 + $info['describe_image'] = !empty($info['describe_image']) ? getImageUrl(json_decode($info['describe_image'])) : [];
102 return $this->success($info); 103 return $this->success($info);
103 } 104 }
104 105
@@ -112,6 +113,7 @@ class CategoryLogic extends BaseLogic @@ -112,6 +113,7 @@ class CategoryLogic extends BaseLogic
112 public function categorySave(){ 113 public function categorySave(){
113 DB::beginTransaction(); 114 DB::beginTransaction();
114 try { 115 try {
  116 + $this->param = $this->saveHandleParam($this->param);
115 if(isset($this->param['id']) && !empty($this->param['id'])){ 117 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']); 118 $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']);
117 $route = $this->param['route']; 119 $route = $this->param['route'];
@@ -135,6 +137,24 @@ class CategoryLogic extends BaseLogic @@ -135,6 +137,24 @@ class CategoryLogic extends BaseLogic
135 } 137 }
136 138
137 /** 139 /**
  140 + * @remark :保存时处理数据
  141 + * @name :saveHandleParam
  142 + * @author :lyh
  143 + * @method :post
  144 + * @time :2023/12/22 17:28
  145 + */
  146 + public function saveHandleParam($param){
  147 + if(isset($this->param['describe_image']) && !empty($this->param['describe_image'])){
  148 + foreach ($this->param['describe_image'] as $k => $v){
  149 + $v = str_replace_url($v);
  150 + $this->param['describe_image'][$k] = $v;
  151 + }
  152 + $this->param['describe_image'] = json_encode($this->param['describe_image']);
  153 + }
  154 + return $this->success($param);
  155 + }
  156 +
  157 + /**
138 * @remark :删除 158 * @remark :删除
139 * @name :delete 159 * @name :delete
140 * @author :lyh 160 * @author :lyh
@@ -41,7 +41,6 @@ class KeywordLogic extends BaseLogic @@ -41,7 +41,6 @@ class KeywordLogic extends BaseLogic
41 $info = $this->model->read($this->param); 41 $info = $this->model->read($this->param);
42 $info['url'] = $this->user['domain'] . $info['route']; 42 $info['url'] = $this->user['domain'] . $info['route'];
43 $info['related_news_info'] = News::whereIn('id', $info['related_news_ids'])->select(['id', 'name'])->get(); 43 $info['related_news_info'] = News::whereIn('id', $info['related_news_ids'])->select(['id', 'name'])->get();
44 -  
45 return $this->success($info); 44 return $this->success($info);
46 } 45 }
47 46
@@ -53,27 +52,27 @@ class KeywordLogic extends BaseLogic @@ -53,27 +52,27 @@ class KeywordLogic extends BaseLogic
53 * @time :2023/8/23 16:50 52 * @time :2023/8/23 16:50
54 */ 53 */
55 public function keywordSave(){ 54 public function keywordSave(){
56 - DB::beginTransaction();  
57 - try {  
58 - $this->param = $this->handleSaveParam($this->param);  
59 - if(isset($this->param['id']) && !empty($this->param['id'])){  
60 - //TODO::不能修改路由  
61 - $this->model->edit($this->param,['id'=>$this->param['id']]);  
62 - $route = RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD,$this->param['id'], $this->user['project_id']);  
63 - }else{  
64 - $this->param = $this->addHandleParam($this->param);  
65 - $id = $this->model->insertGetId($this->param);  
66 - //路由映射  
67 - $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);  
68 - $this->model->edit(['route'=>$route],['id'=>$id]); 55 + $this->param = $this->handleSaveParam($this->param);
  56 + if(isset($this->param['id']) && !empty($this->param['id'])){
  57 + $info = $this->model->read(['title'=>$this->param['title'],'id'=>['!=',$this->param['id']]]);
  58 + if($info !== false){
  59 + $this->fail('当前title已存在');
69 } 60 }
70 -// //清除缓存  
71 - Common::del_user_cache('product_keyword',$this->user['project_id']);  
72 - DB::commit();  
73 - }catch (\Exception $e){  
74 - DB::rollBack();  
75 - $this->fail('保存失败'); 61 + //TODO::不能修改路由
  62 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  63 + $route = RouteMap::getRoute(RouteMap::SOURCE_PRODUCT_KEYWORD,$this->param['id'], $this->user['project_id']);
  64 + }else{
  65 + $info = $this->model->read(['title'=>$this->param['title']]);
  66 + if($info !== false){
  67 + $this->fail('当前title已存在');
  68 + }
  69 + $this->param = $this->addHandleParam($this->param);
  70 + $id = $this->model->insertGetId($this->param);
  71 + //路由映射
  72 + $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
  73 + $this->model->edit(['route'=>$route],['id'=>$id]);
76 } 74 }
  75 + Common::del_user_cache('product_keyword',$this->user['project_id']);
77 $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_KEYWORD,$route); 76 $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_KEYWORD,$route);
78 $this->curlDelRoute(['new_route'=>$route]); 77 $this->curlDelRoute(['new_route'=>$route]);
79 return $this->success(); 78 return $this->success();
@@ -52,6 +52,7 @@ class ProductLogic extends BaseLogic @@ -52,6 +52,7 @@ class ProductLogic extends BaseLogic
52 $id = $this->param['id']; 52 $id = $this->param['id'];
53 }else{ 53 }else{
54 $this->param = $this->addHandleParam($this->param); 54 $this->param = $this->addHandleParam($this->param);
  55 + $this->param['sort'] = $this->setNewsSort();
55 $id = $this->model->addReturnId($this->param); 56 $id = $this->model->addReturnId($this->param);
56 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 57 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
57 $this->model->edit(['route'=>$route],['id'=>$id]); 58 $this->model->edit(['route'=>$route],['id'=>$id]);
@@ -69,6 +70,22 @@ class ProductLogic extends BaseLogic @@ -69,6 +70,22 @@ class ProductLogic extends BaseLogic
69 } 70 }
70 71
71 /** 72 /**
  73 + * @remark :设置最新产品的sort排序
  74 + * @name :setNewsSort
  75 + * @author :lyh
  76 + * @method :post
  77 + * @time :2023/12/25 9:27
  78 + */
  79 + public function setNewsSort(){
  80 + $info = $this->model->orderBy('sort','desc')->first();
  81 + if(empty($info)){
  82 + return 1;
  83 + }
  84 + $sort = $info['sort']+1;
  85 + return $sort;
  86 + }
  87 +
  88 + /**
72 * @remark :处理扩展字段 89 * @remark :处理扩展字段
73 * @name :handleExtent 90 * @name :handleExtent
74 * @author :lyh 91 * @author :lyh
@@ -464,9 +464,9 @@ class RankDataLogic extends BaseLogic @@ -464,9 +464,9 @@ class RankDataLogic extends BaseLogic
464 if($keyword_num && $type == Project::TYPE_TWO && $first_page_num >= $keyword_num){ 464 if($keyword_num && $type == Project::TYPE_TWO && $first_page_num >= $keyword_num){
465 $model->compliance_day = $model->compliance_day + 1; 465 $model->compliance_day = $model->compliance_day + 1;
466 $model->is_compliance = 1; 466 $model->is_compliance = 1;
467 -  
468 //项目表更新 467 //项目表更新
469 - Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $model->compliance_day]); 468 + $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
  469 + Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day+1]);
470 } 470 }
471 } 471 }
472 472
@@ -171,6 +171,7 @@ class UserLoginLogic @@ -171,6 +171,7 @@ class UserLoginLogic
171 $info['image_max'] = $project['image_max']; 171 $info['image_max'] = $project['image_max'];
172 $info['is_update_language'] = $project['is_update_language']; 172 $info['is_update_language'] = $project['is_update_language'];
173 $info['configuration'] = $project['deploy_build']['configuration']; 173 $info['configuration'] = $project['deploy_build']['configuration'];
  174 + $info['project_type'] = $project['type'];
174 if($info['is_customized'] == 1){ 175 if($info['is_customized'] == 1){
175 $info['is_visualization'] = json_decode($project['is_visualization']); 176 $info['is_visualization'] = json_decode($project['is_visualization']);
176 } 177 }
@@ -207,7 +208,7 @@ class UserLoginLogic @@ -207,7 +208,7 @@ class UserLoginLogic
207 $info['image_max'] = $project['image_max']; 208 $info['image_max'] = $project['image_max'];
208 $info['is_update_language'] = $project['is_update_language']; 209 $info['is_update_language'] = $project['is_update_language'];
209 $info['configuration'] = $project['deploy_build']['configuration']; 210 $info['configuration'] = $project['deploy_build']['configuration'];
210 - $info['type'] = $project['type']; 211 + $info['project_type'] = $project['type'];
211 if($info['is_customized'] == 1){ 212 if($info['is_customized'] == 1){
212 $info['is_visualization'] = json_decode($project['is_visualization']); 213 $info['is_visualization'] = json_decode($project['is_visualization']);
213 } 214 }
@@ -24,7 +24,8 @@ class BlogRequest extends FormRequest @@ -24,7 +24,8 @@ class BlogRequest extends FormRequest
24 public function rules() 24 public function rules()
25 { 25 {
26 return [ 26 return [
27 - 'name'=>'required|max:100', 27 + 'name'=>'required|max:200',
  28 +// 'remark'=>'max:500',
28 'url'=>'required', 29 'url'=>'required',
29 ]; 30 ];
30 } 31 }
@@ -33,7 +34,9 @@ class BlogRequest extends FormRequest @@ -33,7 +34,9 @@ class BlogRequest extends FormRequest
33 { 34 {
34 return [ 35 return [
35 'name.required'=>'请填写名称', 36 'name.required'=>'请填写名称',
36 - 'url.required'=>'链接不能为空' 37 + 'name.max'=>'名称超过最长长度200',
  38 + 'url.required'=>'链接不能为空',
  39 +// 'remark.max'=>'描述超过最长长度500'
37 ]; 40 ];
38 } 41 }
39 } 42 }
@@ -25,6 +25,7 @@ class NewsRequest extends FormRequest @@ -25,6 +25,7 @@ class NewsRequest extends FormRequest
25 { 25 {
26 return [ 26 return [
27 'name'=>'required|max:200', 27 'name'=>'required|max:200',
  28 +// 'remark'=>'max:500',
28 'url'=>'required', 29 'url'=>'required',
29 ]; 30 ];
30 } 31 }
@@ -33,8 +34,9 @@ class NewsRequest extends FormRequest @@ -33,8 +34,9 @@ class NewsRequest extends FormRequest
33 { 34 {
34 return [ 35 return [
35 'name.required'=>'请填写名称', 36 'name.required'=>'请填写名称',
36 - 'name.max'=>'名称最大200字',  
37 - 'url.required'=>'新闻链接不能为空' 37 + 'name.max'=>'名称超过最长长度200',
  38 + 'url.required'=>'链接不能为空',
  39 +// 'remark.max'=>'描述超过最长长度500'
38 ]; 40 ];
39 } 41 }
40 } 42 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :Mobile.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/12/25 15:41
  8 + */
  9 +
  10 +namespace App\Models\Manage;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class Mobile extends Base
  15 +{
  16 + protected $table = 'gl_mobile';
  17 +}
@@ -355,7 +355,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -355,7 +355,7 @@ Route::middleware(['bloginauth'])->group(function () {
355 Route::any('/read', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'read'])->name('custom_read'); 355 Route::any('/read', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'read'])->name('custom_read');
356 Route::any('/save', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'save'])->name('custom_save'); 356 Route::any('/save', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'save'])->name('custom_save');
357 Route::any('/saveHtml', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'saveHtml'])->name('custom_saveHtml'); 357 Route::any('/saveHtml', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'saveHtml'])->name('custom_saveHtml');
358 - Route::any('/statusNum', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'statusNumber'])->name('product_statusNum'); 358 + Route::any('/statusNum', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'statusNumber'])->name('custom_statusNum');
359 Route::any('/del', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'del'])->name('custom_del'); 359 Route::any('/del', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'del'])->name('custom_del');
360 }); 360 });
361 // 菜单组 361 // 菜单组
@@ -427,7 +427,10 @@ Route::middleware(['bloginauth'])->group(function () { @@ -427,7 +427,10 @@ Route::middleware(['bloginauth'])->group(function () {
427 Route::prefix('language')->group(function () { 427 Route::prefix('language')->group(function () {
428 Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists'); 428 Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists');
429 }); 429 });
430 - 430 + //优化关键词,检索关键词
  431 + Route::prefix('project_keyword')->group(function () {
  432 + Route::any('/', [\App\Http\Controllers\Bside\Keyword\ProjectKeywordController::class, 'searchKeywords'])->name('searchKeywords');
  433 + });
431 //自定义模板 434 //自定义模板
432 Route::prefix('custom_module')->group(function () { 435 Route::prefix('custom_module')->group(function () {
433 Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'lists'])->name('custom_lists'); 436 Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleController::class, 'lists'])->name('custom_lists');