|
|
@@ -297,21 +297,18 @@ class ProductController extends BaseController
|
|
|
//批量修改product 排序,成本价,加价
|
|
|
public function actionBatchUpdate()
|
|
|
{
|
|
|
+ $shopAdmin = $this->shopAdmin;
|
|
|
+ if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
|
|
|
+ util::fail('超管才能修改');
|
|
|
+ }
|
|
|
|
|
|
+ //花材价格只能在首店修改,并同步到分店
|
|
|
$shop = $this->shop;
|
|
|
$default = $shop->default ?? 0;
|
|
|
if ($default != 1) {
|
|
|
util::fail('请在首店修改');
|
|
|
}
|
|
|
|
|
|
- $shopAdmin = $this->shopAdmin;
|
|
|
- $roleId = $shopAdmin['roleId'] ?? 0;
|
|
|
- $role = AdminRoleClass::getById($roleId);
|
|
|
- $roleName = $role['roleName'] ?? '';
|
|
|
- if ($roleName == '员工') {
|
|
|
- util::fail('没有权限操作哦');
|
|
|
- }
|
|
|
-
|
|
|
$data = Yii::$app->request->post('data', ''); //data = [{id:1,inTurn:10,addPrice:2,cost:10}]
|
|
|
$type = Yii::$app->request->post('type', '');
|
|
|
if (empty($data) || empty($type)) {
|
|
|
@@ -396,6 +393,11 @@ class ProductController extends BaseController
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
|
|
|
+ $shopAdmin = $this->shopAdmin;
|
|
|
+ if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
|
|
|
+ util::fail('超管才能修改');
|
|
|
+ }
|
|
|
+
|
|
|
$shop = $this->shop;
|
|
|
$default = $shop->default ?? 0;
|
|
|
if ($default != 1) {
|
|
|
@@ -405,13 +407,6 @@ class ProductController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- $shopAdmin = $this->shopAdmin;
|
|
|
- $roleId = $shopAdmin['roleId'] ?? 0;
|
|
|
- $role = AdminRoleClass::getById($roleId);
|
|
|
- $roleName = $role['roleName'] ?? '';
|
|
|
- if ($roleName == '员工') {
|
|
|
- util::fail('没有权限操作哦');
|
|
|
- }
|
|
|
$post['adminId'] = $this->adminId;
|
|
|
ProductClass::updateProduct($post);
|
|
|
util::complete();
|
|
|
@@ -453,20 +448,17 @@ class ProductController extends BaseController
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
|
|
|
+ $shopAdmin = $this->shopAdmin;
|
|
|
+ if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
|
|
|
+ util::fail('超管才能添加花材');
|
|
|
+ }
|
|
|
+
|
|
|
$shop = $this->shop;
|
|
|
$default = $shop->default ?? 0;
|
|
|
if ($default != 1) {
|
|
|
util::fail('请在首店添加');
|
|
|
}
|
|
|
|
|
|
- $shopAdmin = $this->shopAdmin;
|
|
|
- $roleId = $shopAdmin['roleId'] ?? 0;
|
|
|
- $role = AdminRoleClass::getById($roleId);
|
|
|
- $roleName = $role['roleName'] ?? '';
|
|
|
- if ($roleName == '员工') {
|
|
|
- util::fail('没有权限操作哦');
|
|
|
- }
|
|
|
-
|
|
|
$post['sjId'] = $this->sjId;
|
|
|
$post['adminId'] = $this->adminId;
|
|
|
$post['shopId'] = $this->shopId;
|
|
|
@@ -485,6 +477,17 @@ class ProductController extends BaseController
|
|
|
//复制花材
|
|
|
public function actionCopy()
|
|
|
{
|
|
|
+ $shopAdmin = $this->shopAdmin;
|
|
|
+ if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
|
|
|
+ util::fail('超管才能添加花材');
|
|
|
+ }
|
|
|
+
|
|
|
+ $shop = $this->shop;
|
|
|
+ $default = $shop->default ?? 0;
|
|
|
+ if ($default != 1) {
|
|
|
+ util::fail('请在首店添加');
|
|
|
+ }
|
|
|
+
|
|
|
$id = Yii::$app->request->get('id');
|
|
|
$productData = ProductClass::getById($id);
|
|
|
if (!$productData) {
|