正在显示
2 个修改的文件
包含
6 行增加
和
2 行删除
| @@ -38,7 +38,8 @@ class ExtendLogic extends BaseLogic | @@ -38,7 +38,8 @@ class ExtendLogic extends BaseLogic | ||
| 38 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 38 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 39 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 39 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 40 | }else{ | 40 | }else{ |
| 41 | - $this->getKey(Translate::tran($this->param['title'], 'en')); | 41 | + $key = trim(strtolower(preg_replace('/[\W]+/', '-', trim(Translate::tran($this->param['title'], 'en')))), '-'); |
| 42 | + $this->param['key'] = $this->getKey($key); | ||
| 42 | $rs = $this->model->add($this->param); | 43 | $rs = $this->model->add($this->param); |
| 43 | } | 44 | } |
| 44 | if($rs === false){ | 45 | if($rs === false){ |
| @@ -56,7 +57,7 @@ class ExtendLogic extends BaseLogic | @@ -56,7 +57,7 @@ class ExtendLogic extends BaseLogic | ||
| 56 | */ | 57 | */ |
| 57 | public function getKey($key){ | 58 | public function getKey($key){ |
| 58 | $info = $this->model->read(['key'=>$key]); | 59 | $info = $this->model->read(['key'=>$key]); |
| 59 | - if($info === false){ | 60 | + if($info !== false){ |
| 60 | $key .= '_1'; | 61 | $key .= '_1'; |
| 61 | return $this->getKey($key); | 62 | return $this->getKey($key); |
| 62 | } | 63 | } |
| @@ -231,6 +231,9 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -231,6 +231,9 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 231 | Route::get('describe/info', [\App\Http\Controllers\Bside\Product\DescribeController::class, 'info'])->name('product_describe_info'); | 231 | Route::get('describe/info', [\App\Http\Controllers\Bside\Product\DescribeController::class, 'info'])->name('product_describe_info'); |
| 232 | Route::post('describe/save', [\App\Http\Controllers\Bside\Product\DescribeController::class, 'save'])->name('product_describe_save'); | 232 | Route::post('describe/save', [\App\Http\Controllers\Bside\Product\DescribeController::class, 'save'])->name('product_describe_save'); |
| 233 | Route::any('describe/delete', [\App\Http\Controllers\Bside\Product\DescribeController::class, 'delete'])->name('product_describe_delete'); | 233 | Route::any('describe/delete', [\App\Http\Controllers\Bside\Product\DescribeController::class, 'delete'])->name('product_describe_delete'); |
| 234 | + //扩展字段 | ||
| 235 | + Route::get('extend', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'lists'])->name('product_extend'); | ||
| 236 | + Route::get('save', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'save'])->name('product_extend_save'); | ||
| 234 | }); | 237 | }); |
| 235 | 238 | ||
| 236 | 239 |
-
请 注册 或 登录 后发表评论