From a717662cb9e2e6e9f9121468cb4d0a0ce65f8eb0 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 2 Jul 2024 11:51:54 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/UserLogic.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 6a5d2b628..5376a200b 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -89,6 +89,7 @@ class UserLogic extends BaseLogic ->find(); //判断是不是员工 if($data){ + $GetNumber = $data['integral']; $data = $data->toArray(); $all =UserShip::field('id,title,limit')->select()->toArray(); $new = self::getNextArrayByID($all,$data['user_ship']); @@ -117,11 +118,11 @@ class UserLogic extends BaseLogic 'is_writeoff'=>0,'uid'=>$uid ])->whereIn('shipping_type',[1,2])->count(); $data['openid'] = UserAuth::where(['user_id'=>$uid,'terminal'=>1])->value('openid'); - $number=UserSign::where('uid',$uid)->where('status',0)->sum('number'); - $data['integral']=bcadd($data['integral'],$number,2); +// $number=UserSign::where('uid',$uid)->where('status',0)->sum('number'); +// $data['integral']=bcadd($data['integral'],$number,2); - $number = UserSign::where('uid',$uid)->where(['status'=>0,'financial_pm'=>1])->sum('number'); - $GetNumber = UserSign::where('uid',$uid)->where('status',1)->sum('number'); + $number = UserSign::where('uid',$uid)->where(['type'=>0,'status'=>1])->sum('number'); +// $GetNumber = UserSign::where('uid',$uid)->where('status',1)->sum('number'); $data['number'] =bcadd($number,0,2); $data['GetNumber'] =bcadd($GetNumber,0,2); }else{ From 8788707a4a92697219877816ab52d02db8938d92 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 2 Jul 2024 11:57:53 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/user_ship/UserShip.php | 13 +++++++++++++ app/store/lists/user/UserLists.php | 13 +++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 app/common/model/user_ship/UserShip.php diff --git a/app/common/model/user_ship/UserShip.php b/app/common/model/user_ship/UserShip.php new file mode 100644 index 000000000..1cfc60f27 --- /dev/null +++ b/app/common/model/user_ship/UserShip.php @@ -0,0 +1,13 @@ +request->get('street',''); + if($street){ + $uid=UserAddress::where('street',$street)->group('uid')->column('uid'); + if($uid){ + $this->searchWhere[]=['id','in',$uid]; + }else{ + return []; + } + } $field = "id,nickname,real_name,sex,avatar,account,mobile,now_money,user_ship,create_time,purchase_funds,integral"; $lists = User::where($this->searchWhere) ->limit($this->limitOffset, $this->limitLength) From 7421de9d1025acdabac210b3a2ec7623a7f2765a Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 2 Jul 2024 13:54:21 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=8F=E7=BA=AC?= =?UTF-8?q?=E5=BA=A6=E9=BB=98=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/store/SystemStoreLists.php | 47 ++++++++++++++---------- app/api/logic/order/OrderLogic.php | 5 ++- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/app/api/lists/store/SystemStoreLists.php b/app/api/lists/store/SystemStoreLists.php index 301b80b05..4462b893b 100644 --- a/app/api/lists/store/SystemStoreLists.php +++ b/app/api/lists/store/SystemStoreLists.php @@ -51,9 +51,9 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac $latitude = $this->request->get('latitude',''); $longitude = $this->request->get('longitude',''); $cart_id = $this->request->get('cart_id',''); - if(empty($longitude) || empty($latitude)){ - throw new Exception('缺失经纬度'); - } +// if(empty($longitude) || empty($latitude)){ +// throw new Exception('缺失经纬度'); +// } $where[]=['is_show','=',YesNoEnum::YES]; $data = SystemStore::where($this->searchWhere)->where($where) ->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show', @@ -65,26 +65,33 @@ class SystemStoreLists extends BaseAdminDataLists implements ListsSearchInterfac ->select() ->toArray(); if($cart_id){ - $cart_id = explode(',',$cart_id); - $cart_select = Cart::whereIn('id', $cart_id) - ->field('id,product_id,cart_num,store_id')->select()->toArray(); - foreach ($cart_select as $v) { - foreach ($data as &$values){ - $store = StoreBranchProduct::where([ - 'store_id'=>$values['id'], - 'product_id'=>$v['product_id'], - ])->field('id,store_name,stock')->withTrashed()->find(); - if(empty($store)){ - $store['stock'] =0; + if($latitude && $longitude){ + $cart_id = explode(',',$cart_id); + $cart_select = Cart::whereIn('id', $cart_id) + ->field('id,product_id,cart_num,store_id')->select()->toArray(); + foreach ($cart_select as $v) { + foreach ($data as &$values){ + $store = StoreBranchProduct::where([ + 'store_id'=>$values['id'], + 'product_id'=>$v['product_id'], + ])->field('id,store_name,stock')->withTrashed()->find(); + if(empty($store)){ + $store['stock'] =0; + } + $values['reservation'] = 0; + if($store['stock'] < $v['cart_num']){ + $values['reservation'] = 1; + } + $values['distance'] = haversineDistance($values['latitude'],$values['longitude'],$latitude,$longitude); } - $values['reservation'] = 0; - if($store['stock'] < $v['cart_num']){ - $values['reservation'] = 1; - } - $values['distance'] = haversineDistance($values['latitude'],$values['longitude'],$latitude,$longitude); - } + } + }else{ + foreach ($data as &$values){ + $values['distance'] = 0; + } } + }else{ foreach ($data as &$value){ $value['distance'] = haversineDistance($value['latitude'],$value['longitude'],$latitude,$longitude); diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index df902eb98..3ea2e26aa 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -176,7 +176,6 @@ class OrderLogic extends BaseLogic $order['source'] = $params['source']; } //处理返回最近的店铺 - $store['near_store'] = []; if ((isset($params['lat']) && $params['lat'] != '') && (isset($params['long']) && $params['long'] != '')) { $storeAll = SystemStore::field('id,name,phone,address,detailed_address,latitude,longitude')->select()->toArray(); $nearestStore = null; @@ -188,9 +187,13 @@ class OrderLogic extends BaseLogic $nearestStore = $value; } } + $store['near_store'] =[]; if ($nearestStore) { $store['near_store'] = $nearestStore; } + }else{ + $store_id = getenv('STORE_ID') ?? 1; + $store['near_store'] =SystemStore::where('id', $store_id)->field('id,name,phone,address,detailed_address,latitude,longitude')->find()??[]; } } catch (\Exception $e) { self::setError($e->getMessage()); From e4c80b9565fc955d04c55e916edb2b7faeb7cf65 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 2 Jul 2024 14:09:32 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=99=90=E5=88=B6=E9=A1=B5=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/logic/WorkbenchLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index 0120bbc53..610582805 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -137,9 +137,9 @@ class WorkbenchLogic extends BaseLogic $recharge_field = 'from_unixtime(pay_time,"%Y-%m") as pay_time,sum(price) as pay_price'; } $data['order_list'] = StoreOrder::with('user')->where($where) - ->whereBetweenTime('pay_time', $startTime, $endTime) +// ->whereBetweenTime('pay_time', $startTime, $endTime) ->order('pay_time', 'desc') - ->limit(6) +// ->limit(6) ->select()->each(function($item){ $item->pay_time=$item->pay_time>0?date('Y-m-d H:i:s',$item->pay_time):''; })