作者 赵彬吉
@@ -69,7 +69,7 @@ class ProjectImport extends Command @@ -69,7 +69,7 @@ class ProjectImport extends Command
69 $task->status = ImportTask::STATUS_COM;//导入完成 69 $task->status = ImportTask::STATUS_COM;//导入完成
70 $task->save(); 70 $task->save();
71 71
72 - $this->send_mail($task->user_id, $task->created_at, $task->type, 0, 0, '文件编码格式错误,仅支持UTF-8和GBK编码格式'); 72 + $this->send_mail($task->user_id, $task->created_at, $task->type, 0, 0, 0, '文件编码格式错误,仅支持UTF-8和GBK编码格式');
73 return true; 73 return true;
74 } elseif ($file_code_type === 'GBK') { 74 } elseif ($file_code_type === 'GBK') {
75 $is_gbk = 1; 75 $is_gbk = 1;
@@ -89,13 +89,15 @@ class ProjectImport extends Command @@ -89,13 +89,15 @@ class ProjectImport extends Command
89 $task->status = ImportTask::STATUS_COM;//导入完成 89 $task->status = ImportTask::STATUS_COM;//导入完成
90 $task->save(); 90 $task->save();
91 91
92 - $this->send_mail($task->user_id, $task->created_at, $task->type, 0, 0, '读取文件数据失败'); 92 + $this->send_mail($task->user_id, $task->created_at, $task->type, 0, 0, 0, '读取文件数据失败');
93 return true; 93 return true;
94 } 94 }
95 95
96 $total_count = 0; //总条数 96 $total_count = 0; //总条数
97 $success_count = 0; //成功导入条数 97 $success_count = 0; //成功导入条数
98 $repeat_count = 0; //过滤已存在条数 98 $repeat_count = 0; //过滤已存在条数
  99 + $fail_count = 0;
  100 + $fail_line = [];
