作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

正在显示 33 个修改的文件 包含 389 行增加216 行删除
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :TemplateLog.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/7/10 14:44
  8 + */
  9 +
  10 +namespace App\Console\Commands\DeleteTemplate;
  11 +
  12 +use App\Models\Project\Project;
  13 +use App\Models\Template\BTemplateLog;
  14 +use App\Services\ProjectServer;
  15 +use Illuminate\Console\Command;
  16 +use Illuminate\Support\Facades\DB;
  17 +
  18 +class TemplateLog extends Command
  19 +{
  20 + /**
  21 + * The name and signature of the console command.
  22 + *
  23 + * @var string
  24 + */
  25 + protected $signature = 'delete_template_log';
  26 +
  27 + /**
  28 + * The console command description.
  29 + *
  30 + * @var string
  31 + */
  32 + protected $description = '定时清理日志';
  33 +
  34 + /**
  35 + * Create a new command instance.
  36 + *
  37 + * @return void
  38 + */
  39 + public function __construct()
  40 + {
  41 + parent::__construct();
  42 + }
  43 +
  44 + public function handle(){
  45 + $projectModel = new Project();
  46 + $list = $projectModel->list(['delete_status'=>0]);
  47 + foreach ($list as $v){
  48 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  49 + ProjectServer::useProject($v['id']);
  50 + $this->deleteTemplate();
  51 + DB::disconnect('custom_mysql');
  52 + }
  53 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  54 + }
  55 +
  56 + /**
  57 + * @remark :定时清理可视化日志
  58 + * @name :deleteTemplate
  59 + * @author :lyh
  60 + * @method :post
  61 + * @time :2024/7/10 14:48
  62 + */
  63 + public function deleteTemplate(){
  64 + $startDate = date("Y-m-01 00:00:00");
  65 + $endDate = date("Y-m-t 23:59:59");
  66 + $templateLogModel = new BTemplateLog();
  67 + return $templateLogModel->del(['created_at'=>['not between'=>[$startDate,$endDate]]]);
  68 + }
  69 +}
