正在显示
3 个修改的文件
包含
27 行增加
和
20 行删除
| @@ -36,20 +36,11 @@ class EnterpriseProductLogic extends BaseLogic | @@ -36,20 +36,11 @@ class EnterpriseProductLogic extends BaseLogic | ||
| 36 | * @time :2025/3/26 10:17 | 36 | * @time :2025/3/26 10:17 |
| 37 | */ | 37 | */ |
| 38 | public function saveEnterpriseProduct(){ | 38 | public function saveEnterpriseProduct(){ |
| 39 | - $saveData = []; | ||
| 40 | - foreach ($this->param['data'] as $k => $v){ | ||
| 41 | - if($k < 1){ | ||
| 42 | - continue; | ||
| 43 | - } | ||
| 44 | - $saveData[] = [ | ||
| 45 | - 'title'=>$v[0], | ||
| 46 | - 'image'=>$v[1], | ||
| 47 | - 'url'=>$v[2], | ||
| 48 | - 'project_id'=>$this->param['project_id'], | ||
| 49 | - 'keywords'=>$v[3], | ||
| 50 | - 'release_at'=>$v[4], | ||
| 51 | - ]; | 39 | + try { |
| 40 | + $this->model->saveEnterpriseProduct($this->param['project_id'],$this->param['data']); | ||
| 41 | + }catch (\Exception $e){ | ||
| 42 | + $this->fail('保存失败,请联系管理员'); | ||
| 52 | } | 43 | } |
| 53 | - return $this->model->insertAll($saveData); | 44 | + return $this->success(); |
| 54 | } | 45 | } |
| 55 | } | 46 | } |
| @@ -24,14 +24,26 @@ class EnterpriseProduct extends Base | @@ -24,14 +24,26 @@ class EnterpriseProduct extends Base | ||
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| 26 | * @remark :保存数据 | 26 | * @remark :保存数据 |
| 27 | - * @name :saveProduct | 27 | + * @name :saveEnterpriseProduct |
| 28 | * @author :lyh | 28 | * @author :lyh |
| 29 | * @method :post | 29 | * @method :post |
| 30 | - * @time :2025/3/26 10:20 | 30 | + * @time :2025/3/26 10:42 |
| 31 | */ | 31 | */ |
| 32 | - public function saveProduct($project_id,$data){ | ||
| 33 | - foreach ($data as $k => $v){ | ||
| 34 | - | 32 | + public function saveEnterpriseProduct($project_id,$data){ |
| 33 | + $saveData = []; | ||
| 34 | + foreach ($data as $val){ | ||
| 35 | + $info = $this->read(['title'=>$val[0],'project_id'=>$project_id],['id']); | ||
| 36 | + if($info === false){ | ||
| 37 | + $saveData[] = [ | ||
| 38 | + 'title'=>$val[0], | ||
| 39 | + 'image'=>$val[1], | ||
| 40 | + 'url'=>$val[2], | ||
| 41 | + 'project_id'=>$project_id, | ||
| 42 | + 'keywords'=>$val[3], | ||
| 43 | + 'release_at'=>$val[4], | ||
| 44 | + ]; | ||
| 45 | + } | ||
| 35 | } | 46 | } |
| 47 | + return $this->insertAll($saveData); | ||
| 36 | } | 48 | } |
| 37 | } | 49 | } |
| @@ -208,7 +208,11 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -208,7 +208,11 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 208 | Route::any('/save', [Aside\Project\KeywordPrefixController::class, 'save'])->name('admin.keyword_save'); | 208 | Route::any('/save', [Aside\Project\KeywordPrefixController::class, 'save'])->name('admin.keyword_save'); |
| 209 | Route::any('/del', [Aside\Project\KeywordPrefixController::class, 'del'])->name('admin.keyword_del'); | 209 | Route::any('/del', [Aside\Project\KeywordPrefixController::class, 'del'])->name('admin.keyword_del'); |
| 210 | }); | 210 | }); |
| 211 | - | 211 | + //企业资料库 |
| 212 | + Route::prefix('enterprise_product')->group(function () { | ||
| 213 | + Route::any('/saveEnterpriseProduct', [Aside\Project\EnterpriseProductController::class, 'saveEnterpriseProduct'])->name('admin.enterprise_product_saveEnterpriseProduct'); | ||
| 214 | + }); | ||
| 215 | + //小语种 | ||
| 212 | Route::prefix('language')->group(function () { | 216 | Route::prefix('language')->group(function () { |
| 213 | Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList'); | 217 | Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList'); |
| 214 | Route::any('/getLanguages', [Aside\Project\MinorLanguagesController::class, 'getLanguages'])->name('admin.getLanguages'); | 218 | Route::any('/getLanguages', [Aside\Project\MinorLanguagesController::class, 'getLanguages'])->name('admin.getLanguages'); |
-
请 注册 或 登录 后发表评论