作者 lyh

gx

... ... @@ -30,7 +30,7 @@ class ProductController extends BaseController
public function getImages(Request $request)
{
$project_id = $request->input('project_id');
$project = ProjectServer::useProject($project_id);
$project = ProjectServer::useProject($project_id); $project = ProjectServer::useProject($project_id);
if (!$project) {
$this->response('项目不存在', Code::SYSTEM_ERROR);
}
... ...
... ... @@ -17,6 +17,7 @@ use App\Models\Product\ExtendInfo;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\Product\ProductType;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\Setting;
use App\Models\Template\BTemplate;
... ... @@ -665,4 +666,41 @@ class ProductController extends BaseController
$logic->delProductKeyword();
$this->response('success');
}
/**
* @remark :获取产品类型
* @name :getProductType
* @author :lyh
* @method :post
* @time :2024/8/21 17:18
*/
public function getProductType(){
$typeModel = new ProductType();
$data = $typeModel->list(['project_id'=>['in',[0,$this->user['project_id']]]]);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存数据
* @name :saveType
* @author :lyh
* @method :post
* @time :2024/8/21 17:52
*/
public function saveType(){
$this->request->validate([
'name'=>'required',
],[
'name.required' => 'id不为空',
]);
$typeModel = new ProductType();
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$typeModel->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$id = $typeModel->addReturnId($this->param);
}
$this->response('success',Code::SUCCESS,['id'=>$id]);
}
}
... ...
<?php
/**
* @remark :
* @name :ProductType.php
* @author :lyh
* @method :post
* @time :2024/8/21 16:46
*/
namespace App\Models\Product;
use App\Models\Base;
class ProductType extends Base
{
protected $table = 'gl_product_type';
}
... ...
... ... @@ -257,6 +257,8 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/sendAiProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sendAiProduct'])->name('product_sendAiProduct');
Route::any('/getSearchCategoryList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getSearchCategoryList'])->name('product_getSearchCategoryList');
Route::any('/delProductKeyword', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delProductKeyword'])->name('product_delProductKeyword');
Route::any('/getProductType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getProductType'])->name('product_getProductType');
Route::any('/saveType', [\App\Http\Controllers\Bside\Product\ProductController::class, 'saveType'])->name('product_saveType');
//产品分类
Route::get('category', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'index'])->name('product_category');
Route::get('category/info', [\App\Http\Controllers\Bside\Product\CategoryController::class, 'info'])->name('product_category_info');
... ...