@@ -31,10 +31,18 @@ class SyncSubmitTask extends Command @@ -31,10 +31,18 @@ class SyncSubmitTask extends Command
31 while (true) { 31 while (true) {
32 $task_id = Redis::rpop('sync_submit_task'); 32 $task_id = Redis::rpop('sync_submit_task');
33 if(!$task_id){ 33 if(!$task_id){
34 - sleep(3);  
35 continue; 34 continue;
36 } 35 }
  36 +
37 $this->output('任务' . $task_id . '开始'); 37 $this->output('任务' . $task_id . '开始');
  38 +
  39 + $time = time();
  40 +
  41 +
  42 + DB::enableQueryLog(); //启用查询日志
  43 + //清除之前的查询日志
  44 + DB::flushQueryLog();
  45 +
38 $task_info = SyncSubmitTaskModel::find($task_id); 46 $task_info = SyncSubmitTaskModel::find($task_id);
39 if (empty($task_info) || $task_info->status !=3) { 47 if (empty($task_info) || $task_info->status !=3) {
40 $this->output('任务不存在或者已执行'); 48 $this->output('任务不存在或者已执行');
@@ -43,7 +51,6 @@ class SyncSubmitTask extends Command @@ -43,7 +51,6 @@ class SyncSubmitTask extends Command
43 try { 51 try {
44 $project = Project::getProjectByDomain($task_info['data']['domain'] ?? ''); 52 $project = Project::getProjectByDomain($task_info['data']['domain'] ?? '');
45 $task_info->project_id = $project->id; 53 $task_info->project_id = $project->id;
46 -  
47 SyncSubmitTaskService::handler($task_info); 54 SyncSubmitTaskService::handler($task_info);
48 $task_info->status = 1; 55 $task_info->status = 1;
49 $task_info->save(); 56 $task_info->save();
@@ -68,6 +75,14 @@ class SyncSubmitTask extends Command @@ -68,6 +75,14 @@ class SyncSubmitTask extends Command
68 75
69 $this->output('任务失败:' . $e->getMessage()); 76 $this->output('任务失败:' . $e->getMessage());
70 } 77 }
  78 +
  79 + $use_time = time() - $time;
  80 + if($use_time > 1){
  81 + //数据库查询
  82 + $this->output('任务用时:' .$use_time . ' | ' . json_encode(DB::getQueryLog(),JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  83 + }
  84 + //清除之前的查询日志
  85 + DB::flushQueryLog();
71 } 86 }
72 } 87 }
73 88
@@ -44,7 +44,6 @@ class SyncSubmitTaskDistribution extends Command @@ -44,7 +44,6 @@ class SyncSubmitTaskDistribution extends Command
44 } 44 }
45 } 45 }
46 } 46 }
47 - sleep(3);  
48 } 47 }
49 } 48 }
50 49
@@ -59,102 +59,4 @@ class Demo extends Command @@ -59,102 +59,4 @@ class Demo extends Command
59 } 59 }
60 return true; 60 return true;
61 } 61 }
62 -  
63 -// public function handle(){  
64 -// $keywordVideoModel = new KeywordVideoTask();  
65 -// $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray();  
66 -// //查看是否有子记录  
67 -// foreach ($project_id_arr as $values){  
68 -// $logModel = new KeywordVideoTaskLog();  
69 -// $logInfo = $logModel->read(['project_id'=>$values]);  
70 -// if($logInfo === false){  
71 -// echo date('Y-m-d H:i:s') . '开启的项目project_id:'.$values . PHP_EOL;  
72 -// $keywordVideoModel->edit(['status'=>0],['project_id'=>$values]);  
73 -// }  
74 -// }  
75 -// $projectModel = new Project();  
76 -// $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]);  
77 -// $data = [];  
78 -// foreach ($list as $v){  
79 -// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;  
80 -// ProjectServer::useProject($v['id']);  
81 -// $this->getProductList();  
82 -// DB::disconnect('custom_mysql');  
83 -// }  
84 -// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;  
85 -// }  
86 -  
87 -// public function getProductList(){  
88 -// $productModel = new Product();  
89 -// $product_all_id = $productModel::whereRaw('LENGTH(keyword_id) > 50')->pluck('id')->toArray();  
90 -// if(empty($product_all_id)){  
91 -// return true;  
92 -// }  
93 -// $lists = $productModel->whereIn("id", $product_all_id)->orderByRaw(DB::raw("FIELD(id, " . implode(',', $product_all_id) . ")"))->get()->toArray();  
94 -// foreach ($lists as $k => $v){  
95 -// echo date('Y-m-d H:i:s') . '项目id:'.$v['project_id'].'+产品product_id:'.$v['id'] . PHP_EOL;  
96 -// $str = ',';  
97 -// shuffle($v['keyword_id']);  
98 -// foreach ($v['keyword_id'] as $key => $value){  
99 -// if($key == 6){  
100 -// break;  
101 -// }  
102 -// $str .= $value.',';  
103 -// }  
104 -// $productModel->edit(['keyword_id'=>$str],['id'=>$v['id']]);  
105 -// }  
106 -// return true;  
107 -// }  
108 -//  
109 -// /**  
110 -// * @remark :关键字有视频的改为1  
111 -// * @name :getProductKeywordInfo  
112 -// * @author :lyh  
113 -// * @method :post  
114 -// * @time :2024/5/31 9:54  
115 -// */  
116 -// public function saveKeyword(){  
117 -// $keywordModel = new Keyword();  
118 -// $rs = $keywordModel->edit(['is_video_keyword'=>0],['video'=>'']);  
119 -// echo date('Y-m-d H:i:s') . 'end'.$rs . PHP_EOL;  
120 -// return true;  
121 -// }  
122 -  
123 -// public function handle(){  
124 -// //切换数据库配置  
125 -// ProjectServer::useProject(1862);  
126 -// return $this->initTable(1380,1862);  
127 -// }  
128 -//  
129 -// public function initTable($project_id, $news_project_id)  
130 -// {  
131 -// config(['database.connections.custom_tmp_mysql_copy.database' => 'gl_data_' . $project_id]);  
132 -// $database_name = DB::connection('custom_tmp_mysql_copy')->getDatabaseName();  
133 -// $tables = Schema::connection('custom_tmp_mysql_copy')->getAllTables();  
134 -// $tables = array_column($tables, 'Tables_in_' . $database_name);  
135 -// foreach ($tables as $table) {  
136 -// $has_table = Schema::connection('custom_mysql')->hasTable($table);  
137 -// if (!$has_table) {  
138 -// $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}");  
139 -// DB::connection('custom_mysql')->statement(array_values((array)$sql[0])[0]); // 修正此处的sql语句获取方式  
140 -// }  
141 -//  
142 -// if ($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form') {  
143 -// continue;  
144 -// }  
145 -// DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据  
146 -// DB::connection('custom_mysql')->table($table)->insertUsing(  
147 -// [], // 列名数组,留空表示插入所有列  
148 -// function ($query) use ($table, $project_id) {  
149 -// $name = 'gl_data_' . $project_id . '.' . $table;  
150 -// $query->select('*')->from("{$name}");  
151 -// }  
152 -// );  
153 -//  
154 -// if (Schema::connection('custom_mysql')->hasColumn($table, 'project_id')) {  
155 -// DB::connection('custom_mysql')->table($table)->update(['project_id' => $news_project_id]);  
156 -// }  
157 -// }  
158 -// return true;  
159 -// }  
160 } 62 }
@@ -21,23 +21,9 @@ class Kernel extends ConsoleKernel @@ -21,23 +21,9 @@ class Kernel extends ConsoleKernel
21 // $schedule->command('inspire')->hourly(); 21 // $schedule->command('inspire')->hourly();
22 $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长 22 $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长
23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
24 -// $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次  
25 -// $schedule->command('rank_data')->dailyAt('08:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次  
26 -// $schedule->command('rank_data_speed')->dailyAt('01:10')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次  
27 -// $schedule->command('rank_data_external_links')->dailyAt('08:30')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次  
28 -// $schedule->command('rank_data_external_links')->dailyAt('18:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次  
29 -// $schedule->command('rank_data_indexed_pages')->dailyAt('07:30')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次  
30 -// $schedule->command('rank_data_recomm_domain')->dailyAt('07:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次  
31 -// $schedule->command('rank_data_week')->weeklyOn([1,2], '08:30')->withoutOverlapping(1); // 排名数据,每周一、二早上执行一次  
32 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 24 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
33 $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 25 $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
34 $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 26 $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
35 -// $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次  
36 -// $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次  
37 -// $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次  
38 -// $schedule->command('web_traffic_russia 1')->everyThirtyMinutes(); // 俄语站引流 1-3个月的项目,半小时一次  
39 -// $schedule->command('web_traffic_russia 2')->cron('*/18 * * * *'); // 俄语站引流 4-8个月的项目,18分钟一次  
40 -// $schedule->command('web_traffic_russia 3')->cron('*/12 * * * *'); // 俄语站引流 大于9个月的项目,12分钟一次  
41 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 27 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
42 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 28 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
43 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 29 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
@@ -48,10 +34,9 @@ class Kernel extends ConsoleKernel @@ -48,10 +34,9 @@ class Kernel extends ConsoleKernel
48 $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次 34 $schedule->command('sync_manager')->dailyAt('01:00')->withoutOverlapping(1); //TODO::手机号码同步 每天执行一次
49 $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字 35 $schedule->command('update_keyword_route')->dailyAt('01:00')->withoutOverlapping(1); //升级项目--清除路由相同的关键字
50 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商 36 $schedule->command('recommended_suppliers')->dailyAt('03:00')->withoutOverlapping(1); //每天凌晨1点执行一次生成推荐商
51 -  
52 $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1); 37 $schedule->command('update_keyword_content')->hourly()->withoutOverlapping(1);
53 - // 每日推送视频任务  
54 - $schedule->command('video_task')->hourly()->withoutOverlapping(1); 38 + // 每月15号执行任务
  39 + $schedule->command('delete_template_log')->monthlyOn(15, '00:00')->withoutOverlapping();
55 // 每日推送已完成视频任务项目生成对应界面 40 // 每日推送已完成视频任务项目生成对应界面
56 $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1); 41 $schedule->command('notice_c')->dailyAt('04:00')->withoutOverlapping(1);
57 } 42 }
@@ -215,6 +215,26 @@ if (!function_exists('_get_child')) { @@ -215,6 +215,26 @@ if (!function_exists('_get_child')) {
215 } 215 }
216 } 216 }
217 217
  218 +if (!function_exists('_get_all_sub')) {
  219 + /**
  220 + * 獲取所有子集id
  221 + * @param int
  222 + * @return array
  223 + */
  224 + function _get_all_sub($my_id,$id_Arr)
  225 + {
  226 + $new_arr[] = $my_id;
  227 + foreach ($id_Arr as $v) {
  228 + if ($v['pid'] == $my_id) {
  229 + $new_arr[] = $v['id'];
  230 + // 递归查找子节点的子节点
  231 + $new_arr = array_merge($new_arr, _get_all_sub($v['id'], $id_Arr));
  232 + }
  233 + }
  234 + return $new_arr ? $new_arr : [];
  235 + }
  236 +}
  237 +
