Merge pull request 'dev' (#23) from dev into preview

Reviewed-on: https://gitea.lihaink.cn/mkm/shop-php/pulls/23
This commit is contained in:
mkm 2023-10-08 11:55:52 +08:00
commit 1a31a072e7
2 changed files with 6 additions and 4 deletions

View File

@ -751,8 +751,10 @@ class ProductRepository extends BaseRepository
$data['attrValue'] = $arr; $data['attrValue'] = $arr;
$content = $data['content']['content'] ?? ''; $content = $data['content']['content'] ?? '';
$data['content_arr'] = [];
if (isset($data['content']) &&$data['content']['type']==1){ if (isset($data['content']) &&$data['content']['type']==1){
$arr = json_decode($content); $arr = json_decode($content);
$data['content_arr'] = $arr;
if($arr){ if($arr){
$content=''; $content='';
foreach($arr->image as $k=>$v){ foreach($arr->image as $k=>$v){

View File

@ -98,7 +98,7 @@ class Product extends BaseController
$product_type=0;//普通商品 $product_type=0;//普通商品
} }
$data['update_time'] = date('Y-m-d H:i:s'); $data['update_time'] = date('Y-m-d H:i:s');
$this->repository->create($data,$product_type); $this->repository->create($data,$product_type,1);
return app('json')->success('添加成功'); return app('json')->success('添加成功');
} }
@ -126,7 +126,7 @@ class Product extends BaseController
$data['update_time'] = date('Y-m-d H:i:s'); $data['update_time'] = date('Y-m-d H:i:s');
$typeSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeSupplyChain'])->value('mer_type_id'); $typeSupplyChainId = Db::name('MerchantType')->where('type_code', Merchant::TypeCode['TypeSupplyChain'])->value('mer_type_id');
$productType = $this->request->merchant()->type_id == $typeSupplyChainId ? 98 : 0; $productType = $this->request->merchant()->type_id == $typeSupplyChainId ? 98 : 0;
$this->repository->edit($id, $data, $this->request->merId(), $productType); $this->repository->edit($id, $data, $this->request->merId(), $productType,1);
return app('json')->success('编辑成功'); return app('json')->success('编辑成功');
} }
@ -280,8 +280,8 @@ class Product extends BaseController
'spec_type' 'spec_type'
]; ];
$data = $this->request->params($params); $data = $this->request->params($params);
$count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['mer_cate_id'],'is_show' => 1,'mer_id' => $this->request->merId()]); // $count = app()->make(StoreCategoryRepository::class)->getWhereCount(['store_category_id' => $data['mer_cate_id'],'is_show' => 1,'mer_id' => $this->request->merId()]);
if (!$count) throw new ValidateException('商户分类不存在或不可用'); // if (!$count) throw new ValidateException('商户分类不存在或不可用');
$data['status'] = 1; $data['status'] = 1;
$this->repository->freeTrial($id, $data,$this->request->merId()); $this->repository->freeTrial($id, $data,$this->request->merId());
return app('json')->success('编辑成功'); return app('json')->success('编辑成功');