|
|
@@ -192,13 +192,11 @@ class ProductController extends BaseController
|
|
|
public function actionBatchChangePrice()
|
|
|
{
|
|
|
$shop = $this->shop ?? [];
|
|
|
-
|
|
|
$default = $shop->default ?? 0;
|
|
|
$shopAdmin = $this->shopAdmin;
|
|
|
if (isset($shopAdmin->super) == false || $shopAdmin->super != 1) {
|
|
|
util::fail('超管才能修改');
|
|
|
}
|
|
|
-
|
|
|
$data = Yii::$app->request->post('data', '');
|
|
|
if (empty($data)) {
|
|
|
util::fail('没有修改');
|
|
|
@@ -207,25 +205,20 @@ class ProductController extends BaseController
|
|
|
if (empty($arr)) {
|
|
|
util::fail('没有修改!');
|
|
|
}
|
|
|
-
|
|
|
$connection = Yii::$app->db;
|
|
|
$transaction = $connection->beginTransaction();
|
|
|
try {
|
|
|
-
|
|
|
$ids = array_column($arr, 'id');
|
|
|
$ids = array_unique(array_filter($ids));
|
|
|
if (empty($ids)) {
|
|
|
util::fail('请选择花材');
|
|
|
}
|
|
|
-
|
|
|
$sjId = $shop->sjId ?? 0;
|
|
|
$chainShopList = [];
|
|
|
if ($default == 1) {
|
|
|
$chainShopList = ShopClass::getAllByCondition(['sjId' => $sjId, 'join' => 0], null, '*', null, true);
|
|
|
}
|
|
|
-
|
|
|
$productList = ProductClass::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id', true);
|
|
|
-
|
|
|
foreach ($arr as $product) {
|
|
|
if (isset($product['price']) == false) {
|
|
|
util::fail('没有价格');
|
|
|
@@ -258,16 +251,13 @@ class ProductController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
$transaction->commit();
|
|
|
util::complete('修改成功');
|
|
|
-
|
|
|
} catch (\Exception $e) {
|
|
|
$transaction->rollBack();
|
|
|
Yii::info("失败原因:" . $e->getMessage());
|
|
|
util::fail('修改失败');
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
//从零售端采购入库,查看供货商的某个门店的product
|