218 238
219 if (!function_exists('checkDomain')) { 239 if (!function_exists('checkDomain')) {
220 /** 240 /**
@@ -624,11 +644,11 @@ if (!function_exists('getFileUrl')) { @@ -624,11 +644,11 @@ if (!function_exists('getFileUrl')) {
624 * @method :post 644 * @method :post
625 * @time :2023/7/20 16:46 645 * @time :2023/7/20 16:46
626 */ 646 */
627 - function getFileUrl($path,$storage_type = 0,$location = 0){ 647 + function getFileUrl($path,$storage_type = 0,$location = 0,$file_cdn = 0){
628 if(is_array($path)){ 648 if(is_array($path)){
629 $url =[]; 649 $url =[];
630 foreach ($path as $v){ 650 foreach ($path as $v){
631 - $url[] = getFileUrl($v,$storage_type,$location); 651 + $url[] = getFileUrl($v,$storage_type,$location,$file_cdn);
632 } 652 }
633 }else{ 653 }else{
634 if(empty($path)){ 654 if(empty($path)){
@@ -642,7 +662,7 @@ if (!function_exists('getFileUrl')) { @@ -642,7 +662,7 @@ if (!function_exists('getFileUrl')) {
642 } 662 }
643 $file_type = pathinfo($path, PATHINFO_EXTENSION); 663 $file_type = pathinfo($path, PATHINFO_EXTENSION);
644 $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx']; 664 $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];
645 - if(in_array(strtolower($file_type),$fileTypeArr)){ 665 + if(in_array(strtolower($file_type),$fileTypeArr) && ($file_cdn == 0)){
646 $cdn2 = config('filesystems.disks.cos')['cdn2']; 666 $cdn2 = config('filesystems.disks.cos')['cdn2'];
647 return $cdn2.$path; 667 return $cdn2.$path;
648 } 668 }
@@ -42,6 +42,7 @@ class PrivateController extends BaseController @@ -42,6 +42,7 @@ class PrivateController extends BaseController
42 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') 42 ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
43 ->where('gl_project.type', Project::TYPE_TWO) 43 ->where('gl_project.type', Project::TYPE_TWO)
44 ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制 44 ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制
  45 + ->where('gl_project.delete_status', Project::IS_DEL_FALSE)
45 ->where(function ($subQuery) { 46 ->where(function ($subQuery) {
46 $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE); 47 $subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE);
47 }) 48 })
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Controllers\Aside\Manage; 3 namespace App\Http\Controllers\Aside\Manage;
4 use App\Enums\Common\Code; 4 use App\Enums\Common\Code;
5 use App\Http\Controllers\Aside\BaseController; 5 use App\Http\Controllers\Aside\BaseController;
  6 +use App\Http\Requests\Aside\Manage\ManagerHrRequest;
6 use App\Models\Manage\ManageHr; 7 use App\Models\Manage\ManageHr;
7 use App\Models\Manage\Menu; 8 use App\Models\Manage\Menu;
8 use Illuminate\Http\Request; 9 use Illuminate\Http\Request;
@@ -53,7 +54,8 @@ class HrController extends BaseController @@ -53,7 +54,8 @@ class HrController extends BaseController
53 * @method :post 54 * @method :post
54 * @time :2023/9/6 10:05 55 * @time :2023/9/6 10:05
55 */ 56 */
56 - public function save(HrLogic $logic){ 57 + public function save(ManagerHrRequest $request,HrLogic $logic){
  58 + $request->validated();
57 $logic->hrSave(); 59 $logic->hrSave();
58 $this->response('success'); 60 $this->response('success');
59 } 61 }
@@ -417,9 +417,11 @@ class ProjectController extends BaseController @@ -417,9 +417,11 @@ class ProjectController extends BaseController
417 public function save(ProjectLogic $logic) 417 public function save(ProjectLogic $logic)
418 { 418 {
419 $this->request->validate([ 419 $this->request->validate([
420 - 'type'=>'required' 420 + 'type'=>'required',
  421 + 'serve_id'=>'required',
421 ],[ 422 ],[
422 - 'type.required' => '类型不能为空' 423 + 'type.required' => '类型不能为空',
  424 + 'serve_id.required' => '请选择服务器'
423 ]); 425 ]);
424 $logic->projectSave(); 426 $logic->projectSave();
425 $this->response('success'); 427 $this->response('success');
@@ -39,13 +39,6 @@ class ATemplateTypeController extends BaseController @@ -39,13 +39,6 @@ class ATemplateTypeController extends BaseController
39 * @time :2023/7/10 15:49 39 * @time :2023/7/10 15:49
40 */ 40 */
41 public function save(ATemplateTypeRequest $ATemplateTypeRequest,ATemplateTypeLogic $ATemplateTypeLogic){ 41 public function save(ATemplateTypeRequest $ATemplateTypeRequest,ATemplateTypeLogic $ATemplateTypeLogic){
42 - if(isset($this->param['id']) && !empty($this->param['id'])){  
43 - $this->request->validate([  
44 - 'id'=>'required'  
45 - ],[  
46 - 'id.required' => 'ID不能为空'  
47 - ]);  
48 - }  
49 $ATemplateTypeRequest->validated(); 42 $ATemplateTypeRequest->validated();
50 $ATemplateTypeLogic->typeSave(); 43 $ATemplateTypeLogic->typeSave();
51 $this->response('success'); 44 $this->response('success');
@@ -90,6 +90,7 @@ class MonthReportController extends BaseController @@ -90,6 +90,7 @@ class MonthReportController extends BaseController
90 90
91 $info['remain_day'] = $this->user['remain_day'];//剩余服务天数 91 $info['remain_day'] = $this->user['remain_day'];//剩余服务天数
92 $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2); 92 $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2);
  93 + $info['month_total'] = (int)$info['month_total'];
93 $this->response('success',Code::SUCCESS,$info); 94 $this->response('success',Code::SUCCESS,$info);
94 } 95 }
95 } 96 }
@@ -85,7 +85,7 @@ class CustomModuleContentController extends BaseController @@ -85,7 +85,7 @@ class CustomModuleContentController extends BaseController
85 $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); 85 $v['image_link'] = getImageUrl($v['image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
86 } 86 }
87 if(!empty($v['video'])){ 87 if(!empty($v['video'])){
88 - $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); 88 + $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn'] ?? 0);
89 $v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']); 89 $v['video']['video_image'] = getImageUrl($v['video']['video_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
90 } 90 }
91 return $this->success($v); 91 return $this->success($v);
@@ -133,11 +133,11 @@ class ProductController extends BaseController @@ -133,11 +133,11 @@ class ProductController extends BaseController
133 } 133 }
134 } 134 }
135 if(!empty($v['video'])){ 135 if(!empty($v['video'])){
136 - $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); 136 + $v['video']['url'] = getFileUrl($v['video']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn'] ?? 0);
137 $v['video']['video_image'] = getImageUrl($v['video']['video_image'] ?? '',$this->user['storage_type'] ?? 0,$this->user['project_location']); 137 $v['video']['video_image'] = getImageUrl($v['video']['video_image'] ?? '',$this->user['storage_type'] ?? 0,$this->user['project_location']);
138 } 138 }
139 if(!empty($v['files']) && !empty($v['files']['url'])){ 139 if(!empty($v['files']) && !empty($v['files']['url'])){
140 - $v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']); 140 + $v['files']['url'] = getFileUrl($v['files']['url'],$this->user['storage_type'] ?? 0,$this->user['project_location'],$this->user['file_cdn'] ?? 0);
141 } 141 }
142 return $this->success($v); 142 return $this->success($v);
143 } 143 }
@@ -167,6 +167,29 @@ class ProductController extends BaseController @@ -167,6 +167,29 @@ class ProductController extends BaseController
167 if(!empty($this->param['start_at']) && !empty($this->param['end_at'])){ 167 if(!empty($this->param['start_at']) && !empty($this->param['end_at'])){
168 $query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59'); 168 $query->where('created_at', '>=' ,$this->param['start_at'].' 00:00:00')->where('created_at', '<=' ,$this->param['end_at'].' 59:59:59');
169 } 169 }
  170 + $this->param['featured_status'] = $this->param['featured_status'] ?? 0;
  171 + if($this->param['featured_status'] != Category::STATUS_ACTIVE) {
  172 + $cateModel = new Category();
  173 + $featured_ids = $cateModel->where('title', 'like', 'Featured%')->pluck('id')->toArray();
  174 + if(!empty($featured_ids)){
  175 + $status = [];
  176 + if(isset($this->map['status'])){
  177 + $status = ['status'=>$this->map['status']];
  178 + }
  179 + $cateList = $cateModel->list($status,'id',['id','pid']);
  180 + //获取当前的子集
  181 + $featured_arr = [];
  182 + foreach ($featured_ids as $id){
  183 + $featured_arr = array_merge($featured_arr,array_unique(_get_all_sub($id,$cateList)));
  184 + }
  185 + if(!empty($featured_arr)){
  186 + $cateRelated = new CategoryRelated();
  187 + $product_ids = $cateRelated->whereIn('cate_id',$featured_arr)->pluck('product_id')->unique()->toArray();
  188 + $query = $query->whereNotIn('id',$product_ids);
  189 + }
  190 + }
  191 +
  192 + }
