|
...
|
...
|
@@ -99,6 +99,7 @@ class CategoryLogic extends BaseLogic |
|
|
|
$info = $this->model->read(['id'=>$id]);
|
|
|
|
$info['url'] = $info['route'];
|
|
|
|
$info['image_link'] = getImageUrl($info['image']);
|
|
|
|
$info['describe_image'] = getImageUrl($info['describe_image']);
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -112,12 +113,12 @@ class CategoryLogic extends BaseLogic |
|
|
|
public function categorySave(){
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
$this->param = $this->saveHandleParam($this->param);
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']);
|
|
|
|
$route = $this->param['route'];
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
|
|
|
|
$this->edit(['route'=>$route],['id'=>$id]);
|
|
...
|
...
|
@@ -135,6 +136,25 @@ class CategoryLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存时处理数据
|
|
|
|
* @name :saveHandleParam
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/22 17:28
|
|
|
|
*/
|
|
|
|
public function saveHandleParam($param){
|
|
|
|
if(isset($this->param['describe_image']) && !empty($this->param['describe_image'])){
|
|
|
|
foreach ($this->param['describe_image'] as $k => $v){
|
|
|
|
$v = str_replace_url($v);
|
|
|
|
$this->param['describe_image'][$k] = $v;
|
|
|
|
}
|
|
|
|
$this->param['describe_image'] = json_encode($this->param['describe_image']);
|
|
|
|
}
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
return $this->success($param);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :删除
|
|
|
|
* @name :delete
|
|
|
|
* @author :lyh
|
...
|
...
|
|