Merge remote-tracking branch 'origin/master' into akun
正在显示
7 个修改的文件
包含
102 行增加
和
11 行删除
| @@ -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 |
| @@ -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 | } |
| @@ -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 | /** |
| @@ -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(); |
| @@ -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 | /** |
| @@ -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'); |
-
请 注册 或 登录 后发表评论