170 return $query; 193 return $query;
171 } 194 }
172 195
@@ -356,9 +379,9 @@ class ProductController extends BaseController @@ -356,9 +379,9 @@ class ProductController extends BaseController
356 foreach ($arr1 as $k1=>$v1){ 379 foreach ($arr1 as $k1=>$v1){
357 $v1 = (array)$v1; 380 $v1 = (array)$v1;
358 if(isset($v1['url'])){ 381 if(isset($v1['url'])){
359 - $v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location']); 382 + $v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
360 }else{ 383 }else{
361 - $v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location']); 384 + $v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
362 } 385 }
363 $arr1[$k1] = $v1; 386 $arr1[$k1] = $v1;
364 } 387 }
@@ -422,6 +445,11 @@ class ProductController extends BaseController @@ -422,6 +445,11 @@ class ProductController extends BaseController
422 * @time :2023/8/21 18:33 445 * @time :2023/8/21 18:33
423 */ 446 */
424 public function getStatusNumber(ProductLogic $logic){ 447 public function getStatusNumber(ProductLogic $logic){
  448 + $this->request->validate([
  449 + 'featured_status'=>'numeric',
  450 + ],[
  451 + 'featured_status.numeric' => 'numeric为数字',
  452 + ]);
425 $data = $logic->getStatusNumber(); 453 $data = $logic->getStatusNumber();
426 $this->response('success',Code::SUCCESS,$data); 454 $this->response('success',Code::SUCCESS,$data);
427 } 455 }
@@ -536,10 +564,9 @@ class ProductController extends BaseController @@ -536,10 +564,9 @@ class ProductController extends BaseController
536 $setNumModel = new SettingNum(); 564 $setNumModel = new SettingNum();
537 $info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]); 565 $info = $setNumModel->read(['type'=>$setNumModel::TYPE_PRODUCT_SORT]);
538 if($info === false){ 566 if($info === false){
539 - $info = [];  
540 - }else{  
541 - $info['data'] = json_decode($info['data']); 567 + $this->response('success');
542 } 568 }
  569 + $info['data'] = json_decode($info['data']);
543 $this->response('success',Code::SUCCESS,$info); 570 $this->response('success',Code::SUCCESS,$info);
544 } 571 }
545 572
@@ -580,4 +607,21 @@ class ProductController extends BaseController @@ -580,4 +607,21 @@ class ProductController extends BaseController
580 } 607 }
581 $this->response('success',Code::SUCCESS,$productInfo); 608 $this->response('success',Code::SUCCESS,$productInfo);
582 } 609 }
  610 +
  611 + /**
  612 + * @remark :搜索分类参数
  613 + * @name :searchCategory
  614 + * @author :lyh
  615 + * @method :post
  616 + * @time :2024/7/9 14:48
  617 + */
  618 + public function getSearchCategoryList(ProductLogic $logic){
  619 + $this->request->validate([
  620 + 'featured_status'=>'numeric',
  621 + ],[
  622 + 'featured_status.numeric' => 'numeric为数字',
  623 + ]);
  624 + $data = $logic->getSearchCategoryList();
  625 + $this->response('success',Code::SUCCESS,$data);
  626 + }
