From 2bafdff0527587aab6d1d689927a61aa7b423968 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 26 Dec 2024 10:44:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(DemoLogic):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E4=BB=B7=E6=A0=BC=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=85=92=E5=BA=97=E4=BB=B7=E6=A0=BC=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在更新 StoreProduct 价格后,添加成功更新的逻辑,将 ceshi_two 表中的状态设置为 1 - 新增酒店价格设置,与食堂价格设置类似 - 优化代码结构,提高可读性和维护性 --- app/api/logic/DemoLogic.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/api/logic/DemoLogic.php b/app/api/logic/DemoLogic.php index 6e8fb6791..9d7fbd531 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)]); From a1b759b0aa95e0e8d32d730b528b560ef84a88e5 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 26 Dec 2024 11:27:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?refactor(warehouse):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E4=BA=A7=E5=93=81=E9=80=BB=E8=BE=91=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E8=AE=A2=E5=8D=95=E7=B1=BB=E5=9E=8B=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将原有的 != 7 判断条件改为 in_array([1,4]),以提高代码可读性和维护性 - 此修改仅在 order_type 不等于 6 的情况下生效,不影响其他逻辑 --- app/admin/logic/warehouse_product/WarehouseProductLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/logic/warehouse_product/WarehouseProductLogic.php b/app/admin/logic/warehouse_product/WarehouseProductLogic.php index 905ad4413..a7b3b2578 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'], From a695d479340e44187ff89bdfd1a3e1c9ae7d7765 Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Thu, 26 Dec 2024 11:42:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/beforehand_order/BeforehandOrderLists.php | 2 ++ .../purchase_product_offer/PurchaseProductOfferLists.php | 1 - .../purchase_product_offer/PurchaseProductOfferLogic.php | 7 ++++--- app/admin/logic/store_product/StoreProductLogic.php | 4 ++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index d4a90faa2..113d9ace7 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -112,6 +112,8 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte $item->order_type_name = '往期补单'; } elseif ($item->order_type == 7) { $item->order_type_name = '采购订单'; + } elseif ($item->order_type == 8) { + $item->order_type_name = '其他订单'; } $item->msg = ''; $count1 = PurchaseProductOffer::where('order_id', $item->id)->where('buyer_confirm', 0)->count('id'); diff --git a/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php b/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php index 5d72a652f..1d02eb601 100644 --- a/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php +++ b/app/admin/lists/purchase_product_offer/PurchaseProductOfferLists.php @@ -72,7 +72,6 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc $item->order_sn=BeforehandOrder::where('id',$item['order_id'])->value('order_id'); $find=StoreProduct::where('id',$item->product_id)->withTrashed()->find(); $item->store_name=$find->store_name; - $item->store_info=$find->store_info; $item->image=$find->image; $item->unit_name=StoreProductUnit::where('id',$item->unit)->value('name'); $item->cate_name=StoreCategory::where('id',$find->cate_id)->value('name'); diff --git a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php index 7ba297bd4..a54b7d3da 100644 --- a/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php +++ b/app/admin/logic/purchase_product_offer/PurchaseProductOfferLogic.php @@ -62,9 +62,6 @@ class PurchaseProductOfferLogic extends BaseLogic } $find=StoreProduct::where('id',$params['product_id'])->find(); $purchaseProductOffer = PurchaseProductOffer::where(['order_id' => $procurementOrder['id'], 'product_id' => $params['product_id']])->find(); - $procurementOrder->total_price = bcadd($procurementOrder->total_price, bcmul($find['price'], $params['need_num'], 2), 2); - $procurementOrder->pay_price = $procurementOrder->total_price; - $procurementOrder->save(); if ($purchaseProductOffer) { $purchaseProductOffer->need_num = $purchaseProductOffer['need_num'] + $params['need_num']; if (!empty($purchaseProductOffer['source_order_info'])) { @@ -184,6 +181,10 @@ class PurchaseProductOfferLogic extends BaseLogic // $find = StoreProductPrice::where(['offer_id' => $params['id']])->find(); $product = StoreProduct::where('id', $offer['product_id'])->withTrashed()->field('id,store_name,top_cate_id,two_cate_id')->find(); $unit_name=StoreProductUnit::where('id', $offer['unit'])->value('name'); + $order = BeforehandOrder::where('id', $params['bhoid'])->find(); + $order->pay_price = bcadd($offer['total_price'], $order->pay_price, 2); + $order->total_price = $order->pay_price; + $order->save(); self::setProductGroupPrice($params, $product); // $data = []; // $dict_data = DictData::where('type_value', 'price_lv_' . $product['top_cate_id'])->field('name,value')->select(); diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index c16f39bc4..924a5e01f 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -73,6 +73,8 @@ class StoreProductLogic extends BaseLogic 'store_batch' => $params['store_batch'] ?? 1, 'product_type' => $params['product_type'] ?? 0, 'is_show' => $params['is_show'] ?? 0, + 'made_place' => $params['made_place'] ?? '', + 'shelf_life' => $params['shelf_life'] ?? 0, ]; $rose = 0; //零售-供货 @@ -222,6 +224,8 @@ class StoreProductLogic extends BaseLogic 'manufacturer_information' => $params['manufacturer_information'] ?? '', 'swap' => $params['swap'] ?? 0, 'is_show' => $params['is_show'] ?? 0, + 'made_place' => $params['made_place'] ?? '', + 'shelf_life' => $params['shelf_life'] ?? 0, ]; $rose = 0; //零售-供货