diff --git a/app/admin/logic/warehouse_product/WarehouseProductLogic.php b/app/admin/logic/warehouse_product/WarehouseProductLogic.php index 905ad441..a7b3b257 100644 --- a/app/admin/logic/warehouse_product/WarehouseProductLogic.php +++ b/app/admin/logic/warehouse_product/WarehouseProductLogic.php @@ -125,7 +125,7 @@ class WarehouseProductLogic extends BaseLogic if ($params['order_type'] != 6) { $storege = WarehouseProductStorege::where('warehouse_id', $params['warehouse_id'])->where('product_id', $params['product_id'])->find(); if ($storege) { - if($params['order_type']!=7){ + if(in_array($params['order_type'],[1,4])){ SystemStoreStorage::create([ 'store_id' => $params['store_id'], 'admin_id' => $params['admin_id'], diff --git a/app/api/logic/DemoLogic.php b/app/api/logic/DemoLogic.php index 6e8fb679..9d7fbd53 100644 --- a/app/api/logic/DemoLogic.php +++ b/app/api/logic/DemoLogic.php @@ -13,7 +13,10 @@ class DemoLogic extends BaseLogic $arr = Db::name('ceshi_two')->select(); foreach ($arr as $k => $v) { //门店供货、商户、零售 - StoreProduct::where('id', $v['product_id'])->update(['purchase' => $v['price'], 'cost' => bcadd($v['price1'], 0, 2), 'vip_price' => bcadd($v['price1'], 0, 2), 'price' => bcadd($v['price6'], 0, 2)]); + $res=StoreProduct::where('id', $v['product_id'])->update(['purchase' => $v['price'], 'cost' => bcadd($v['price1'], 0, 2), 'vip_price' => bcadd($v['price1'], 0, 2), 'price' => bcadd($v['price6'], 0, 2)]); + if($res){ + Db::name('ceshi_two')->where('product_id', $v['product_id'])->update(['status' => 1]); + } //种养殖 $find = Db::name('store_product_group_price')->where('product_id', $v['product_id'])->where('group_id', 5)->find(); if ($find) { @@ -21,13 +24,20 @@ class DemoLogic extends BaseLogic } else { Db::name('store_product_group_price')->insert(['product_id' => $v['product_id'], 'group_id' => 5, 'price' => bcadd($v['price8'], 0, 2), 'price_type' => 3, 'base_rate' => bcadd(bcmul($v['lv8'], 100), 100, 2)]); } - //酒店 + //食堂 $find2 = Db::name('store_product_group_price')->where('product_id', $v['product_id'])->where('group_id', 7)->find(); if ($find2) { Db::name('store_product_group_price')->where('product_id', $v['product_id'])->where('group_id', 7)->update(['price' => bcadd($v['price3'], 0, 2)]); } else { Db::name('store_product_group_price')->insert(['product_id' => $v['product_id'], 'group_id' => 7, 'price' => bcadd($v['price3'], 0, 2), 'price_type' => 3, 'base_rate' => bcadd(bcmul($v['lv3'], 100), 100, 2)]); } + //酒店 + $find2 = Db::name('store_product_group_price')->where('product_id', $v['product_id'])->where('group_id', 6)->find(); + if ($find2) { + Db::name('store_product_group_price')->where('product_id', $v['product_id'])->where('group_id', 6)->update(['price' => bcadd($v['price3'], 0, 2)]); + } else { + Db::name('store_product_group_price')->insert(['product_id' => $v['product_id'], 'group_id' => 6, 'price' => bcadd($v['price3'], 0, 2), 'price_type' => 3, 'base_rate' => bcadd(bcmul($v['lv3'], 100), 100, 2)]); + } //一条龙 $find3 = Db::name('store_product_group_price')->where('product_id', $v['product_id'])->where('group_id', 18)->find(); if ($find3) { @@ -50,7 +60,6 @@ class DemoLogic extends BaseLogic Db::name('store_product_group_price')->insert(['product_id' => $v['product_id'], 'group_id' => 19, 'price' => bcadd($v['price2'], 0, 2), 'price_type' => 3, 'base_rate' => bcadd(bcmul($v['lv2'], 100), 100, 2)]); } //食堂会员 - $find4 = Db::name('store_product_group_price')->where('product_id', $v['product_id'])->where('group_id', 20)->find(); if ($find4) { Db::name('store_product_group_price')->where('product_id', $v['product_id'])->where('group_id', 20)->update(['price' => bcadd($v['price4'], 0, 2)]);