583 } 627 }
@@ -342,7 +342,7 @@ class FileController @@ -342,7 +342,7 @@ class FileController
342 if ($info === false) { 342 if ($info === false) {
343 $this->response('指定文件不存在!', Code::USER_ERROR); 343 $this->response('指定文件不存在!', Code::USER_ERROR);
344 } 344 }
345 - $fileUrl = getFileUrl($info['path'],$info['is_cos']); 345 + $fileUrl = getFileUrl($info['path'],$this->cache['storage_type'] ?? 0,$this->cache['project_location'] ?? 0,$this->cache['file_cdn'] ?? 0);
346 // 设置响应头 346 // 设置响应头
347 header('Content-Description: File Transfer'); 347 header('Content-Description: File Transfer');
348 header('Content-Type: application/octet-stream'); 348 header('Content-Type: application/octet-stream');
@@ -392,7 +392,7 @@ class FileController @@ -392,7 +392,7 @@ class FileController
392 $fileModel = new File(); 392 $fileModel = new File();
393 $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']); 393 $lists = $fileModel->list($this->map,'id',['id','hash','type','path','created_at','name']);
394 foreach ($lists as $k => $v){ 394 foreach ($lists as $k => $v){
395 - $v['file_link'] = getFileUrl($v['path'],$this->cache['storage_type'] ?? 0); 395 + $v['file_link'] = getFileUrl($v['path'],$this->cache['storage_type'] ?? 0,$this->cache['project_location'] ?? 0,$this->cache['file_cdn'] ?? 0);
396 $lists[$k] = $v; 396 $lists[$k] = $v;
397 } 397 }
398 $this->response('success',Code::SUCCESS,$lists); 398 $this->response('success',Code::SUCCESS,$lists);
@@ -408,7 +408,7 @@ class FileController @@ -408,7 +408,7 @@ class FileController
408 public function responseData($path, $name){ 408 public function responseData($path, $name){
409 $data = [ 409 $data = [
410 'file'=>$path, 410 'file'=>$path,
411 - 'file_link'=>getFileUrl($path,$this->cache['storage_type'] ?? 0), 411 + 'file_link'=>getFileUrl($path,$this->cache['storage_type'] ?? 0,$this->cache['project_location'] ?? 0,$this->cache['file_cdn'] ?? 0),
412 'name'=>$name, 412 'name'=>$name,
413 'file_download'=>url('a/download_files?path='.$path) 413 'file_download'=>url('a/download_files?path='.$path)
414 ]; 414 ];
@@ -37,15 +37,6 @@ class BaseLogic extends Logic @@ -37,15 +37,6 @@ class BaseLogic extends Logic
37 */ 37 */
38 public function getParam(){ 38 public function getParam(){
39 $requestAll = $this->request->all(); 39 $requestAll = $this->request->all();
40 - foreach ($requestAll as $k => $v){  
41 - if(is_array($v)){  
42 - continue;  
43 - }else{  
44 - if(empty($v) && ($v == null)){  
45 - unset($requestAll[$k]);  
46 - }  
47 - }  
48 - }  
49 return $this->success($requestAll); 40 return $this->success($requestAll);
50 } 41 }
51 } 42 }
@@ -39,7 +39,8 @@ class HrLogic extends BaseLogic @@ -39,7 +39,8 @@ class HrLogic extends BaseLogic
39 * @time :2023/9/6 10:17 39 * @time :2023/9/6 10:17
40 */ 40 */
41 public function hrSave(){ 41 public function hrSave(){
42 - //处理参数 42 + $this->handleParam();
  43 + //处理参数
43 foreach ($this->model::specieField() as $v){ 44 foreach ($this->model::specieField() as $v){
44 $this->param = $this->setJson($v,$this->param); 45 $this->param = $this->setJson($v,$this->param);
45 } 46 }
@@ -52,6 +53,22 @@ class HrLogic extends BaseLogic @@ -52,6 +53,22 @@ class HrLogic extends BaseLogic
52 } 53 }
53 54
54 /** 55 /**
  56 + * @remark :处理字段
  57 + * @name :handleParam
  58 + * @author :lyh
  59 + * @method :post
  60 + * @time :2024/7/10 16:32
  61 + */
  62 + public function handleParam(){
  63 + $this->param['status'] = empty($this->param['status']) ? 1 : $this->param['status'];
  64 + $this->param['education'] = empty($this->param['education']) ? 1 : $this->param['education'];
  65 + $this->param['entry_position'] = empty($this->param['entry_position']) ? 1 : $this->param['entry_position'];
  66 + $this->param['p_level'] = empty($this->param['p_level']) ? 1 : $this->param['p_level'];
  67 + $this->param['dept_id'] = empty($this->param['dept_id']) ? 1 : $this->param['dept_id'];
  68 + $this->param['belong_group'] = empty($this->param['belong_group']) ? 1 : $this->param['belong_group'];
  69 + }
  70 +
  71 + /**
55 * @remark :添加人事信息时 同步添加管理员账号 72 * @remark :添加人事信息时 同步添加管理员账号
56 * @name :addManager 73 * @name :addManager
57 * @author :lyh 74 * @author :lyh
@@ -75,10 +92,8 @@ class HrLogic extends BaseLogic @@ -75,10 +92,8 @@ class HrLogic extends BaseLogic
75 $managerModel = new Manage(); 92 $managerModel = new Manage();
76 $this->param['manage_id'] = $managerModel->addReturnId($data); 93 $this->param['manage_id'] = $managerModel->addReturnId($data);
77 $this->model->add($this->param); 94 $this->model->add($this->param);
78 -  
79 //同步到B端演示项目 95 //同步到B端演示项目
80 $this->syncBProjectUser($this->param['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']); 96 $this->syncBProjectUser($this->param['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']);
81 -  
82 DB::commit(); 97 DB::commit();
83 }catch (\Exception $e){ 98 }catch (\Exception $e){
84 DB::rollBack(); 99 DB::rollBack();
@@ -120,7 +135,7 @@ class HrLogic extends BaseLogic @@ -120,7 +135,7 @@ class HrLogic extends BaseLogic
120 DB::commit(); 135 DB::commit();
121 }catch (\Exception $e){ 136 }catch (\Exception $e){
122 DB::rollBack(); 137 DB::rollBack();
123 - $this->fail('系统错误,请联系管理员'); 138 + $this->fail('系统错误,请联系管理员'.$e->getMessage());
124 } 139 }
125 return $this->success(); 140 return $this->success();
126 } 141 }
@@ -148,7 +148,7 @@ class ProjectLogic extends BaseLogic @@ -148,7 +148,7 @@ class ProjectLogic extends BaseLogic
148 //初始化项目 148 //初始化项目
149 $this->createProjectData($this->param); 149 $this->createProjectData($this->param);
150 //双向绑定服务器,需放到保存项目的上方 150 //双向绑定服务器,需放到保存项目的上方
151 - $this->setServers($this->param['serve_id'] ?? 0,$this->param['id']); 151 + $this->setServers($this->param['serve_id'],$this->param['id']);
152 //保存项目信息 152 //保存项目信息
153 $this->saveProject($this->param); 153 $this->saveProject($this->param);
154 //保存建站部署信息 154 //保存建站部署信息
@@ -177,6 +177,9 @@ class ProjectLogic extends BaseLogic @@ -177,6 +177,9 @@ class ProjectLogic extends BaseLogic
177 * @time :2024/6/25 15:34 177 * @time :2024/6/25 15:34
178 */ 178 */
179 public function setServers($servers_id,$project_id){ 179 public function setServers($servers_id,$project_id){
  180 + if(empty($servers_id)){
  181 + return $this->success();
  182 + }
180 //查看當前項目服務器是否有更改 183 //查看當前項目服務器是否有更改
181 $projectModel = new Project(); 184 $projectModel = new Project();
182 $projectInfo = $projectModel->read(['id'=>$project_id],['serve_id']); 185 $projectInfo = $projectModel->read(['id'=>$project_id],['serve_id']);
@@ -16,18 +16,15 @@ class TaskOwnerLogic extends BaseLogic @@ -16,18 +16,15 @@ class TaskOwnerLogic extends BaseLogic
16 public function __construct() 16 public function __construct()
17 { 17 {
18 parent::__construct(); 18 parent::__construct();
19 -  
20 $this->model = new TaskOwner(); 19 $this->model = new TaskOwner();
21 } 20 }
22 21
23 public function save($param){ 22 public function save($param){
24 //获取已分配了的 23 //获取已分配了的
25 $manage_ids = $this->model->where('task_id', $param['task_id'])->pluck('manage_id', 'id')->toArray(); 24 $manage_ids = $this->model->where('task_id', $param['task_id'])->pluck('manage_id', 'id')->toArray();
26 -  
27 //待删除的 25 //待删除的
28 $del_manage_ids = array_diff($manage_ids, $param['manage_ids']); 26 $del_manage_ids = array_diff($manage_ids, $param['manage_ids']);
29 $this->delete(array_keys($del_manage_ids)); 27 $this->delete(array_keys($del_manage_ids));
30 -  
31 //新增的 28 //新增的
32 $add_manage_ids = array_diff($param['manage_ids'], $manage_ids); 29 $add_manage_ids = array_diff($param['manage_ids'], $manage_ids);
33 foreach ($add_manage_ids as $add_manage_id){ 30 foreach ($add_manage_ids as $add_manage_id){
@@ -66,7 +66,7 @@ class AyrReleaseLogic extends BaseLogic @@ -66,7 +66,7 @@ class AyrReleaseLogic extends BaseLogic
66 $arr[] = getImageUrl($v1); 66 $arr[] = getImageUrl($v1);
67 } 67 }
68 }else{ 68 }else{
69 - $arr[] = getFileUrl($v); 69 + $arr[] = getFileUrl($v,$this->user['storage_type'] ?? 0,$this->user['project_location'] ?? 0,$this->user['file_cdn'] ?? 0);
70 } 70 }
71 } 71 }
72 } 72 }
@@ -709,7 +709,7 @@ class BTemplateLogic extends BaseLogic @@ -709,7 +709,7 @@ class BTemplateLogic extends BaseLogic
709 } 709 }
710 $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']); 710 $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
711 $this->addUpdateNotify($type,$route); 711 $this->addUpdateNotify($type,$route);
712 - return $this->curlDelRoute(['route'=>$route,'new_route'=>$route]); 712 + return $this->curlDelRoute(['old_route'=>$route,'new_route'=>$route]);
713 } 713 }
714 714
715 /** 715 /**
@@ -210,4 +210,5 @@ class BaseLogic extends Logic @@ -210,4 +210,5 @@ class BaseLogic extends Logic
210 ]; 210 ];
211 return http_post($c_url, json_encode($param)); 211 return http_post($c_url, json_encode($param));
212 } 212 }
  213 +
213 } 214 }
@@ -179,16 +179,15 @@ class BlogLogic extends BaseLogic @@ -179,16 +179,15 @@ class BlogLogic extends BaseLogic
179 public function paramProcessing($param){ 179 public function paramProcessing($param){
180 if(isset($this->param['id'])){ 180 if(isset($this->param['id'])){
181 $param['operator_id'] = $this->user['id']; 181 $param['operator_id'] = $this->user['id'];
182 - if(isset($param['category_id']) && !empty($param['category_id'])){  
183 - $param['category_id'] = $this->getCategory($param['category_id']);  
184 - }  
185 }else{ 182 }else{
186 $param['create_id'] = $this->user['id']; 183 $param['create_id'] = $this->user['id'];
187 $param['operator_id'] = $this->user['id']; 184 $param['operator_id'] = $this->user['id'];
188 $param['project_id'] = $this->user['project_id']; 185 $param['project_id'] = $this->user['project_id'];
189 - if(isset($param['category_id']) && !empty($param['category_id'])){  
190 - $param['category_id'] = $this->getCategory($param['category_id']);  
191 - } 186 + }
  187 + if(isset($param['category_id']) && !empty($param['category_id'])){
  188 + $param['category_id'] = $this->getCategory($param['category_id']);
  189 + }else{
  190 + $param['category_id'] = '';
192 } 191 }
193 return $this->success($param); 192 return $this->success($param);
194 } 193 }
@@ -201,11 +200,8 @@ class BlogLogic extends BaseLogic @@ -201,11 +200,8 @@ class BlogLogic extends BaseLogic
201 * @time :2023/10/20 9:02 200 * @time :2023/10/20 9:02
202 */ 201 */
203 public function getCategory($category){ 202 public function getCategory($category){
204 - $str = '';  
205 - foreach ($category as $v){  
206 - $str .= $v.',';  
207 - }  
208 - return !empty(trim($str,',')) ? ','.$str.',' : ''; 203 + $str = implode(',',$category);
  204 + return !empty(trim(trim($str,','),',')) ? ','.$str.',' : '';
209 } 205 }
210 206
211 /** 207 /**
@@ -94,7 +94,7 @@ class CustomModuleContentLogic extends BaseLogic @@ -94,7 +94,7 @@ class CustomModuleContentLogic extends BaseLogic
94 }elseif($v['type'] == 4){ 94 }elseif($v['type'] == 4){
95 $arr1 = json_decode($info['values']); 95 $arr1 = json_decode($info['values']);
96 foreach ($arr1 as $k1=>$v1){ 96 foreach ($arr1 as $k1=>$v1){
97 - $v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location']); 97 + $v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
98 $arr1[$k1] = $v1; 98 $arr1[$k1] = $v1;
99 } 99 }
100 $v['values'] = $arr1; 100 $v['values'] = $arr1;
@@ -60,7 +60,7 @@ class CountLogic extends BaseLogic @@ -60,7 +60,7 @@ class CountLogic extends BaseLogic
60 public function scheme_info(){ 60 public function scheme_info(){
61 $data = [ 61 $data = [
62 'company'=>$this->project['company'] ?? '', 62 'company'=>$this->project['company'] ?? '',
63 - 'scheme'=>Project::planMap()[$this->project['deploy_build']['plan']], 63 + 'scheme'=>!empty($this->project['deploy_build']['plan']) ? Project::planMap()[$this->project['deploy_build']['plan']] : '',
64 'service_duration'=>$this->project['deploy_build']['service_duration'], 64 'service_duration'=>$this->project['deploy_build']['service_duration'],
65 ]; 65 ];
66 return $this->success($data); 66 return $this->success($data);
@@ -191,16 +191,15 @@ class NewsLogic extends BaseLogic @@ -191,16 +191,15 @@ class NewsLogic extends BaseLogic
191 } 191 }
192 if(isset($this->param['id'])){ 192 if(isset($this->param['id'])){
193 $param['operator_id'] = $this->user['id']; 193 $param['operator_id'] = $this->user['id'];
194 - if(isset($param['category_id']) && !empty($param['category_id'])){  
195 - $param['category_id'] = $this->getCategory($param['category_id']);  
196 - }  
197 }else{ 194 }else{
198 $param['create_id'] = $this->user['id']; 195 $param['create_id'] = $this->user['id'];
199 $param['operator_id'] = $this->user['id']; 196 $param['operator_id'] = $this->user['id'];
200 $param['project_id'] = $this->user['project_id']; 197 $param['project_id'] = $this->user['project_id'];
201 - if(isset($param['category_id']) && !empty($param['category_id'])){  
202 - $param['category_id'] = $this->getCategory($param['category_id']);  
203 - } 198 + }
  199 + if(isset($param['category_id']) && !empty($param['category_id'])){
  200 + $param['category_id'] = $this->getCategory($param['category_id']);
  201 + }else{
  202 + $param['category_id'] = '';
204 } 203 }
205 return $this->success($param); 204 return $this->success($param);
206 } 205 }
@@ -213,11 +212,8 @@ class NewsLogic extends BaseLogic @@ -213,11 +212,8 @@ class NewsLogic extends BaseLogic
213 * @time :2023/10/20 9:02 212 * @time :2023/10/20 9:02
214 */ 213 */
215 public function getCategory($category){ 214 public function getCategory($category){
216 - $str = '';  
217 - foreach ($category as $v){  
218 - $str .= $v.',';  
219 - }  
220 - return !empty(trim($str,',')) ? ','.$str.',' : ''; 215 + $str = implode(',',$category);
  216 + return !empty(trim(trim($str,','),',')) ? ','.$str.',' : '';
221 } 217 }
222 218
223 /** 219 /**
@@ -334,22 +334,6 @@ class ProductLogic extends BaseLogic @@ -334,22 +334,6 @@ class ProductLogic extends BaseLogic
334 334
335 335
336 /** 336 /**
337 - * @remark :编辑产品  
338 - * @name :editProduct  
339 - * @author :lyh  
340 - * @method :post  
341 - * @time :2023/9/7 10:02  
342 - */  
343 - public function editProductRoute($id,$route){  
344 - $info = $this->model->read(['id'=>$id]);  
345 - if($info['route'] != $route){  
346 - $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);  
347 - }  
348 - $this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]);  
349 - return $route;  
350 - }  
351 -  
352 - /**  
353 * @remark :删除数据 337 * @remark :删除数据
354 * @name :delete 338 * @name :delete
355 * @author :lyh 339 * @author :lyh
@@ -409,10 +393,32 @@ class ProductLogic extends BaseLogic @@ -409,10 +393,32 @@ class ProductLogic extends BaseLogic
409 //三种状态 0:草稿 1:发布 2:回收站 393 //三种状态 0:草稿 1:发布 2:回收站
410 $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3]; 394 $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3];
411 foreach ($data as $k => $v){ 395 foreach ($data as $k => $v){
  396 + $map = [];
  397 + $cateModel = new Category();
  398 + $status = [];
  399 + if($v != 3){
  400 + $status = ['status'=>$v];
  401 + }
  402 + $cateList = $cateModel->list($status,'id',['id','pid']);
  403 + $this->param['featured_status'] = $this->param['featured_status'] ?? 0;
  404 + if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){
  405 + $featured_ids = $cateModel->where('title', 'like', 'Featured%')->pluck('id')->toArray();
  406 + //获取当前的子集
  407 + $featured_arr = [];
  408 + foreach ($featured_ids as $id){
  409 + $featured_arr = array_merge($featured_arr,array_unique(_get_all_sub($id,$cateList)));
  410 + }
  411 + if(!empty($featured_arr)){
  412 + $cateRelated = new CategoryRelated();
  413 + $product_ids = $cateRelated->whereIn('cate_id',$featured_arr)->pluck('product_id')->unique()->toArray();
  414 + $map['id'] = ['not in',$product_ids];
  415 + }
  416 + }
412 if($v == 3){ 417 if($v == 3){
413 - $data[$k] = $this->model->where(['project_id'=>$this->user['project_id']])->count(); 418 + $data[$k] = $this->model->formatQuery($map)->count();
414 }else{ 419 }else{
415 - $data[$k] = $this->model->where(['status'=>$v,'project_id'=>$this->user['project_id']])->count(); 420 + $map['status'] = $v;
  421 + $data[$k] = $this->model->formatQuery($map)->count();
416 } 422 }
417 } 423 }
418 return $this->success($data); 424 return $this->success($data);
@@ -428,16 +434,51 @@ class ProductLogic extends BaseLogic @@ -428,16 +434,51 @@ class ProductLogic extends BaseLogic
428 public function setCopyProduct(){ 434 public function setCopyProduct(){
429 $info = $this->model->read(['id'=>$this->param['id']]); 435 $info = $this->model->read(['id'=>$this->param['id']]);
430 $param = $this->setProductParams($info); 436 $param = $this->setProductParams($info);
431 - $save_id = $this->model->insertGetId($param);  
432 - $route = preg_replace('/-product.*/', '', $param['route']);  
433 - $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']);  
434 - $this->model->edit(['route'=>$route],['id'=>$save_id]);  
435 - //同步可视化装修数据  
436 - $this->copyTemplate($this->param['id'],$info['project_id'],$save_id); 437 + DB::beginTransaction();
  438 + try {
  439 + $save_id = $this->model->insertGetId($param);
  440 + CategoryRelated::saveRelated($save_id, $info['category_id']);
  441 + $route = preg_replace('/-product.*/', '', $param['route']);
  442 + //同步分类关联表
  443 + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $save_id, $this->user['project_id']);
  444 + $this->model->edit(['route'=>$route],['id'=>$save_id]);
  445 + //同步可视化装修数据
  446 + $this->copyTemplate($this->param['id'],$info['project_id'],$save_id);
  447 + //同步扩展字段
  448 + $this->copyExtendInfo($info['id'],$save_id);
  449 + DB::commit();
  450 + }catch (\Exception $e){
  451 + DB::rollBack();
  452 + $this->fail('复制失败,请联系管理员');
  453 + }