99 if (count($line_of_text) > 1) { 101 if (count($line_of_text) > 1) {
100 102
101 //设置数据库 103 //设置数据库
@@ -132,6 +134,8 @@ class ProjectImport extends Command @@ -132,6 +134,8 @@ class ProjectImport extends Command
132 } 134 }
133 } 135 }
134 } catch (\Exception $e) { 136 } catch (\Exception $e) {
  137 + $fail_count += 1;
  138 + $fail_line[] = $k + 1;
135 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', title: ' . $v[0] . ', import fail, error: ' . $e->getMessage() . PHP_EOL; 139 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', title: ' . $v[0] . ', import fail, error: ' . $e->getMessage() . PHP_EOL;
136 } 140 }
137 } 141 }
@@ -146,7 +150,7 @@ class ProjectImport extends Command @@ -146,7 +150,7 @@ class ProjectImport extends Command
146 $task->success_count += $success_count; 150 $task->success_count += $success_count;
147 $task->save(); 151 $task->save();
148 152
149 - $this->send_mail($task->user_id, $task->created_at, $task->type, $success_count, $repeat_count, ''); 153 + $this->send_mail($task->user_id, $task->created_at, $task->type, $success_count, $fail_count, $repeat_count, '', $fail_line);
150 154
151 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', import end, total count: ' . $total_count . ', success count: ' . $success_count . PHP_EOL; 155 echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', import end, total count: ' . $total_count . ', success count: ' . $success_count . PHP_EOL;
152 156
@@ -190,7 +194,7 @@ class ProjectImport extends Command @@ -190,7 +194,7 @@ class ProjectImport extends Command
190 } 194 }
191 195
192 //发送站内通知 196 //发送站内通知
193 - protected function send_mail($user_list, $time, $type, $success_count, $repeat_count, $reason) 197 + protected function send_mail($user_list, $time, $type, $success_count, $repeat_count, $fail_count, $reason, $fail_line = [])
194 { 198 {
195 if ($type == ImportTask::TYPE_NEWS) { 199 if ($type == ImportTask::TYPE_NEWS) {
196 $type_content = '新闻'; 200 $type_content = '新闻';
@@ -202,7 +206,9 @@ class ProjectImport extends Command @@ -202,7 +206,9 @@ class ProjectImport extends Command
202 $title = '导入结果通知'; 206 $title = '导入结果通知';
203 $content = '您于 ' . $time . ' 添加的 ' . $type_content . ' 导入任务已执行完成, 成功导入数据:' . $success_count . ' 条'; 207 $content = '您于 ' . $time . ' 添加的 ' . $type_content . ' 导入任务已执行完成, 成功导入数据:' . $success_count . ' 条';
204 $repeat_count && $content .= ',过滤已存在数据:' . $repeat_count . ' 条'; 208 $repeat_count && $content .= ',过滤已存在数据:' . $repeat_count . ' 条';
  209 + $fail_count && $content .= ',导入失败:' . $fail_count . ' 条';
205 $reason && $content .= ',原因:' . $reason; 210 $reason && $content .= ',原因:' . $reason;
  211 + $fail_line && $content .= ',失败行数:' . implode(',', $fail_line);
206 212
207 $mail_model = new Mail(); 213 $mail_model = new Mail();
208 $mail_model->add([ 214 $mail_model->add([
@@ -36,7 +36,7 @@ class OptimizeController extends BaseController @@ -36,7 +36,7 @@ class OptimizeController extends BaseController
36 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id') 36 ->leftJoin('gl_project_deploy_build', 'gl_project.id', '=', 'gl_project_deploy_build.project_id')
37 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id') 37 ->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
38 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id'); 38 ->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id');
39 - $query = $this->searchParam($query)->orderBy('gl_project_deploy_optimize.start_date','desc')->orderBy('gl_project_deploy_optimize.id','desc'); 39 + $query = $this->searchParam($query)->orderBy('gl_project_deploy_optimize.start_date','asc')->orderBy('gl_project_deploy_optimize.id','desc');
40 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray(); 40 $lists = $query->paginate($this->row, $this->selectParam(), 'page', $this->page)->toArray();
41 if(!empty($lists) && !empty($lists['list'])){ 41 if(!empty($lists) && !empty($lists['list'])){
42 $rankDataModel = new RankData(); 42 $rankDataModel = new RankData();
@@ -6,6 +6,7 @@ use App\Enums\Common\Code; @@ -6,6 +6,7 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Aside\BaseController; 6 use App\Http\Controllers\Aside\BaseController;
7 use App\Http\Logic\Aside\Template\ATemplateLogic; 7 use App\Http\Logic\Aside\Template\ATemplateLogic;
8 use App\Http\Requests\Aside\Template\ATemplateRequest; 8 use App\Http\Requests\Aside\Template\ATemplateRequest;
  9 +use App\Models\Template\Setting;
9 10
10 /** 11 /**
11 * @remark :A端主题模板管理 12 * @remark :A端主题模板管理
@@ -35,6 +36,23 @@ class ATemplateController extends BaseController @@ -35,6 +36,23 @@ class ATemplateController extends BaseController
35 } 36 }
36 37
37 /** 38 /**
  39 + * @remark :获取选择的模版
  40 + * @name :getTemplateInfo
  41 + * @author :lyh
  42 + * @method :post
  43 + * @time :2023/11/3 17:19
  44 + */
  45 + public function getSettingInfo(ATemplateLogic $aTemplateLogic){
  46 + $this->request->validate([
  47 + 'project_id'=>'required'
  48 + ],[
  49 + 'project_id.required' => 'project_id不能为空'
  50 + ]);
  51 + $info = $aTemplateLogic->getSettingInfo();
  52 + $this->response('success',Code::SUCCESS,$info);
  53 + }
  54 +
  55 + /**
38 * @remark :获取数据详情 56 * @remark :获取数据详情
39 * @name :read 57 * @name :read
40 * @author :lyh 58 * @author :lyh
@@ -33,6 +33,7 @@ class BTemplateLogController extends BaseController @@ -33,6 +33,7 @@ class BTemplateLogController extends BaseController
33 * @time :2023/8/23 11:05 33 * @time :2023/8/23 11:05
34 */ 34 */
35 public function lists(BTemplateLog $bTemplateLog){ 35 public function lists(BTemplateLog $bTemplateLog){
  36 + unset($this->map['template_id']);
36 $this->map['project_id'] = $this->user['project_id']; 37 $this->map['project_id'] = $this->user['project_id'];
37 $this->map['source'] = 1; 38 $this->map['source'] = 1;
38 $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']); 39 $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']);
@@ -185,4 +185,21 @@ class ATemplateLogic extends BaseLogic @@ -185,4 +185,21 @@ class ATemplateLogic extends BaseLogic
185 } 185 }
186 return $this->success(); 186 return $this->success();
187 } 187 }
  188 +
  189 + /**
  190 + * @remark :获取选择的模版
  191 + * @name :getSettingInfo
  192 + * @author :lyh
  193 + * @method :post
  194 + * @time :2023/11/3 17:21
  195 + */
  196 + public function getSettingInfo(){
  197 + $data = [];
  198 + $bSettingModel = new Setting();
  199 + $info = $bSettingModel->read(['project_id'=>$this->param['project_id']],['template_id']);
  200 + if($info !== false){
  201 + $data = $this->model->read(['id'=>$info['template_id']],['id','name']);
  202 + }
  203 + return $this->success($data);
  204 + }
188 } 205 }
@@ -14,6 +14,7 @@ use App\Models\Service\Service as ServiceSettingModel; @@ -14,6 +14,7 @@ use App\Models\Service\Service as ServiceSettingModel;
14 use App\Models\Template\BTemplate; 14 use App\Models\Template\BTemplate;
15 use App\Models\Template\BTemplateCommon; 15 use App\Models\Template\BTemplateCommon;
16 use App\Models\Template\BTemplateLog; 16 use App\Models\Template\BTemplateLog;
  17 +use App\Models\Template\Setting;
17 18
18 class BTemplateLogLogic extends BaseLogic 19 class BTemplateLogLogic extends BaseLogic
19 { 20 {
@@ -42,17 +43,26 @@ class BTemplateLogLogic extends BaseLogic @@ -42,17 +43,26 @@ class BTemplateLogLogic extends BaseLogic
42 if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){ 43 if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){
43 $this->fail('演示项目仅支持演示功能,无法更改首页'); 44 $this->fail('演示项目仅支持演示功能,无法更改首页');
44 } 45 }
  46 + //获取当前项目的模版
  47 + $bSettingModel = new Setting();
  48 + $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  49 + if($settingInfo === false){
  50 + $this->fail('请先选择模版');
  51 + }
  52 + //切换模版
  53 + if($info['template_id'] != $settingInfo['template_id']){
  54 + $bSettingModel->edit(['template_id'=>$info['template_id']],['id'=>$settingInfo['id']]);
  55 + }
45 try { 56 try {
46 $data = $this->setParam($info); 57 $data = $this->setParam($info);
47 $BTemplateModel = new BTemplate(); 58 $BTemplateModel = new BTemplate();
48 $BTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); 59 $BTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);
49 $commonData = $this->setCommonParam($info); 60 $commonData = $this->setCommonParam($info);
50 $commonTemplateModel = new BTemplateCommon(); 61 $commonTemplateModel = new BTemplateCommon();
51 - $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); 62 + $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]);
52 }catch (\Exception $e){ 63 }catch (\Exception $e){
53 $this->fail('系统错误,请联系管理员'); 64 $this->fail('系统错误,请联系管理员');
54 } 65 }
55 - //同步更新公共头和底  
56 return $this->success(); 66 return $this->success();
57 } 67 }
58 68
@@ -65,13 +75,8 @@ class BTemplateLogLogic extends BaseLogic @@ -65,13 +75,8 @@ class BTemplateLogLogic extends BaseLogic
65 */ 75 */
66 public function setParam($info){ 76 public function setParam($info){
67 $data = [ 77 $data = [
68 - 'html'=>$info['text'],  
69 - 'head_html'=>$info['head_html'],  
70 - 'head_css'=>$info['head_css'],  
71 'main_html'=>$info['main_html'], 78 'main_html'=>$info['main_html'],
72 'main_css'=>$info['main_css'], 79 'main_css'=>$info['main_css'],
73 - 'footer_html'=>$info['footer_html'],  
74 - 'footer_css'=>$info['footer_css'],  
75 ]; 80 ];
76 return $this->success($data); 81 return $this->success($data);
77 } 82 }
@@ -268,11 +268,11 @@ class BTemplateLogic extends BaseLogic @@ -268,11 +268,11 @@ class BTemplateLogic extends BaseLogic
268 $this->param = $this->stringProcessing($this->param); 268 $this->param = $this->stringProcessing($this->param);
269 //保存头部信息 269 //保存头部信息
270 $this->saveCommonTemplate($this->param); 270 $this->saveCommonTemplate($this->param);
271 - $this->param = $this->templateSaveParam($this->param);//组装数据 271 + $param = $this->templateSaveParam($this->param);//组装数据
272 if($info === false){ 272 if($info === false){
273 - $this->model->add($this->param); 273 + $this->model->add($param);
274 }else{ 274 }else{
275 - $this->model->edit($this->param,['id'=>$info['id']]); 275 + $this->model->edit($param,['id'=>$info['id']]);
276 } 276 }
277 //写入操作模版记录 277 //写入操作模版记录
278 $this->setTemplateLog($this->param); 278 $this->setTemplateLog($this->param);
@@ -302,8 +302,8 @@ class BTemplateLogic extends BaseLogic @@ -302,8 +302,8 @@ class BTemplateLogic extends BaseLogic
302 'head_css'=>$param['head_css'], 302 'head_css'=>$param['head_css'],
303 'footer_html'=>$param['footer_html'], 303 'footer_html'=>$param['footer_html'],
304 'footer_css'=>$param['footer_css'], 304 'footer_css'=>$param['footer_css'],
305 - 'other'=>str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")),  
306 ]; 305 ];
  306 + $other = str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"));
