作者 lyh

gx

@@ -30,7 +30,7 @@ class ProductController extends BaseController @@ -30,7 +30,7 @@ class ProductController extends BaseController
30 public function getImages(Request $request) 30 public function getImages(Request $request)
31 { 31 {
32 $project_id = $request->input('project_id'); 32 $project_id = $request->input('project_id');
33 - $project = ProjectServer::useProject($project_id); 33 + $project = ProjectServer::useProject($project_id); $project = ProjectServer::useProject($project_id);
34 if (!$project) { 34 if (!$project) {
35 $this->response('项目不存在', Code::SYSTEM_ERROR); 35 $this->response('项目不存在', Code::SYSTEM_ERROR);
36 } 36 }
@@ -17,6 +17,7 @@ use App\Models\Product\ExtendInfo; @@ -17,6 +17,7 @@ use App\Models\Product\ExtendInfo;
17 use App\Models\Product\Keyword; 17 use App\Models\Product\Keyword;
18 use App\Models\Product\KeywordRelated; 18 use App\Models\Product\KeywordRelated;
19 use App\Models\Product\Product; 19 use App\Models\Product\Product;
  20 +use App\Models\Product\ProductType;
20 use App\Models\RouteMap\RouteMap; 21 use App\Models\RouteMap\RouteMap;
21 use App\Models\Template\Setting; 22 use App\Models\Template\Setting;
22 use App\Models\Template\BTemplate; 23 use App\Models\Template\BTemplate;
@@ -665,4 +666,41 @@ class ProductController extends BaseController @@ -665,4 +666,41 @@ class ProductController extends BaseController
665 $logic->delProductKeyword(); 666 $logic->delProductKeyword();
666 $this->response('success'); 667 $this->response('success');
667 } 668 }
  669 +
  670 + /**
  671 + * @remark :获取产品类型
  672 + * @name :getProductType
  673 + * @author :lyh
  674 + * @method :post
  675 + * @time :2024/8/21 17:18
  676 + */
  677 + public function getProductType(){
  678 + $typeModel = new ProductType();
  679 + $data = $typeModel->list(['project_id'=>['in',[0,$this->user['project_id']]]]);
  680 + $this->response('success',Code::SUCCESS,$data);
  681 + }
  682 +
  683 + /**
  684 + * @remark :保存数据
  685 + * @name :saveType
  686 + * @author :lyh
  687 + * @method :post
  688 + * @time :2024/8/21 17:52
  689 + */
  690 + public function saveType(){
  691 + $this->request->validate([
  692 + 'name'=>'required',
  693 + ],[
  694 + 'name.required' => 'id不为空',
  695 + ]);
  696 + $typeModel = new ProductType();
  697 + if(isset($this->param['id']) && !empty($this->param['id'])){
  698 + $id = $this->param['id'];
  699 + $typeModel->edit($this->param,['id'=>$this->param['id']]);
  700 + }else{
  701 + $this->param['project_id'] = $this->user['project_id'];
  702 + $id = $typeModel->addReturnId($this->param);
  703 + }
  704 + $this->response('success',Code::SUCCESS,['id'=>$id]);
  705 + }
668 } 706 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ProductType.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/21 16:46
  8 + */
  9 +
  10 +namespace App\Models\Product;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class ProductType extends Base
  15 +{
  16 + protected $table = 'gl_product_type';
  17 +}
@@ -257,6 +257,8 @@ Route::middleware(['bloginauth'])->group(function () { @@ -257,6 +257,8 @@ Route::middleware(['bloginauth'])->group(function () {
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 Route::any('/getSearchCategoryList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getSearchCategoryList'])->name('product_getSearchCategoryList');
259 Route::any('/delProductKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductKeyword'])->name('product_delProductKeyword'); 259 Route::any('/delProductKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductKeyword'])->name('product_delProductKeyword');
  260 + Route::any('/getProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductType'])->name('product_getProductType');
  261 + Route::any('/saveType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'saveType'])->name('product_saveType');
260 //产品分类 262 //产品分类
261 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category'); 263 Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category');
262 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info'); 264 Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info');