437 return $this->success(['id'=>$save_id]); 454 return $this->success(['id'=>$save_id]);
438 } 455 }
439 456
440 /** 457 /**
  458 + * @remark :复制项目扩展字段
  459 + * @name :copyExtendInfo
  460 + * @author :lyh
  461 + * @method :post
  462 + * @time :2024/7/12 9:23
  463 + */
  464 + public function copyExtendInfo($old_id,$new_id){
  465 + $extendInfoModel = new ExtendInfo();
  466 + $extendList = $extendInfoModel->list(['product_id'=>$old_id],'created_at');
  467 + if(!empty($extendList)){
  468 + $data = [];
  469 + foreach ($extendList as $k => $v){
  470 + unset($v['id']);
  471 + $v['product_id'] = $new_id;
  472 + $v['created_at'] = date('Y-m-d H:i:s');
  473 + $v['updated_at'] = date('Y-m-d H:i:s');
  474 + $data[] = $v;
  475 + }
  476 + return $extendList->insert($data);
  477 + }
  478 + return $this->success();
  479 + }
  480 +
  481 + /**
441 * @remark :同步模版数据 482 * @remark :同步模版数据
442 * @name :copyTemplate 483 * @name :copyTemplate
443 * @author :lyh 484 * @author :lyh
@@ -847,4 +888,35 @@ class ProductLogic extends BaseLogic @@ -847,4 +888,35 @@ class ProductLogic extends BaseLogic
847 } 888 }
848 return false; 889 return false;
849 } 890 }
  891 +
  892 + /**
  893 + * @remark :产品列表搜索参数时分类列表
  894 + * @param :
  895 + * @name :getSearchCategoryList
  896 + * @author :lyh
  897 + * @method :post
  898 + * @time :2024/7/9 14:56
  899 + */
  900 + public function getSearchCategoryList()
  901 + {
  902 + $data = [];
  903 + $categoryModel = new Category();
  904 + $this->param['deleted_at'] = null;
  905 + $this->param['featured_status'] = $this->param['featured_status'] ?? 0;
  906 + if(($this->param['featured_status'] != Category::STATUS_ACTIVE)) {
  907 + $this->param['title'] = ['not like','Featured%'];
  908 + }
  909 + unset($this->param['featured_status']);
  910 + $list = $categoryModel->list($this->param, ['sort', 'id'], ['id', 'pid', 'title']);
  911 + if (!empty($list)) {
  912 + foreach ($list as $v) {
  913 + $v = (array)$v;
  914 + if ($v['pid'] == 0) {
  915 + $v['sub'] = _get_child($v['id'], $list);
  916 + $data[] = $v;
  917 + }
  918 + }
  919 + }
  920 + return $this->success($data);
  921 + }
