作者 lyh

gx

... ... @@ -28,11 +28,9 @@ class ProductLogic extends BaseLogic
}
public function productSave(){
//封面取第一个图片
$this->param['thumb'] = $this->param['gallery'][0] ?? '';
$this->param = $this->handleSaveParam($this->param);
// DB::beginTransaction();
// try {
$this->param['created_uid'] = $this->user['id'];
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$this->param['id']]);
... ... @@ -54,6 +52,28 @@ class ProductLogic extends BaseLogic
return $this->success();
}
/**
* @remark :不使用save处理参数
* @name :handleSaveParam
* @author :lyh
* @method :post
* @time :2023/8/21 17:03
*/
public function handleSaveParam(&$param){
$param['thumb'] = Arr::a2s($param['gallery'][0] ?? '');
$param['gallery'] = Arr::a2s($param['gallery'] ?? '');
$param['attrs'] = Arr::a2s($param['attrs'] ?? '');
$param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
$param['category_id'] = ','.Arr::arrToSet($param['category_id']).',';
$param['keyword_id'] = Arr::arrToSet($param['keyword_id'] ?? '');
$param['describe'] = Arr::a2s($param['describe'] ?? '');
$param['describe_id'] = Arr::arrToSet($param['describe_id'] ?? '');
$param['seo_mate'] = Arr::a2s($param['seo_mate']);
$param['related_product_id'] = Arr::arrToSet($param['related_product_id'] ?? '');
$param['icon'] = Arr::a2s($param['icon'] ?? '');
$param['created_uid'] = $this->user['id'];
return $param;
}
public function delete($ids, $map =[]){
$ids= array_filter(Arr::splitFilterToArray($ids), 'intval');
DB::beginTransaction();
... ...