diff --git a/app/store/controller/Goods.php b/app/store/controller/Goods.php index d014431d..96e4467e 100644 --- a/app/store/controller/Goods.php +++ b/app/store/controller/Goods.php @@ -180,6 +180,9 @@ class Goods extends Controller if ($model->isEmpty()) { return $this->renderError("该商品已不存在!"); } + if ($model->store_id != $this->storeId) { + return $this->renderError("您不能修复改商品!"); + } if (!in_array($model->channel, ['zy'])) { $params['goods_price'] = $model->goods_price_min; $params['cost_price'] = $model->cost_price_min; @@ -206,6 +209,10 @@ class Goods extends Controller */ public function pool(array $goodsIds, bool $state): Json { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能操作该商品"); + } $model = new GoodsModel; //过滤其他渠道的商品,只能把自营商品加入商品池 $list = GoodsModel::whereIn('goods_id', $goodsIds)->where('channel','zy')->select(); @@ -248,6 +255,10 @@ class Goods extends Controller */ public function state(array $goodsIds, bool $state): Json { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能操作该商品"); + } $model = new GoodsModel; if (!$model->setStatus($goodsIds, $state)) { return $this->renderError($model->getError() ?: '操作失败'); @@ -283,6 +294,10 @@ class Goods extends Controller */ public function setBrand(array $goodsIds, bool $is_brand): Json { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能操作该商品"); + } $model = new GoodsModel; if (!$model->setBrand($goodsIds, $is_brand)) { return $this->renderError($model->getError() ?: '操作失败'); @@ -297,6 +312,10 @@ class Goods extends Controller */ public function setNew(array $goodsIds, bool $is_new): Json { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能操作该商品"); + } $model = new GoodsModel; if (!$model->setNew($goodsIds, $is_new)) { return $this->renderError($model->getError() ?: '操作失败'); @@ -311,6 +330,10 @@ class Goods extends Controller */ public function setInstore(array $goodsIds, bool $is_in_store): Json { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能操作该商品"); + } $model = new GoodsModel; if (!$model->setInstore($goodsIds, $is_in_store)) { return $this->renderError($model->getError() ?: '操作失败'); @@ -325,6 +348,10 @@ class Goods extends Controller */ public function setRank(array $goodsIds, int $paihang): Json { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能操作该商品"); + } $model = new GoodsModel; if (!$model->setRank($goodsIds, $paihang)) { return $this->renderError($model->getError() ?: '操作失败'); @@ -339,6 +366,10 @@ class Goods extends Controller */ public function category(array $goodsIds, array $categoryIds): Json { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能操作该商品"); + } $model = new GoodsModel; foreach ($goodsIds as $key => $goodsId) { @@ -354,7 +385,11 @@ class Goods extends Controller * @return Json */ public function delete(array $goodsIds): Json - { + { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能删除该商品"); + } $model = new GoodsModel; if (!$model->setDelete($goodsIds)) { return $this->renderError($model->getError() ?: '删除失败'); @@ -601,6 +636,10 @@ class Goods extends Controller */ public function jingpin(array $goodsIds, int $is_jingpin): Json { + $count = GoodsModel::withoutGlobalScope()->whereIn('goods_id', $goodsIds)->where('store_id', "<>", $this->storeId)->count(); + if ($count > 0) { + return $this->renderError("您不能操作该商品"); + } $model = new GoodsModel; if (!$model->setIsJingpin($goodsIds, $is_jingpin)) { return $this->renderError($model->getError() ?: '操作失败'); diff --git a/app/store/controller/Store.php b/app/store/controller/Store.php index 7a186be7..29c60f5a 100644 --- a/app/store/controller/Store.php +++ b/app/store/controller/Store.php @@ -80,7 +80,7 @@ class Store extends Controller public function edit(int $storeId): Json { $params = $this->postForm(); - + unset($params['effective_time']); // 更新记录 if (!AdminStoreModel::withoutGlobalScope()->where('store_id', $storeId)->update($params)) { return $this->renderError('更新失败'); diff --git a/app/store/service/order/Delivery.php b/app/store/service/order/Delivery.php index 860f368e..e9da5a43 100644 --- a/app/store/service/order/Delivery.php +++ b/app/store/service/order/Delivery.php @@ -50,11 +50,12 @@ class Delivery extends BaseService */ public function delivery(int $orderId, array $param): bool { - if(empty($param['expressId'] && $param['delivery']!=20)) { + + if($param['deliveryMethod'] == self::DELIVERY_METHOD_MANUAL && empty($param['expressId'])) { $this->error = '物流公司不能为空'; return false; } - if (empty($param['expressNo'] && $param['delivery']!=20)) { + if ($param['deliveryMethod'] == self::DELIVERY_METHOD_MANUAL && empty($param['expressNo'])) { $this->error = '物流单号不能为空'; return false; } diff --git a/config/module.php b/config/module.php index b5e0944b..8e7882b7 100755 --- a/config/module.php +++ b/config/module.php @@ -28,11 +28,11 @@ return [ ], '' => [ 'name' => '商户管理', - 'required' => true, + 'required' => false, 'children' => [ - 'merchant' => ['name' => '商户管理', 'enable' => true], - 'merchant-manage' => ['name' => '商户列表', 'enable' => true], - 'merchant-cate' => ['name' => '商户分类', 'enable' => true], + 'merchant' => ['name' => '商户管理', 'enable' => false], + 'merchant-manage' => ['name' => '商户列表', 'enable' => false], + 'merchant-cate' => ['name' => '商户分类', 'enable' => false], ] ], 'goods' => [ @@ -116,6 +116,7 @@ return [ 'children' => [ 'customer' => ['name' => '客服设置', 'enable' => true], 'shoplist' => ['name' => '商城列表', 'enable' => false], + 'openshop' => ['name' => '开通商城', 'enable' => false], 'storage' => ['name' => '上传设置', 'enable' => true], 'printer' => ['name' => '小票打印机', 'enable' => true], ]