850 } 922 }
@@ -80,6 +80,9 @@ class TranslateLogic extends BaseLogic @@ -80,6 +80,9 @@ class TranslateLogic extends BaseLogic
80 if(!empty($arr2)){ 80 if(!empty($arr2)){
81 $i = 0; 81 $i = 0;
82 TranslateText: 82 TranslateText:
  83 + if($languageInfo['short'] == 'zh-ct'){
  84 + $languageInfo['short'] = 'zh-TW';
  85 + }
83 $translate_list = Translate::tran($arr2, $languageInfo['short']); 86 $translate_list = Translate::tran($arr2, $languageInfo['short']);
84 if(empty($translate_list)){ 87 if(empty($translate_list)){
85 if ($i < 3) { 88 if ($i < 3) {
@@ -279,6 +279,7 @@ class UserLoginLogic @@ -279,6 +279,7 @@ class UserLoginLogic
279 $info['project_type'] = $project['type']; 279 $info['project_type'] = $project['type'];
280 $info['storage_type'] = $project['storage_type']; 280 $info['storage_type'] = $project['storage_type'];
281 $info['project_location'] = $project['project_location']; 281 $info['project_location'] = $project['project_location'];
  282 + $info['file_cdn'] = $project['deploy_build']['file_cdn'];
282 $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0; 283 $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0;
283 $info['remain_day'] = $project['remain_day'] ?? 0; 284 $info['remain_day'] = $project['remain_day'] ?? 0;
284 if($info['is_customized'] == 1){ 285 if($info['is_customized'] == 1){
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ManagerHrRequest.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/7/10 15:59
  8 + */
  9 +
  10 +namespace App\Http\Requests\Aside\Manage;
  11 +use App\Models\Manage\Manage;
  12 +use App\Rules\Mobile;
  13 +use Illuminate\Foundation\Http\FormRequest;
  14 +use Illuminate\Validation\Rule;
  15 +
  16 +class ManagerHrRequest extends FormRequest
  17 +{
  18 + /**
  19 + * Determine if the user is authorized to make this request.
  20 + *
  21 + * @return bool
  22 + */
  23 + public function authorize()
  24 + {
  25 + return true;
  26 + }
  27 +
  28 + /**
  29 + * Get the validation rules that apply to the request.
  30 + *
  31 + * @return array
  32 + */
  33 + public function rules()
  34 + {
  35 + return [
  36 + 'name'=>'required',
  37 + 'mobile'=>'required',
  38 +// 'status'=>'required',
  39 +// 'education'=>'required',
  40 +// 'entry_position'=>'required',
  41 +// 'p_level'=>'required',
  42 +// 'dept_id'=>'required',
  43 +// 'belong_group'=>'required',
  44 + ];
  45 + }
  46 +
  47 + public function messages()
  48 + {
  49 + return [
  50 + 'name.required' => '名称不能为空',
  51 + 'mobile.required' => '手机号码不能为空',
  52 +// 'status.required' => '请选择用户状态',
  53 +// 'education.required' => '请选择学历',
  54 +// 'entry_position.required' => '请选择入职岗位',
  55 +// 'belong_group.required' => '请选择小组',
  56 +// 'p_level.required' => '请选择入职岗位级别',
  57 +// 'dept_id.required' => '请选择部门',
  58 + ];
  59 + }
  60 +
  61 +}
@@ -25,7 +25,7 @@ class NewsRequest extends FormRequest @@ -25,7 +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 + 'remark'=>'max:1000',
29 'url'=>'required', 29 'url'=>'required',
30 ]; 30 ];
31 } 31 }
@@ -36,7 +36,7 @@ class NewsRequest extends FormRequest @@ -36,7 +36,7 @@ class NewsRequest extends FormRequest
36 'name.required'=>'请填写名称', 36 'name.required'=>'请填写名称',
37 'name.max'=>'名称超过最长长度200', 37 'name.max'=>'名称超过最长长度200',
38 'url.required'=>'链接不能为空', 38 'url.required'=>'链接不能为空',
39 -// 'remark.max'=>'描述超过最长长度500' 39 + 'remark.max'=>'描述超过最长长度1000'
40 ]; 40 ];
41 } 41 }
42 } 42 }
@@ -175,18 +175,21 @@ class Base extends Model @@ -175,18 +175,21 @@ class Base extends Model
175 $query->where($k, $v[0], $v[1]); 175 $query->where($k, $v[0], $v[1]);
176 } 176 }
177 break; 177 break;
  178 + case 'not like':
  179 + $query->where($k, $v[0], $v[1]);
  180 + break;