307 if($info === false){ 307 if($info === false){
308 $data['template_id'] = $param['template_id']; 308 $data['template_id'] = $param['template_id'];
309 $data['project_id'] = $this->user['project_id']; 309 $data['project_id'] = $this->user['project_id'];
@@ -312,6 +312,8 @@ class BTemplateLogic extends BaseLogic @@ -312,6 +312,8 @@ class BTemplateLogic extends BaseLogic
312 }else{ 312 }else{
313 $templateCommonModel->edit($data,['id'=>$info['id']]); 313 $templateCommonModel->edit($data,['id'=>$info['id']]);
314 } 314 }
  315 + //更新所有界面的other
  316 + $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id']]);
315 return $this->success(); 317 return $this->success();
316 } 318 }
317 319
@@ -413,7 +415,7 @@ class BTemplateLogic extends BaseLogic @@ -413,7 +415,7 @@ class BTemplateLogic extends BaseLogic
413 public function templateSaveParam($param){ 415 public function templateSaveParam($param){
414 $param['project_id'] = $this->user['project_id']; 416 $param['project_id'] = $this->user['project_id'];
415 $param['html'] = $param['main_html']; 417 $param['html'] = $param['main_html'];
416 -// unset($param['head_html'],$param['head_css'],$param['footer_html'],$param['footer_css']); 418 + unset($param['head_html'],$param['head_css'],$param['footer_html'],$param['footer_css']);
417 return $this->success($param); 419 return $this->success($param);
418 } 420 }
419 421
@@ -122,8 +122,8 @@ class CustomTemplateLogic extends BaseLogic @@ -122,8 +122,8 @@ class CustomTemplateLogic extends BaseLogic
122 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'), 122 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'),
123 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), 123 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
124 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), 124 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
125 - 'other'=>str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")),  
126 ]; 125 ];
  126 + $other = str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s"));
