From d28a1ca1aba895a94cac5f93ca061aab18f7e39e Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 15:38:12 +0800 Subject: [PATCH 01/87] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E7=9B=B8=E5=85=B3=E7=9A=84=E5=85=B3?= =?UTF-8?q?=E8=81=94=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/store_order/StoreOrderLists.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/store/lists/store_order/StoreOrderLists.php b/app/store/lists/store_order/StoreOrderLists.php index dc37fd612..59a98e78d 100644 --- a/app/store/lists/store_order/StoreOrderLists.php +++ b/app/store/lists/store_order/StoreOrderLists.php @@ -54,8 +54,8 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface } elseif ($is_sashier == 2) { //小程序订单 $this->searchWhere[] = ['pay_type', 'in', [7, 3, 18,19]]; } - return StoreOrder::where($this->searchWhere) - ->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status', 'paid', 'total_num']) + return StoreOrder::where($this->searchWhere)->with(['user']) + ->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type', 'status', 'paid', 'total_num']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) use ($store_id) { From 291b0dabb1424245f15a7d6abfd680f52aa27f6b Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 15:49:16 +0800 Subject: [PATCH 02/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/enum/OrderEnum.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index 5564d4ef7..9c8a5c8f7 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -183,10 +183,10 @@ class OrderEnum public static function getOrderType($value = true) { $data = [ - self::RECEIVED_GOODS => '已收货', + self::RECEIVED_GOODS => '已完成', self::WAIT_EVALUATION => '待评价', self::WAIT_DELIVERY => '待发货', - self::WAIT_RECEIVING => '待收货', + self::WAIT_RECEIVING => '待核销', self::RETURN_SUCCESS => '退货成功', self::ALREADY_REFUND => '已退款', self::RECEIVED_BACK => '已退款', From f649369f08abce8ff0278120647cc99522bd4f64 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 16:23:20 +0800 Subject: [PATCH 03/87] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E9=80=80=E6=AC=BE?= =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=B5=81=E6=B0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/enum/OrderEnum.php | 1 + app/common/logic/PayNotifyLogic.php | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/app/common/enum/OrderEnum.php b/app/common/enum/OrderEnum.php index 9c8a5c8f7..1ffb751c1 100644 --- a/app/common/enum/OrderEnum.php +++ b/app/common/enum/OrderEnum.php @@ -46,6 +46,7 @@ class OrderEnum const CASHIER_FACE_PAY = 17;//现金收银 const PURCHASE_FUNDS = 18;//采购款收银 + const PAY_BACK =-1; /** diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index bde01d353..c894fd405 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -293,11 +293,38 @@ class PayNotifyLogic extends BaseLogic } //微信日志 user_order_refund $capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money,'',1); + //处理财务流水退还 + self::store_finance_back($orderSn); self::addStock($order['id']);//微信 // self::afterPay($order,$extra['transaction_id']); } + + /** + * 财务退还金额相关 + * @param $orderSn + * @return void + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public static function store_finance_back($orderSn) + { + $data = StoreFinanceFlow::where('order_sn',$orderSn) + ->where(['financial_pm'=>1]) + ->select()->toArray(); + foreach ($data as &$value){ + unset($value['id']); + $value['financial_record_sn']=(new StoreFinanceFlowLogic)->getSn(); + $value['financial_pm']=0; + $value['financial_type']= OrderEnum::PAY_BACK; + $value['create_time']=time(); + } + (new StoreFinanceFlow)->saveAll($data); + + } + /** * 现金退款相关 * @param $orderSn From 702a4f06bc5afec1df665bb8f4c708560b8792d1 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 24 Jun 2024 16:30:25 +0800 Subject: [PATCH 04/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86IndexC?= =?UTF-8?q?ontroller=E5=92=8CUserController=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E7=A7=AF=E5=88=86=E5=92=8C=E7=AD=BE=E5=88=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=9B=E4=BF=AE=E6=94=B9=E4=BA=86OrderLogic?= =?UTF-8?q?=E5=92=8CUserLogic=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91=EF=BC=9B=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=BA=86PayNotifyLogic=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BA=86=E7=A7=AF=E5=88=86=E5=A2=9E=E5=8A=A0=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 13 +------------ app/api/controller/user/UserController.php | 8 ++++++++ app/api/logic/order/OrderLogic.php | 7 +++++++ app/api/logic/user/UserLogic.php | 2 ++ app/common/logic/PayNotifyLogic.php | 3 ++- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 5c87916b4..415e8f76c 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -28,18 +28,7 @@ class IndexController extends BaseApiController public function index() { - $order = [ - 'out_trade_no' => 'CZ1719197818549414', - ]; - $app = new PayService(0); - - try { - $res = $app->wechat->query($order); - } catch (\Exception $e) { - return $this->fail($e->extra['message']); - } - d($res); - +d(2); diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index cf2696601..457598205 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -7,6 +7,8 @@ use app\api\logic\user\UserLogic; use app\api\validate\UserValidate; use app\common\enum\PayEnum; use app\common\logic\PaymentLogic; +use app\common\model\user\User; +use app\common\model\user_sign\UserSign; use support\Cache; use think\Exception; @@ -207,8 +209,14 @@ class UserController extends BaseApiController $params['page_no'] = $page_no > 0 ? $page_no : 1; $params['page_size'] = $page_size > 0 ? $page_size : 15; $res = UserLogic::dealDetails($params,$this->userId); + $integral = User::where('id',$this->userId)->value('integral'); + $number = UserSign::where('id',$this->userId)->where('status',0)->sum('number'); $res['page_no'] = $params['page_no']; $res['page_size'] = $params['page_size']; + $res['extend'] = [ + 'integral'=>$integral, + 'number'=>$number + ]; return $this->success('ok', $res); } diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 398f97321..2ee47e26c 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -24,6 +24,7 @@ use app\common\model\system_store\SystemStoreStaff; use app\common\model\user\User; use app\common\model\user\UserAddress; use app\common\model\user\UserShip; +use app\common\model\user_sign\UserSign; use app\common\model\user_spread_log\UserSpreadLog; use Picqer\Barcode\BarcodeGeneratorJPG; use Picqer\Barcode\BarcodeGeneratorPNG; @@ -442,6 +443,12 @@ class OrderLogic extends BaseLogic $order=StoreOrder::where('id',$data['id'])->find(); PayNotifyLogic::afterPay($order); PayNotifyLogic::descStock($order['id']); + if($order['uid']){ + $user_number = bcmul($order['pay_price'], '0.10', 2); + User::where('id', $order['uid'])->inc('integral', $user_number)->update(); + UserSign::where(['uid' => $order['uid'],'order_id' => $order['order_id']])->update(['status'=>1]); + } + Db::commit(); return true; } catch (\Exception $e) { diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 90428f7e8..06475e6e8 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -105,6 +105,8 @@ 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); }else{ $data = []; } diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index bde01d353..0f08b7da8 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -483,9 +483,10 @@ class PayNotifyLogic extends BaseLogic 'title' => '购买商品获得兑换券', 'store_id' => $order['store_id'], 'number' => $user_number, + 'status' => 0, ]; $user_sing->save($sing); - User::where('id', $order['uid'])->inc('integral', $user_number)->update(); + // User::where('id', $order['uid'])->inc('integral', $user_number)->update(); } From 87a492b8345b4f1f5ded52f5e5397c301785d51c Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 16:42:41 +0800 Subject: [PATCH 05/87] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=85=85=E5=80=BC=E6=96=B9=E5=BC=8F=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store_order/StoreOrderController.php | 14 +++++++------- .../store_order/StoreOrderController.php | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/admin/controller/store_order/StoreOrderController.php b/app/admin/controller/store_order/StoreOrderController.php index 45a98d163..34307b5cb 100644 --- a/app/admin/controller/store_order/StoreOrderController.php +++ b/app/admin/controller/store_order/StoreOrderController.php @@ -122,12 +122,12 @@ class StoreOrderController extends BaseAdminController $refund = (new \app\common\logic\store_order\StoreOrderLogic()) ->refund($params['order_id'],$money,$money); if($refund){ - $arr = [ - 'amount'=>[ - 'refund'=>$money - ] - ]; - PayNotifyLogic::refund($params['order_id'],$arr); +// $arr = [ +// 'amount'=>[ +// 'refund'=>$money +// ] +// ]; +// PayNotifyLogic::refund($params['order_id'],$arr); return $this->success(); } } @@ -148,7 +148,7 @@ class StoreOrderController extends BaseAdminController PayNotifyLogic::cash_refund($params['order_id']); return $this->success(); } - //支付包支付 + //todo 支付包支付 return $this->fail('退款失败'); } diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 668dda2ae..fa80d2f0f 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -357,13 +357,28 @@ class StoreOrderController extends BaseAdminController return $this->fail('支付条码不能为空'); } $params = $this->request->post(); + switch ($pay_type) { + case PayEnum::CASH_PAY: + $recharge_type = 'CASH_PAY'; + break; + case PayEnum::WECHAT_PAY_BARCODE: + $recharge_type = 'INDUSTRYMEMBERS'; + break; + case PayEnum::ALIPAY_BARCODE: + $recharge_type = 'ALI_INDUSTRYMEMBERS'; + break; + default: + $recharge_type = ''; + break; + } $data = [ 'store_id' => $this->adminInfo['store_id'], 'uid' => $params['uid'], 'staff_id' => $this->adminId, 'order_id' => getNewOrderId('CZ'), 'price' => $params['price'], - 'recharge_type' => 'INDUSTRYMEMBERS', + 'recharge_type' =>$recharge_type, + 'type' => 1, ]; $order = UserRecharge::create($data); $order['pay_price'] = $order['price']; From c20c1cf940d05a41ab89f163cec24788090412cc Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 24 Jun 2024 16:47:51 +0800 Subject: [PATCH 06/87] =?UTF-8?q?feat(app/queue/redis):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AE=A2=E5=8D=95=E6=94=AF=E4=BB=98=E8=B6=85=E6=97=B6?= =?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/queue/redis/CodePaySend.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/queue/redis/CodePaySend.php b/app/queue/redis/CodePaySend.php index d944b9eec..df95edba1 100644 --- a/app/queue/redis/CodePaySend.php +++ b/app/queue/redis/CodePaySend.php @@ -5,6 +5,7 @@ namespace app\queue\redis; use app\common\logic\PayNotifyLogic; use app\common\model\retail\Cashierclass; use app\common\model\store_order\StoreOrder; +use app\common\model\user_recharge\UserRecharge; use app\common\service\pay\PayService; use app\common\service\PushService; use Webman\RedisQueue\Consumer; @@ -44,17 +45,29 @@ class CodePaySend implements Consumer { // 直接更改消息队列数据结构,将最大重试次数max_attempts字段设置为0,即不再重试。 if($package['attempts'] ==$exception['max_attempts']){ + $pay = new PayService(); $data = [ 'order_id' => $package['data']['order_id'], 'paid' => 0, ]; - $find=StoreOrder::where($data)->find(); - if($find){ - $order = StoreOrder::update($data); + if($package['data']['pay_type']=='recharge'){ + $order=UserRecharge::where($data)->find(); if($order){ - PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'cash_register','msg'=>'支付超时,订单已被取消,请重新提交订单']); + $res=UserRecharge::where($data)->update(['status'=>-1]); + if($res){ + PushService::push('wechat_mmp_' . $order['uid'], $order['uid'], ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>$data['id']]]); + } + } + }else{ + + $order=StoreOrder::where($data)->find(); + if($order){ + PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'cash_register','msg'=>'支付超时,订单已被取消,请重新提交订单']); } } + $pay->wechat->close(['out_trade_no'=>$order['order_id']]); + + } return $package; } From c059df525c4b4f71d6013b38b016f4bcf7498a83 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 24 Jun 2024 16:53:53 +0800 Subject: [PATCH 07/87] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=85=85=E5=80=BC=E4=BC=9A=E5=91=98API=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 6a2b27056..6b22108b6 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -99,6 +99,32 @@ class StoreController extends BaseApiController return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); } + /** + * 重新充值会员 + */ + public function again_recharge() + { + $auth_code = $this->request->post('auth_code'); //微信支付条码 + $id = $this->request->post('id',0); //id + $order = UserRecharge::where('id', $id)->where('paid',0)->find(); + if(!$order){ + return $this->fail('订单不存在'); + } + $order['pay_price']=$order['price']; + $result = PaymentLogic::codepay($auth_code, $order,'条码支付'); + if (PaymentLogic::hasError()) { + return $this->fail(PaymentLogic::getError()); + } + if (isset($result['trade_state_desc']) && $result['trade_state_desc'] == '支付成功') { + PayNotifyLogic::handle('recharge', $result['out_trade_no'], $result); + } else { + Redis::send('send-code-pay', ['order_id' => $order['order_id'],'pay_type'=>'recharge']); + return $this->success('用户支付中'); + } + return $this->success('支付成功', ['out_trade_no' => $result['out_trade_no'], 'pay_type' => PayEnum::WECHAT_PAY_BARCODE, 'transaction_id' => $result['transaction_id']]); + } + + /** * 门店会员充值数量 */ From 4fc91a476b5bd331a09419f82528f5f8db1535c8 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 17:07:39 +0800 Subject: [PATCH 08/87] =?UTF-8?q?=E5=85=85=E5=80=BC=E7=8E=B0=E9=87=91?= =?UTF-8?q?=E9=80=80=E6=AC=BE,=E8=B0=83=E8=AF=95=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user_recharge/UserRechargeController.php | 26 +++++++++++++++++++ .../user_recharge/UserRechargeValidate.php | 6 +++++ app/api/controller/PayController.php | 3 +++ app/common/logic/PayNotifyLogic.php | 25 +++++++++++++++++- 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/app/admin/controller/user_recharge/UserRechargeController.php b/app/admin/controller/user_recharge/UserRechargeController.php index 27a48b982..f583a2e56 100644 --- a/app/admin/controller/user_recharge/UserRechargeController.php +++ b/app/admin/controller/user_recharge/UserRechargeController.php @@ -7,6 +7,8 @@ use app\admin\controller\BaseAdminController; use app\admin\lists\user_recharge\UserRechargeLists; use app\admin\logic\user_recharge\UserRechargeLogic; use app\admin\validate\user_recharge\UserRechargeValidate; +use app\common\logic\PayNotifyLogic; +use app\common\model\user\UserRecharge; /** @@ -91,5 +93,29 @@ class UserRechargeController extends BaseAdminController return $this->data($result); } + public function refund() + { + $params = (new UserRechargeValidate())->goCheck('refund'); + $detail = UserRecharge::where('id',$params['id'])->findOrEmpty(); + if(empty($detail)){ + return $this->fail('无该充值订单请检查'); + } + //现金 + if($detail['recharge_type'] =='CASH_PAY'){ + PayNotifyLogic::recharge_cash_refund($params['id']); + return $this->success(); + } + //微信 + if($detail['recharge_type'] == 'INDUSTRYMEMBERS'){ + $money = (int)bcmul($detail['price'],100); + (new \app\common\logic\store_order\StoreOrderLogic()) + ->refund($detail['order_id'],$money,$money); + return $this->success(); + } + + //支付宝 + + + } } \ No newline at end of file diff --git a/app/admin/validate/user_recharge/UserRechargeValidate.php b/app/admin/validate/user_recharge/UserRechargeValidate.php index 4abccd2d6..553b1ae7d 100644 --- a/app/admin/validate/user_recharge/UserRechargeValidate.php +++ b/app/admin/validate/user_recharge/UserRechargeValidate.php @@ -32,6 +32,12 @@ class UserRechargeValidate extends BaseValidate ]; + public function sceneRefund() + { + return $this->only(['id']); + } + + /** * @notes 添加场景 * @return UserRechargeValidate diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php index e422175d5..6b5d5ff94 100644 --- a/app/api/controller/PayController.php +++ b/app/api/controller/PayController.php @@ -28,6 +28,8 @@ class PayController extends BaseApiController { $app = new PayService(1); $result = $app->wechat->callback(Request()->post()); + Cache::set('6log'.time(),$result); + Cache::set('6logJ'.time(),json_encode($result)); if ($result && $result->event_type == 'TRANSACTION.SUCCESS') { $ciphertext = $result->resource['ciphertext']; if ($ciphertext['trade_state'] === 'SUCCESS') { @@ -47,6 +49,7 @@ class PayController extends BaseApiController } else { if ($result && $result->event_type == 'REFUND.SUCCESS') { $ciphertext = $result->resource['ciphertext']; + Cache::set('6logC'.time(),json_encode($ciphertext)); if ($ciphertext['refund_status'] === 'SUCCESS') { //处理订单 -1判断是退的一单还是拆分的订单 $out_trade_no = $ciphertext['out_trade_no'] . '-1'; diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index fe50ec195..f9877d6d3 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -296,7 +296,7 @@ class PayNotifyLogic extends BaseLogic //处理财务流水退还 self::store_finance_back($orderSn); self::addStock($order['id']);//微信 - + return true; // self::afterPay($order,$extra['transaction_id']); } @@ -359,6 +359,28 @@ class PayNotifyLogic extends BaseLogic return true; } + /** + * 充值现金退款相关 + * @param $orderId + * @param $extra + * @return true + */ + public static function recharge_cash_refund($orderId,$extra = []) + { + $order = UserRecharge::where('id',$orderId)->findOrEmpty(); + if ($order->isEmpty() || $order->status == -1) { + return true; + } + $order->status = -1; + $order->refund_price = $order->price; + $order->refund_time = time(); + $order->remarks = ''; + $order->save(); + return true; + } + + + /** * 充值 */ @@ -427,6 +449,7 @@ class PayNotifyLogic extends BaseLogic self::descStock($order['id']); } // Redis::send('push-platform-print', ['id' => $order['id']]); + return true; } /** From 21a16ff999625ac22e625fce6376ecdfc6fad235 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 24 Jun 2024 17:21:32 +0800 Subject: [PATCH 09/87] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E8=AE=A2?= =?UTF-8?q?=E5=8D=95ID=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 6b22108b6..5aa96ccc9 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -110,6 +110,9 @@ class StoreController extends BaseApiController if(!$order){ return $this->fail('订单不存在'); } + $order_id=getNewOrderId('CZ'); + UserRecharge::where('id', $id)->update(['order_id'=>$order_id]); + $order['order_id']=$order_id; $order['pay_price']=$order['price']; $result = PaymentLogic::codepay($auth_code, $order,'条码支付'); if (PaymentLogic::hasError()) { From ba9bc4a8aab3a450f84a0131fcad316e53b40bbb Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 17:32:55 +0800 Subject: [PATCH 10/87] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=85=85=E5=80=BC?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E9=80=BB=E8=BE=91=E5=92=8C=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user_recharge/UserRechargeController.php | 2 +- app/api/controller/PayController.php | 2 -- app/common/logic/PayNotifyLogic.php | 11 +++++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/admin/controller/user_recharge/UserRechargeController.php b/app/admin/controller/user_recharge/UserRechargeController.php index f583a2e56..afb5bb4f5 100644 --- a/app/admin/controller/user_recharge/UserRechargeController.php +++ b/app/admin/controller/user_recharge/UserRechargeController.php @@ -114,7 +114,7 @@ class UserRechargeController extends BaseAdminController } //支付宝 - + return $this->success(); } diff --git a/app/api/controller/PayController.php b/app/api/controller/PayController.php index 6b5d5ff94..37bd0d970 100644 --- a/app/api/controller/PayController.php +++ b/app/api/controller/PayController.php @@ -28,8 +28,6 @@ class PayController extends BaseApiController { $app = new PayService(1); $result = $app->wechat->callback(Request()->post()); - Cache::set('6log'.time(),$result); - Cache::set('6logJ'.time(),json_encode($result)); if ($result && $result->event_type == 'TRANSACTION.SUCCESS') { $ciphertext = $result->resource['ciphertext']; if ($ciphertext['trade_state'] === 'SUCCESS') { diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f9877d6d3..54b7076d6 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -259,6 +259,17 @@ class PayNotifyLogic extends BaseLogic //更新状态 $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); if ($order->isEmpty() || $order->status == OrderEnum::REFUND_PAY) { + //充值 + $orderRe = UserRecharge::where('order_id',$orderSn)->findOrEmpty(); + if($orderRe->isEmpty() || $orderRe->status == -1){ + return true; + } + $orderRe->status = -1; + $orderRe->refund_price = $orderRe->price; + $orderRe->refund_time = time(); + $orderRe->remarks = ''; + $orderRe->save(); + return true; } $order->status = OrderEnum::REFUND_PAY; From 02d4a299742f59ced5ce6a7e4c799898a0f382e0 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 17:39:44 +0800 Subject: [PATCH 11/87] =?UTF-8?q?=E5=85=85=E5=80=BC=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/user_recharge/UserRechargeLists.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/admin/lists/user_recharge/UserRechargeLists.php b/app/admin/lists/user_recharge/UserRechargeLists.php index 6a9101e65..c498ce199 100644 --- a/app/admin/lists/user_recharge/UserRechargeLists.php +++ b/app/admin/lists/user_recharge/UserRechargeLists.php @@ -44,7 +44,7 @@ class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterfa public function lists(): array { return UserRecharge::where($this->searchWhere) - ->field(['id', 'uid', 'order_id', 'price', 'recharge_type', 'paid', 'pay_time']) + ->field(['id', 'uid', 'order_id', 'price', 'recharge_type', 'paid', 'pay_time','status','refund_time']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) { @@ -54,6 +54,11 @@ class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterfa }else{ $item['pay_time']=''; } + if($item['refund_time']>0){ + $item['refund_time']=date('Y-m-d H:i:s',$item['pay_time']); + }else{ + $item['refund_time']=''; + } if($item['paid']==1){ $item['paid_name']='已充值'; }else{ From 5531bb8022392b14b11fe4a61b240389fd80ce66 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 17:47:38 +0800 Subject: [PATCH 12/87] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/user_recharge/UserRechargeController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/admin/controller/user_recharge/UserRechargeController.php b/app/admin/controller/user_recharge/UserRechargeController.php index afb5bb4f5..5ef965ca6 100644 --- a/app/admin/controller/user_recharge/UserRechargeController.php +++ b/app/admin/controller/user_recharge/UserRechargeController.php @@ -95,7 +95,7 @@ class UserRechargeController extends BaseAdminController public function refund() { - $params = (new UserRechargeValidate())->goCheck('refund'); + $params = (new UserRechargeValidate())->post()->goCheck('refund'); $detail = UserRecharge::where('id',$params['id'])->findOrEmpty(); if(empty($detail)){ return $this->fail('无该充值订单请检查'); @@ -114,6 +114,10 @@ class UserRechargeController extends BaseAdminController } //支付宝 + if($detail['recharge_type'] == 'ALI_INDUSTRYMEMBERS'){ + + } + return $this->success(); } From f70792062f998837dc0af5970c0c27d19272da58 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 17:56:06 +0800 Subject: [PATCH 13/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/user_recharge/UserRechargeLists.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/lists/user_recharge/UserRechargeLists.php b/app/admin/lists/user_recharge/UserRechargeLists.php index c498ce199..327c2dba8 100644 --- a/app/admin/lists/user_recharge/UserRechargeLists.php +++ b/app/admin/lists/user_recharge/UserRechargeLists.php @@ -55,7 +55,7 @@ class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterfa $item['pay_time']=''; } if($item['refund_time']>0){ - $item['refund_time']=date('Y-m-d H:i:s',$item['pay_time']); + $item['refund_time']=date('Y-m-d H:i:s',$item['refund_time']); }else{ $item['refund_time']=''; } From 751ddafe73484f517d300ed8d8d9359ffd6631fb Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 24 Jun 2024 17:57:51 +0800 Subject: [PATCH 14/87] =?UTF-8?q?feat(ConfigLogic):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A1=A8=E3=80=81=E7=BC=96=E8=BE=91=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=A1=A8=E3=80=81=E5=88=A0=E9=99=A4=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=A1=A8=E3=80=81=E8=8E=B7=E5=8F=96=E9=85=8D=E7=BD=AE=E8=A1=A8?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/ConfigController.php | 1 + .../controller/config/ConfigController.php | 95 +++++++++++++++++++ app/admin/lists/config/ConfigLists.php | 64 +++++++++++++ app/admin/logic/ConfigLogic.php | 91 ++++++++++++++++-- app/admin/validate/config/ConfigValidate.php | 86 +++++++++++++++++ 5 files changed, 330 insertions(+), 7 deletions(-) create mode 100644 app/admin/controller/config/ConfigController.php create mode 100644 app/admin/lists/config/ConfigLists.php create mode 100644 app/admin/validate/config/ConfigValidate.php diff --git a/app/admin/controller/ConfigController.php b/app/admin/controller/ConfigController.php index 35d12c289..9ccb57337 100644 --- a/app/admin/controller/ConfigController.php +++ b/app/admin/controller/ConfigController.php @@ -14,6 +14,7 @@ namespace app\admin\controller; +use app\admin\lists\config\ConfigLists; use app\admin\logic\auth\AuthLogic; use app\admin\logic\ConfigLogic; use think\facade\Db; diff --git a/app/admin/controller/config/ConfigController.php b/app/admin/controller/config/ConfigController.php new file mode 100644 index 000000000..a6ef4550b --- /dev/null +++ b/app/admin/controller/config/ConfigController.php @@ -0,0 +1,95 @@ +dataLists(new ConfigLists()); + } + + + /** + * @notes 添加配置表 + * @return \think\response\Json + * @author admin + * @date 2024/06/24 17:52 + */ + public function add() + { + $params = (new ConfigValidate())->post()->goCheck('add'); + $result = ConfigLogic::add($params); + if (true === $result) { + return $this->success('添加成功', [], 1, 1); + } + return $this->fail(ConfigLogic::getError()); + } + + + /** + * @notes 编辑配置表 + * @return \think\response\Json + * @author admin + * @date 2024/06/24 17:52 + */ + public function edit() + { + $params = (new ConfigValidate())->post()->goCheck('edit'); + $result = ConfigLogic::edit($params); + if (true === $result) { + return $this->success('编辑成功', [], 1, 1); + } + return $this->fail(ConfigLogic::getError()); + } + + + /** + * @notes 删除配置表 + * @return \think\response\Json + * @author admin + * @date 2024/06/24 17:52 + */ + public function delete() + { + $params = (new ConfigValidate())->post()->goCheck('delete'); + ConfigLogic::delete($params); + return $this->success('删除成功', [], 1, 1); + } + + + /** + * @notes 获取配置表详情 + * @return \think\response\Json + * @author admin + * @date 2024/06/24 17:52 + */ + public function detail() + { + $params = (new ConfigValidate())->goCheck('detail'); + $result = ConfigLogic::detail($params); + return $this->data($result); + } + + +} \ No newline at end of file diff --git a/app/admin/lists/config/ConfigLists.php b/app/admin/lists/config/ConfigLists.php new file mode 100644 index 000000000..c2cd2b901 --- /dev/null +++ b/app/admin/lists/config/ConfigLists.php @@ -0,0 +1,64 @@ + ['name', 'type'], + ]; + } + + + /** + * @notes 获取配置列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2024/05/30 10:25 + */ + public function lists(): array + { + return Config::where($this->searchWhere) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->select() + ->toArray(); + } + + + /** + * @notes 获取配置数量 + * @return int + * @author likeadmin + * @date 2024/05/30 10:25 + */ + public function count(): int + { + return AppUpdate::where($this->searchWhere)->count(); + } + +} \ No newline at end of file diff --git a/app/admin/logic/ConfigLogic.php b/app/admin/logic/ConfigLogic.php index d9ef9f806..a2b705d0c 100644 --- a/app/admin/logic/ConfigLogic.php +++ b/app/admin/logic/ConfigLogic.php @@ -14,17 +14,97 @@ namespace app\admin\logic; - +use app\common\logic\BaseLogic; +use app\common\model\Config; use app\common\model\dict\DictData; use app\common\service\{FileService, ConfigService}; +use think\facade\Db; /** * 配置类逻辑层 * Class ConfigLogic * @package app\admin\logic */ -class ConfigLogic +class ConfigLogic extends BaseLogic { + /** + * @notes 添加配置表 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/24 17:52 + */ + public static function add(array $params): bool + { + Db::startTrans(); + try { + Config::create([ + 'type' => $params['type'], + 'name' => $params['name'], + 'value' => $params['value'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 编辑配置表 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/24 17:52 + */ + public static function edit(array $params): bool + { + Db::startTrans(); + try { + Config::where('id', $params['id'])->update([ + 'type' => $params['type'], + 'name' => $params['name'], + 'value' => $params['value'] + ]); + + Db::commit(); + return true; + } catch (\Exception $e) { + Db::rollback(); + self::setError($e->getMessage()); + return false; + } + } + + + /** + * @notes 删除配置表 + * @param array $params + * @return bool + * @author admin + * @date 2024/06/24 17:52 + */ + public static function delete(array $params): bool + { + return Config::destroy($params['id']); + } + + + /** + * @notes 获取配置表详情 + * @param $params + * @return array + * @author admin + * @date 2024/06/24 17:52 + */ + public static function detail($params): array + { + return Config::findOrEmpty($params['id'])->toArray(); + } /** * @notes 获取配置 * @return array @@ -68,7 +148,7 @@ class ConfigLogic if (!is_string($type)) { return []; } - + $type = explode(',', $type); $lists = DictData::whereIn('type_value', $type)->select()->toArray(); @@ -86,7 +166,4 @@ class ConfigLogic } return $result; } - - - -} \ No newline at end of file +} diff --git a/app/admin/validate/config/ConfigValidate.php b/app/admin/validate/config/ConfigValidate.php new file mode 100644 index 000000000..1a42ab197 --- /dev/null +++ b/app/admin/validate/config/ConfigValidate.php @@ -0,0 +1,86 @@ + 'require', + 'name' => 'require', + 'value' => 'require', + ]; + + + /** + * 参数描述 + * @var string[] + */ + protected $field = [ + 'id' => 'id', + 'name' => '名称', + 'value' => '值', + ]; + + + /** + * @notes 添加场景 + * @return ConfigValidate + * @author admin + * @date 2024/06/24 17:52 + */ + public function sceneAdd() + { + return $this->only(['name','value']); + } + + + /** + * @notes 编辑场景 + * @return ConfigValidate + * @author admin + * @date 2024/06/24 17:52 + */ + public function sceneEdit() + { + return $this->only(['id','name','value']); + } + + + /** + * @notes 删除场景 + * @return ConfigValidate + * @author admin + * @date 2024/06/24 17:52 + */ + public function sceneDelete() + { + return $this->only(['id']); + } + + + /** + * @notes 详情场景 + * @return ConfigValidate + * @author admin + * @date 2024/06/24 17:52 + */ + public function sceneDetail() + { + return $this->only(['id']); + } + +} \ No newline at end of file From d3a44b336bbb1f3bb59a5d6028fa1820bde3e4c4 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 18:03:27 +0800 Subject: [PATCH 15/87] =?UTF-8?q?=E9=80=80=E6=AC=BE=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/user_recharge/UserRechargeLists.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/admin/lists/user_recharge/UserRechargeLists.php b/app/admin/lists/user_recharge/UserRechargeLists.php index 327c2dba8..a6f1f432e 100644 --- a/app/admin/lists/user_recharge/UserRechargeLists.php +++ b/app/admin/lists/user_recharge/UserRechargeLists.php @@ -64,6 +64,9 @@ class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterfa }else{ $item['paid_name']='未充值'; } + if($item['status']== -1){ + $item['paid_name']='已退款'; + } return $item; }) ->toArray(); From 57f6cf0e3b85ee755fd4b81f891d1c09b29169ca Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 24 Jun 2024 18:04:33 +0800 Subject: [PATCH 16/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E5=95=86=E5=BA=97=E6=8E=A7=E5=88=B6=E5=99=A8=E4=BB=A5=E4=BB=8E?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A1=A8=E4=B8=AD=E8=8E=B7=E5=8F=96=E5=85=85?= =?UTF-8?q?=E5=80=BC=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 3 ++- app/store/controller/store_order/StoreOrderController.php | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 5aa96ccc9..a5c93465a 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -12,6 +12,7 @@ use app\api\validate\UserValidate; use app\common\enum\PayEnum; use app\common\logic\PaymentLogic; use app\common\logic\PayNotifyLogic; +use app\common\model\Config; use app\common\model\user\User; use app\common\model\user_create_log\UserCreateLog; use app\common\model\user_recharge\UserRecharge; @@ -80,7 +81,7 @@ class StoreController extends BaseApiController 'uid'=>$find['id'], 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), - 'price'=>1000, + 'price'=>Config::where('name','recharge')->value('value')??1000, 'recharge_type'=>'INDUSTRYMEMBERS', ]; $order = UserRecharge::create($data); diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index fa80d2f0f..4b7295af4 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -345,12 +345,6 @@ class StoreOrderController extends BaseAdminController */ public function rechange_amount() { - // $order = UserRecharge::where('order_id','CZ1719052252643357')->find(); - // $order['pay_price'] = $order['price']; - // d(1); - // PayNotifyLogic::handle('recharge', $order['order_id'], $order); - - // d(1); $pay_type = $this->request->post('pay_type'); $auth_code = $this->request->post('auth_code'); //微信支付条码 if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { From 17697bf361f57a37798f6c5352b24299a8f7adf8 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 24 Jun 2024 18:14:56 +0800 Subject: [PATCH 17/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E5=92=8C=E8=AE=A2=E5=8D=95=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=A0=B9=E6=8D=AE=E9=85=8D=E7=BD=AE=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E4=BB=B7=E6=A0=BC=E5=92=8C=E6=8A=B5=E6=89=A3=E9=87=91?= =?UTF-8?q?=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/product/ProductLists.php | 10 +++++-- app/api/logic/order/OrderLogic.php | 36 ++++++++++++++++---------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index f8e219939..a8826a48b 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -10,6 +10,7 @@ use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_product\StoreProduct; use app\common\lists\ListsSearchInterface; use app\common\model\cate\Cate; +use app\common\model\Config; //use app\common\model\goods\GoodsLabel; use think\facade\Db; @@ -102,11 +103,16 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L $this->searchWhere[] = ['cate_id','=',$class_all]; } } - + $off_activity=Config::where('name','off_activity')->value('value'); + if($off_activity==1){ + $field='id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,cost price,bar_code,image,sales,store_info,delete_time,unit,batch'; + }else{ + $field='id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch'; + } $this->searchWhere[] = ['status', '=', 1]; $this->searchWhere[] = ['stock', '>', 0]; return StoreBranchProduct::where($this->searchWhere) - ->field(['id', 'product_id', 'cate_id', 'store_name', 'cost', 'store_id','vip_price','purchase', 'price', 'bar_code', 'image', 'sales', 'store_info', 'delete_time', 'unit', 'batch']) + ->field($field) ->with(['className', 'unitName']) ->limit($this->limitOffset, $this->limitLength) ->order($this->sortOrder) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 2ee47e26c..4697609d3 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -10,6 +10,7 @@ use app\common\logic\BaseLogic; use app\common\logic\CapitalFlowLogic; use app\common\logic\PayNotifyLogic; use app\common\logic\StoreFinanceFlowLogic; +use app\common\model\Config; use app\common\model\dict\DictData; use app\common\model\dict\DictType; use app\common\model\order\Cart; @@ -73,9 +74,14 @@ class OrderLogic extends BaseLogic self::$activity_price = 0; //活动减少 self::$store_price = 0; //门店零售价 /** 计算价格 */ - + $off_activity=Config::where('name','off_activity')->value('value'); + if($off_activity==1){ + $field='id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id'; + }else{ + $field='id branch_product_id,store_name,image,unit,cost price,vip_price,cost,purchase,product_id'; + } foreach ($cart_select as $k => $v) { - $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id')->withTrashed()->find(); + $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->withTrashed()->find(); if (!$find) { continue; } @@ -86,18 +92,20 @@ class OrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 $cart_select[$k]['vip'] = 0; - if ($user && $user['user_ship'] == 1) { - //更新 会员为1的时候原价减去会员价 - $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - $cart_select[$k]['vip'] =1; - } - if ($user && $user['user_ship'] == 4) { - //更新 为4商户的时候减去商户价格 - $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + if($off_activity!=1){ + if ($user && $user['user_ship'] == 1) { + //更新 会员为1的时候原价减去会员价 + $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); + $cart_select[$k]['deduction_price'] =$deduction_price_count; + self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + $cart_select[$k]['vip'] =1; + } + if ($user && $user['user_ship'] == 4) { + //更新 为4商户的时候减去商户价格 + $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); + $cart_select[$k]['deduction_price'] =$deduction_price_count; + self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + } } //利润 From 49ee6b0c1cb429c687a488a85d43b53c6edfed39 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 24 Jun 2024 18:17:27 +0800 Subject: [PATCH 18/87] =?UTF-8?q?feat(PayNotifyLogic):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=94=AF=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=B4=BB=E5=8A=A8=E4=BB=B7=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 62 +++++++++++++++++++---------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 54b7076d6..7450440c6 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -7,6 +7,7 @@ use app\common\enum\OrderEnum; use app\common\enum\PayEnum; use app\common\enum\user\UserShipEnum; use app\common\enum\YesNoEnum; +use app\common\model\Config; use app\common\model\dict\DictType; use app\common\model\finance\CapitalFlow; use app\common\model\finance\PayNotifyLog; @@ -260,9 +261,9 @@ class PayNotifyLogic extends BaseLogic $order = StoreOrder::where('order_id', $orderSn)->findOrEmpty(); if ($order->isEmpty() || $order->status == OrderEnum::REFUND_PAY) { //充值 - $orderRe = UserRecharge::where('order_id',$orderSn)->findOrEmpty(); - if($orderRe->isEmpty() || $orderRe->status == -1){ - return true; + $orderRe = UserRecharge::where('order_id', $orderSn)->findOrEmpty(); + if ($orderRe->isEmpty() || $orderRe->status == -1) { + return true; } $orderRe->status = -1; $orderRe->refund_price = $orderRe->price; @@ -283,8 +284,8 @@ class PayNotifyLogic extends BaseLogic $user = User::where('id', $order['uid'])->findOrEmpty(); $capitalFlowDao = new CapitalFlowLogic($user); $deal_money = bcdiv($extra['amount']['refund'], 100, 2); - if (in_array($order['pay_type'],[PayEnum::BALANCE_PAY,PayEnum::PURCHASE_FUNDS])){ - if($order['pay_type'] == PayEnum::BALANCE_PAY){//用户余额 + if (in_array($order['pay_type'], [PayEnum::BALANCE_PAY, PayEnum::PURCHASE_FUNDS])) { + if ($order['pay_type'] == PayEnum::BALANCE_PAY) { //用户余额 $user->now_money = bcadd($user->now_money, $deal_money, 2); $user->save(); //增加数量 @@ -292,7 +293,7 @@ class PayNotifyLogic extends BaseLogic //退款 $capitalFlowDao->userIncome('system_balance_back', 'system_back', $order['id'], $deal_money); } - if($order['pay_type'] == PayEnum::PURCHASE_FUNDS){//采购款 + if ($order['pay_type'] == PayEnum::PURCHASE_FUNDS) { //采购款 $user->purchase_funds = bcadd($user->purchase_funds, $deal_money, 2); $user->save(); //增加数量 @@ -300,13 +301,12 @@ class PayNotifyLogic extends BaseLogic //退款 $capitalFlowDao->userIncome('system_purchase_back', 'system_back', $order['id'], $deal_money); } - } //微信日志 user_order_refund - $capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money,'',1); + $capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money, '', 1); //处理财务流水退还 self::store_finance_back($orderSn); - self::addStock($order['id']);//微信 + self::addStock($order['id']); //微信 return true; // self::afterPay($order,$extra['transaction_id']); } @@ -322,18 +322,17 @@ class PayNotifyLogic extends BaseLogic */ public static function store_finance_back($orderSn) { - $data = StoreFinanceFlow::where('order_sn',$orderSn) - ->where(['financial_pm'=>1]) + $data = StoreFinanceFlow::where('order_sn', $orderSn) + ->where(['financial_pm' => 1]) ->select()->toArray(); - foreach ($data as &$value){ + foreach ($data as &$value) { unset($value['id']); - $value['financial_record_sn']=(new StoreFinanceFlowLogic)->getSn(); - $value['financial_pm']=0; - $value['financial_type']= OrderEnum::PAY_BACK; - $value['create_time']=time(); + $value['financial_record_sn'] = (new StoreFinanceFlowLogic)->getSn(); + $value['financial_pm'] = 0; + $value['financial_type'] = OrderEnum::PAY_BACK; + $value['create_time'] = time(); } (new StoreFinanceFlow)->saveAll($data); - } /** @@ -358,7 +357,7 @@ class PayNotifyLogic extends BaseLogic $order->save(); //日志记录 $model = new StoreCashFinanceFlow(); - $model->store_id = $order['store_id']??0; + $model->store_id = $order['store_id'] ?? 0; $model->cash_price = $order->pay_price; $model->receivable = $order->pay_price; $model->remark = '退款'; @@ -376,9 +375,9 @@ class PayNotifyLogic extends BaseLogic * @param $extra * @return true */ - public static function recharge_cash_refund($orderId,$extra = []) + public static function recharge_cash_refund($orderId, $extra = []) { - $order = UserRecharge::where('id',$orderId)->findOrEmpty(); + $order = UserRecharge::where('id', $orderId)->findOrEmpty(); if ($order->isEmpty() || $order->status == -1) { return true; } @@ -515,6 +514,27 @@ class PayNotifyLogic extends BaseLogic { $financeLogic = new StoreFinanceFlowLogic(); $user_sing = new UserSign(); + $off_activity = Config::where('name', 'off_activity')->value('value'); + if ($off_activity == 1) { + //-----活动价结算更改 + $financeLogic->order = $order; + $financeLogic->user = ['uid' => $order['uid']]; + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); + $financeLogic->out($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + if ($order['uid'] > 0) { + $user_number = bcmul($order['pay_price'], '0.10', 2); + $sing = [ + 'uid' => $order['uid'], + 'order_id' => $order['order_id'], + 'title' => '购买商品获得兑换券', + 'store_id' => $order['store_id'], + 'number' => $user_number, + ]; + $user_sing->save($sing); + } + return false; + } $vipFen = 0; if ($order['uid'] > 0) { // 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去 @@ -896,7 +916,7 @@ class PayNotifyLogic extends BaseLogic $updateData[] = [ 'id' => $StoreBranchProduct['id'], 'stock' => $StoreBranchProduct['stock'] + $v['cart_num'], -// 'sales' => ['inc', $v['cart_num']] + // 'sales' => ['inc', $v['cart_num']] ]; } } From b39bf47b89fdfb8bc659a9fdad1b334ac1693b56 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 18:25:32 +0800 Subject: [PATCH 19/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/UserLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 06475e6e8..781026611 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -289,10 +289,10 @@ class UserLogic extends BaseLogic //返还金明细 -todo back $query = VipFlow::with('store')->where(['user_id'=>$uid]); if($params['mark'] == 1){ - $query->where('status',1); + $query->where('status',0); } if($params['mark'] == 2){ - $query->where('status',0); + $query->where('status',1); } $count = $query->count(); $data = $query From d68f2a992d541de0dbf505b14c27e06d74f8d54d Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 18:28:21 +0800 Subject: [PATCH 20/87] =?UTF-8?q?=E7=A4=BC=E5=93=81=E5=88=B8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/UserLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 781026611..0b38b2726 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -274,10 +274,10 @@ class UserLogic extends BaseLogic //礼品券明细 $query = UserSign::where(['uid'=>$uid]); if($params['mark'] == 1){ - $query->where('financial_pm',1); + $query->where('financial_pm',0); } if($params['mark'] == 2){ - $query->where('financial_pm',0); + $query->where('financial_pm',1); } $count = $query->count(); $data =$query From 630ef10fd6220b5095e887fadd207558f9cdcddb Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 09:43:30 +0800 Subject: [PATCH 21/87] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/product/ProductLists.php | 33 +++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index a8826a48b..85efb1ae4 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -4,6 +4,7 @@ namespace app\api\lists\product; use app\admin\lists\BaseAdminDataLists; +use app\common\lists\ListsExtendInterface; use app\common\lists\ListsSortInterface; use app\common\model\dict\DictType; use app\common\model\store_branch_product\StoreBranchProduct; @@ -19,7 +20,7 @@ use think\facade\Db; * Class goods * @package app\api\goods */ -class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface +class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface,ListsExtendInterface { @@ -64,7 +65,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L */ public function setDefaultOrder(): array { - return [ 'price' => 'asc','id' => 'desc']; + return ['price' => 'asc', 'id' => 'desc']; } /** @@ -99,16 +100,13 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L if ($arr) { $arr2 = Cate::where('pid', 'in', $arr)->column('id'); $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)]; - }else{ - $this->searchWhere[] = ['cate_id','=',$class_all]; + } else { + $this->searchWhere[] = ['cate_id', '=', $class_all]; } } - $off_activity=Config::where('name','off_activity')->value('value'); - if($off_activity==1){ - $field='id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,cost price,bar_code,image,sales,store_info,delete_time,unit,batch'; - }else{ - $field='id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch'; - } + + $field = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch'; + $this->searchWhere[] = ['status', '=', 1]; $this->searchWhere[] = ['stock', '>', 0]; return StoreBranchProduct::where($this->searchWhere) @@ -116,9 +114,8 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L ->with(['className', 'unitName']) ->limit($this->limitOffset, $this->limitLength) ->order($this->sortOrder) -// ->page($this->limitOffset +1,$this->limitLength) + // ->page($this->limitOffset +1,$this->limitLength) ->select()->toArray(); - } @@ -150,8 +147,8 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L if ($arr) { $arr2 = Cate::where('pid', 'in', $arr)->column('id'); $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)]; - }else{ - $this->searchWhere[] = ['cate_id','=',$class_all]; + } else { + $this->searchWhere[] = ['cate_id', '=', $class_all]; } } @@ -160,4 +157,12 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L return StoreBranchProduct::where($this->searchWhere) ->count(); } + public function extend(){ + $off_activity = Config::where('name', 'off_activity')->value('value'); + return [ + 'off_activity'=>$off_activity, + 'price'=>'cost', + 'op_price'=>'price', + ]; + } } From e6becf88b46815d01f4b7bd27ad23a49e87a13a3 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 25 Jun 2024 09:46:16 +0800 Subject: [PATCH 22/87] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 2 +- app/api/controller/user/UserController.php | 13 +++++++++++++ app/api/logic/store/StoreLogic.php | 8 +++----- app/api/logic/user/AddressLogic.php | 13 ++++++++++--- app/api/logic/user/UserLogic.php | 16 ++++++++++++++++ app/store/controller/user/AddressController.php | 2 +- 6 files changed, 44 insertions(+), 10 deletions(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index a5c93465a..c9cb3564e 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -51,7 +51,7 @@ class StoreController extends BaseApiController $info = StoreLogic::search($where); if ($info) { - return $this->success('ok',$info??[]); + return $this->success('ok',$info); } else { return $this->fail('店铺不存在'); } diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index 457598205..148a25b58 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -147,6 +147,7 @@ class UserController extends BaseApiController return $this->fail('发送失败'); } + //登录 public function login_sms() { $params = (new UserValidate())->post()->goCheck('login'); @@ -157,6 +158,18 @@ class UserController extends BaseApiController return $this->fail('发送失败'); } + + //报备 + public function reporting_sms() + { + $params = (new UserValidate())->post()->goCheck('login'); + $res = (new UserLogic())->dealReportingSms($params['account']); + if ($res){ + return $this->success('发送成功'); + } + return $this->fail('发送失败'); + + } diff --git a/app/api/logic/store/StoreLogic.php b/app/api/logic/store/StoreLogic.php index f9fd39616..1f8c418ed 100644 --- a/app/api/logic/store/StoreLogic.php +++ b/app/api/logic/store/StoreLogic.php @@ -12,15 +12,13 @@ class StoreLogic extends BaseLogic public static function search($param) { - return SystemStore::where($param) + $data = SystemStore::where($param) ->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show', 'day_time', 'is_store', 'latitude', 'longitude', 'day_start', 'day_end', 'is_store' , 'is_send' ]) - ->find() - ->toArray(); - - + ->find(); + return $data ? $data->toArray() : []; } diff --git a/app/api/logic/user/AddressLogic.php b/app/api/logic/user/AddressLogic.php index c2393319b..aeb07f57a 100644 --- a/app/api/logic/user/AddressLogic.php +++ b/app/api/logic/user/AddressLogic.php @@ -59,14 +59,15 @@ class AddressLogic extends BaseLogic { Db::startTrans(); try { - if($params['is_default']==1){ + $is_default = $params['is_default'] ??0; + if($is_default==1){ UserAddress::where('uid',$params['uid'])->update(['is_default'=>0]); } $data = [ 'real_name' => $params['real_name'], 'phone' => $params['phone'], - 'detail' => $params['detail'], - 'is_default' => $params['is_default'], + 'detail' => $params['detail']??'', + 'is_default' => $params['is_default']??0, 'province' => $params['province'], 'city' => $params['city'], 'area' => $params['area'], @@ -109,4 +110,10 @@ class AddressLogic extends BaseLogic { return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where('id',$params['address_id'])->findOrEmpty()->toArray(); } + + + public static function info($params): array + { + return UserAddress::field('id,real_name,phone,province,city,area,street,village,brigade,detail,is_default')->where($params)->findOrEmpty()->toArray(); + } } diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 0b38b2726..8fac69153 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -211,6 +211,22 @@ class UserLogic extends BaseLogic } + public function dealReportingSms($phone) + { + $code = generateRandomCode(); + $template = getenv('SMS_LOGIN_TEMPLATE'); + $check =(new SmsService())->client($phone,$template,$code); + if($check){ + $remark = $phone.'_reporting'; + Cache::set($remark,$code,5*60); + return true; + }else{ + return false; + } + + } + + public static function dealPayPassword($params,$uid) diff --git a/app/store/controller/user/AddressController.php b/app/store/controller/user/AddressController.php index b3a74cf8b..5563dc142 100644 --- a/app/store/controller/user/AddressController.php +++ b/app/store/controller/user/AddressController.php @@ -44,6 +44,6 @@ class AddressController extends BaseAdminController if($uid){ $params = ['uid' => $uid]; } - return $this->success('获取成功',AddressLogic::detail($params)); + return $this->success('获取成功',AddressLogic::info($params)); } } From af396c6b16bb9f036138bb3b6525a4bb33ddcd90 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 10:18:33 +0800 Subject: [PATCH 23/87] =?UTF-8?q?feat(CartList):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=BB=A1=E5=87=8F=E6=B4=BB=E5=8A=A8=E9=80=BB=E8=BE=91=E5=92=8C?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/store_product/StoreProductLogic.php | 3 ++ app/api/lists/order/CartList.php | 43 +++++++++++++------ 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index b2784d03c..8cdfb894c 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -39,6 +39,7 @@ class StoreProductLogic extends BaseLogic $data = [ 'store_name' => $params['store_name'], 'image' => $params['image'], + 'store_info' => $params['store_info'] ?? '', 'bar_code' => $params['bar_code'] ?? '', 'cate_id' => $params['cate_id'], 'unit' => $params['unit'], @@ -140,6 +141,7 @@ class StoreProductLogic extends BaseLogic 'store_name' => $params['store_name'], 'image' => $params['image'], 'bar_code' => $params['bar_code'] ?? '', + 'store_info' => $params['store_info'] ?? '', 'cate_id' => $params['cate_id'], 'unit' => $params['unit'], 'stock' => $params['stock'], @@ -181,6 +183,7 @@ class StoreProductLogic extends BaseLogic 'cost' => $params['cost'],'unit'=>$params['unit'], 'batch'=>$params['batch'],'store_name'=>$params['store_name'], 'manufacturer_information' => $params['manufacturer_information']??'', + 'store_info' => $params['store_info']??'', ]); Db::commit(); diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index 652c9eedf..43765c46b 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -7,6 +7,7 @@ use app\admin\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\order\Cart; use app\common\lists\ListsExtendInterface; +use app\common\model\Config; use app\common\model\dict\DictType; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_product_attr_value\StoreProductAttrValue; @@ -23,6 +24,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists protected $total_price = 0; protected $activity_price = 0; + protected $off_activity = 0; /** @@ -60,27 +62,33 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists return $item; }) ->toArray(); - // $check = DictType::where('type', 'activities')->find(); + $off_activity = Config::where('name', 'off_activity')->value('value'); + $this->off_activity=$off_activity; $user = User::where('id', $userId)->find(); foreach ($list as $key => &$item) { - $find = StoreBranchProduct::where(['product_id' => $item['product_id'],'store_id' => $item['store_id']]) + $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']]) ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price') ->withTrashed() ->find(); if ($find) { - if ($user && $user['user_ship'] == 1) { - //更新 会员为1的时候原价减去会员价 - $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$item['cart_num'],2); - $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); - }elseif ($user && $user['user_ship'] == 4) { - //更新 为4商户的时候减去商户价格 - $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$item['cart_num'],2); - $this->activity_price = bcadd( $this->activity_price, $deduction_price_count, 2); + if($off_activity==1){ + $this->activity_price = bcadd(bcmul($item['cost'],$item['cart_num'], 2), $this->activity_price, 2); }else{ - $this->activity_price =0; + if ($user && $user['user_ship'] == 1) { + //更新 会员为1的时候原价减去会员价 + $deduction_price_count = bcmul(bcsub($find['price'], $find['vip_price'], 2), $item['cart_num'], 2); + $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); + } elseif ($user && $user['user_ship'] == 4) { + //更新 为4商户的时候减去商户价格 + $deduction_price_count = bcmul(bcsub($find['price'], $find['cost'], 2), $item['cart_num'], 2); + $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); + } else { + $this->activity_price = 0; + } } + $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['imgs'] = $find['image']; @@ -111,10 +119,19 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists public function extend() { - return [ + $data= [ + 'off_activity' => $this->off_activity, 'total_price' => $this->total_price, 'activity_price' => $this->activity_price, - 'pay_price'=> bcsub($this->total_price, $this->activity_price, 2) + 'msg' => '', + 'pay_price' => bcsub($this->total_price, $this->activity_price, 2) ]; + if($this->off_activity==1){ + $data['pay_price']=$this->activity_price; + if($this->activity_price<500){ + $data['msg']='还差'.bcsub(500,$this->activity_price,2).'元可参与满减活动'; + } + } + return $data; } } From 151c24fdf3c7990cb5b40845c3fa93cc264b873f Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 10:21:24 +0800 Subject: [PATCH 24/87] =?UTF-8?q?feat(CartList):=20=E6=A0=B9=E6=8D=AEoff?= =?UTF-8?q?=5Factivity=E6=9B=B4=E6=96=B0activity=5Fprice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/CartList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index 43765c46b..76e9ddf34 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -74,7 +74,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists if ($find) { if($off_activity==1){ - $this->activity_price = bcadd(bcmul($item['cost'],$item['cart_num'], 2), $this->activity_price, 2); + $this->activity_price = bcadd(bcmul($find['cost'],$find['cart_num'], 2), $this->activity_price, 2); }else{ if ($user && $user['user_ship'] == 1) { //更新 会员为1的时候原价减去会员价 From 995443f6667c386b77d0d720e58d2d20150baf54 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 10:24:18 +0800 Subject: [PATCH 25/87] =?UTF-8?q?feat(CartList.php):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?= =?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/lists/order/CartList.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index 76e9ddf34..16875867c 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -74,7 +74,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists if ($find) { if($off_activity==1){ - $this->activity_price = bcadd(bcmul($find['cost'],$find['cart_num'], 2), $this->activity_price, 2); + $this->activity_price = bcadd(bcmul($find['cost'],$item['cart_num'], 2), $this->activity_price, 2); }else{ if ($user && $user['user_ship'] == 1) { //更新 会员为1的时候原价减去会员价 @@ -128,8 +128,9 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists ]; if($this->off_activity==1){ $data['pay_price']=$this->activity_price; - if($this->activity_price<500){ - $data['msg']='还差'.bcsub(500,$this->activity_price,2).'元可参与满减活动'; + if($this->total_price<500){ + $data['msg']='还差'.bcsub(500,$this->total_price,2).'元可参与满减活动'; + $data['pay_price']= $this->total_price; } } return $data; From 9406d2ba2635fb2aea58f5744705e53d05ab5513 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 25 Jun 2024 10:39:37 +0800 Subject: [PATCH 26/87] =?UTF-8?q?=E6=8A=A5=E5=A4=87=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index c9cb3564e..12c31fec1 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -16,6 +16,7 @@ use app\common\model\Config; use app\common\model\user\User; use app\common\model\user_create_log\UserCreateLog; use app\common\model\user_recharge\UserRecharge; +use support\Cache; use Webman\RedisQueue\Redis; class StoreController extends BaseApiController @@ -41,6 +42,7 @@ class StoreController extends BaseApiController { $store_id = (int)$this->request->get('store_id'); $phone = (int)$this->request->get('phone'); + $code = $this->request->get('code',''); $where = []; if($phone){ $where['phone'] = $phone; @@ -48,6 +50,16 @@ class StoreController extends BaseApiController if($store_id){ $where['id'] = $store_id; } + if($code && $phone){ + $remark = $phone.'_reporting'; + $codeCache = Cache::get($remark); + if(empty($codeCache)){ + return $this->fail('验证码不存在'); + } + if ($codeCache != $code) { + return $this->fail('验证码错误'); + } + } $info = StoreLogic::search($where); if ($info) { From 506073629ea7235e642681d2113e6b16844e1ce4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 10:53:25 +0800 Subject: [PATCH 27/87] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=8C=89?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/statistics/controller/IndexController.php | 49 +++++++++---------- app/statistics/logic/OrderLogic.php | 14 ++++-- app/statistics/logic/ProductLogic.php | 10 ++-- 3 files changed, 38 insertions(+), 35 deletions(-) diff --git a/app/statistics/controller/IndexController.php b/app/statistics/controller/IndexController.php index 0e4957275..e6f2ed0f4 100644 --- a/app/statistics/controller/IndexController.php +++ b/app/statistics/controller/IndexController.php @@ -2,6 +2,7 @@ namespace app\statistics\controller; +use app\admin\logic\statistic\TradeStatisticLogic; use app\common\controller\BaseLikeController; use app\statistics\logic\OrderLogic; use app\statistics\logic\ProductLogic; @@ -15,12 +16,13 @@ class IndexController extends BaseLikeController public function index() { + $time=$this->request->get('date',date('Y-m-d')); $store_id = $this->store_id; if($store_id){ $where['store_id'] = $store_id; } $where['paid'] = 1; - $res = OrderLogic::dayPayPrice($where); + $res = OrderLogic::dayPayPrice($where,$time); if (OrderLogic::hasError()) { return $this->fail(OrderLogic::getError()); //获取错误信息并返回错误信息 } @@ -28,7 +30,8 @@ class IndexController extends BaseLikeController } public function user() { - $today = strtotime(date('Y-m-d')); + $time=$this->request->get('date',date('Y-m-d')); + $today = strtotime($time); $dates=[]; // 循环输出前5天的日期 for ($i = 0; $i <= 4; $i++) { @@ -56,12 +59,13 @@ class IndexController extends BaseLikeController */ public function product_count() { + $time=$this->request->get('date',date('Y-m-d')); $store_id = $this->store_id; $where=[]; if($store_id){ $where['store_id'] = $store_id; } - $res = ProductLogic::Count($where); + $res = ProductLogic::Count($where,$time); if (ProductLogic::hasError()) { return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 } @@ -72,12 +76,13 @@ class IndexController extends BaseLikeController */ public function order_user_num_count() { + $time=$this->request->get('date',date('Y-m-d')); $store_id = $this->store_id; $where=[]; if($store_id){ $where['store_id'] = $store_id; } - $res = OrderLogic::Count($where); + $res = OrderLogic::Count($where,$time); if (ProductLogic::hasError()) { return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 } @@ -88,12 +93,13 @@ class IndexController extends BaseLikeController */ public function sales_ranking() { + $time=$this->request->get('date',date('Y-m-d')); $store_id = $this->store_id; $where=[]; if($store_id){ $where['store_id'] = $store_id; } - $res = ProductLogic::sales($where); + $res = OrderLogic::sales($where,$time); if (ProductLogic::hasError()) { return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 } @@ -104,38 +110,31 @@ class IndexController extends BaseLikeController */ public function user_trade_count() { - $dates = []; + $logic=(new TradeStatisticLogic()); + $leftToday = $logic->getTopLeftTrade(['create_time' => 'today']); + $leftyestoday = $logic->getTopLeftTrade(['create_time' => 'yestoday']); + $totalleft = [$leftToday, $leftyestoday]; + foreach ($totalleft as $k => $v) { + $left['name'] = "当日订单金额"; + $left['x'] = $v['curve']['x']; + $left['series'][$k]['money'] = round($v['total_money'], 2); + $left['series'][$k]['value'] = array_values($v['curve']['y']); + } - $today = new DateTime(); - $thirtyDaysAgo = new DateTime($today->format('Y-m-d')); - $thirtyDaysAgo->modify('-30 days'); - for ($i = 0; $i < 31; $i++) { - $date = new DateTime($thirtyDaysAgo->format('Y-m-d')); - $date->modify('+' . $i . ' days'); - $dates[] = $date->format('Y-m-d'); - } - $store_id = $this->store_id; - $where=[]; - if($store_id){ - $where['store_id'] = $store_id; - } - $res = UserLogic::TradeCount($where, $dates); - if (UserLogic::hasError()) { - return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息 - } - return $this->success('ok', $res); + return $this->data($left); } /** * 当日订单金额 */ public function street_currday_order_count() { + $time=$this->request->get('date',date('Y-m-d')); $store_id = $this->store_id; $where=[]; if($store_id){ $where['store_id'] = $store_id; } - $res = OrderLogic::Currday($where); + $res = OrderLogic::Currday($where,$time); if (ProductLogic::hasError()) { return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 } diff --git a/app/statistics/logic/OrderLogic.php b/app/statistics/logic/OrderLogic.php index 5c32bee1c..3f1617ac7 100644 --- a/app/statistics/logic/OrderLogic.php +++ b/app/statistics/logic/OrderLogic.php @@ -26,9 +26,8 @@ class OrderLogic extends BaseLogic ]; return $data; } - public static function Currday($where) + public static function Currday($where,$date) { - $date = date("Y-m-d"); $startTime = strtotime($date . ' 00:00:00'); // 当天的开始时间戳 $endTime = strtotime($date . ' 23:59:59'); // 当天的结束时间戳 @@ -57,14 +56,19 @@ class OrderLogic extends BaseLogic } return $data; } - public static function dayPayPrice($where) + public static function dayPayPrice($where,$time) { $todayAmount = UserRecharge::where($where) - ->whereDay('create_time') + ->whereDay('create_time',$time) ->sum('price'); $pay_price = StoreOrder::where($where) - ->whereDay('create_time') + ->whereDay('create_time',$time) ->sum('pay_price'); return bcadd($todayAmount, $pay_price, 2); } + + public static function sales($where,$time){ + $select=StoreOrder::where($where)->whereDay('create_time',$time)->limit(10)->order('id desc')->field('id,order_id,pay_price,create_time')->select(); + return $select?->toArray(); + } } diff --git a/app/statistics/logic/ProductLogic.php b/app/statistics/logic/ProductLogic.php index 2abe8ab06..8fad8de91 100644 --- a/app/statistics/logic/ProductLogic.php +++ b/app/statistics/logic/ProductLogic.php @@ -7,18 +7,18 @@ use app\common\model\store_branch_product\StoreBranchProduct; class ProductLogic extends BaseLogic { - public static function Count($where) + public static function Count($where,$time) { - $todayProductCount=StoreBranchProduct::where($where)->count(); - $yestertodayProductCount=StoreBranchProduct::where($where)->where('create_time', '<',strtotime(date('Y-md'))-1)->count(); + $todayProductCount=StoreBranchProduct::where($where)->whereDay($time)->count(); + $yestertodayProductCount=StoreBranchProduct::where($where)->where('create_time', '<',strtotime($time)-1)->count(); if ($yestertodayProductCount == 0 ||$todayProductCount==0) { $weeklyProductTotalGrowthRate = 0; } else { $weeklyProductTotalGrowthRate = ($todayProductCount - $yestertodayProductCount) / $yestertodayProductCount * 100; } - $todayNewProductCount=StoreBranchProduct::where($where)->whereDay('create_time')->count(); - $yestertodayNewProductCount=StoreBranchProduct::where($where)->whereDay('create_time', 'yesterday')->count(); + $todayNewProductCount=StoreBranchProduct::where($where)->whereDay('create_time',$time)->count(); + $yestertodayNewProductCount=StoreBranchProduct::where($where)->whereDay('create_time', date('Y-m-d',strtotime($time)-1))->count(); if ($yestertodayProductCount == 0 ||$todayProductCount==0) { $weeklyNewProductTotalGrowthRate = 0; } else { From 777c3e8e5696c83bd4ef204c3fcaedd797518e7c Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 25 Jun 2024 11:02:49 +0800 Subject: [PATCH 28/87] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/validate/user/UserValidate.php | 3 ++- app/api/logic/user/UserLogic.php | 4 +-- app/store/controller/user/UserController.php | 28 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/app/admin/validate/user/UserValidate.php b/app/admin/validate/user/UserValidate.php index f08c15182..b23470481 100644 --- a/app/admin/validate/user/UserValidate.php +++ b/app/admin/validate/user/UserValidate.php @@ -35,6 +35,7 @@ class UserValidate extends BaseValidate 'brigade' => 'require', 'user_ship' => 'require', 'type' => 'require|number', + 'code' => 'require|number', ]; @@ -59,8 +60,8 @@ class UserValidate extends BaseValidate 'brigade' => ' 队', 'user_ship' => ' 会员类型', 'type' => '查询类型', + 'code' => '验证码', ]; - public function sceneFund() { return $this->only(['type','id']); diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 8fac69153..d63b83999 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -211,13 +211,13 @@ class UserLogic extends BaseLogic } - public function dealReportingSms($phone) + public function dealReportingSms($phone,$string = '_reporting') { $code = generateRandomCode(); $template = getenv('SMS_LOGIN_TEMPLATE'); $check =(new SmsService())->client($phone,$template,$code); if($check){ - $remark = $phone.'_reporting'; + $remark = $phone.$string; Cache::set($remark,$code,5*60); return true; }else{ diff --git a/app/store/controller/user/UserController.php b/app/store/controller/user/UserController.php index 5e45e7786..dd6b82e4b 100644 --- a/app/store/controller/user/UserController.php +++ b/app/store/controller/user/UserController.php @@ -4,11 +4,13 @@ namespace app\store\controller\user; +use app\common\service\SmsService; use app\store\controller\BaseAdminController; use app\store\lists\user\UserLists; use app\admin\logic\user\UserLogic; use app\admin\validate\user\UserValidate; use app\common\model\user\User; +use support\Cache; class UserController extends BaseAdminController { @@ -18,10 +20,36 @@ class UserController extends BaseAdminController return $this->dataLists(new UserLists()); } + /** + * 用户档案短信 + * @return \support\Response + */ + public function archives_sms() + { + $mobile = $this->request->post('mobile',''); + if (empty($mobile)) + return $this->fail('手机号缺失'); + $res = (new \app\api\logic\user\UserLogic())->dealReportingSms($mobile,'_userArchives'); + if ($res){ + return $this->success('发送成功'); + } + return $this->fail('发送失败'); + } public function add() { $params = (new UserValidate())->post()->goCheck('storeAdd'); + $code = $params['code']; + if($code && $params['mobile']){ + $remark = $params['mobile'].'_userArchives'; + $codeCache = Cache::get($remark); + if(empty($codeCache)){ + return $this->fail('验证码不存在'); + } + if ($codeCache != $code) { + return $this->fail('验证码错误'); + } + } UserLogic::StoreAdd($params); if (UserLogic::hasError() ) { return $this->fail(UserLogic::getError()); From 8efd10698975e72ce40251a8cac23efd07133e53 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 11:05:19 +0800 Subject: [PATCH 29/87] =?UTF-8?q?feat(PayNotifyLogic):=20=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E9=85=8D=E7=BD=AE=E7=9A=84=E9=87=91=E9=A2=9D=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=94=A8=E6=88=B7=E7=AD=89=E7=BA=A7=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AE=A2=E5=8D=95=E6=94=AF=E4=BB=98=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 3 ++- app/queue/redis/CodePaySend.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 7450440c6..28c71a124 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -421,7 +421,7 @@ class PayNotifyLogic extends BaseLogic bcscale(2); // $user->now_money = bcadd($user->now_money, $price, 2);//v.1 //更新等级 - if ($price >= 0.01) { + if ($price >= Config::where('name','recharge')->value('value')) { $user->user_ship = 1; //v.1 } $user->purchase_funds = bcadd($user->purchase_funds, $price, 2); @@ -432,6 +432,7 @@ class PayNotifyLogic extends BaseLogic if (!empty($extra['payer']['openid'])) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 3], 4); } + PushService::push('wechat_mmp_' . $order['uid'], $order['uid'], ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]); return true; } diff --git a/app/queue/redis/CodePaySend.php b/app/queue/redis/CodePaySend.php index df95edba1..3c4d781ba 100644 --- a/app/queue/redis/CodePaySend.php +++ b/app/queue/redis/CodePaySend.php @@ -55,7 +55,7 @@ class CodePaySend implements Consumer if($order){ $res=UserRecharge::where($data)->update(['status'=>-1]); if($res){ - PushService::push('wechat_mmp_' . $order['uid'], $order['uid'], ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>$data['id']]]); + PushService::push('wechat_mmp_' . $order['uid'], $order['uid'], ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>$data['id'],'paid'=>0]]); } } }else{ From d3f90f03afb0976aca26fa66f18014e00190fb4a Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 11:21:32 +0800 Subject: [PATCH 30/87] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=E5=B9=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=88=90=E5=8A=9F=E6=94=AF=E4=BB=98=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 28c71a124..2fcd361d0 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -41,14 +41,6 @@ class PayNotifyLogic extends BaseLogic { Db::startTrans(); try { - if ($action != 'cash_pay' && $action != 'balancePay' && $action != 'purchase_funds' && $action != 'gift_pay') { - $payNotifyLogLogic = new PayNotifyLogLogic(); - if ($action == 'refund') { - $payNotifyLogLogic->insert($action, $extra, PayNotifyLog::TYPE_REFUND); - } else { - $payNotifyLogLogic->insert($action, $extra); - } - } self::$action($orderSn, $extra, $type); Db::commit(); return true; @@ -428,11 +420,11 @@ class PayNotifyLogic extends BaseLogic $user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2); $user->save(); + PushService::push('wechat_mmp_' . $uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]); if (!empty($extra['payer']['openid'])) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 3], 4); } - PushService::push('wechat_mmp_' . $order['uid'], $order['uid'], ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]); return true; } From de20073ad3da488df19b1f6fc9a4935843f6b139 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 25 Jun 2024 11:41:49 +0800 Subject: [PATCH 31/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/validate/UserValidate.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/api/validate/UserValidate.php b/app/api/validate/UserValidate.php index 2bac53011..29d3e3a5c 100644 --- a/app/api/validate/UserValidate.php +++ b/app/api/validate/UserValidate.php @@ -4,6 +4,7 @@ namespace app\api\validate; +use app\common\model\auth\Admin; use app\common\validate\BaseValidate; /** @@ -19,8 +20,8 @@ class UserValidate extends BaseValidate 'store_id' => 'require', 'mobile' => 'require', 'phone' => 'require|number', - 'password' => 'require', - 'rePassword' => 'require', + 'password' => 'require|length:6', + 'rePassword' => 'require|requireWith:password|confirm:password', 'type' => 'require', 'account' => 'require', @@ -32,8 +33,8 @@ class UserValidate extends BaseValidate 'mobile.require' => '手机', 'phone.require' => '手机', 'account.require' => '手机', - 'password.require' => '密码', - 'rePassword.require' => '确认密码', + 'password.require' => '密码缺失', + 'rePassword.require' => '确认密码缺失', 'type' => '查询类型', ]; From 287cd9d2ffbacfedd782b00e278f60cdd450fa04 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 11:50:54 +0800 Subject: [PATCH 32/87] =?UTF-8?q?feat(PushService):=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95PushService::push=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/PushService.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/common/service/PushService.php b/app/common/service/PushService.php index 83b42a190..1dc695b6a 100644 --- a/app/common/service/PushService.php +++ b/app/common/service/PushService.php @@ -2,6 +2,7 @@ namespace app\common\service; +use support\Log; use Webman\Push\Api; class PushService @@ -15,6 +16,7 @@ class PushService */ public static function push($subscription, $uid, $content) { + Log::info('PushService::push', [$subscription, $uid, $content]); $api = new Api( getenv('PUSH_URL'), config('plugin.webman.push.app.app_key'), From a66017a21e16544e413279ade19abbf4cb5c0381 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 13:34:15 +0800 Subject: [PATCH 33/87] =?UTF-8?q?feat(StoreController):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0other=5Fuid=E5=88=B0=E6=94=AF=E4=BB=98=E8=AE=A2?= =?UTF-8?q?=E5=8D=95API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 1 + app/common/logic/PayNotifyLogic.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 12c31fec1..166bf0eeb 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -91,6 +91,7 @@ class StoreController extends BaseApiController $data=[ 'store_id'=>$params['store_id'], 'uid'=>$find['id'], + 'other_uid'=>$this->userId, 'staff_id'=>0, 'order_id'=>getNewOrderId('CZ'), 'price'=>Config::where('name','recharge')->value('value')??1000, diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 2fcd361d0..431a3ca62 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -419,7 +419,9 @@ class PayNotifyLogic extends BaseLogic $user->purchase_funds = bcadd($user->purchase_funds, $price, 2); $user->total_recharge_amount = bcadd($user->total_recharge_amount, $price, 2); $user->save(); - + if($order['other_uid']>0){ + $uid=$order['other_uid']; + } PushService::push('wechat_mmp_' . $uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]); if (!empty($extra['payer']['openid'])) { From 2d0dcf8a4be1191ae7bf3cc285902ed166190c45 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 14:08:10 +0800 Subject: [PATCH 34/87] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E7=B1=BB=E5=9E=8B=E5=8F=82=E6=95=B0=E5=88=B0=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=AD=98=E5=82=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/store_product/StoreProductLogic.php | 2 +- app/api/controller/IndexController.php | 6 +++++- app/queue/redis/StoreStorageSend.php | 1 + app/statistics/controller/IndexController.php | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/admin/logic/store_product/StoreProductLogic.php b/app/admin/logic/store_product/StoreProductLogic.php index 8cdfb894c..bcecea565 100644 --- a/app/admin/logic/store_product/StoreProductLogic.php +++ b/app/admin/logic/store_product/StoreProductLogic.php @@ -53,6 +53,7 @@ class StoreProductLogic extends BaseLogic 'manufacturer_information' => $params['manufacturer_information']??'', 'swap' => $params['swap'] ?? 0, 'batch' => $params['batch'] ?? 0, + 'product_type' => $params['product_type'] ?? 0, ]; // if ($params['rose'] > 0) { // $rose_price = bcmul($params['cost'], $params['rose'], 2); @@ -154,7 +155,6 @@ class StoreProductLogic extends BaseLogic 'batch' => $params['batch'], 'manufacturer_information' => $params['manufacturer_information']??'', 'swap' => $params['swap'] ?? 0, - ]; StoreProduct::where('id', $params['id'])->update($data); diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 415e8f76c..e7cd97861 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -10,6 +10,7 @@ use app\common\model\Config as ModelConfig; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\system_store\SystemStore; use app\common\service\pay\PayService; +use app\common\service\PushService; use app\common\service\wechat\WechatTemplate; use Exception; use support\Cache; @@ -28,7 +29,10 @@ class IndexController extends BaseApiController public function index() { -d(2); + $uid=9; + $a= PushService::push('wechat_mmp_'.$uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>5]]); + +return json($a); diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index 33b263814..02e7eefe6 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -64,6 +64,7 @@ class StoreStorageSend implements Consumer 'batch' => $find['batch'], 'store_id' => $store_id, 'sales' => 0, + 'product_type' => $find['product_type'], 'stock' => 0, ]; $branch = StoreBranchProduct::create($product); diff --git a/app/statistics/controller/IndexController.php b/app/statistics/controller/IndexController.php index e6f2ed0f4..2e0099062 100644 --- a/app/statistics/controller/IndexController.php +++ b/app/statistics/controller/IndexController.php @@ -12,7 +12,7 @@ use DateTime; class IndexController extends BaseLikeController { - public $store_id=3; + public $store_id=0; public function index() { From f93afed82e6bf076c5dfb0554df79a13c1103159 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 14:11:39 +0800 Subject: [PATCH 35/87] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=94=AF=E4=BB=98=E6=88=90=E5=8A=9F=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 431a3ca62..ad000f294 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -423,7 +423,7 @@ class PayNotifyLogic extends BaseLogic $uid=$order['other_uid']; } PushService::push('wechat_mmp_' . $uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]); - + PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]); if (!empty($extra['payer']['openid'])) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 3], 4); } From fa3b17123b7fbedf31754899bc580af8595b952d Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 14:18:32 +0800 Subject: [PATCH 36/87] =?UTF-8?q?feat:=20=E9=87=8D=E6=9E=84ListsSearchTrai?= =?UTF-8?q?t=E7=B1=BB=E4=B8=AD=E7=9A=84=E6=90=9C=E7=B4=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=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/common/lists/ListsSearchTrait.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/app/common/lists/ListsSearchTrait.php b/app/common/lists/ListsSearchTrait.php index 4a92cef50..c7d7e7091 100644 --- a/app/common/lists/ListsSearchTrait.php +++ b/app/common/lists/ListsSearchTrait.php @@ -22,23 +22,6 @@ trait ListsSearchTrait return []; } $where = []; - $class_key = $this->request->__get('class_key'); - if ($class_key !== null) { - foreach ($class_key as $key => $value) { - if (isset($search[$key])) { - foreach ($value as $v) { // 遍历class_key的值,添加到search数组中 - array_push($search[$key], $v); // 添加class_key的搜索条件 - } - } else { - $search[$key] = [$value[0]]; // 创建新的搜索条件 - } - } - } - - $class_value = $this->request->__get('class_value'); // 获取class_value的值 - if ($class_value !== null) { - $this->params = array_merge($this->params, $class_value); - } foreach ($search as $whereType => $whereFields) { switch ($whereType) { case '=': From bbea3f74eed804038c712982400c33e38779d272 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 25 Jun 2024 14:22:55 +0800 Subject: [PATCH 37/87] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=89=8B=E6=9C=BA?= =?UTF-8?q?=E5=8F=B7=E7=9B=B8=E5=85=B3=E5=92=8C=E5=95=86=E5=93=81=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/product/ProductLists.php | 28 +------------------------- app/api/logic/user/UserLogic.php | 10 ++++++++- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index 85efb1ae4..2644ed0bd 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -37,6 +37,7 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L if ($name) { if (preg_match('/[\x{4e00}-\x{9fff}]+/u', $name) == 1) { $where['%like%'] = ['store_name' => 'store_name']; + $where['='] = ['store_id', 'bar_code', 'cate_id']; } else { $where['='] = ['bar_code', 'cate_id']; } @@ -79,20 +80,6 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L */ public function lists(): array { - - $found = false; - if ($this->searchWhere) { - foreach ($this->searchWhere as $subArray) { - if (in_array('store_id', $subArray)) { - $found = true; - break; // 找到后退出循环 - } - } - } - if (!$found) { - $store_id = DictType::where('type', 'store')->value('remark') ?? 5; - $this->searchWhere[] = ['store_id', '=', $store_id]; - } $class_all = $this->request->get('class_all'); if ($class_all) { //查3级别的 @@ -127,19 +114,6 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L */ public function count(): int { - $found = false; - if ($this->searchWhere) { - foreach ($this->searchWhere as $subArray) { - if (in_array('store_id', $subArray)) { - $found = true; - break; // 找到后退出循环 - } - } - } - if (!$found) { - $store_id = DictType::where('type', 'store')->value('remark') ?? 5; - $this->searchWhere[] = ['store_id', '=', $store_id]; - } $class_all = $this->request->get('class_all'); if ($class_all) { //查3级别的 diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index d63b83999..67c7e4fc5 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -3,6 +3,7 @@ namespace app\api\logic\user; +use app\api\service\UserTokenService; use app\common\{logic\BaseLogic, model\dict\DictData, model\finance\CapitalFlow, @@ -53,8 +54,15 @@ class UserLogic extends BaseLogic ['id', '<>', $params['user_id']] ])->findOrEmpty(); + if (!$user->isEmpty()) { - throw new \Exception('手机号已被其他账号绑定'); + //切换被绑定账号删除该账号并且以新的账号登录 + UserAuth::where('user_id',$params['user_id'])->update([ + 'user_id'=>$user['id'] + ]); + + return $user['id']; +// throw new \Exception('手机号已被其他账号绑定'); } // 绑定手机号 From 5d5b2a28cacacb27b525f20390364af18f97248e Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 14:34:11 +0800 Subject: [PATCH 38/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9ProductLists?= =?UTF-8?q?=E7=B1=BB=E5=AE=9E=E7=8E=B0=E6=90=9C=E7=B4=A2=E3=80=81=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E5=92=8C=E6=89=A9=E5=B1=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/product/ProductLists.php | 43 ++++++-------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index 2644ed0bd..8ccab3a48 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -20,7 +20,7 @@ use think\facade\Db; * Class goods * @package app\api\goods */ -class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface,ListsExtendInterface +class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, ListsSortInterface, ListsExtendInterface { @@ -32,20 +32,10 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L */ public function setSearch(): array { - $name = $this->request->get('store_name', ''); - // $where['%pipe_like%'] =['name'=>'store_name|bar_code']; - if ($name) { - if (preg_match('/[\x{4e00}-\x{9fff}]+/u', $name) == 1) { - $where['%like%'] = ['store_name' => 'store_name']; - $where['='] = ['store_id', 'bar_code', 'cate_id']; - } else { - $where['='] = ['bar_code', 'cate_id']; - } - } else { - $where['='] = ['store_id', 'bar_code', 'cate_id']; - } - - return $where; + return [ + '=' => ['store_id', 'cate_id'], + '%pipe_like%' => ['store_name' => 'store_name|bar_code'], + ]; } /** * @notes 设置支持排序字段 @@ -114,29 +104,16 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L */ public function count(): int { - $class_all = $this->request->get('class_all'); - if ($class_all) { - //查3级别的 - $arr = Cate::where('pid', $class_all)->column('id'); - if ($arr) { - $arr2 = Cate::where('pid', 'in', $arr)->column('id'); - $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)]; - } else { - $this->searchWhere[] = ['cate_id', '=', $class_all]; - } - } - - $this->searchWhere[] = ['status', '=', 1]; - $this->searchWhere[] = ['stock', '>', 0]; return StoreBranchProduct::where($this->searchWhere) ->count(); } - public function extend(){ + public function extend() + { $off_activity = Config::where('name', 'off_activity')->value('value'); return [ - 'off_activity'=>$off_activity, - 'price'=>'cost', - 'op_price'=>'price', + 'off_activity' => $off_activity, + 'price' => 'cost', + 'op_price' => 'price', ]; } } From 4a7a1fa263025f2a8cc77b309c57739253b73285 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 25 Jun 2024 15:05:58 +0800 Subject: [PATCH 39/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E6=A0=A1=E9=AA=8C=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 24 ++++++++++---------- app/api/controller/user/UserController.php | 12 ++++++++-- app/api/logic/user/UserLogic.php | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index 166bf0eeb..cda667c89 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -42,7 +42,6 @@ class StoreController extends BaseApiController { $store_id = (int)$this->request->get('store_id'); $phone = (int)$this->request->get('phone'); - $code = $this->request->get('code',''); $where = []; if($phone){ $where['phone'] = $phone; @@ -50,17 +49,6 @@ class StoreController extends BaseApiController if($store_id){ $where['id'] = $store_id; } - if($code && $phone){ - $remark = $phone.'_reporting'; - $codeCache = Cache::get($remark); - if(empty($codeCache)){ - return $this->fail('验证码不存在'); - } - if ($codeCache != $code) { - return $this->fail('验证码错误'); - } - } - $info = StoreLogic::search($where); if ($info) { return $this->success('ok',$info); @@ -77,6 +65,18 @@ class StoreController extends BaseApiController $params = (new UserValidate())->post()->goCheck('rechargeStoreMoney'); $auth_code = $this->request->post('auth_code'); //微信支付条码 $recharge_type = $this->request->post('recharge_type',''); //微信支付条码 + $code = $this->request->post('code','');//验证码 + $phone = $params['mobile']; + if($code && $phone){ + $remark = $phone.'_reporting'; + $codeCache = Cache::get($remark); + if(empty($codeCache)){ + return $this->fail('验证码不存在'); + } + if ($codeCache != $code) { + return $this->fail('验证码错误'); + } + } $find=User::where('mobile',$params['mobile'])->find(); if(!$find){ $params['create_uid']=$this->userId; diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index 148a25b58..d6f5b8694 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -4,6 +4,7 @@ namespace app\api\controller\user; use app\api\controller\BaseApiController; use app\api\logic\user\UserLogic; +use app\api\service\UserTokenService; use app\api\validate\UserValidate; use app\common\enum\PayEnum; use app\common\logic\PaymentLogic; @@ -38,7 +39,14 @@ class UserController extends BaseApiController if ($result === false) { return $this->fail(UserLogic::getError()); } - $data = UserLogic::info($this->userId); + if($result && is_numeric($result)){ + $data = UserLogic::info($result); + $userInfo = UserTokenService::setToken($result, 1); + $data['token'] = $userInfo['token']; + }else{ + $data = UserLogic::info($this->userId); + } + return $this->success('绑定成功', $data, 1, 1); } @@ -165,7 +173,7 @@ class UserController extends BaseApiController $params = (new UserValidate())->post()->goCheck('login'); $res = (new UserLogic())->dealReportingSms($params['account']); if ($res){ - return $this->success('发送成功'); + return $this->success('发送成功',[],1,1); } return $this->fail('发送失败'); diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 67c7e4fc5..b98b7c48c 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -60,7 +60,7 @@ class UserLogic extends BaseLogic UserAuth::where('user_id',$params['user_id'])->update([ 'user_id'=>$user['id'] ]); - + User::destroy($params['user_id']); return $user['id']; // throw new \Exception('手机号已被其他账号绑定'); } From 8330a2ffd7a12993a872155a0dca991db045d7e2 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Tue, 25 Jun 2024 15:46:26 +0800 Subject: [PATCH 40/87] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/product/ProductLists.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index 8ccab3a48..ef91ba000 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -81,16 +81,22 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L $this->searchWhere[] = ['cate_id', '=', $class_all]; } } - - $field = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch'; + $order = $this->request->get('order',''); + $field = $this->request->get('field',''); + if(empty($order)||empty($field)){ + $order = $this->sortOrder; + }else{ + $order = [$field => $order]; + } + $fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch'; $this->searchWhere[] = ['status', '=', 1]; $this->searchWhere[] = ['stock', '>', 0]; return StoreBranchProduct::where($this->searchWhere) - ->field($field) + ->field($fields) ->with(['className', 'unitName']) ->limit($this->limitOffset, $this->limitLength) - ->order($this->sortOrder) + ->order($order) // ->page($this->limitOffset +1,$this->limitLength) ->select()->toArray(); } From af75268604814a6e2ffc5478d4b7c0985748a48e Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 16:05:29 +0800 Subject: [PATCH 41/87] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=AD=98=E5=82=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 2 +- app/common/logic/PayNotifyLogic.php | 19 +++++------ .../UserProductStorageLogic.php | 32 +++++++++++++++++++ .../UserProductStorageLogLogic.php | 10 ++++++ .../UserProductStorage.php | 20 ++++++++++++ .../UserProductStorageLog.php | 20 ++++++++++++ 6 files changed, 93 insertions(+), 10 deletions(-) create mode 100644 app/common/logic/user_product_storage/UserProductStorageLogic.php create mode 100644 app/common/logic/user_product_storage_log/UserProductStorageLogLogic.php create mode 100644 app/common/model/user_product_storage/UserProductStorage.php create mode 100644 app/common/model/user_product_storage_log/UserProductStorageLog.php diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 4697609d3..61f5cffe9 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -156,7 +156,6 @@ class OrderLogic extends BaseLogic 'order_id' => $params['order_id'] ?? getNewOrderId('PF'), 'total_price' => self::$total_price, //总价 'cost' => self::$cost, //成本价1- - 'profit' =>0, //利润 'pay_price' => $pay_price, //后期可能有降价抵扣 'vip_price' => 0, 'total_num' => count($cart_select), //总数 @@ -170,6 +169,7 @@ class OrderLogic extends BaseLogic 'activities' => self::$activity_price>0?1:0, 'deduction_price' => self::$activity_price, 'is_vip' => 0, + 'is_storage' => $params['is_storage']??0, ]; $order['default_delivery'] = 0; if ($params['store_id']) { diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index ad000f294..b03b41809 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -7,6 +7,7 @@ use app\common\enum\OrderEnum; use app\common\enum\PayEnum; use app\common\enum\user\UserShipEnum; use app\common\enum\YesNoEnum; +use app\common\logic\user_product_storage\UserProductStorageLogic; use app\common\model\Config; use app\common\model\dict\DictType; use app\common\model\finance\CapitalFlow; @@ -73,6 +74,10 @@ class PayNotifyLogic extends BaseLogic if (!$order->save()) { throw new \Exception('订单保存出错'); } + if($order['is_storage']==1){ + $order->status=2; + UserProductStorageLogic::add($order); + } // 减去余额 $user->now_money = bcsub($user['now_money'], $order['pay_price'], 2); $user->save(); @@ -166,6 +171,10 @@ class PayNotifyLogic extends BaseLogic if (!$order->save()) { throw new \Exception('订单保存出错'); } + if($order['is_storage']==1){ + $order->status=2; + UserProductStorageLogic::add($order); + } // 减去采购款 $user->purchase_funds = bcsub($user['purchase_funds'], $order['pay_price'], 2); $user->save(); @@ -219,6 +228,7 @@ class PayNotifyLogic extends BaseLogic $user = User::where('id', $order['uid'])->find(); if ($order->pay_type == OrderEnum::CASHIER_ORDER_PAY || $order->pay_type == OrderEnum::CASHIER_ORDER_ALI_PAY) { //收银台支付 $order->status = 2; + $order->save(); self::afterPay($order, $extra['transaction_id']); } else { $capitalFlowDao = new CapitalFlowLogic($user); @@ -231,15 +241,6 @@ class PayNotifyLogic extends BaseLogic self::descStock($order['id']); } - // if ($order->pay_type == 9) { - // $extra['create_time'] = $order['create_time']; - // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]); - // Redis::send('push-platform-print', ['id' => $order['id']]); - // } - // else { - // PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); - // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); - // } if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 4); } diff --git a/app/common/logic/user_product_storage/UserProductStorageLogic.php b/app/common/logic/user_product_storage/UserProductStorageLogic.php new file mode 100644 index 000000000..5fc6199b9 --- /dev/null +++ b/app/common/logic/user_product_storage/UserProductStorageLogic.php @@ -0,0 +1,32 @@ +field('product_id,cart_num nums')->select(); + if($arr){ + $data=$arr; + $data_log=$arr; + + foreach ($data as $k=>$v){ + $data[$k]['uid']=$order['uid']; + $data[$k]['oid']=$order['id']; + $data[$k]['status']=1; + $data_log[$k]['uid']=$order['uid']; + $data_log[$k]['oid']=$order['id']; + $data_log[$k]['financial_pm']=1; + } + UserProductStorage::insertAll($data); + UserProductStorageLog::insertAll($data_log); + + } + } + +} \ No newline at end of file diff --git a/app/common/logic/user_product_storage_log/UserProductStorageLogLogic.php b/app/common/logic/user_product_storage_log/UserProductStorageLogLogic.php new file mode 100644 index 000000000..686bc0b0f --- /dev/null +++ b/app/common/logic/user_product_storage_log/UserProductStorageLogLogic.php @@ -0,0 +1,10 @@ + Date: Tue, 25 Jun 2024 16:27:36 +0800 Subject: [PATCH 42/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E6=94=B6=E6=AC=BE=E6=9F=A5=E8=AF=A2=E4=B8=BA=E5=BD=93=E6=97=A5?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=94=AF=E4=BB=98=E7=9A=84=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 4 +++- app/store/logic/WorkbenchLogic.php | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index e7cd97861..8c4d47047 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -12,6 +12,7 @@ use app\common\model\system_store\SystemStore; use app\common\service\pay\PayService; use app\common\service\PushService; use app\common\service\wechat\WechatTemplate; +use app\statistics\logic\OrderLogic; use Exception; use support\Cache; use think\facade\Db; @@ -28,7 +29,8 @@ class IndexController extends BaseApiController public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config']; public function index() - { + { $all_where['paid'] = 1; + d(OrderLogic::dayPayPrice($all_where,date('Y-m-d',time()))); $uid=9; $a= PushService::push('wechat_mmp_'.$uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>5]]); diff --git a/app/store/logic/WorkbenchLogic.php b/app/store/logic/WorkbenchLogic.php index 20fa8a024..0ddb5fd0d 100644 --- a/app/store/logic/WorkbenchLogic.php +++ b/app/store/logic/WorkbenchLogic.php @@ -35,6 +35,7 @@ use app\common\model\system_store\SystemStore; use app\common\model\user_recharge\UserRecharge; use app\common\service\ConfigService; use app\common\service\FileService; +use app\statistics\logic\OrderLogic; /** @@ -82,7 +83,9 @@ class WorkbenchLogic extends BaseLogic //门店收益金额 $data['income_amount'] = StoreFinanceFlow::where($storeFinanceWhere)->whereBetweenTime('create_time', $startTime, $endTime)->sum('number'); //门店收款金额 - $data['receipt_amount'] = UserRecharge::where($userRechargeWhere)->whereBetweenTime('create_time', $startTime, $endTime)->sum('price'); + $all_where['paid'] = 1; + $data['receipt_amount'] = OrderLogic::dayPayPrice($all_where,date('Y-m-d',time())); +// $data['receipt_amount'] = UserRecharge::where($userRechargeWhere)->whereBetweenTime('create_time', $startTime, $endTime)->sum('price'); //保证金金额 $data['deposit_amount'] = StoreFinanceFlow::where($storeFinanceWhereTwo)->whereBetweenTime('create_time', $startTime, $endTime)->sum('number'); //门店成交用户数 From 6e5badd9698cb59e53b66ee1627a22bfbbba4a10 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 16:55:08 +0800 Subject: [PATCH 43/87] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=94=B6?= =?UTF-8?q?=E9=93=B6=E5=8F=B0=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD=E5=8F=8A?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index b03b41809..57876439b 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -216,31 +216,32 @@ class PayNotifyLogic extends BaseLogic if ($order->isEmpty() || $order->paid == PayEnum::ISPAID) { return true; } + $order->status = 1; + $order->paid = 1; + $order->pay_time = time(); + if($order['is_storage']==1){ + $order->status=2; + UserProductStorageLogic::add($order); + } if ($order->pay_type != 10) { $order->pay_price = bcdiv($extra['amount']['payer_total'], 100, 2); - $order->paid = 1; - $order->pay_time = time(); - $order->status = 1; - $order->save(); } else { $extra['transaction_id'] = time(); } $user = User::where('id', $order['uid'])->find(); if ($order->pay_type == OrderEnum::CASHIER_ORDER_PAY || $order->pay_type == OrderEnum::CASHIER_ORDER_ALI_PAY) { //收银台支付 $order->status = 2; - $order->save(); self::afterPay($order, $extra['transaction_id']); } else { $capitalFlowDao = new CapitalFlowLogic($user); //微信支付和用户余额无关 $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1, $order['store_id']); } - + $order->save(); self::dealProductLog($order); if ($order['shipping_type'] == 3) { self::descStock($order['id']); } - if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 4); } From b40b004e9e6217abc55448aa90da791a5f292ef4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 17:28:07 +0800 Subject: [PATCH 44/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9IndexController?= =?UTF-8?q?=E7=B1=BB=E4=BB=A5=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E7=BB=9F=E8=AE=A1=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/statistics/controller/IndexController.php | 76 +++++++++++-------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/app/statistics/controller/IndexController.php b/app/statistics/controller/IndexController.php index 2e0099062..d89abbbaa 100644 --- a/app/statistics/controller/IndexController.php +++ b/app/statistics/controller/IndexController.php @@ -4,6 +4,8 @@ namespace app\statistics\controller; use app\admin\logic\statistic\TradeStatisticLogic; use app\common\controller\BaseLikeController; +use app\common\model\user\User; +use app\common\model\user_recharge\UserRecharge; use app\statistics\logic\OrderLogic; use app\statistics\logic\ProductLogic; use app\statistics\logic\UserLogic; @@ -12,27 +14,27 @@ use DateTime; class IndexController extends BaseLikeController { - public $store_id=0; + public $store_id = 0; public function index() { - $time=$this->request->get('date',date('Y-m-d')); + $time = $this->request->get('date', date('Y-m-d')); $store_id = $this->store_id; - if($store_id){ + if ($store_id) { $where['store_id'] = $store_id; } $where['paid'] = 1; - $res = OrderLogic::dayPayPrice($where,$time); + $res = OrderLogic::dayPayPrice($where, $time); if (OrderLogic::hasError()) { return $this->fail(OrderLogic::getError()); //获取错误信息并返回错误信息 } - return $this->success('ok', ['dayPayPrice' => $res,'title'=>'百合镇农(特)产品交易大数据']); + return $this->success('ok', ['dayPayPrice' => $res, 'title' => '百合镇农(特)产品交易大数据']); } public function user() { - $time=$this->request->get('date',date('Y-m-d')); + $time = $this->request->get('date', date('Y-m-d')); $today = strtotime($time); - $dates=[]; + $dates = []; // 循环输出前5天的日期 for ($i = 0; $i <= 4; $i++) { // 计算前第$i天的日期时间戳 @@ -40,14 +42,14 @@ class IndexController extends BaseLikeController // 将时间戳格式化为日期 $date = date('Y-m-d', $timestamp); - $dates[]=$date; + $dates[] = $date; } $store_id = $this->store_id; - $where=[]; - if($store_id){ + $where = []; + if ($store_id) { $where['store_id'] = $store_id; } - $res = UserLogic::userCount($where,$dates); + $res = UserLogic::userCount($where, $dates); if (UserLogic::hasError()) { return $this->fail(UserLogic::getError()); //获取错误信息并返回错误信息 } @@ -59,13 +61,13 @@ class IndexController extends BaseLikeController */ public function product_count() { - $time=$this->request->get('date',date('Y-m-d')); + $time = $this->request->get('date', date('Y-m-d')); $store_id = $this->store_id; - $where=[]; - if($store_id){ + $where = []; + if ($store_id) { $where['store_id'] = $store_id; } - $res = ProductLogic::Count($where,$time); + $res = ProductLogic::Count($where, $time); if (ProductLogic::hasError()) { return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 } @@ -76,30 +78,40 @@ class IndexController extends BaseLikeController */ public function order_user_num_count() { - $time=$this->request->get('date',date('Y-m-d')); + $time = $this->request->get('date', date('Y-m-d')); $store_id = $this->store_id; - $where=[]; - if($store_id){ + $where = []; + if ($store_id) { $where['store_id'] = $store_id; } - $res = OrderLogic::Count($where,$time); - if (ProductLogic::hasError()) { - return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 - } - return $this->success('ok', $res); + $where['recharge_type']='INDUSTRYMEMBERS'; + $where['status']=1; + $where['paid']=1; + // $res = OrderLogic::Count($where,$time); + // if (ProductLogic::hasError()) { + // return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 + // } + $res = UserRecharge::where($where)->whereTime('create_time', $time)->select()->each(function ($item) { + if($item['uid']){ + $item['nickname']=User::where('id',$item['uid'])->value('nickname'); + }else{ + $item['nickname']=''; + } + }); + return $this->success('ok', $res?->toArray()); } /** * 商品销量排行榜统计 */ public function sales_ranking() { - $time=$this->request->get('date',date('Y-m-d')); + $time = $this->request->get('date', date('Y-m-d')); $store_id = $this->store_id; - $where=[]; - if($store_id){ + $where = []; + if ($store_id) { $where['store_id'] = $store_id; } - $res = OrderLogic::sales($where,$time); + $res = OrderLogic::sales($where, $time); if (ProductLogic::hasError()) { return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 } @@ -110,7 +122,7 @@ class IndexController extends BaseLikeController */ public function user_trade_count() { - $logic=(new TradeStatisticLogic()); + $logic = (new TradeStatisticLogic()); $leftToday = $logic->getTopLeftTrade(['create_time' => 'today']); $leftyestoday = $logic->getTopLeftTrade(['create_time' => 'yestoday']); $totalleft = [$leftToday, $leftyestoday]; @@ -128,13 +140,13 @@ class IndexController extends BaseLikeController */ public function street_currday_order_count() { - $time=$this->request->get('date',date('Y-m-d')); + $time = $this->request->get('date', date('Y-m-d')); $store_id = $this->store_id; - $where=[]; - if($store_id){ + $where = []; + if ($store_id) { $where['store_id'] = $store_id; } - $res = OrderLogic::Currday($where,$time); + $res = OrderLogic::Currday($where, $time); if (ProductLogic::hasError()) { return $this->fail(ProductLogic::getError()); //获取错误信息并返回错误信息 } From c699abfd6f356f5cce878570cd9eddd410f11701 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 17:37:41 +0800 Subject: [PATCH 45/87] =?UTF-8?q?feat(ProductLists.php):=20=E6=A0=B9?= =?UTF-8?q?=E6=8D=AEoff=5Factivity=E9=85=8D=E7=BD=AE=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/product/ProductLists.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/api/lists/product/ProductLists.php b/app/api/lists/product/ProductLists.php index ef91ba000..763bdddbd 100644 --- a/app/api/lists/product/ProductLists.php +++ b/app/api/lists/product/ProductLists.php @@ -116,10 +116,19 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L public function extend() { $off_activity = Config::where('name', 'off_activity')->value('value'); - return [ - 'off_activity' => $off_activity, - 'price' => 'cost', - 'op_price' => 'price', - ]; + if($off_activity==1){ + $data=[ + 'off_activity' => $off_activity, + 'price' => 'cost', + 'op_price' => 'price', + ]; + }else{ + $data=[ + 'off_activity' => $off_activity, + 'price' => 'price', + 'op_price' => 'price', + ]; + } + return $data; } } From b7f8c6ad4205f3adb7b9cea1f87b0a20e0ed6ab9 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 18:12:07 +0800 Subject: [PATCH 46/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=80=BB=E8=BE=91=E4=BB=A5=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E7=9A=84=E6=97=A5=E6=9C=9F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/statistics/logic/ProductLogic.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/statistics/logic/ProductLogic.php b/app/statistics/logic/ProductLogic.php index 8fad8de91..06be8df22 100644 --- a/app/statistics/logic/ProductLogic.php +++ b/app/statistics/logic/ProductLogic.php @@ -9,20 +9,20 @@ class ProductLogic extends BaseLogic { public static function Count($where,$time) { - $todayProductCount=StoreBranchProduct::where($where)->whereDay($time)->count(); + $todayProductCount=StoreBranchProduct::where($where)->whereDay('create_time',$time)->count(); $yestertodayProductCount=StoreBranchProduct::where($where)->where('create_time', '<',strtotime($time)-1)->count(); if ($yestertodayProductCount == 0 ||$todayProductCount==0) { $weeklyProductTotalGrowthRate = 0; } else { - $weeklyProductTotalGrowthRate = ($todayProductCount - $yestertodayProductCount) / $yestertodayProductCount * 100; + $weeklyProductTotalGrowthRate =bcdiv(($todayProductCount - $yestertodayProductCount) ,$yestertodayProductCount) * 100; } $todayNewProductCount=StoreBranchProduct::where($where)->whereDay('create_time',$time)->count(); $yestertodayNewProductCount=StoreBranchProduct::where($where)->whereDay('create_time', date('Y-m-d',strtotime($time)-1))->count(); - if ($yestertodayProductCount == 0 ||$todayProductCount==0) { + if ($todayNewProductCount == 0 ||$yestertodayNewProductCount==0) { $weeklyNewProductTotalGrowthRate = 0; } else { - $weeklyNewProductTotalGrowthRate = ($todayNewProductCount - $yestertodayNewProductCount) / $yestertodayNewProductCount * 100; + $weeklyNewProductTotalGrowthRate =bcdiv(($todayNewProductCount - $yestertodayNewProductCount),$yestertodayNewProductCount) * 100; } $data = [ "totalProductCounInfo" => [ From 2c2baf413583ccbb356ce176bcb516a41b34a738 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 11:07:10 +0800 Subject: [PATCH 47/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E5=9C=A8StoreOrderLists=E5=92=8CStoreOrderController=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86=E8=AE=A2=E5=8D=95=E5=88=9B=E5=BB=BA=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/store_order/StoreOrderLists.php | 8 ++++---- app/store/controller/store_order/StoreOrderController.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/admin/lists/store_order/StoreOrderLists.php b/app/admin/lists/store_order/StoreOrderLists.php index fc4051333..5b2e2d84f 100644 --- a/app/admin/lists/store_order/StoreOrderLists.php +++ b/app/admin/lists/store_order/StoreOrderLists.php @@ -69,10 +69,10 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface } $product = StoreOrderCartInfo::where('oid', $item['id'])->field(['id', 'oid', 'product_id', 'cart_info']) ->limit(3)->select(); - foreach ($product as &$items) { - $items['store_name'] = $items['cart_info']['name']; - $items['image'] = $items['cart_info']['image']; - } + foreach ($product as &$items) { + $items['store_name'] = $items['cart_info']['name']; + $items['image'] = $items['cart_info']['image']; + } $item['product'] = $product; return $item; }) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 4b7295af4..d7bc50d1b 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -169,7 +169,7 @@ class StoreOrderController extends BaseAdminController $user = User::where('id', $uid)->find(); } $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 - $order = StoreOrderLogic::createOrder($cartId, $addressId, $user, $params); + $order = OrderLogic::createOrder($cartId, $addressId, $user, $params); if ($order != false) { switch ($pay_type) { case PayEnum::PURCHASE_FUNDS: From 56f22df5c4972f0b8a331eb40c216331be075486 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 11:16:31 +0800 Subject: [PATCH 48/87] =?UTF-8?q?=E5=95=86=E6=88=B7=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=BB=98=E8=AE=A4shipping=5Ftype=E5=80=BC?= =?UTF-8?q?=E4=B8=BA3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/controller/store_order/StoreOrderController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index d7bc50d1b..c6320965f 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -85,6 +85,7 @@ class StoreOrderController extends BaseAdminController $params = $this->request->post(); $params['store_id'] = $this->adminInfo['store_id']; $user = User::where('id', $params['uid'])->find(); + $params['shipping_type'] =3; $res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, $user, $params); if ($res == false) { $msg = StoreOrderLogic::getError(); @@ -169,6 +170,7 @@ class StoreOrderController extends BaseAdminController $user = User::where('id', $uid)->find(); } $params['store_id'] = $this->request->adminInfo['store_id']; //当前登录的店铺id,用于判断是否是当前店铺的订单 + $params['shipping_type'] =3; $order = OrderLogic::createOrder($cartId, $addressId, $user, $params); if ($order != false) { switch ($pay_type) { From 42f4e3d1d34d30787502d778339c51e0136d8d86 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 11:17:12 +0800 Subject: [PATCH 49/87] =?UTF-8?q?feat(CartList):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6API=EF=BC=8C=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=BB=A1=E5=87=8F=E6=B4=BB=E5=8A=A8=E8=B0=83=E6=95=B4=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E4=BB=B7=E6=A0=BC=E5=92=8C=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/CartList.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index 16875867c..342e7bf21 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -122,15 +122,14 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists $data= [ 'off_activity' => $this->off_activity, 'total_price' => $this->total_price, - 'activity_price' => $this->activity_price, 'msg' => '', 'pay_price' => bcsub($this->total_price, $this->activity_price, 2) ]; if($this->off_activity==1){ $data['pay_price']=$this->activity_price; if($this->total_price<500){ - $data['msg']='还差'.bcsub(500,$this->total_price,2).'元可参与满减活动'; - $data['pay_price']= $this->total_price; + $data['msg']='还差'.bcsub(500,$this->total_price,2).'元可获得10%品牌礼品券'; + $data['pay_price']= $this->activity_price; } } return $data; From 27b199994a09047e80bea51f11c66a286ff2b40e Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 13:40:31 +0800 Subject: [PATCH 50/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=93=8D=E5=BA=94=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StoreBranchProductLists.php | 16 +-- .../StoreFinanceFlowLists.php | 100 +++++++-------- app/api/logic/order/OrderLogic.php | 2 +- .../logic/store_order/StoreOrderLogic.php | 118 +++++++++--------- .../store_order/StoreOrderController.php | 24 ++-- .../store_product/StoreProductController.php | 29 +---- 6 files changed, 124 insertions(+), 165 deletions(-) diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php index ea5239d8a..02f6df20d 100644 --- a/app/admin/lists/store_branch_product/StoreBranchProductLists.php +++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php @@ -61,8 +61,8 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI //2或者1 $where[]=['cate_id','=',$class_all]; } - - return StoreBranchProduct::where($this->searchWhere)->where($where) + $this->searchWhere[]=$where; + return StoreBranchProduct::where($this->searchWhere) ->field(['id','store_id','product_id', 'image', 'store_name', 'cate_id', 'price', 'sales', 'stock', 'unit', 'cost','purchase', 'status','batch','vip_price','manufacturer_information']) ->when(!empty($this->adminInfo['store_id']), function ($query) { $query->where('store_id', $this->adminInfo['store_id']); @@ -99,17 +99,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI */ public function count(): int { - $status = $this->params['status'] ?? ''; - $class_all=$this->request->get('class_all'); - $where=[]; - if($class_all){ - $arr=Cate::where('pid',$class_all)->column('id'); - if($arr){ - $arr2=Cate::where('pid','in',$arr)->column('id'); - $where[]=['cate_id','in',array_merge($arr,$arr2)]; - } - } - return StoreBranchProduct::where($this->searchWhere)->where($where) + return StoreBranchProduct::where($this->searchWhere) ->when(!empty($this->adminInfo['store_id']), function ($query) { $query->where('store_id', $this->adminInfo['store_id']); }) diff --git a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php index 014944b78..45bb608a7 100644 --- a/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php +++ b/app/admin/lists/store_finance_flow/StoreFinanceFlowLists.php @@ -81,57 +81,57 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt $item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']); })->toArray(); - foreach ($data as $key => $item) { - $list1 = StoreFinanceFlow::where('order_id', $item['order_id'])->where('financial_type', '>', 1)->field($field)->select()->each(function ($item) { - if ($item['user_id'] <= 0) { - $item['nickname'] = '游客'; - } else { - $id = $item['user_id']; - $item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "|$id"; - } - if (!empty($this->request->adminInfo['store_id'])) { - $item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0; - } - if ($item['financial_pm'] == 0) { - $item['number'] = '-' . $item['number']; - $item['financial_type_name'] = '订单支出:' . OrderEnum::getFinancialType($item['financial_type']); - } else { - $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']) . '获得'; - $item['number'] = '+' . $item['number']; - } - $item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name'); - $item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : ''; - $item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']); - }); - $list2 = UserSign::where('order_id', $item['order_sn'])->whereIn('user_ship', [0, 2, 3])->select(); - foreach ($list2 as $k => $v) { - $list2[$k]['id'] = 'JF' . $v['id']; - $list2[$k]['order_sn'] = $item['order_sn']; - $list2[$k]['store_name'] = $item['store_name']; - if($v['user_ship']==0){ - $list2[$k]['financial_pm'] = 1; - $list2[$k]['number'] = '+' . $v['number']; - }else{ - if($v['financial_pm']==1){ - $list2[$k]['financial_pm'] = 1; - $list2[$k]['number'] = '+' . $v['number']; - }else{ - $list2[$k]['financial_pm'] = 0; - $list2[$k]['number'] = '-' . $v['number']; - } - } - $list2[$k]['nickname'] = $v['uid'] > 0 ? User::where('id', $v['uid'])->value('nickname') . '|' . $v['uid'] : '游客'; - $list2[$k]['financial_type_name'] = $v['title']; - $list2[$k]['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']); - } - $list3 = array_merge($list1->toArray(), $list2->toArray()); - // 提取 financial_pm 字段到单独的数组 - $financial_pm = array_column($list3, 'financial_pm'); + // foreach ($data as $key => $item) { + // $list1 = StoreFinanceFlow::where('order_id', $item['order_id'])->where('financial_type', '>', 1)->field($field)->select()->each(function ($item) { + // if ($item['user_id'] <= 0) { + // $item['nickname'] = '游客'; + // } else { + // $id = $item['user_id']; + // $item['nickname'] = User::where('id', $item['user_id'])->value('nickname') . "|$id"; + // } + // if (!empty($this->request->adminInfo['store_id'])) { + // $item['financial_pm'] = $item['financial_pm'] == 0 ? 1 : 0; + // } + // if ($item['financial_pm'] == 0) { + // $item['number'] = '-' . $item['number']; + // $item['financial_type_name'] = '订单支出:' . OrderEnum::getFinancialType($item['financial_type']); + // } else { + // $item['financial_type_name'] = OrderEnum::getFinancialType($item['financial_type']) . '获得'; + // $item['number'] = '+' . $item['number']; + // } + // $item['staff_name'] = SystemStoreStaff::where('id', $item['staff_id'])->value('staff_name'); + // $item['store_name'] = $item['store_id'] > 0 ? SystemStore::where('id', $item['store_id'])->value('name') : ''; + // $item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']); + // }); + // $list2 = UserSign::where('order_id', $item['order_sn'])->whereIn('user_ship', [0, 2, 3])->select(); + // foreach ($list2 as $k => $v) { + // $list2[$k]['id'] = 'JF' . $v['id']; + // $list2[$k]['order_sn'] = $item['order_sn']; + // $list2[$k]['store_name'] = $item['store_name']; + // if($v['user_ship']==0){ + // $list2[$k]['financial_pm'] = 1; + // $list2[$k]['number'] = '+' . $v['number']; + // }else{ + // if($v['financial_pm']==1){ + // $list2[$k]['financial_pm'] = 1; + // $list2[$k]['number'] = '+' . $v['number']; + // }else{ + // $list2[$k]['financial_pm'] = 0; + // $list2[$k]['number'] = '-' . $v['number']; + // } + // } + // $list2[$k]['nickname'] = $v['uid'] > 0 ? User::where('id', $v['uid'])->value('nickname') . '|' . $v['uid'] : '游客'; + // $list2[$k]['financial_type_name'] = $v['title']; + // $list2[$k]['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']); + // } + // $list3 = array_merge($list1->toArray(), $list2->toArray()); + // // 提取 financial_pm 字段到单独的数组 + // $financial_pm = array_column($list3, 'financial_pm'); - // 对 financial_pm 数组进行排序,这将影响原始数组 - array_multisort($financial_pm, SORT_ASC, $list3); - $data[$key]['list']=$list3; - } + // // 对 financial_pm 数组进行排序,这将影响原始数组 + // array_multisort($financial_pm, SORT_ASC, $list3); + // $data[$key]['list']=$list3; + // } return $data; } diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 61f5cffe9..9a103f0ed 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -75,7 +75,7 @@ class OrderLogic extends BaseLogic self::$store_price = 0; //门店零售价 /** 计算价格 */ $off_activity=Config::where('name','off_activity')->value('value'); - if($off_activity==1){ + if($off_activity!=1){ $field='id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id'; }else{ $field='id branch_product_id,store_name,image,unit,cost price,vip_price,cost,purchase,product_id'; diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 088e87c8b..4d2e5830f 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -19,6 +19,7 @@ use app\common\service\SmsService; use Exception; use support\Cache; use think\facade\Db; +use app\common\model\system_store\SystemStore; class StoreOrderLogic extends BaseLogic { @@ -32,6 +33,11 @@ class StoreOrderLogic extends BaseLogic * @notes 获取购物车商品信息 * @param $params * @return array|bool + */ + /** + * @notes 获取购物车商品信息 + * @param $params + * @return array|bool */ static public function cartIdByOrderInfo($cartId, $addressId, $user = null, $params = []) { @@ -45,14 +51,19 @@ class StoreOrderLogic extends BaseLogic try { self::$total_price = 0; self::$pay_price = 0; - self::$cost = 0; //成本 + self::$cost = 0; //成本由采购价替代原成本为门店零售价 self::$profit = 0; //利润 self::$activity_price = 0; //活动减少 self::$store_price = 0; //门店零售价 /** 计算价格 */ - $pay_type = isset($params['pay_type'])?$params['pay_type']:0; + // $off_activity=Config::where('name','off_activity')->value('value'); + // if($off_activity==1){ + // $field='id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id'; + // }else{ + $field='id branch_product_id,store_name,image,unit,cost price,vip_price,cost,purchase,product_id'; + // } foreach ($cart_select as $k => $v) { - $find = StoreBranchProduct::where(['product_id' => $v['product_id'],'store_id'=>$params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id,swap')->withTrashed()->find(); + $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->withTrashed()->find(); if (!$find) { continue; } @@ -63,47 +74,39 @@ class StoreOrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 $cart_select[$k]['vip'] = 0; - if ($user && $user['user_ship'] == 1) { - //更新 会员为1的时候原价减去会员价 - $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - $cart_select[$k]['vip'] =1; - } + // if($off_activity!=1){ + // if ($user && $user['user_ship'] == 1) { + // //更新 会员为1的时候原价减去会员价 + // $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); + // $cart_select[$k]['deduction_price'] =$deduction_price_count; + // self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + // $cart_select[$k]['vip'] =1; + // } + // if ($user && $user['user_ship'] == 4) { + // //更新 为4商户的时候减去商户价格 + // $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); + // $cart_select[$k]['deduction_price'] =$deduction_price_count; + // self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); + // } + // } - if ($user && $user['user_ship'] == 4) { - //更新 为4商户的时候减去商户价格 - $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - } - if($pay_type ==19){ - if ($find['swap'] < $cart_select[$k]['cart_num']) { - throw new \Exception('兑换数量不足'); - } - } //利润 - // $cart_select[$k]['profit'] = bcmul($cart_select[$k]['total_price'],0.05,2); //利润 + // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额 $cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价 $cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2)??0; //vip售价 + $cart_select[$k]['product_id'] = $find['product_id']; $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; //vip1待返回金额 - $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'],2); +// d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] ); $cartInfo = $cart_select[$k]; $cartInfo['name'] = $find['store_name']; $cartInfo['image'] = $find['image']; - //计算好vip价格 - // $vipPrice = self::dealVip($find['price']); - // if ($vipPrice) { - // $cartInfo['price'] = $vipPrice; - // } - //$cart_select[$k]['total'] - $vipPrice ?? 0; $cart_select[$k]['cart_info'] = json_encode($cartInfo); $cart_select[$k]['branch_product_id'] = $find['branch_product_id']; //理论上每笔都是拆分了 @@ -113,53 +116,52 @@ class StoreOrderLogic extends BaseLogic $cart_select[$k]['unit_name'] = StoreProductUnit::where(['id' => $find['unit']])->value('name'); self::$total_price = bcadd(self::$total_price, $cart_select[$k]['total_price'], 2); self::$pay_price = bcadd(self::$pay_price, $cart_select[$k]['pay_price'], 2); - self::$cost = bcadd(self::$cost, $cart_select[$k]['cost'], 2); + self::$cost = bcadd(self::$cost, $cart_select[$k]['purchase'], 2); self::$store_price = bcadd(self::$store_price, $cart_select[$k]['store_price'], 2);//门店零售价格 // self::$profit = bcadd(self::$profit, $cart_select[$k]['profit'], 2); } - if ($user && $user['user_ship'] == 1 && $pay_type !=17) { - $pay_price = self::$pay_price; - $activity_string = ''; - }else{ - $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 - $activity_string = '减免'; - } - if($pay_type == 19){ - $pay_price = self::$pay_price; - $activity_string = ''; - } + //加支付方式限制 + // $pay_type = isset($params['pay_type'])?$params['pay_type']:0; + // if ($user && $user['user_ship'] == 1 && $pay_type !=17) { + // $pay_price = self::$pay_price; + // }else{ + // $pay_price =bcsub(self::$pay_price, self::$activity_price, 2); //减去活动优惠金额 + // } + $pay_price = self::$pay_price; // if($pay_price < 500){ -// throw new \think\Exception('金额低于500'); +// throw new Exception('金额低于500'); // } - - $vipPrice = 0; + //成本价 收益 $order = [ 'create_time' => time(), - 'order_id' =>$params['order_id'] ?? getNewOrderId('PF'), + 'order_id' => $params['order_id'] ?? getNewOrderId('PF'), 'total_price' => self::$total_price, //总价 - 'cost' => self::$cost,//成本价 - 'profit' => 0,//利润 - 'pay_price' => $pay_price,//后期可能有降价抵扣 - 'vip_price' => $vipPrice, - 'total_num' => count($cart_select),//总数 + 'cost' => self::$cost, //成本价1- + 'pay_price' => $pay_price, //后期可能有降价抵扣 + 'vip_price' => 0, + 'total_num' => count($cart_select), //总数 'pay_type' => $params['pay_type'] ?? 0, 'reservation_time' => $params['reservation_time'] ?? null, 'cart_id' => implode(',', $cartId), 'store_id' => $params['store_id'] ?? 0, - 'shipping_type' =>3,//配送方式 1=快递 ,2=门店自提 - 'activity' =>$activity_string, - 'activity_price' =>self::$activity_price,//活动优惠价 + 'shipping_type' => $params['shipping_type'] ?? 2, //配送方式 1=快递 ,2=门店自提 + 'activity' => '减免', + 'activity_price' => self::$activity_price, 'activities' => self::$activity_price>0?1:0, - 'default_delivery'=>1, - 'original_price'=>self::$total_price, - 'deduction_price' => self::$activity_price,//抵扣金额 + 'deduction_price' => self::$activity_price, + 'is_vip' => 0, + 'is_storage' => $params['is_storage']??0, ]; - if($user && $user['user_ship']!=4){ - $order['is_vip']=1; + $order['default_delivery'] = 0; + if ($params['store_id']) { + $order['default_delivery'] = SystemStore::where('id', $params['store_id'])->value('is_send'); } + if($user && $user['user_ship']>=1 &&$user['user_ship']<=3){ + $order['is_vip'] = 1; + } } catch (\Exception $e) { self::setError($e->getMessage()); return false; diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index c6320965f..009055f0b 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -85,7 +85,6 @@ class StoreOrderController extends BaseAdminController $params = $this->request->post(); $params['store_id'] = $this->adminInfo['store_id']; $user = User::where('id', $params['uid'])->find(); - $params['shipping_type'] =3; $res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, $user, $params); if ($res == false) { $msg = StoreOrderLogic::getError(); @@ -347,34 +346,25 @@ class StoreOrderController extends BaseAdminController */ public function rechange_amount() { + // $order = UserRecharge::where('order_id','CZ1719052252643357')->find(); + // $order['pay_price'] = $order['price']; + // d(1); + // PayNotifyLogic::handle('recharge', $order['order_id'], $order); + + // d(1); $pay_type = $this->request->post('pay_type'); $auth_code = $this->request->post('auth_code'); //微信支付条码 if ($auth_code == '' && $pay_type != PayEnum::CASH_PAY) { return $this->fail('支付条码不能为空'); } $params = $this->request->post(); - switch ($pay_type) { - case PayEnum::CASH_PAY: - $recharge_type = 'CASH_PAY'; - break; - case PayEnum::WECHAT_PAY_BARCODE: - $recharge_type = 'INDUSTRYMEMBERS'; - break; - case PayEnum::ALIPAY_BARCODE: - $recharge_type = 'ALI_INDUSTRYMEMBERS'; - break; - default: - $recharge_type = ''; - break; - } $data = [ 'store_id' => $this->adminInfo['store_id'], 'uid' => $params['uid'], 'staff_id' => $this->adminId, 'order_id' => getNewOrderId('CZ'), 'price' => $params['price'], - 'recharge_type' =>$recharge_type, - 'type' => 1, + 'recharge_type' => 'INDUSTRYMEMBERS', ]; $order = UserRecharge::create($data); $order['pay_price'] = $order['price']; diff --git a/app/store/controller/store_product/StoreProductController.php b/app/store/controller/store_product/StoreProductController.php index 780430b60..f56219f1f 100644 --- a/app/store/controller/store_product/StoreProductController.php +++ b/app/store/controller/store_product/StoreProductController.php @@ -19,31 +19,9 @@ use app\store\validate\store_product\StoreProductValidate; // #[ApiDoc\title('商品列表')] class StoreProductController extends BaseAdminController { - - // #[ - // ApiDoc\Title('商品列表'), - // ApiDoc\url('/store/store_product/storeProduct/lists'), - // ApiDoc\Method('GET'), - // ApiDoc\NotHeaders(), - // ApiDoc\Query(name: 'cate_id', type: 'int', require: false, desc: '分类id'), - // ApiDoc\Query(name: 'store_name', type: 'string', require: false, desc: '商品名称'), - // ApiDoc\Query(name: 'status', type: 'int', require: false, desc: '状态:1上架,2下架,3售罄,4库存告警'), - // ApiDoc\Header(ref: [Definitions::class, "token"]), - // ApiDoc\Query(ref: [Definitions::class, "page"]), - // ApiDoc\ResponseSuccess("data", type: "array", children: [ - // ['name' => 'id', 'desc' => 'ID', 'type' => 'int'], - // ['name' => 'product_id', 'desc' => '商品ID', 'type' => 'int'], - // ['name' => 'image', 'desc' => '图片', 'type' => 'string'], - // ['name' => 'store_name', 'desc' => '商品名称', 'type' => 'string'], - // ['name' => 'price', 'desc' => '零售价', 'type' => 'float'], - // ['name' => 'cost', 'desc' => '成本价', 'type' => 'float'], - // ['name' => 'sales', 'desc' => '销量', 'type' => 'int'], - // ['name' => 'stock', 'desc' => '库存', 'type' => 'int'], - // ['name' => 'unit_name', 'desc' => '单位', 'type' => 'string'], - // ['name' => 'cate_name', 'desc' => '分类', 'type' => 'string'], - // ['name' => 'status', 'desc' => '状态:1上架,0下架', 'type' => 'string'], - // ]), - // ] + /** + * 商品列表 + */ public function lists() { return $this->dataLists(new StoreBranchProductLists()); @@ -194,5 +172,4 @@ class StoreProductController extends BaseAdminController StoreBranchProductLogic::stock($params); return $this->success('操作成功', [], 1, 1); } - } From d8d4f7f9def97f4a20731771b51c0c01268b30c8 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 13:56:20 +0800 Subject: [PATCH 51/87] =?UTF-8?q?feat:=20=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E7=89=B9?= =?UTF-8?q?=E6=9D=83=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/cart/CartList.php | 89 +++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/app/store/lists/cart/CartList.php b/app/store/lists/cart/CartList.php index e16f45c1e..b4561de84 100644 --- a/app/store/lists/cart/CartList.php +++ b/app/store/lists/cart/CartList.php @@ -6,10 +6,12 @@ namespace app\store\lists\cart; use app\admin\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\order\Cart; -use app\common\lists\ListsExtendInterface; +use app\common\model\Config; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_product_attr_value\StoreProductAttrValue; use app\common\model\store_product_unit\StoreProductUnit; +use app\common\model\user\User; +use app\common\lists\ListsExtendInterface; /** * 购物车列表 @@ -18,10 +20,9 @@ use app\common\model\store_product_unit\StoreProductUnit; */ class CartList extends BaseAdminDataLists implements ListsSearchInterface, ListsExtendInterface { - protected $total_price = 0; - - + protected $activity_price = 0; + protected $off_activity = 0; /** * @notes 设置搜索条件 * @return \string[][] @@ -31,8 +32,6 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists { return []; } - - /** * @notes 购物车列表 * @return array @@ -43,27 +42,54 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists */ public function lists($where = []): array { - $this->searchWhere[]=['staff_id','=',$this->adminId]; - $this->searchWhere[]=['is_pay','=',0]; - $list = Cart::where($this->searchWhere) - ->field('id,product_id,cart_num,store_id') + $userId = $this->request->get('uid'); + $where = [ + 'staff_id' => $this->adminId, + 'is_pay' => 0 + ]; + $list = Cart::where($this->searchWhere)->where($where) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) { - $find = StoreBranchProduct::where(['product_id' => $item['product_id'],'store_id'=>$item['store_id']]) - ->field('product_id,image,price,store_name,unit') - ->find(); - if ($find) { - $item['total_price'] = bcmul($item['cart_num'], $find['price'], 2); - $item['image'] = $find['image']; - $item['price'] = $find['price']; - $item['store_name'] = $find['store_name']; - $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); - } + return $item; }) ->toArray(); + $off_activity = Config::where('name', 'off_activity')->value('value'); + $this->off_activity = $off_activity; + $user = User::where('id', $userId)->find(); + foreach ($list as $key => &$item) { + $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']]) + ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price') + ->withTrashed() + ->find(); + + if ($find) { + if ($off_activity == 1) { + $this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2); + } else { + if ($user && $user['user_ship'] == 1) { + //更新 会员为1的时候原价减去会员价 + $deduction_price_count = bcmul(bcsub($find['price'], $find['vip_price'], 2), $item['cart_num'], 2); + $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); + } elseif ($user && $user['user_ship'] == 4) { + //更新 为4商户的时候减去商户价格 + $deduction_price_count = bcmul(bcsub($find['price'], $find['cost'], 2), $item['cart_num'], 2); + $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); + } else { + $this->activity_price = 0; + } + } + + $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); + $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); + $item['image'] = $find['image']; + $item['sell'] = $find['price']; + $item['store_name'] = $find['store_name']; + $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); + } + } return $list; } @@ -75,11 +101,30 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists */ public function count(): int { - return Cart::where($this->searchWhere)->count(); + $userId = $this->request->userId; + if (!$userId) return 0; + $where = [ + 'uid' => $userId, + 'is_pay' => 0 + ]; + return Cart::where($this->searchWhere)->where($where)->count(); } public function extend() { - // return ['total_price' => $this->total_price]; + $data = [ + 'off_activity' => $this->off_activity, + 'total_price' => $this->total_price, + 'msg' => '', + 'pay_price' => bcsub($this->total_price, $this->activity_price, 2) + ]; + if ($this->off_activity == 1) { + $data['pay_price'] = $this->activity_price; + if ($this->total_price < 500) { + $data['msg'] = '还差' . bcsub(500, $this->total_price, 2) . '元可获得10%品牌礼品券'; + $data['pay_price'] = $this->activity_price; + } + } + return $data; } } From a2afde54396d22ecafa7b32fb8d41b968562a192 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 14:07:53 +0800 Subject: [PATCH 52/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9CartList.php?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E5=95=86=E5=93=81=E6=88=90=E6=9C=AC?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/CartList.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index 342e7bf21..4c8c1550b 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -92,7 +92,8 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['imgs'] = $find['image']; - $item['sell'] = $find['price']; + $item['price'] = $find['price']; + $item['cost'] = $find['cost']; $item['goods_name'] = $find['store_name']; $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); } From f919e94ec388f57de3633076e51543829c0a46a1 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 14:09:09 +0800 Subject: [PATCH 53/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=96=B9=E5=BC=8F=E5=B9=B6=E5=A2=9E=E5=8A=A0=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/cart/CartList.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/store/lists/cart/CartList.php b/app/store/lists/cart/CartList.php index b4561de84..394edfc7c 100644 --- a/app/store/lists/cart/CartList.php +++ b/app/store/lists/cart/CartList.php @@ -85,7 +85,8 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['image'] = $find['image']; - $item['sell'] = $find['price']; + $item['price'] = $find['price']; + $item['cost'] = $find['cost']; $item['store_name'] = $find['store_name']; $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); } From 62b5ef67f4293cc6d6b65af0a6beb33555a276f4 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 14:50:41 +0800 Subject: [PATCH 54/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=80=BB=E8=BE=91=E5=92=8C=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E9=87=8D=E6=9E=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=8A=98=E6=89=A3=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/CartList.php | 14 -------------- app/api/logic/order/OrderLogic.php | 15 --------------- .../store_order/StoreOrderController.php | 10 +++++----- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index 4c8c1550b..2ca53b8d6 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -64,7 +64,6 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists ->toArray(); $off_activity = Config::where('name', 'off_activity')->value('value'); $this->off_activity=$off_activity; - $user = User::where('id', $userId)->find(); foreach ($list as $key => &$item) { $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']]) @@ -75,20 +74,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists if ($find) { if($off_activity==1){ $this->activity_price = bcadd(bcmul($find['cost'],$item['cart_num'], 2), $this->activity_price, 2); - }else{ - if ($user && $user['user_ship'] == 1) { - //更新 会员为1的时候原价减去会员价 - $deduction_price_count = bcmul(bcsub($find['price'], $find['vip_price'], 2), $item['cart_num'], 2); - $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); - } elseif ($user && $user['user_ship'] == 4) { - //更新 为4商户的时候减去商户价格 - $deduction_price_count = bcmul(bcsub($find['price'], $find['cost'], 2), $item['cart_num'], 2); - $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); - } else { - $this->activity_price = 0; - } } - $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['imgs'] = $find['image']; diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 9a103f0ed..bddf25345 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -92,21 +92,6 @@ class OrderLogic extends BaseLogic $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 $cart_select[$k]['vip'] = 0; - if($off_activity!=1){ - if ($user && $user['user_ship'] == 1) { - //更新 会员为1的时候原价减去会员价 - $deduction_price_count=bcmul(bcsub($find['price'], $find['vip_price'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - $cart_select[$k]['vip'] =1; - } - if ($user && $user['user_ship'] == 4) { - //更新 为4商户的时候减去商户价格 - $deduction_price_count=bcmul(bcsub($find['price'], $find['cost'], 2),$v['cart_num'],2); - $cart_select[$k]['deduction_price'] =$deduction_price_count; - self::$activity_price = bcadd(self::$activity_price, $deduction_price_count, 2); - } - } //利润 // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 009055f0b..d98768387 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -85,13 +85,13 @@ class StoreOrderController extends BaseAdminController $params = $this->request->post(); $params['store_id'] = $this->adminInfo['store_id']; $user = User::where('id', $params['uid'])->find(); - $res = StoreOrderLogic::cartIdByOrderInfo($cartId, null, $user, $params); + $res = OrderLogic::cartIdByOrderInfo($cartId, null, $user, $params); if ($res == false) { - $msg = StoreOrderLogic::getError(); + $msg = OrderLogic::getError(); if ($msg == '购物车为空') { return $this->data([]); } - return $this->fail(StoreOrderLogic::getError()); + return $this->fail(OrderLogic::getError()); } return $this->data($res); } @@ -105,9 +105,9 @@ class StoreOrderController extends BaseAdminController if (empty($user)) { return $this->fail('无该用户请检查'); } - $order = StoreOrderLogic::cartIdByOrderInfo($params['cart_id'], null, $user, $params); + $order = OrderLogic::cartIdByOrderInfo($params['cart_id'], null, $user, $params); if (!$order) { - return $this->fail(StoreOrderLogic::getError()); + return $this->fail(OrderLogic::getError()); } if ($params['type'] == 1) { if ($order['order']['pay_price'] > $user['purchase_funds']) { From c92f8a72b6f83bdf9cff8814681228d3e3f69539 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 14:52:20 +0800 Subject: [PATCH 55/87] =?UTF-8?q?=E9=97=A8=E5=BA=97=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/store_order/StoreOrderLogic.php | 3 +++ .../store_order/StoreOrderController.php | 6 +++--- app/store/lists/store_order/StoreOrderLists.php | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 4d2e5830f..da9cf0212 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -288,6 +288,9 @@ class StoreOrderLogic extends BaseLogic */ public function storeOrderCount($storeId, $status, $paid = 1) { + if(empty($storeId)){ + return StoreOrder::where(['status' => $status, 'paid' => $paid])->count(); + } return StoreOrder::where(['store_id' => $storeId, 'status' => $status, 'paid' => $paid])->count(); } diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index d98768387..e7e587ccd 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -59,9 +59,9 @@ class StoreOrderController extends BaseAdminController 'pay_type' => PayEnum::getPaySceneDesc(), 'order_status' => [ 'wait_send' => $orderLogic->storeOrderCount($this->request->adminInfo['store_id'], 0), - 'to_be_paid' => $orderLogic->storeOrderCount($this->request->adminInfo['store_id'], 0, 0), - 'wait_receive' => $orderLogic->storeOrderCount($this->request->adminInfo['store_id'], 1), - 'finish' => $orderLogic->storeOrderCount($this->request->adminInfo['store_id'], 2), + 'to_be_paid' => $orderLogic->storeOrderCount(0, 0, 0), + 'wait_receive' => $orderLogic->storeOrderCount(0, 1), + 'finish' => $orderLogic->storeOrderCount(0, 2), ], ]); } diff --git a/app/store/lists/store_order/StoreOrderLists.php b/app/store/lists/store_order/StoreOrderLists.php index 59a98e78d..1eb00fe33 100644 --- a/app/store/lists/store_order/StoreOrderLists.php +++ b/app/store/lists/store_order/StoreOrderLists.php @@ -54,6 +54,22 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface } elseif ($is_sashier == 2) { //小程序订单 $this->searchWhere[] = ['pay_type', 'in', [7, 3, 18,19]]; } + $status = $this->request->get('status',''); + $this->searchWhere[] = ['store_id', '=', $store_id]; + switch ($status){ + case -1: + $this->searchWhere[] = ['status', '=', 0]; + $this->searchWhere[] = ['paid', '=', 0]; + break; + case 1: + $this->searchWhere[] = ['status', '=', 1]; + break; + case 2: + $this->searchWhere[] = ['status', '=', 2]; + $this->searchWhere[] = ['paid', '=', 1]; + break; + } + return StoreOrder::where($this->searchWhere)->with(['user']) ->field(['id', 'order_id', 'pay_price', 'pay_time','uid', 'pay_type', 'status', 'paid', 'total_num']) ->limit($this->limitOffset, $this->limitLength) From 217bfec00e0ec0b9f221e249b322a59b5623de99 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 14:53:21 +0800 Subject: [PATCH 56/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/store_order/StoreOrderLists.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/store/lists/store_order/StoreOrderLists.php b/app/store/lists/store_order/StoreOrderLists.php index 1eb00fe33..542d75bb3 100644 --- a/app/store/lists/store_order/StoreOrderLists.php +++ b/app/store/lists/store_order/StoreOrderLists.php @@ -55,7 +55,6 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface $this->searchWhere[] = ['pay_type', 'in', [7, 3, 18,19]]; } $status = $this->request->get('status',''); - $this->searchWhere[] = ['store_id', '=', $store_id]; switch ($status){ case -1: $this->searchWhere[] = ['status', '=', 0]; From 6bd47998902950a7e1887a365e2c0196cee0928e Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 14:54:41 +0800 Subject: [PATCH 57/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/store_order/StoreOrderLists.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/store/lists/store_order/StoreOrderLists.php b/app/store/lists/store_order/StoreOrderLists.php index 542d75bb3..416fc983a 100644 --- a/app/store/lists/store_order/StoreOrderLists.php +++ b/app/store/lists/store_order/StoreOrderLists.php @@ -62,6 +62,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface break; case 1: $this->searchWhere[] = ['status', '=', 1]; + $this->searchWhere[] = ['paid', '=', 1]; break; case 2: $this->searchWhere[] = ['status', '=', 2]; From ca086a51564d597847fc9f2c643401e189122f63 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 14:57:39 +0800 Subject: [PATCH 58/87] =?UTF-8?q?feat(CartList):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?= =?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/store/lists/cart/CartList.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/store/lists/cart/CartList.php b/app/store/lists/cart/CartList.php index 394edfc7c..83f7939f2 100644 --- a/app/store/lists/cart/CartList.php +++ b/app/store/lists/cart/CartList.php @@ -121,8 +121,8 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists ]; if ($this->off_activity == 1) { $data['pay_price'] = $this->activity_price; - if ($this->total_price < 500) { - $data['msg'] = '还差' . bcsub(500, $this->total_price, 2) . '元可获得10%品牌礼品券'; + if ($this->activity_price < 500) { + $data['msg'] = '还差' . bcsub(500, $this->activity_price, 2) . '元可获得10%品牌礼品券'; $data['pay_price'] = $this->activity_price; } } From 445c070933a1cf4c3ad51177ffde003bddb9d497 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 15:04:21 +0800 Subject: [PATCH 59/87] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=9C=8D=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=A4=A7=E4=BA=8E500=E6=89=8D=E8=83=BD=E8=8E=B7?= =?UTF-8?q?=E5=BE=97=E5=85=91=E6=8D=A2=E5=88=B8=E5=BE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 57876439b..baaf34f80 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -519,7 +519,7 @@ class PayNotifyLogic extends BaseLogic $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); $financeLogic->out($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - if ($order['uid'] > 0) { + if ($order['uid'] > 0 && $order['total_price'] > 500) { $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], @@ -553,17 +553,19 @@ class PayNotifyLogic extends BaseLogic $order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2); self::dealVipAmount($order, $order['pay_type']); } + if($order['total_price'] > 500){ + $user_number = bcmul($order['pay_price'], '0.10', 2); + $sing = [ + 'uid' => $order['uid'], + 'order_id' => $order['order_id'], + 'title' => '购买商品获得兑换券', + 'store_id' => $order['store_id'], + 'number' => $user_number, + 'status' => 0, + ]; + $user_sing->save($sing); + } - $user_number = bcmul($order['pay_price'], '0.10', 2); - $sing = [ - 'uid' => $order['uid'], - 'order_id' => $order['order_id'], - 'title' => '购买商品获得兑换券', - 'store_id' => $order['store_id'], - 'number' => $user_number, - 'status' => 0, - ]; - $user_sing->save($sing); // User::where('id', $order['uid'])->inc('integral', $user_number)->update(); } From 048e5e8d0da8b9da2c0fcce0d884277a486c89e6 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 15:11:22 +0800 Subject: [PATCH 60/87] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/cart/CartList.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/app/store/lists/cart/CartList.php b/app/store/lists/cart/CartList.php index 83f7939f2..36d01580f 100644 --- a/app/store/lists/cart/CartList.php +++ b/app/store/lists/cart/CartList.php @@ -57,9 +57,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists ->toArray(); $off_activity = Config::where('name', 'off_activity')->value('value'); $this->off_activity = $off_activity; - $user = User::where('id', $userId)->find(); foreach ($list as $key => &$item) { - $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']]) ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price') ->withTrashed() @@ -68,20 +66,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists if ($find) { if ($off_activity == 1) { $this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2); - } else { - if ($user && $user['user_ship'] == 1) { - //更新 会员为1的时候原价减去会员价 - $deduction_price_count = bcmul(bcsub($find['price'], $find['vip_price'], 2), $item['cart_num'], 2); - $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); - } elseif ($user && $user['user_ship'] == 4) { - //更新 为4商户的时候减去商户价格 - $deduction_price_count = bcmul(bcsub($find['price'], $find['cost'], 2), $item['cart_num'], 2); - $this->activity_price = bcadd($this->activity_price, $deduction_price_count, 2); - } else { - $this->activity_price = 0; - } } - $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['image'] = $find['image']; @@ -117,7 +102,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists 'off_activity' => $this->off_activity, 'total_price' => $this->total_price, 'msg' => '', - 'pay_price' => bcsub($this->total_price, $this->activity_price, 2) + 'pay_price' => $this->total_price ]; if ($this->off_activity == 1) { $data['pay_price'] = $this->activity_price; From 02c492c1a41c9dafe93f2e1053aeefc45de2209f Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 15:12:00 +0800 Subject: [PATCH 61/87] =?UTF-8?q?feat(CartList):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/CartList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index 2ca53b8d6..c7c4ed8be 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -110,7 +110,7 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists 'off_activity' => $this->off_activity, 'total_price' => $this->total_price, 'msg' => '', - 'pay_price' => bcsub($this->total_price, $this->activity_price, 2) + 'pay_price' => $this->total_price ]; if($this->off_activity==1){ $data['pay_price']=$this->activity_price; From 11fc23a322eecd7234a2f388ca2cdca064fe1e1d Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 15:18:12 +0800 Subject: [PATCH 62/87] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B8=E9=94=80?= =?UTF-8?q?=E7=A4=BC=E5=93=81=E5=88=B8=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index bddf25345..93fc43001 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -436,7 +436,8 @@ class OrderLogic extends BaseLogic $order=StoreOrder::where('id',$data['id'])->find(); PayNotifyLogic::afterPay($order); PayNotifyLogic::descStock($order['id']); - if($order['uid']){ + + if($order['uid'] && $order['total_price'] > 500){ $user_number = bcmul($order['pay_price'], '0.10', 2); User::where('id', $order['uid'])->inc('integral', $user_number)->update(); UserSign::where(['uid' => $order['uid'],'order_id' => $order['order_id']])->update(['status'=>1]); From c3378b3f55abba1327c4ede5c60aa29f1e555976 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 15:28:08 +0800 Subject: [PATCH 63/87] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=E7=A4=BC=E5=93=81=E5=88=B8=E5=92=8C=E5=86=BB?= =?UTF-8?q?=E7=BB=93=E7=A4=BC=E5=93=81=E5=88=B8=E5=BE=97=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/user/UserController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index d6f5b8694..f6f09d5f1 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -232,11 +232,13 @@ class UserController extends BaseApiController $res = UserLogic::dealDetails($params,$this->userId); $integral = User::where('id',$this->userId)->value('integral'); $number = UserSign::where('id',$this->userId)->where('status',0)->sum('number'); + $GetNumber = UserSign::where('id',$this->userId)->where('status',1)->sum('number'); $res['page_no'] = $params['page_no']; $res['page_size'] = $params['page_size']; $res['extend'] = [ 'integral'=>$integral, - 'number'=>$number + 'number'=>$number, + 'get_number'=>$GetNumber ]; return $this->success('ok', $res); From 41c77533b8778a6cb66c9143fd6f85a9726afbe2 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 15:28:13 +0800 Subject: [PATCH 64/87] =?UTF-8?q?feat(CartList):=20=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E7=8A=B6=E6=80=81=E8=B0=83=E6=95=B4=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=BB=B7=E6=A0=BC=E5=92=8C=E6=94=AF=E4=BB=98=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E8=AE=A1=E7=AE=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/CartList.php | 9 +++++---- app/store/lists/cart/CartList.php | 8 +++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index c7c4ed8be..a76d8c17b 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -65,7 +65,6 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists $off_activity = Config::where('name', 'off_activity')->value('value'); $this->off_activity=$off_activity; foreach ($list as $key => &$item) { - $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']]) ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price') ->withTrashed() @@ -74,11 +73,13 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists if ($find) { if($off_activity==1){ $this->activity_price = bcadd(bcmul($find['cost'],$item['cart_num'], 2), $this->activity_price, 2); + $item['price'] = $find['cost']; + }else{ + $item['price'] = $find['price']; } $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['imgs'] = $find['image']; - $item['price'] = $find['price']; $item['cost'] = $find['cost']; $item['goods_name'] = $find['store_name']; $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); @@ -114,8 +115,8 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists ]; if($this->off_activity==1){ $data['pay_price']=$this->activity_price; - if($this->total_price<500){ - $data['msg']='还差'.bcsub(500,$this->total_price,2).'元可获得10%品牌礼品券'; + if($this->activity_price<500){ + $data['msg']='还差'.bcsub(500,$this->activity_price,2).'元可获得10%品牌礼品券'; $data['pay_price']= $this->activity_price; } } diff --git a/app/store/lists/cart/CartList.php b/app/store/lists/cart/CartList.php index 36d01580f..47ab41107 100644 --- a/app/store/lists/cart/CartList.php +++ b/app/store/lists/cart/CartList.php @@ -64,13 +64,15 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists ->find(); if ($find) { - if ($off_activity == 1) { - $this->activity_price = bcadd(bcmul($find['cost'], $item['cart_num'], 2), $this->activity_price, 2); + if($off_activity==1){ + $this->activity_price = bcadd(bcmul($find['cost'],$item['cart_num'], 2), $this->activity_price, 2); + $item['price'] = $find['cost']; + }else{ + $item['price'] = $find['price']; } $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['image'] = $find['image']; - $item['price'] = $find['price']; $item['cost'] = $find['cost']; $item['store_name'] = $find['store_name']; $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); From d4184391fb003776c4d187c4c5a9150b59e378cc Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 15:29:39 +0800 Subject: [PATCH 65/87] =?UTF-8?q?feat(CartList.php):=20=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97?= =?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/lists/order/CartList.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/api/lists/order/CartList.php b/app/api/lists/order/CartList.php index a76d8c17b..de0fc8e24 100644 --- a/app/api/lists/order/CartList.php +++ b/app/api/lists/order/CartList.php @@ -73,13 +73,11 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists if ($find) { if($off_activity==1){ $this->activity_price = bcadd(bcmul($find['cost'],$item['cart_num'], 2), $this->activity_price, 2); - $item['price'] = $find['cost']; - }else{ - $item['price'] = $find['price']; } $item['goods_total_price'] = bcmul($item['cart_num'], $find['price'], 2); $this->total_price = bcadd($this->total_price, $item['goods_total_price'], 2); $item['imgs'] = $find['image']; + $item['price'] = $find['price']; $item['cost'] = $find['cost']; $item['goods_name'] = $find['store_name']; $item['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name'); From 3f7d500347231eb339955abadc78181f871175e5 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 15:41:01 +0800 Subject: [PATCH 66/87] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E8=AE=A2=E5=8D=95=E4=B8=8B=E5=8D=95=E4=BB=B7?= =?UTF-8?q?=E6=A0=BC=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/OrderList.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/api/lists/order/OrderList.php b/app/api/lists/order/OrderList.php index f1ba4dd47..86a4e5378 100644 --- a/app/api/lists/order/OrderList.php +++ b/app/api/lists/order/OrderList.php @@ -52,12 +52,13 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface ->select() ->each(function ($item) { $item['goods_list'] = StoreOrderCartInfo::where('oid', $item['id']) - ->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,old_cart_id')->limit(3)->select() + ->field('product_id,cart_num,verify_code,is_writeoff,writeoff_time,old_cart_id,cart_info')->limit(3)->select() ->each(function ($v) use ($item) { $find = StoreBranchProduct::where('product_id', $v['product_id'])->where('store_id', $item['store_id'])->withTrashed()->find(); $v['store_name'] = $find['store_name']; $v['image'] = $find['image']; - $v['price'] = $find['price']; +// $v['price'] = $find['price']; + $v['price'] = $v['cart_info']['price']; $v['unit_name'] = StoreProductUnit::where('id', $find['unit'])->value('name') ?? ''; }); $item['goods_count'] = count(explode(',', $item['cart_id'])); From bfb85eecd18037a2651f82081d211759ceff4eb6 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 15:44:14 +0800 Subject: [PATCH 67/87] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=86=BB=E7=BB=93?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=BE=97=E5=80=BC=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/UserLogic.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index b98b7c48c..bfd9c80b4 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -115,6 +115,10 @@ class UserLogic extends BaseLogic $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('id',$uid)->where('status',0)->sum('number'); + $GetNumber = UserSign::where('id',$uid)->where('status',1)->sum('number'); + $data['number '] =$number; + $data['GetNumber'] =$GetNumber; }else{ $data = []; } From 379c8aea4c3558612a41facc3ce997070f034112 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 15:47:03 +0800 Subject: [PATCH 68/87] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=86=BB=E7=BB=93?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=BE=97=E5=80=BC=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/UserLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index bfd9c80b4..c14d71b0e 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -117,7 +117,7 @@ class UserLogic extends BaseLogic $data['integral']=bcadd($data['integral'],$number,2); $number = UserSign::where('id',$uid)->where('status',0)->sum('number'); $GetNumber = UserSign::where('id',$uid)->where('status',1)->sum('number'); - $data['number '] =$number; + $data['number'] =$number; $data['GetNumber'] =$GetNumber; }else{ $data = []; From 4f2e432d10238f364bafeaa2a1c6a7ba667d6973 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 15:51:00 +0800 Subject: [PATCH 69/87] =?UTF-8?q?feat(order):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91=EF=BC=8C=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E4=BB=B7=E6=A0=BC=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 93fc43001..33be0201c 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -75,19 +75,19 @@ class OrderLogic extends BaseLogic self::$store_price = 0; //门店零售价 /** 计算价格 */ $off_activity=Config::where('name','off_activity')->value('value'); - if($off_activity!=1){ - $field='id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id'; - }else{ - $field='id branch_product_id,store_name,image,unit,cost price,vip_price,cost,purchase,product_id'; - } + $field='id branch_product_id,store_name,image,unit,price,vip_price,cost,purchase,product_id'; foreach ($cart_select as $k => $v) { $find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->withTrashed()->find(); if (!$find) { continue; } unset($cart_select[$k]['id']); - - $cart_select[$k]['price'] = $find['price']; + if($off_activity==1){ + $price=$find['cost']; + }else{ + $price=$find['price']; + } + $cart_select[$k]['price'] = $price; $cart_select[$k]['cost'] = $find['cost']; $cart_select[$k]['total_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单总价 $cart_select[$k]['deduction_price'] =self::$activity_price;//抵扣金额 @@ -96,16 +96,16 @@ class OrderLogic extends BaseLogic //利润 // $cart_select[$k]['profit'] = bcmul($v['cart_num'], $onePrice, 2); //利润 $cart_select[$k]['purchase'] = bcmul($v['cart_num'], $find['purchase'], 2) ?? 0; //成本 - $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $find['price'], 2); //订单支付金额 + $cart_select[$k]['pay_price'] = bcmul($v['cart_num'], $price, 2); //订单支付金额 $cart_select[$k]['store_price'] = bcmul($v['cart_num'], $find['cost'], 2)??0; //门店零售价 - $cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2)??0; //vip售价 + // $cart_select[$k]['vip_price'] = bcmul($v['cart_num'], $find['vip_price'], 2)??0; //vip售价 $cart_select[$k]['product_id'] = $find['product_id']; $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; //vip1待返回金额 - $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'],2); + // $cart_select[$k]['vip_frozen_price'] = bcsub($cart_select[$k]['pay_price'],$cart_select[$k]['vip_price'],2); // d($cart_select[$k]['pay_price'],$cart_select[$k]['store_price'],$cart_select[$k]['vip_price'] ); $cartInfo = $cart_select[$k]; $cartInfo['name'] = $find['store_name']; From f9b10e51ce6f9d72ffc1be6b40917f20e60a949f Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:02:54 +0800 Subject: [PATCH 70/87] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8=E4=B8=80=E7=BA=A7=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E6=9F=A5=E8=AF=A2=E5=95=86=E5=93=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/lists/store_product/StoreProductLists.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/admin/lists/store_product/StoreProductLists.php b/app/admin/lists/store_product/StoreProductLists.php index 12c737412..360cda901 100644 --- a/app/admin/lists/store_product/StoreProductLists.php +++ b/app/admin/lists/store_product/StoreProductLists.php @@ -4,6 +4,7 @@ namespace app\admin\lists\store_product; use app\admin\lists\BaseAdminDataLists; +use app\common\model\cate\Cate; use app\common\model\store_product\StoreProduct; use app\common\lists\ListsSearchInterface; use app\common\model\store_category\StoreCategory; @@ -45,6 +46,17 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa */ public function lists(): array { + $class_all = $this->request->get('class_all'); + if ($class_all) { + //查3级别的 + $arr = Cate::where('pid', $class_all)->column('id'); + if ($arr) { + $arr2 = Cate::where('pid', 'in', $arr)->column('id'); + $this->searchWhere[] = ['cate_id', 'in', array_merge($arr, $arr2)]; + } else { + $this->searchWhere[] = ['cate_id', '=', $class_all]; + } + } return StoreProduct::where($this->searchWhere) ->field(['id', 'image', 'store_name','swap', 'cate_id','batch', 'price','vip_price','sales', 'stock', 'is_show', 'unit', 'cost','rose','purchase','bar_code','manufacturer_information']) ->limit($this->limitOffset, $this->limitLength) From 4cb0f02df1673c680427b92e8f6187fe10e29d21 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:11:56 +0800 Subject: [PATCH 71/87] =?UTF-8?q?=E8=B0=83=E8=AF=95=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/SmsService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index af0d86ba0..e45c905a6 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -75,7 +75,7 @@ class SmsService return false; } }catch(NoGatewayAvailableException $e){ - throw new BusinessException($e->getMessage()); + throw new BusinessException($e->getExceptions()); } } From fc36227b33350ad8d1048dcb49e2bfc93fc7ca53 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:13:47 +0800 Subject: [PATCH 72/87] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/SmsService.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index e45c905a6..aa18e526a 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -47,7 +47,7 @@ class SmsService public function client($phone,$template,$code,$type = 0) { - try{ +// try{ $easySms = new EasySms($this->config); if($type){//预留发送到货短信 @@ -67,16 +67,16 @@ class SmsService 'code' => $code ], ]); - } + }d($res); if($res && $res['aliyun']['status'] == 'success'){ return true; }else{ return false; } - }catch(NoGatewayAvailableException $e){ - throw new BusinessException($e->getExceptions()); - } +// }catch(NoGatewayAvailableException $e){ +// throw new BusinessException($e->getExceptions()); +// } } } From 338354ee774d6b919f389ca94f526bad48b729f9 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:30:06 +0800 Subject: [PATCH 73/87] =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=94=B6=E9=93=B6?= =?UTF-8?q?=E5=8F=B0=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/SmsService.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index aa18e526a..eac0e415e 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -47,7 +47,7 @@ class SmsService public function client($phone,$template,$code,$type = 0) { -// try{ + try{ $easySms = new EasySms($this->config); if($type){//预留发送到货短信 @@ -67,16 +67,17 @@ class SmsService 'code' => $code ], ]); - }d($res); + } if($res && $res['aliyun']['status'] == 'success'){ return true; }else{ return false; } -// }catch(NoGatewayAvailableException $e){ -// throw new BusinessException($e->getExceptions()); -// } + }catch(NoGatewayAvailableException $e){ + d($e); + throw new BusinessException($e->getExceptions()); + } } } From fdddbbec51e59e38818529323481f68eae247e4b Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 16:38:04 +0800 Subject: [PATCH 74/87] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 53 +++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 8c4d47047..cd0862a83 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -14,6 +14,8 @@ use app\common\service\PushService; use app\common\service\wechat\WechatTemplate; use app\statistics\logic\OrderLogic; use Exception; +use Overtrue\EasySms\EasySms; +use Overtrue\EasySms\Exceptions\NoGatewayAvailableException; use support\Cache; use think\facade\Db; use Webman\Config; @@ -29,7 +31,56 @@ class IndexController extends BaseApiController public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config']; public function index() - { $all_where['paid'] = 1; + { + $config = [ + // HTTP 请求的超时时间(秒) + 'timeout' => 5.0, + + // 默认发送配置 + 'default' => [ + // 网关调用策略,默认:顺序调用 + 'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class, + + // 默认可用的发送网关 + 'gateways' => [ + 'yunpian', 'aliyun', + ], + ], + // 可用的网关配置 + 'gateways' => [ + 'errorlog' => [ + 'file' => runtime_path() . '/logs/' . date('Ymd') . '/easy-sms.log', + ], + 'aliyun' => [ + 'access_key_id' => 'LTAI5t7mhH3ij2cNWs1zhPmv', + 'access_key_secret' => 'gqo2wMpvi8h5bDBmCpMje6BaiXvcPu', + 'sign_name' => '里海科技', + ], + //... + ], + ]; + + try { + $easySms = new EasySms($config); + $template = getenv('SMS_TEMPLATE'); + $a = $easySms->send(18715753257, [ + 'content' => '您的验证码为: 6379', + 'template' => $template, + 'data' => [ + 'code' => 6379 + ], + ]); +// d($a); + }catch (NoGatewayAvailableException $exception){ + throw new \Exception($exception->getExceptions()); + } + + d($a,getenv('SMS_TEMPLATE')); + + + + + $all_where['paid'] = 1; d(OrderLogic::dayPayPrice($all_where,date('Y-m-d',time()))); $uid=9; $a= PushService::push('wechat_mmp_'.$uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'支付超时,订单已被取消,请重新提交订单','data'=>['id'=>5]]); From 6cfc2c773ee99345ada887f8f24d68c163615861 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 16:50:35 +0800 Subject: [PATCH 75/87] =?UTF-8?q?feat(order):=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=80=BB=E8=BE=91=E4=BB=A5=E5=A4=84=E7=90=86?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 33be0201c..411272a01 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -186,11 +186,12 @@ class OrderLogic extends BaseLogic if (!$orderInfo) { return false; } + $uid=$user['id']??0; $_order = $orderInfo['order']; - $_order['uid'] = $user['id']; + $_order['uid'] = $uid; $_order['spread_uid'] =$params['spread_uid']??0; - $_order['real_name'] = $user['real_name']; - $_order['mobile'] = $user['mobile']; + $_order['real_name'] = $user['real_name']??''; + $_order['mobile'] = $user['mobile']??''; $_order['pay_type'] = $orderInfo['order']['pay_type']; $_order['verify_code'] = $verify_code; $_order['reservation_time'] = null; @@ -198,8 +199,8 @@ class OrderLogic extends BaseLogic $_order['reservation_time'] = $params['reservation_time']; $_order['reservation'] = YesNoEnum::YES; } - if ($addressId > 0) { - $address = UserAddress::where(['id' => $addressId, 'uid' => $user['id']])->find(); + if ($addressId > 0 &&$uid>0 ) { + $address = UserAddress::where(['id' => $addressId, 'uid' => $uid])->find(); if ($address) { $_order['real_name'] = $address['real_name']; $_order['user_phone'] = $address['phone']; @@ -222,7 +223,7 @@ class OrderLogic extends BaseLogic $goods_list = $orderInfo['cart_list']; foreach ($goods_list as $k => $v) { $goods_list[$k]['oid'] = $order->id; - $goods_list[$k]['uid'] = $user['id']; + $goods_list[$k]['uid'] = $uid; $goods_list[$k]['cart_id'] = implode(',', $cartId); $goods_list[$k]['delivery_id'] = $params['store_id']; //商家id $StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->withTrashed()->find(); From 9d54b4dea10c494d5c4e3fd40faa457581255859 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 17:07:56 +0800 Subject: [PATCH 76/87] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E6=AC=BE=20=E4=BD=99=E9=A2=9D=E6=94=AF=E4=BB=98=E5=86=BB?= =?UTF-8?q?=E7=BB=93=E7=A4=BC=E5=93=81=E5=88=B8=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 | 4 ++-- app/common/logic/PayNotifyLogic.php | 20 +++++++++++++++++++- app/common/service/SmsService.php | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index c14d71b0e..c0b6b12c0 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -115,8 +115,8 @@ class UserLogic extends BaseLogic $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('id',$uid)->where('status',0)->sum('number'); - $GetNumber = UserSign::where('id',$uid)->where('status',1)->sum('number'); + $number = UserSign::where('uid',$uid)->where('status',0)->sum('number'); + $GetNumber = UserSign::where('uid',$uid)->where('status',1)->sum('number'); $data['number'] =$number; $data['GetNumber'] =$GetNumber; }else{ diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index baaf34f80..49042a568 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -88,6 +88,7 @@ class PayNotifyLogic extends BaseLogic $order['pay_price'] = $oldUser; } } + self::addUserSing($order); $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_balance_pay', 'order', $order['id'], $order['pay_price'], '', 0, $order['store_id']); self::dealProductLog($order); @@ -184,7 +185,7 @@ class PayNotifyLogic extends BaseLogic // if ($user['user_ship'] == 1) { // self::dealVipAmount($order, PayEnum::PURCHASE_FUNDS); // } - + self::addUserSing($order); if ($extra && $extra['store_id']) { $params = [ 'verify_code' => $order['verify_code'], @@ -383,6 +384,23 @@ class PayNotifyLogic extends BaseLogic return true; } + //入冻结礼品券 + public static function addUserSing($order) + { + $user_sing = new UserSign(); + if ($order['uid'] > 0 && $order['total_price'] > 500) { + $user_number = bcmul($order['pay_price'], '0.10', 2); + $sing = [ + 'uid' => $order['uid'], + 'order_id' => $order['order_id'], + 'title' => '购买商品获得兑换券', + 'store_id' => $order['store_id'], + 'number' => $user_number, + ]; + $user_sing->save($sing); + } + return true; + } /** diff --git a/app/common/service/SmsService.php b/app/common/service/SmsService.php index eac0e415e..f98f15688 100644 --- a/app/common/service/SmsService.php +++ b/app/common/service/SmsService.php @@ -75,7 +75,7 @@ class SmsService return false; } }catch(NoGatewayAvailableException $e){ - d($e); + throw new BusinessException($e->getExceptions()); } From 63428d50155aa83aafbcd00eeb05219129fa557e Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 17:14:46 +0800 Subject: [PATCH 77/87] =?UTF-8?q?=E5=9B=9E=E8=B0=83=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 49042a568..93cc62e60 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -537,7 +537,8 @@ class PayNotifyLogic extends BaseLogic $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); $financeLogic->out($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); - if ($order['uid'] > 0 && $order['total_price'] > 500) { + if ($order['uid'] > 0 && $order['total_price'] > 500 && $order['pay_type'] !=18 + && $order['pay_type'] !=3) { $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], @@ -571,7 +572,8 @@ class PayNotifyLogic extends BaseLogic $order['pay_price'] = bcsub($order['pay_price'], $vipFrozenAmount, 2); self::dealVipAmount($order, $order['pay_type']); } - if($order['total_price'] > 500){ + if($order['total_price'] > 500 && $order['pay_type'] !=18 + && $order['pay_type'] !=3){ $user_number = bcmul($order['pay_price'], '0.10', 2); $sing = [ 'uid' => $order['uid'], From 85eea995581f661d41e2ca2abc41a40ae102b6ed Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 17:33:11 +0800 Subject: [PATCH 78/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=85=E5=80=BC?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/logic/user/UserLogic.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/admin/logic/user/UserLogic.php b/app/admin/logic/user/UserLogic.php index 8ee754deb..7a6f7e8a6 100644 --- a/app/admin/logic/user/UserLogic.php +++ b/app/admin/logic/user/UserLogic.php @@ -80,7 +80,6 @@ class UserLogic extends BaseLogic $password = create_password(123456, $passwordSalt); $defaultAvatar = config('project.default_image.admin_avatar'); $avatar = !empty($params['avatar']) ? FileService::setFileUrl($params['avatar']) : $defaultAvatar; - Db::startTrans(); try { $data=[ @@ -104,13 +103,13 @@ class UserLogic extends BaseLogic UserAddress::create([ 'uid' => $res['id'], 'real_name' => $params['real_name']??"", - 'mobile' => $params['mobile'], - 'province' => $params['province'], - 'city' => $params['city'], - 'area' => $params['area'], - 'street' => $params['street'], - 'village' => $params['village'], - 'brigade' => $params['brigade'], + 'mobile' => $params['mobile']??'', + 'province' => $params['province']??'', + 'city' => $params['city']??'', + 'area' => $params['area']??'', + 'street' => $params['street']??'', + 'village' => $params['village']??'', + 'brigade' => $params['brigade']??'', 'is_default' => 1, ]); Db::commit(); From 9346c581b372123758482f9b1ad8d2aaf7246324 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 17:55:46 +0800 Subject: [PATCH 79/87] =?UTF-8?q?feat:=20=E5=AE=9E=E7=8E=B0=E7=BA=BF?= =?UTF-8?q?=E4=B8=8B=E5=88=86=E6=B6=A6=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 1 - app/common/logic/CommissionLogic.php | 195 ++++++++++++++++++ app/common/logic/StoreFinanceFlowLogic.php | 2 +- .../logic/store_order/StoreOrderLogic.php | 1 + .../store_order/StoreOrderController.php | 3 +- 5 files changed, 199 insertions(+), 3 deletions(-) create mode 100644 app/common/logic/CommissionLogic.php diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index 411272a01..c875b5ab0 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -448,7 +448,6 @@ class OrderLogic extends BaseLogic return true; } catch (\Exception $e) { Db::rollback(); - d($e); self::setError($e->getMessage()); return false; } diff --git a/app/common/logic/CommissionLogic.php b/app/common/logic/CommissionLogic.php new file mode 100644 index 000000000..f9a438e59 --- /dev/null +++ b/app/common/logic/CommissionLogic.php @@ -0,0 +1,195 @@ + 0) { + $address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find(); + if ($address) { + $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid'); + if ($arr1) { + $uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); + if ($uid) { + $village_uid = $uid; + } + } + $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); + if ($arr2) { + $uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); + if ($uid) { + $brigade_uid = $uid; + } + } + } + } + self::user($order, 0.03, $transaction_id,$village_uid,12);//会员 + self::user($order, 0.01, $transaction_id,$brigade_uid,15);//队长 + self::user($order, 0.01, $transaction_id,0,16);//其他 + } + /** + * 走队长分润 + */ + public static function setBrigade($order, $transaction_id) + { + self::user($order, 0.05, $transaction_id,$order['uid'],14); + $village_uid=0; + $brigade_uid=0; + if ($order['uid'] > 0) { + $address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find(); + if ($address) { + $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid'); + if ($arr1) { + $uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); + if ($uid) { + $village_uid = $uid; + } + } + $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); + if ($arr2) { + $uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); + if ($uid) { + $brigade_uid = $uid; + } + } + } + } + self::user($order, 0.03, $transaction_id,$village_uid,12);//会员 + self::user($order, 0.01, $transaction_id,$brigade_uid,15);//队长 + self::user($order, 0.01, $transaction_id,0,16);//其他 + } + /** + * 走厨师分润 + */ + public static function setCook($order, $transaction_id) + { + self::user($order, 0.07, $transaction_id,$order['uid'],12);//改到带返还金中 + $village_uid=0; + $brigade_uid=0; + if ($order['uid'] > 0) { + $address = UserAddress::where(['uid' => $order['uid'], 'is_default' => 1])->find(); + if ($address) { + $arr1 = UserAddress::where(['village' => $address['village'], 'is_default' => 1])->column('uid'); + if ($arr1) { + $uid = User::where('id', 'in', $arr1)->where('user_ship', 2)->value('id'); + if ($uid) { + $village_uid = $uid; + } + } + $arr2 = UserAddress::where(['village' => $address['village'], 'brigade' => $address['brigade'], 'is_default' => 1])->column('uid'); + if ($arr2) { + $uid = User::where('id', 'in', $arr1)->where('user_ship', 3)->value('id'); + if ($uid) { + $brigade_uid = $uid; + } + } + } + } + self::user($order, 0.01, $transaction_id,$village_uid,14);//村长 + self::user($order, 0.01, $transaction_id,$brigade_uid,15);//队长 + self::user($order, 0.01, $transaction_id,0,16);//其他 + } + + /** + * 走线下分润 + */ + public static function setStore($order, $transaction_id) + { + self::platform($order, 0.05, $transaction_id);//平台 + self::store($order, 0.02, $transaction_id,0);//门店 + self::user($order, 0.01, $transaction_id,0,16);//其他 + + } + + + /** + * 平台分润 + */ + public static function platform($order, $platformRate, $transaction_id) + { + $financeLogic = new StoreFinanceFlowLogic(); + $financeLogic->order=$order; + $fees = bcdiv(bcmul($order['pay_price'], $platformRate, 2), 1, 2); + if ($fees > 0) { + $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费 + $financeLogic->out($transaction_id, $fees, OrderEnum::ORDER_HANDLING_FEES, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //商户平台手续费支出 + } + } + /** + * 门店分润 + */ + public static function store($order, $platformRate, $transaction_id,$uid) + { + $financeLogic = new StoreFinanceFlowLogic(); + $financeLogic->user['uid']=$order['uid']; + $financeLogic->other_arr['vip_uid']=$uid; + $financeLogic->order=$order; + $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 + + //缴纳齐全了就加商户没有就加到平台 + $money_limt = SystemStore::where('id', $order['store_id'])->field('paid_deposit,security_deposit')->find(); + $deposit = bcsub($money_limt['security_deposit'], $money_limt['paid_deposit'], 2); //保证金剩余额度 + $store_profit = bcdiv(bcmul($order['pay_price'], $platformRate, 2), 1, 2); + if ($deposit > 0) { + if ($deposit > $store_profit) { + if ($store_profit > 0) { + SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $store_profit)->update(); + $financeLogic->out($transaction_id, $store_profit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + $financeLogic->in($transaction_id, 0, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费 + } + } else { + $money = bcsub($store_profit, $deposit, 2); + if ($deposit > 0) { + SystemStore::where('id', $order['store_id'])->inc('paid_deposit', $deposit)->update(); + $financeLogic->out($transaction_id, $deposit, OrderEnum::ORDER_MARGIN, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + } + if ($money) { + SystemStore::where('id', $order['store_id'])->inc('store_money', $money)->update(); + $financeLogic->in($transaction_id, $money, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费 + } + } + } else { + if ($store_profit > 0) { + SystemStore::where('id', $order['store_id'])->inc('store_money', $store_profit)->update(); + $financeLogic->in($transaction_id, $store_profit, OrderEnum::MERCHANT_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); //平台手续费 + } + } + } + + /** + * 分给用户 + */ + public static function user($order, $userRate, $transaction_id,$uid=0,$enum = 0) + { + $financeLogic = new StoreFinanceFlowLogic(); + $fees = bcmul($order['pay_price'], $userRate, 2); + if ($fees > 0) { + //记录用户余额收入 + if ($uid) { + $GiveUser = User::where('id', $order['uid'])->find(); + $capitalFlowDao = new CapitalFlowLogic($GiveUser); + $capitalFlowDao->userIncome('system_balance_add', 'order', $order['id'], $fees); + } + $financeLogic->user['uid']=$order['uid']; + $financeLogic->other_arr['vip_uid']=$uid; + $financeLogic->order=$order; + $financeLogic->in($transaction_id, $fees, $enum, $order['store_id'], 0, 0, $order['pay_type']); + $financeLogic->out($transaction_id, $fees, $enum, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); + + + } + } +} diff --git a/app/common/logic/StoreFinanceFlowLogic.php b/app/common/logic/StoreFinanceFlowLogic.php index ac7d66070..fab958091 100644 --- a/app/common/logic/StoreFinanceFlowLogic.php +++ b/app/common/logic/StoreFinanceFlowLogic.php @@ -53,7 +53,7 @@ class StoreFinanceFlowLogic extends BaseLogic 'order_id' => $this->order['id'], 'transaction_id' => $transaction_id, 'order_sn' => $this->order['order_id'], - 'user_id' => $this->user['uid'], + 'user_id' => $this->user['uid']??0, 'other_uid' => $this->other_arr['vip_uid']??0, 'financial_type' => $financialType, 'financial_pm' => $pm, diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index da9cf0212..6c8d94725 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -264,6 +264,7 @@ class StoreOrderLogic extends BaseLogic $query->field(['id', 'oid', 'product_id', 'cart_info']); }])->where($params)->whereIn('shipping_type',OrderEnum::ONLINE) ->page($pageNo, $pageSize) + ->order('id desc') ->select()->toArray(); foreach ($order as &$value){ diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index e7e587ccd..79b74cfa0 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -18,6 +18,7 @@ use app\common\logic\store_order\StoreOrderLogic; use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_order\StoreOrder; use app\common\model\store_order_cart_info\StoreOrderCartInfo; +use app\common\model\store_product\StoreProduct; use app\common\model\store_product_unit\StoreProductUnit; use app\common\model\system_store\SystemStore; use app\common\model\system_store\SystemStoreStaff; @@ -437,7 +438,7 @@ class StoreOrderController extends BaseAdminController $find['nickname'] = $user['nickname'] ?? ''; $find['user_mobile'] = $user['mobile'] ?? ''; $find['info'] = StoreOrderCartInfo::where('oid', $find['id'])->field('store_id,product_id,cart_num,cart_info')->select()->each(function ($item) { - $goods = StoreBranchProduct::where(['store_id' => $item['store_id'], 'product_id' => $item['product_id']])->field('store_name,unit')->find(); + $goods = StoreProduct::where(['id' => $item['product_id']])->field('store_name,unit')->find(); $item['unit_name'] = StoreProductUnit::where('id', $goods['unit'])->value('name'); $item['store_name'] = $goods['store_name']; $item['total_price'] = $item['cart_info']['total_price']; From a54eebddb610f1294b0ce6df93926f691d04df93 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 18:02:23 +0800 Subject: [PATCH 80/87] =?UTF-8?q?feat(StoreOrderLogic):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=86StoreOrderLogic=EF=BC=8C=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E4=BA=86=E5=9C=A8=E7=BA=BF=E8=AE=A2=E5=8D=95=E7=9A=84=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E6=96=B9=E5=BC=8F=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=88=86=E9=A1=B5=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/store_order/StoreOrderLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 6c8d94725..1a0c6efd3 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -262,7 +262,7 @@ class StoreOrderLogic extends BaseLogic $params['is_writeoff'] = YesNoEnum::YES; $order = StoreOrder::with(['user', 'staff', 'product' => function ($query) { $query->field(['id', 'oid', 'product_id', 'cart_info']); - }])->where($params)->whereIn('shipping_type',OrderEnum::ONLINE) + }])->where($params) ->page($pageNo, $pageSize) ->order('id desc') ->select()->toArray(); From 69cc28c0d452f565c27b62295bd356471ead2598 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 18:06:02 +0800 Subject: [PATCH 81/87] =?UTF-8?q?feat(StoreOrderController):=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9writeoff=5Flist=E6=96=B9=E6=B3=95=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E9=A1=B5=E7=A0=81=E5=92=8C=E6=AF=8F=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E7=9A=84=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/store_order/StoreOrderController.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index 79b74cfa0..1b14fec01 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -322,15 +322,11 @@ class StoreOrderController extends BaseAdminController // ] public function writeoff_list(StoreOrderLogic $orderLogic) { - $page_no = (int)$this->request->post('page_no', 1); - $page_size = (int)$this->request->post('page_size', 15); - $params = $this->request->post(); + $page_no = (int)$this->request->get('page_no', 1); + $page_size = (int)$this->request->get('page_size', 15); + $params = $this->request->get(); $params['page_no'] = $page_no; $params['page_size'] = $page_size; - if (empty($page_no) || empty($page_size)) { - $params['page_no'] = 1; - $params['page_size'] = 15; - } $params['store_id'] = $this->request->adminInfo['store_id']; $result = $orderLogic->writeList($params); From 9cd1395a0ab7f690bbf8d657ec3c3edf04eb0354 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 18:07:37 +0800 Subject: [PATCH 82/87] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/store/StoreController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/api/controller/store/StoreController.php b/app/api/controller/store/StoreController.php index cda667c89..bab205a87 100644 --- a/app/api/controller/store/StoreController.php +++ b/app/api/controller/store/StoreController.php @@ -85,6 +85,9 @@ class StoreController extends BaseApiController $find['real_name']=$params['real_name']; $find->save(); } + if($find === false){ + return $this->fail(UserUserLogic::getError()); + } if($recharge_type!='INDUSTRYMEMBERS'){ return $this->success('添加用户成功'); } From 7f78621b667b27b96aca06c0823c3570c67bf898 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 26 Jun 2024 18:07:45 +0800 Subject: [PATCH 83/87] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E7=A9=BA=E9=AA=8C=E8=AF=81=E7=A0=81=E7=9A=84=E5=88=A4=E6=96=AD?= =?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/common/logic/store_order/StoreOrderLogic.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/common/logic/store_order/StoreOrderLogic.php b/app/common/logic/store_order/StoreOrderLogic.php index 1a0c6efd3..8b5a8943a 100644 --- a/app/common/logic/store_order/StoreOrderLogic.php +++ b/app/common/logic/store_order/StoreOrderLogic.php @@ -258,6 +258,9 @@ class StoreOrderLogic extends BaseLogic $pageNo = $params['page_no']; $pageSize = $params['page_size']; unset($params['page_no'],$params['page_size']); + if($params['verify_code']==''){ + unset($params['verify_code']); + } $params['paid'] = YesNoEnum::YES; $params['is_writeoff'] = YesNoEnum::YES; $order = StoreOrder::with(['user', 'staff', 'product' => function ($query) { From 00e8d3e1a6469fca01996216d08b9bc74693c639 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 18:12:35 +0800 Subject: [PATCH 84/87] =?UTF-8?q?=E6=94=B6=E9=93=B6=E6=9C=BA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=AD=97=E6=AE=B5=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/store/lists/user/UserLists.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/store/lists/user/UserLists.php b/app/store/lists/user/UserLists.php index 0a888bef6..8b3437237 100644 --- a/app/store/lists/user/UserLists.php +++ b/app/store/lists/user/UserLists.php @@ -5,6 +5,7 @@ namespace app\store\lists\user; use app\common\model\store_finance_flow\StoreFinanceFlow; +use app\common\model\user_sign\UserSign; use app\store\lists\BaseAdminDataLists; use app\common\model\user\User; use app\common\model\user\UserShip; @@ -50,6 +51,8 @@ class UserLists extends BaseAdminDataLists implements ListsSearchInterface $data['return_money'] = StoreFinanceFlow:: where(['user_id'=>$data['id'],'status'=>0,'financial_pm'=>0]) ->sum('number'); + $data['amount_frozen'] = UserSign::where('uid',$data['id'])->where('status',0)->sum('number'); + $data['get_frozen'] = UserSign::where('uid',$data['id'])->where('status',1)->sum('number'); })->toArray(); return $lists; From eb0aa5b6fcdbfcc765fefc2cc74a504f34fd1f1b Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 18:27:36 +0800 Subject: [PATCH 85/87] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/user/UserController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/controller/user/UserController.php b/app/api/controller/user/UserController.php index f6f09d5f1..64988235f 100644 --- a/app/api/controller/user/UserController.php +++ b/app/api/controller/user/UserController.php @@ -187,7 +187,7 @@ class UserController extends BaseApiController $remark = $this->userId.'_payPassword'; $code = Cache::get($remark); if ($code && isset($params['code']) && $code !== $params['code']) { - throw new Exception('验证码错误'); + return $this->fail('验证码错误'); } if ($params['rePassword'] !== $params['password']) return $this->fail('两次密码不一致'); From c5a21a867b50727d5357455e5f426415a500b8c4 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 18:32:27 +0800 Subject: [PATCH 86/87] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/order/OrderList.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/api/lists/order/OrderList.php b/app/api/lists/order/OrderList.php index 86a4e5378..e97c09067 100644 --- a/app/api/lists/order/OrderList.php +++ b/app/api/lists/order/OrderList.php @@ -46,7 +46,8 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface { $userId = $this->request->userId; if (!$userId) return []; - $data = StoreOrder::with(['store'])->where($this->searchWhere)->where('uid', $userId) + $data = StoreOrder::with(['store'])->where($this->searchWhere)->where(['uid'=>$userId]) + ->whereIn('shipping_type',[1,2]) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() @@ -86,6 +87,6 @@ class OrderList extends BaseAdminDataLists implements ListsSearchInterface public function count(): int { $userId = $this->request->userId; - return StoreOrder::where($this->searchWhere)->where('uid', $userId)->count(); + return StoreOrder::where($this->searchWhere)->whereIn('shipping_type',[1,2])->where('uid', $userId)->count(); } } From 9a0cd3bd4c4c53d14cbaa7297cb1ab2de3f42686 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Wed, 26 Jun 2024 18:37:37 +0800 Subject: [PATCH 87/87] =?UTF-8?q?=E4=BF=9D=E7=95=992=E4=BD=8D=E5=B0=8F?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/UserLogic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index c0b6b12c0..dd77934bc 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -117,8 +117,8 @@ class UserLogic extends BaseLogic $data['integral']=bcadd($data['integral'],$number,2); $number = UserSign::where('uid',$uid)->where('status',0)->sum('number'); $GetNumber = UserSign::where('uid',$uid)->where('status',1)->sum('number'); - $data['number'] =$number; - $data['GetNumber'] =$GetNumber; + $data['number'] =bcadd($number,0,2); + $data['GetNumber'] =bcadd($GetNumber,0,2); }else{ $data = []; }