178 case 'in': 181 case 'in':
179 // in查询 ['id'=>['in',[1,2,3]]] 182 // in查询 ['id'=>['in',[1,2,3]]]
180 $query->whereIn($k, $v[1]); 183 $query->whereIn($k, $v[1]);
181 break; 184 break;
182 - case 'or':  
183 - // in查询 ['id'=>['or',[1,2,3]]]  
184 - $query->orWhere($k, $v[1]);  
185 - break;  
186 case 'not in': 185 case 'not in':
187 // in查询 ['id'=>['not in',[1,2,3]]] 186 // in查询 ['id'=>['not in',[1,2,3]]]
188 $query->whereNotIn($k, $v[1]); 187 $query->whereNotIn($k, $v[1]);
189 break; 188 break;
  189 + case 'or':
  190 + // in查询 ['id'=>['or',[1,2,3]]]
  191 + $query->orWhere($k, $v[1]);
  192 + break;
190 case 'between': 193 case 'between':
191 // in查询 ['id'=>['between',[create1,create2]]] 194 // in查询 ['id'=>['between',[create1,create2]]]
192 $query->whereBetween($k, $v[1]); 195 $query->whereBetween($k, $v[1]);
@@ -169,7 +169,7 @@ return [ @@ -169,7 +169,7 @@ return [
169 ], 169 ],
170 //操作日志 170 //操作日志
171 'operator_log' =>[ 171 'operator_log' =>[
172 - 'log'=>false,//true开启 172 + 'log'=>true,//true开启
173 'action' => [],//不需要写入日志的方法 173 'action' => [],//不需要写入日志的方法
174 ], 174 ],
175 ]; 175 ];
@@ -255,6 +255,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -255,6 +255,7 @@ Route::middleware(['bloginauth'])->group(function () {
255 Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct'); 255 Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct');
256 Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetCategory'])->name('product_batchSetCategory'); 256 Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Product\ProductController::class, 'batchSetCategory'])->name('product_batchSetCategory');
257 Route::any('/sendAiProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sendAiProduct'])->name('product_sendAiProduct'); 257 Route::any('/sendAiProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sendAiProduct'])->name('product_sendAiProduct');
  258 + Route::any('/getSearchCategoryList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getSearchCategoryList'])->name('product_getSearchCategoryList');
258 //产品分类 259 //产品分类
259 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); 260 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category');
260 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); 261 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info');