From 31d4826466229f826ae486af5e0da3563438e99d Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 23 Jul 2024 11:00:59 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0'rose'=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=88=B0=E4=BA=A7=E5=93=81=E5=BA=93=E5=AD=98=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/store_product/StoreProductLogic.php | 2 ++ app/queue/redis/StoreStorageSend.php | 1 + 2 files changed, 3 insertions(+) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index a6bfde63..d5ca3b83 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -182,6 +182,7 @@ class StoreProductLogic extends BaseLogic 'batch' => $params['batch'], 'manufacturer_information' => $params['manufacturer_information']??'', 'swap' => $params['swap'] ?? 0, + 'rose' => $params['rose'] ?? 0, ]; StoreProduct::where('id', $params['id'])->update($data); @@ -213,6 +214,7 @@ class StoreProductLogic extends BaseLogic 'top_cate_id'=>$dealCate['top_cate_id'],'two_cate_id'=>$dealCate['two_cate_id'], 'bar_code'=> $params['bar_code'], 'purchase'=> $params['purchase'], + 'rose'=> $params['rose']??0, ]); Db::commit(); diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index 04f5ad9b..cadd9e7c 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -69,6 +69,7 @@ class StoreStorageSend implements Consumer 'sales' => 0, 'product_type' => $find['product_type'], 'stock' => 0, + 'rose' => $find['rose'], ]; $branch = StoreBranchProduct::create($product); $arr = [ From ed8fdb342228ef9a433dae6ab3b40105e3c06b7f Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 23 Jul 2024 15:08:51 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=8F=8A=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LoginLogic.php | 1 + app/api/logic/order/OrderLogic.php | 35 +++++++++++++++-------------- app/common/cache/UserTokenCache.php | 1 + 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php index c4d715a3..f5982542 100644 --- a/app/api/logic/LoginLogic.php +++ b/app/api/logic/LoginLogic.php @@ -112,6 +112,7 @@ class LoginLogic extends BaseLogic 'store_id' => SystemStoreStaff::where('phone',$userInfo['mobile'])->value('store_id')??null, // 'sn' => $userInfo['sn'], 'token' => $userInfo['token'], + 'real_name' => $userInfo['real_name'], ]; } catch (\Exception $e) { self::setError($e->getMessage()); diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 91258b10..1c794315 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -52,7 +52,6 @@ class OrderLogic extends BaseLogic public static $total_price; public static $pay_price; public static $cost; - public static $profit; public static $store_price; //门店零售价 public static $activity_price; public static $deduction_price; @@ -71,11 +70,10 @@ class OrderLogic extends BaseLogic self::setError('购物车为空'); return false; } - // try { + try { self::$total_price = 0; self::$pay_price = 0; self::$cost = 0; //成本由采购价替代原成本为门店零售价 - self::$profit = 0; //利润 self::$activity_price = 0; //活动减少 self::$store_price = 0; //商户价 self::$deduction_price = 0; @@ -113,8 +111,8 @@ class OrderLogic extends BaseLogic } else { $price = $find['price']; } - if($off_activity==0 && $find['top_cate_id']==15189 && $user&&$user['user_ship']==5){ - $price=$find['cost']; + if ($off_activity == 0 && $find['top_cate_id'] == 15189 && $user && $user['user_ship'] == 5) { + $price = $find['cost']; } $cart_select[$k]['price'] = $price; $cart_select[$k]['cost'] = $find['cost']; @@ -192,7 +190,7 @@ class OrderLogic extends BaseLogic 'order_id' => $params['order_id'] ?? getNewOrderId('PF'), 'total_price' => self::$total_price, //总价 'cost' => self::$cost, //成本价1- - 'pay_price' => $pay_price, //后期可能有降价抵扣 + 'pay_price' => $pay_price, //支付价 'vip_price' => 0, 'total_num' => count($cart_select), //总数 'pay_type' => $params['pay_type'] ?? 0, @@ -202,11 +200,12 @@ class OrderLogic extends BaseLogic 'shipping_type' => $params['shipping_type'] ?? 2, //配送方式 1=快递 ,2=门店自提 'activity' => '减免', 'activity_price' => self::$activity_price, - 'activities' => self::$activity_price > 0 ? 1 : 0, - 'deduction_price' => self::$deduction_price, - 'frozen_money' => self::$frozen_money, //返还金额(活动关闭得时候有) + 'activities' => $off_activity, + 'deduction_price' => self::$deduction_price, //抵扣金额 + 'frozen_money' => 0, //self::$frozen_money, //返还金额(活动关闭得时候有) 'source' => 0, 'is_storage' => $params['is_storage'] ?? 0, + 'address_id' => 0, ]; $order['default_delivery'] = 0; if ($params['store_id']) { @@ -230,6 +229,7 @@ class OrderLogic extends BaseLogic $store_id = getenv('STORE_ID') ?? 1; $store['near_store'] = SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? []; } + // $order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id'); } if (empty($store_check)) { if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) { @@ -249,10 +249,10 @@ class OrderLogic extends BaseLogic } } } - // } catch (\Exception $e) { - // self::setError($e->getMessage()); - // return false; - // } + } catch (\Exception $e) { + self::setError($e->getMessage()); + return false; + } return ['order' => $order, 'cart_list' => $cart_select, 'shopInfo' => $store['near_store']]; } @@ -284,7 +284,8 @@ class OrderLogic extends BaseLogic $_order['pay_type'] = $orderInfo['order']['pay_type']; $_order['verify_code'] = $verify_code; $_order['reservation_time'] = null; - $_order['reservation'] = 0;$params['reservation'] ?? 0; //是否需要预约 + $_order['reservation'] = 0; + $params['reservation'] ?? 0; //是否需要预约 // if (isset($params['reservation_time']) && $params['reservation_time']) { // $_order['reservation_time'] = $params['reservation_time']; // $_order['reservation'] = YesNoEnum::YES; @@ -300,7 +301,7 @@ class OrderLogic extends BaseLogic if ($params['shipping_type'] == 2) { $_order['status'] = 1; } - if ($_order['pay_type']==PayEnum::BALANCE_PAY && $user!=null&&$user['now_money'] < $_order['pay_price']) { + if ($_order['pay_type'] == PayEnum::BALANCE_PAY && $user != null && $user['now_money'] < $_order['pay_price']) { throw new \Exception('余额不足'); } //生成核销码 @@ -506,10 +507,10 @@ class OrderLogic extends BaseLogic if ($find['verify_img']) { $find['verify_img'] = $url . $find['verify_img']; } - if($find['is_writeoff']==0){ + if ($find['is_writeoff'] == 0) { $generator = new BarcodeGeneratorPNG(); $tmpFilename = $generator->getBarcode($find['verify_code'], $generator::TYPE_CODE_128); - $find['verify_base64'] = 'data:image/png;base64,'.base64_encode($tmpFilename); + $find['verify_base64'] = 'data:image/png;base64,' . base64_encode($tmpFilename); } //处理返回最近的店铺 if ($param['lat'] && $param['long']) { diff --git a/app/common/cache/UserTokenCache.php b/app/common/cache/UserTokenCache.php index db1ae76e..af6509a4 100644 --- a/app/common/cache/UserTokenCache.php +++ b/app/common/cache/UserTokenCache.php @@ -77,6 +77,7 @@ class UserTokenCache extends BaseCache $userInfo = [ 'user_id' => $user->id, 'nickname' => $user->nickname, + 'real_name' => $user->real_name, 'token' => $token, 'mobile' => $user->mobile, 'avatar' => $user->avatar, From 9560b4f2beeb334ba634e2b00accfdb6e93c2fdd Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 23 Jul 2024 15:24:06 +0800 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=9C=B0?= =?UTF-8?q?=E5=9D=80API=E7=9C=81=E4=BB=BD=E3=80=81=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E3=80=81=E5=8C=BA=E3=80=81=E8=A1=97=E9=81=93=E3=80=81=E6=9D=91?= =?UTF-8?q?=E3=80=81=E9=98=9F=E4=BF=A1=E6=81=AF=E5=BD=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/AddressLogic.php | 8 +++++++- app/api/validate/UserAddressValidate.php | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/api/logic/user/AddressLogic.php b/app/api/logic/user/AddressLogic.php index e7861c3e..9b54b169 100644 --- a/app/api/logic/user/AddressLogic.php +++ b/app/api/logic/user/AddressLogic.php @@ -35,7 +35,13 @@ class AddressLogic extends BaseLogic 'uid' => $params['uid'], 'real_name' => $params['real_name'], 'phone' => $params['phone'], - 'detail' => $params['detail'], + 'province'=> $params['province'], + 'city' => $params['city'], + 'area' => $params['area'], + 'street' => $params['street'], + 'village' => $params['village'], + 'brigade' => $params['brigade'], + 'detail' => '', 'is_default' => $params['is_default'], ]); Db::commit(); diff --git a/app/api/validate/UserAddressValidate.php b/app/api/validate/UserAddressValidate.php index b7911da0..0dbf68f8 100644 --- a/app/api/validate/UserAddressValidate.php +++ b/app/api/validate/UserAddressValidate.php @@ -21,7 +21,11 @@ class UserAddressValidate extends BaseValidate protected $rule = [ 'real_name' => 'require', 'phone' => 'require', - 'detail' => 'require', + 'city' => 'require', + 'area' => 'require', + 'street' => 'require', + 'village' => 'require', + 'brigade' => 'require', 'address_id' => 'require', "is_default"=>"require|in:0,1" @@ -38,7 +42,12 @@ class UserAddressValidate extends BaseValidate 'phone' => '收货人电话', 'detail' => '收货人详细地址', 'address_id' => '地址id', - "is_default"=>"默认地址" + "is_default"=>"默认地址", + 'city'=>'城市', + 'area'=>'区', + 'street'=>'街道', + 'village'=>'村', + 'brigade'=>'队' ]; @@ -51,7 +60,7 @@ class UserAddressValidate extends BaseValidate */ public function sceneAdd() { - return $this->only(['real_name','phone','detail']); + return $this->only(['real_name','phone','city','area','street','village','brigade']); } @@ -63,7 +72,7 @@ class UserAddressValidate extends BaseValidate */ public function sceneEdit() { - return $this->only(['real_name','phone','id']); + return $this->only(['real_name','phone','id','city','area','street','village','brigade']); } From d1e71245186ac9b50676663516ceeb19c73d5fd6 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 23 Jul 2024 15:45:37 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20=E4=BF=AE=E6=AD=A3=E4=BA=86?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=AE=A2=E5=8D=95=E4=B8=AD=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E7=9A=84=E8=8E=B7=E5=8F=96=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E7=9A=84=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 2 +- app/api/logic/user/AddressLogic.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 1c794315..eb44a671 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -229,7 +229,7 @@ class OrderLogic extends BaseLogic $store_id = getenv('STORE_ID') ?? 1; $store['near_store'] = SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find() ?? []; } - // $order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id'); + $order['address_id'] = UserAddress::where('uid', $user['id'])->where('is_default', 1)->value('id')??0; } if (empty($store_check)) { if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) { diff --git a/app/api/logic/user/AddressLogic.php b/app/api/logic/user/AddressLogic.php index 9b54b169..694c1a16 100644 --- a/app/api/logic/user/AddressLogic.php +++ b/app/api/logic/user/AddressLogic.php @@ -43,6 +43,8 @@ class AddressLogic extends BaseLogic 'brigade' => $params['brigade'], 'detail' => '', 'is_default' => $params['is_default'], + 'create_time' => time(), + 'update_time' => time(), ]); Db::commit(); return $id; From c94d247261c126c962c39e6c47d282f61c696251 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 25 Jul 2024 09:39:28 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=AF=B9=E4=BC=9A=E5=91=98=E6=97=B6=E9=97=B4=E7=9A=84=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/user/UserLists.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/admin/lists/user/UserLists.php b/app/admin/lists/user/UserLists.php index 19b3d633..863f8f4c 100644 --- a/app/admin/lists/user/UserLists.php +++ b/app/admin/lists/user/UserLists.php @@ -62,6 +62,9 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS if($item['vip_name']== null){ $item['vip_name'] = '普通会员'; } + if($item['vip_name']!= null){ + $item['vip_time'] = date('Y-m-d H:i:s', strtotime($item['vip_time'])); + } if($item['label_name']== null){ $item['label_name'] = '无'; } From dedf7434b3854d5091dca0674be52691cf1273c5 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 25 Jul 2024 09:43:36 +0800 Subject: [PATCH 6/9] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E5=AF=B9=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E4=B8=ADVIP=E6=97=B6=E9=97=B4=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/user/UserLists.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/lists/user/UserLists.php b/app/admin/lists/user/UserLists.php index 863f8f4c..83a7a878 100644 --- a/app/admin/lists/user/UserLists.php +++ b/app/admin/lists/user/UserLists.php @@ -44,7 +44,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS public function lists(): array { $field = "id,nickname,real_name,sex,avatar,account,mobile,channel,create_time,purchase_funds,user_ship, - label_id,integral,now_money,total_recharge_amount"; + label_id,integral,now_money,total_recharge_amount,vip_time"; $lists = User::where($this->searchWhere) ->with(['user_ship','user_label']) ->limit($this->limitOffset, $this->limitLength) From fb5fe6574ab0cdeb3ffeedbf333e4b6e6830f810 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 25 Jul 2024 09:46:43 +0800 Subject: [PATCH 7/9] =?UTF-8?q?feat(UserLists.php):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=AD=89=E7=BA=A7=E5=88=A4=E6=96=AD=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/user/UserLists.php | 2 +- app/common/logic/PayNotifyLogic.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/admin/lists/user/UserLists.php b/app/admin/lists/user/UserLists.php index 83a7a878..2393366f 100644 --- a/app/admin/lists/user/UserLists.php +++ b/app/admin/lists/user/UserLists.php @@ -62,7 +62,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS if($item['vip_name']== null){ $item['vip_name'] = '普通会员'; } - if($item['vip_name']!= null){ + if($item['vip_time']!= null){ $item['vip_time'] = date('Y-m-d H:i:s', strtotime($item['vip_time'])); } if($item['label_name']== null){ diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 04bc3d2b..c4b03a1a 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -451,7 +451,9 @@ class PayNotifyLogic extends BaseLogic //更新等级 $user->user_ship = $order['user_ship']; - + if($user['vip_time']==null){ + $user->vip_time = time(); + } $user->purchase_funds = bcadd($user->purchase_funds, $price, 2); $user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2); $user->save(); From f4d45c7e5e3a98a3d3b425b5dd6ce315ca2ea87f Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 25 Jul 2024 11:37:13 +0800 Subject: [PATCH 8/9] =?UTF-8?q?refactor(UserLists.php):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86=E4=BC=9A=E5=91=98=E6=97=B6=E9=97=B4=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/user/UserLists.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/lists/user/UserLists.php b/app/admin/lists/user/UserLists.php index 2393366f..92017690 100644 --- a/app/admin/lists/user/UserLists.php +++ b/app/admin/lists/user/UserLists.php @@ -63,7 +63,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface,ListsS $item['vip_name'] = '普通会员'; } if($item['vip_time']!= null){ - $item['vip_time'] = date('Y-m-d H:i:s', strtotime($item['vip_time'])); + $item['vip_time'] = date('Y-m-d H:i:s', $item['vip_time']); } if($item['label_name']== null){ $item['label_name'] = '无'; From f132fb7f9ba14e93cea997b9b52f7bb19bf59d3a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 25 Jul 2024 14:20:34 +0800 Subject: [PATCH 9/9] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E5=95=86=E5=93=81=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/logic/WorkbenchLogic.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index de3a9e68..9adaf4a7 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -910,6 +910,7 @@ class WorkbenchLogic extends BaseLogic ->select()->toArray(); foreach ($list as $key => &$item) { $find = StoreProduct::where('id', $item['product_id'])->field('store_name,image')->find(); + if(!$find) continue; $item['store_name'] = $find['store_name']; $item['image'] = $find['image']; if ($item['profit'] == null) $item['profit'] = 0;