127 if($info === false){ 127 if($info === false){
128 $data['template_id'] = $bSettingInfo['template_id']; 128 $data['template_id'] = $bSettingInfo['template_id'];
129 $data['project_id'] = $this->user['project_id']; 129 $data['project_id'] = $this->user['project_id'];
@@ -132,6 +132,8 @@ class CustomTemplateLogic extends BaseLogic @@ -132,6 +132,8 @@ class CustomTemplateLogic extends BaseLogic
132 }else{ 132 }else{
133 $templateCommonModel->edit($data,['id'=>$info['id']]); 133 $templateCommonModel->edit($data,['id'=>$info['id']]);
134 } 134 }
  135 + //更新所有界面的other
  136 + $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id']]);
135 return $this->success(); 137 return $this->success();
136 } 138 }
137 139
@@ -354,7 +354,25 @@ class BlogCategoryLogic extends BaseLogic @@ -354,7 +354,25 @@ class BlogCategoryLogic extends BaseLogic
354 } 354 }
355 $return[] = $c_id; 355 $return[] = $c_id;
356 } 356 }
357 - return ','.implode(',',$return).','; 357 + return $this->getLastCategory($return);
  358 + }
  359 +
  360 + /**
  361 + * @remark :获取最后一级分类id
  362 + * @name :getLastCategory
  363 + * @author :lyh
  364 + * @method :post
  365 + * @time :2023/10/20 9:02
  366 + */
  367 + public function getLastCategory($category){
  368 + $str = '';
  369 + foreach ($category as $v){
  370 + $info = $this->model->read(['pid'=>$v]);
  371 + if($info === false){
  372 + $str .= $v.',';
  373 + }
  374 + }
  375 + return ','.$str;
358 } 376 }
359 377
360 /** 378 /**
@@ -295,7 +295,7 @@ class BlogLogic extends BaseLogic @@ -295,7 +295,7 @@ class BlogLogic extends BaseLogic
295 ] 295 ]
296 ); 296 );
297 //更新路由 297 //更新路由
298 - $route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_BLOG, $id, $project_id); 298 + $route = RouteMap::setRoute($data[0], RouteMap::SOURCE_BLOG, $id, $project_id);
299 $this->edit(['url' => $route], ['id' => $id]); 299 $this->edit(['url' => $route], ['id' => $id]);
300 300
301 return true; 301 return true;
@@ -336,7 +336,25 @@ class NewsCategoryLogic extends BaseLogic @@ -336,7 +336,25 @@ class NewsCategoryLogic extends BaseLogic
336 } 336 }
337 $return[] = $c_id; 337 $return[] = $c_id;
338 } 338 }
339 - return ','.implode(',',$return).','; 339 + return $this->getLastCategory($return);
  340 + }
  341 +
  342 + /**
  343 + * @remark :获取最后一级分类id
  344 + * @name :getLastCategory
  345 + * @author :lyh
  346 + * @method :post
  347 + * @time :2023/10/20 9:02
  348 + */
  349 + public function getLastCategory($category){
  350 + $str = '';
  351 + foreach ($category as $v){
  352 + $info = $this->model->read(['pid'=>$v]);
  353 + if($info === false){
  354 + $str .= $v.',';
  355 + }
  356 + }
  357 + return ','.$str;
340 } 358 }
341 359
342 /** 360 /**
@@ -59,8 +59,8 @@ class NewsLogic extends BaseLogic @@ -59,8 +59,8 @@ class NewsLogic extends BaseLogic
59 public function newsSave() 59 public function newsSave()
60 { 60 {
61 //拼接参数 61 //拼接参数
62 -// DB::beginTransaction();  
63 -// try { 62 + DB::beginTransaction();
  63 + try {
64 $this->param = $this->paramProcessing($this->param); 64 $this->param = $this->paramProcessing($this->param);
65 if (isset($this->param['id']) && !empty($this->param['id'])) { 65 if (isset($this->param['id']) && !empty($this->param['id'])) {
66 //是否更新路由 66 //是否更新路由
@@ -72,11 +72,11 @@ class NewsLogic extends BaseLogic @@ -72,11 +72,11 @@ class NewsLogic extends BaseLogic
72 //更新路由 72 //更新路由
73 $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']);
74 $this->edit(['url' => $route], ['id' => $id]); 74 $this->edit(['url' => $route], ['id' => $id]);
75 -// DB::commit();  
76 -// } catch (\Exception $e) {  
77 -// DB::rollBack();  
78 -// $this->fail('系统错误,请联系管理员');  
79 -// } 75 + DB::commit();
  76 + } catch (\Exception $e) {
  77 + DB::rollBack();
  78 + $this->fail('系统错误,请联系管理员');
  79 + }
80 //通知更新 80 //通知更新
81 $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]); 81 $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]);
82 return $this->success(); 82 return $this->success();
@@ -331,7 +331,7 @@ class NewsLogic extends BaseLogic @@ -331,7 +331,7 @@ class NewsLogic extends BaseLogic
331 ] 331 ]
332 ); 332 );
333 //更新路由 333 //更新路由
334 - $route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_NEWS, $id, $project_id); 334 + $route = RouteMap::setRoute($data[0], RouteMap::SOURCE_NEWS, $id, $project_id);
335 $this->edit(['url' => $route], ['id' => $id]); 335 $this->edit(['url' => $route], ['id' => $id]);
336 336
337 return true; 337 return true;
@@ -319,10 +319,29 @@ class CategoryLogic extends BaseLogic @@ -319,10 +319,29 @@ class CategoryLogic extends BaseLogic
319 } 319 }
320 $return[] = $c_id; 320 $return[] = $c_id;
321 } 321 }
322 -  
323 //清除缓存 322 //清除缓存
324 Common::del_user_cache('product_category',$project_id); 323 Common::del_user_cache('product_category',$project_id);
325 - return ','.implode(',',$return).','; 324 + return $this->getLastCategory($return);
  325 + }
  326 +
  327 + /**
  328 + * @remark :获取最后一级分类id
  329 + * @name :getLastCategory
  330 + * @author :lyh
  331 + * @method :post
  332 + * @time :2023/10/20 9:02
  333 + */
  334 + public function getLastCategory($category){
  335 + $str = '';
  336 + if(isset($category) && !empty($category)){
  337 + foreach ($category as $v){
  338 + $info = $this->model->read(['pid'=>$v]);
  339 + if($info === false){
  340 + $str .= $v.',';
  341 + }
  342 + }
  343 + }
  344 + return ','.$str;
326 } 345 }
327 346
328 /** 347 /**
@@ -549,7 +549,7 @@ class ProductLogic extends BaseLogic @@ -549,7 +549,7 @@ class ProductLogic extends BaseLogic
549 ] 549 ]
550 ); 550 );
551 //更新路由 551 //更新路由
552 - $route = RouteMap::setRoute($data[1] ?: $data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id); 552 + $route = RouteMap::setRoute($data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id);
553 $this->edit(['route' => $route], ['id' => $id]); 553 $this->edit(['route' => $route], ['id' => $id]);
554 554
555 return true; 555 return true;
@@ -115,14 +115,12 @@ class UserLoginLogic @@ -115,14 +115,12 @@ class UserLoginLogic
115 $this->fail('该项目未找到注册账号'); 115 $this->fail('该项目未找到注册账号');
116 } 116 }
117 $info = $this->autoAssembleParam($has_user); 117 $info = $this->autoAssembleParam($has_user);
118 - if(!Cache::get($info['token'])){  
119 - //生成新token  
120 - $token = md5(uniqid().$info['id']);  
121 - //存储缓存  
122 - $info['token'] = $token;  
123 - $info['manager_id'] = $data['manager_id'];//代表自动登录写入日志  
124 - Cache::add($token,$info,3600 * 12);  
125 - } 118 + //生成新token
  119 + $token = md5(uniqid().$info['id']);
  120 + //存储缓存
  121 + $info['token'] = $token;
  122 + $info['manager_id'] = $data['manager_id'];//代表自动登录写入日志
  123 + Cache::add($token,$info,3600 * 12);
126 Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(), 124 Common::set_user_login(['user_id'=>$info['id'],'ip'=>request()->ip(),
127 'project_id'=>$info['project_id'], 'type'=>1 ,'remark' => '自动登录,操作管理员为:'.$data['manager_id']]); 125 'project_id'=>$info['project_id'], 'type'=>1 ,'remark' => '自动登录,操作管理员为:'.$data['manager_id']]);
128 return $info; 126 return $info;
@@ -293,6 +293,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -293,6 +293,7 @@ Route::middleware(['aloginauth'])->group(function () {
293 Route::prefix('template')->group(function () { 293 Route::prefix('template')->group(function () {
294 Route::any('/', [Aside\Template\ATemplateController::class, 'lists'])->name('admin.ATemplate_lists'); 294 Route::any('/', [Aside\Template\ATemplateController::class, 'lists'])->name('admin.ATemplate_lists');
295 Route::any('/read', [Aside\Template\ATemplateController::class, 'read'])->name('admin.ATemplate_read'); 295 Route::any('/read', [Aside\Template\ATemplateController::class, 'read'])->name('admin.ATemplate_read');
  296 + Route::any('/getSettingInfo', [Aside\Template\ATemplateController::class, 'getSettingInfo'])->name('admin.ATemplate_getSettingInfo');
296 Route::any('/save', [Aside\Template\ATemplateController::class, 'save'])->name('admin.ATemplate_save'); 297 Route::any('/save', [Aside\Template\ATemplateController::class, 'save'])->name('admin.ATemplate_save');
297 Route::any('/status', [Aside\Template\ATemplateController::class, 'status'])->name('admin.ATemplate_status'); 298 Route::any('/status', [Aside\Template\ATemplateController::class, 'status'])->name('admin.ATemplate_status');
298 Route::any('/del', [Aside\Template\ATemplateController::class, 'del'])->name('admin.ATemplate_del'); 299 Route::any('/del', [Aside\Template\ATemplateController::class, 'del'])->name('admin.ATemplate_del');