作者 Your Name
@@ -114,9 +114,7 @@ class RecommendedSuppliers extends Command @@ -114,9 +114,7 @@ class RecommendedSuppliers extends Command
114 * @method :post 114 * @method :post
115 * @time :2024/7/1 18:07 115 * @time :2024/7/1 18:07
116 */ 116 */
117 - public function getKeywords($project_id){  
118 - $keywordModel = new Keyword();  
119 - $keywordModel-> 117 + public function getKeywords($project_id){git
120 $info = Keyword::inRandomOrder()->first(); 118 $info = Keyword::inRandomOrder()->first();
121 $keywordInfo = $this->getPurchaser($info->title,$project_id); 119 $keywordInfo = $this->getPurchaser($info->title,$project_id);
122 if($keywordInfo !== false){ 120 if($keywordInfo !== false){
@@ -39,7 +39,7 @@ class ServersIpController extends BaseController @@ -39,7 +39,7 @@ class ServersIpController extends BaseController
39 } 39 }
40 $serversIpModel = new ServersIpModel(); 40 $serversIpModel = new ServersIpModel();
41 $this->map['status'] = 0; 41 $this->map['status'] = 0;
42 - $data = $serversIpModel->list($this->map,'total'); 42 + $data = $serversIpModel->list($this->map,'total',['*'],'asc');
43 foreach ($data as $k => $v){ 43 foreach ($data as $k => $v){
44 $v['is_optional'] = 0;//是否可选择 44 $v['is_optional'] = 0;//是否可选择
45 if($v['total'] >= $info['ip_total']){ 45 if($v['total'] >= $info['ip_total']){
@@ -31,6 +31,23 @@ class BTemplateController extends BaseController @@ -31,6 +31,23 @@ class BTemplateController extends BaseController
31 } 31 }
32 32
33 /** 33 /**
  34 + * @remark :获取数据详情
  35 + * @name :templateInfo
  36 + * @author :lyh
  37 + * @method :post
  38 + * @time :2024/7/31 14:27
  39 + */
  40 + public function publicInfo(BTemplateLogic $BTemplateLogic){
  41 + $this->request->validate([
  42 + 'id'=>'required',
  43 + ],[
  44 + 'id.required' => 'id不能为空',
  45 + ]);
  46 + $info = $BTemplateLogic->getPublicTemplateInfo();
  47 + $this->response('success',Code::SUCCESS,$info);
  48 + }
  49 +
  50 + /**
34 * @remark :获取用户模版id 51 * @remark :获取用户模版id
35 * @name :getUserTemplate 52 * @name :getUserTemplate
36 * @author :lyh 53 * @author :lyh
@@ -52,6 +52,19 @@ class BTemplateLogic extends BaseLogic @@ -52,6 +52,19 @@ class BTemplateLogic extends BaseLogic
52 } 52 }
53 53
54 /** 54 /**
  55 + * @remark :获取模版详情
  56 + * @name :getPublicTemplateInfo
  57 + * @author :lyh
  58 + * @method :post
  59 + * @time :2024/7/31 14:31
  60 + */
  61 + public function getPublicTemplateInfo(){
  62 + $templateModel = new Template();
  63 + $info = $templateModel->read($this->param);
  64 + return $this->success($info);
  65 + }
  66 +
  67 + /**
55 * @remark :获取可视化html 68 * @remark :获取可视化html
56 * @name :getTemplateHtml 69 * @name :getTemplateHtml
57 * @author :lyh 70 * @author :lyh
@@ -126,7 +126,9 @@ class CustomTemplateLogic extends BaseLogic @@ -126,7 +126,9 @@ class CustomTemplateLogic extends BaseLogic
126 if($bSettingInfo === false){ 126 if($bSettingInfo === false){
127 $this->fail('请先选择模版'); 127 $this->fail('请先选择模版');
128 } 128 }
129 - $this->saveCommonTemplate($html,$bSettingInfo['template_id']); 129 + if(!isset($this->param['template_status'])){//代表直接替换模版 不更新头部底部
  130 + $this->saveCommonTemplate($html,$bSettingInfo['template_id']);
  131 + }
130 $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); 132 $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s');
131 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 133 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
132 } 134 }
@@ -193,8 +193,11 @@ class BlogLogic extends BaseLogic @@ -193,8 +193,11 @@ class BlogLogic extends BaseLogic
193 * @time :2023/10/20 9:02 193 * @time :2023/10/20 9:02
194 */ 194 */
195 public function getCategory($category){ 195 public function getCategory($category){
  196 + if(empty($category)){
  197 + return '';
  198 + }
196 $str = implode(',',$category); 199 $str = implode(',',$category);
197 - return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; 200 + return !empty(trim(trim($str,','),',')) ? ','.trim(trim($str,','),',').',' : '';
198 } 201 }
199 202
200 /** 203 /**
@@ -213,7 +213,7 @@ class NewsLogic extends BaseLogic @@ -213,7 +213,7 @@ class NewsLogic extends BaseLogic
213 */ 213 */
214 public function getCategory($category){ 214 public function getCategory($category){
215 $str = implode(',',$category); 215 $str = implode(',',$category);
216 - return !empty(trim(trim($str,','),',')) ? ','.$str.',' : ''; 216 + return !empty(trim(trim($str,','),',')) ? ','.trim(trim($str,','),',').',' : '';
217 } 217 }
218 218
219 /** 219 /**
@@ -356,6 +356,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -356,6 +356,7 @@ Route::middleware(['bloginauth'])->group(function () {
356 Route::prefix('template')->group(function () { 356 Route::prefix('template')->group(function () {
357 //获取所有公共主题模版 357 //获取所有公共主题模版
358 Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists'); 358 Route::any('/publicTemplateLists', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicTemplateLists'])->name('template_publicTemplateLists');
  359 + Route::any('/publicInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'publicInfo'])->name('template_publicInfo');
359 //获取选中的主题模版 360 //获取选中的主题模版
360 Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate'); 361 Route::any('/getPublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getPublicTemplate'])->name('template_getPublicTemplate');
361 Route::any('/getTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTemplate'])->name('template_getTemplate'); 362 Route::any('/getTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getTemplate'])->name('template_getTemplate');