ソースを参照

Merge branch 'minus'

shish 11 ヶ月 前
コミット
9fa34d06c0
35 ファイル変更871 行追加233 行削除
  1. 5 2
      app-ghs/controllers/TestController.php
  2. 2 2
      app-hd/controllers/CheckOrderController.php
  3. 1 1
      app-hd/controllers/ConsoleController.php
  4. 1 1
      app-hd/controllers/GhsController.php
  5. 2 1
      app-hd/controllers/MtController.php
  6. 46 4
      app-hd/controllers/OrderController.php
  7. 65 0
      app-hd/controllers/RechargeController.php
  8. 119 7
      app-hd/controllers/RefundController.php
  9. 5 0
      app-hd/controllers/StatCgGhsController.php
  10. 4 0
      app-hd/controllers/StatItemController.php
  11. 1 0
      app-mall/controllers/BaseController.php
  12. 86 13
      app-mall/controllers/OrderController.php
  13. 18 0
      biz-ghs/shop/classes/ShopMoneyClass.php
  14. 20 31
      biz-ghs/stat/classes/StatKdClass.php
  15. 6 1
      biz-ghs/stat/classes/StatSaleClass.php
  16. 2 2
      biz-hd/cg/classes/CgRefundClass.php
  17. 46 109
      biz-hd/custom/classes/CustomClass.php
  18. 164 3
      biz-hd/order/classes/OrderClass.php
  19. 14 0
      biz-hd/order/classes/OrderForwardClass.php
  20. 15 0
      biz-hd/order/models/OrderForward.php
  21. 15 0
      biz-hd/order/services/OrderForwardService.php
  22. 7 13
      biz-hd/order/services/OrderService.php
  23. 29 3
      biz-hd/recharge/classes/RechargeClass.php
  24. 29 39
      biz-hd/refund/services/HdRefundService.php
  25. 29 0
      biz-hd/wx/classes/WxMiniClass.php
  26. 13 0
      biz-hd/wx/models/WxMini.php
  27. 16 1
      biz-mall/order/classes/OrderClass.php
  28. 13 0
      biz-mall/order/classes/OrderForwardClass.php
  29. 13 0
      biz-mall/order/models/OrderForward.php
  30. 15 0
      biz-mall/order/services/OrderForwardService.php
  31. 13 0
      biz-mall/shop/classes/ShopExtClass.php
  32. 13 0
      biz-mall/shop/models/ShopExt.php
  33. 30 0
      biz-mall/wx/classes/WxMiniClass.php
  34. 13 0
      biz-mall/wx/models/WxMini.php
  35. 1 0
      common/components/lakala/Lakala.php

+ 5 - 2
app-ghs/controllers/TestController.php

@@ -81,7 +81,7 @@ class TestController extends BaseController
         $merchant = WxOpenClass::getMallWxInfo();
         $ptStyle = dict::getDict('ptStyle', 'mall');
 
-        $ret = miniUtil::generateShortLink($merchant, 'pages/home/recent','',$ptStyle);
+        $ret = miniUtil::generateShortLink($merchant, 'pages/home/recent', '', $ptStyle);
         print_r($ret);
 
         util::stop();
@@ -369,7 +369,10 @@ class TestController extends BaseController
             //['name' => '九江伊朵鲜花批发', 'merchantNo' => '82242405992002A', 'wx' => [774681090, 774681246], 'zfb' => '2088470298005142'],
             //['name' => '徐州云之南鲜花', 'merchantNo' => '82230305992006C', 'wx' => [788161779, 788162410], 'zfb' => '2088670707622207'],
             //['name' => '济南伟伟鲜花批发', 'merchantNo' => '8224510599200EL', 'wx' => [789073494, 789074603], 'zfb' => '2088670850497224'],
-            ['name' => '赣州紫荆鲜花批发', 'merchantNo' => '82242805992004J', 'wx' => [790052021, 790051859], 'zfb' => '2088670969143838'],
+            //['name' => '赣州紫荆鲜花批发', 'merchantNo' => '82242805992004J', 'wx' => [790052021, 790051859], 'zfb' => '2088670969143838'],
+            ['name' => '东莞惠雅鲜花(莞城店)', 'merchantNo' => '8226020599200GJ', 'wx' => [796953190, 796976959], 'zfb' => '2088770940104912'],
+            ['name' => '沈阳市云花鲜花批发-专业化扫码', 'merchantNo' => '8222210599200BT', 'wx' => [796180053], 'zfb' => '2088770820458908'],
+            ['name' => '沈阳市云花鲜花批发-聚合收银台', 'merchantNo' => '8222210599200BS', 'wx' => [796157674], 'zfb' => '2088770815918545'],
             //['name' => '日照温暖小筑', 'merchantNo' => '82247705992002F', 'wx' => [781363841, 781362087], 'zfb' => '2088570557754874'],
             //['name' => '昆明建芳基地鲜花直发', 'merchantNo' => '8223970599200AH', 'wx' => [775915046, 775915051], 'zfb' => '2088470558755358'],
             //['name' => '日照月下鲜花批发', 'merchantNo' => '82247705992002D', 'wx' => [759404451, 759404055], 'zfb' => '2088170264295192'],

+ 2 - 2
app-hd/controllers/CheckOrderController.php

@@ -107,9 +107,9 @@ class CheckOrderController extends BaseController
         $post['itemInfo'] = $ghsItemInfo;
         if ($update === true) {
             //编辑
-            $order = CheckOrderClass::opOrder($post, $draft, $update);
+            $order = CheckOrderClass::opOrder($post, $draft, true);
         } else {
-            $order = CheckOrderClass::opOrder($post, $draft, $update);
+            $order = CheckOrderClass::opOrder($post, $draft);
         }
         if ($order) {
             util::success($order);

+ 1 - 1
app-hd/controllers/ConsoleController.php

@@ -79,7 +79,7 @@ class ConsoleController extends BaseController
         $menu = [
             ["name" => "商城", "img" => "ghs/home/shop2.png", "url" => "/admin/cg/mall", 'pf' => 1,],
             ["name" => "改价", "img" => "ghs/home/gj2.png", "url" => "/admin/changePrice/list2", 'pf' => 1,],
-            ["name" => "花材", "img" => "ghs/home/hcgl2.png", "url" => "/admin/item/list2", 'pf' => 1,],
+            ["name" => "花材绿植", "img" => "ghs/home/hcgl2.png", "url" => "/admin/item/list2", 'pf' => 1,],
             ["name" => "接花束", "img" => "ghs/home/shop2.png", "url" => "/admin/order/workOrder", 'pf' => 1,],
             ["name" => "拆散", "img" => "ghs/home/kcyjs2.png", "url" => "/admin/part/list", 'pf' => 1,],
             ["name" => "损耗", "img" => "ghs/home/kcyjs2.png", "url" => "/admin/breakage/list", 'pf' => 1,],

+ 1 - 1
app-hd/controllers/GhsController.php

@@ -99,7 +99,7 @@ class GhsController extends BaseController
     //添加虚拟的供货商 ssh 20230305
     public function actionAddGhs()
     {
-        util::fail('开发中,即将上线');
+        util::fail('开发中');
         $post = Yii::$app->request->post();
         $name = $post['name'] ?? '';
         if (empty($name)) {

+ 2 - 1
app-hd/controllers/MtController.php

@@ -577,7 +577,8 @@ class MtController extends PublicController
                 'thirdOrderId' => $mtOrderId,
             ];
             $hasPay = dict::getDict('hasPay', 'payed');
-            $order = OrderService::createFinishOrder($orderData, $custom, $hasPay);
+            //这里没有维护,已经可以放弃。多处调用这个方法,注意同步修改,搜索关键词 createHdNewOrder
+            $order = OrderService::createHdOrder($orderData, $custom, $hasPay);
 
             $transaction->commit();
 

+ 46 - 4
app-hd/controllers/OrderController.php

@@ -10,12 +10,14 @@ use bizHd\custom\classes\HdClass;
 use bizHd\goods\classes\GoodsClass;
 use bizHd\merchant\services\ShopService;
 use bizHd\order\classes\OrderClass;
+use bizHd\order\classes\OrderForwardClass;
 use bizHd\order\classes\OrderItemClass;
 use bizHd\order\classes\OrderSendClass;
 use bizHd\order\services\OrderService;
 use bizHd\product\classes\ProductClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\saas\services\RegionService;
+use bizHd\shop\classes\MainClass;
 use bizHd\shop\classes\ShopClass;
 use bizHd\user\services\UserService;
 use bizHd\work\classes\WorkClass;
@@ -229,6 +231,9 @@ class OrderController extends BaseController
         if (empty($order)) {
             util::fail('没有找到订单');
         }
+        if ($order->forward == 1) {
+            util::fail('售后付款单不能打印');
+        }
         OrderClass::valid($order, $this->mainId);
         OrderClass::onlinePrint($order, true);
         util::complete();
@@ -511,8 +516,6 @@ class OrderController extends BaseController
         $hdName = $hd->name ?? '';
         $post['hdId'] = $hdId;
         $post['hdName'] = $hdName;
-
-        //$post['customId'] = $customId;
         $customName = $custom->name ?? '';
         $post['customName'] = $customName;
         $post['customNamePy'] = stringUtil::py($customName);
@@ -538,7 +541,15 @@ class OrderController extends BaseController
         $forward = $post['forward'] ?? 0;
         if ($forward == 1) {
             if ($hasPay != 1) {
-                util::fail('负数订单只能线下转账');
+                util::fail('售后付款单只能走线下转账');
+            }
+        } else {
+            //如果不是售后付款单,并且选的不是余额支付,余额又够付当前订单,则自动切到余额支付
+            $balance = $custom->balance ?? 0;
+            $modifyPrice = $post['modifyPrice'] ?? 0;
+            if ($hasPay != 4 && $balance > $modifyPrice) {
+                $post['hasPay'] = 4;
+                $hasPay = 4;
             }
         }
 
@@ -585,7 +596,12 @@ class OrderController extends BaseController
             }
             Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 3, 'has']);
 
-            $return = OrderService::createFinishOrder($post, $custom, $hasPay);
+            //多处调用这个方法,注意同步修改,搜索关键词 createHdNewOrder
+            $return = OrderService::createHdOrder($post, $custom, $hasPay);
+            $shop = $this->shop;
+            $staff = $this->shopAdmin;
+            //售后开付款单,库存要变化,关系要建立,多处需要同步修改 sh_pay_change ssh
+            OrderClass::shPayChange($return, $shop, $staff);
             $transaction->commit();
 
             //打印小票和语音播报
@@ -940,6 +956,32 @@ class OrderController extends BaseController
         $id = Yii::$app->request->get('id', 0);
         $detail = OrderClass::getFullInfo($id);
         OrderService::valid($detail, $this->mainId);
+
+        $forwardMap = [];
+        if ($detail['forward'] == 1) {
+            //当前单如果已经是售后付款单,则取出其对应的原单
+            $map = OrderForwardClass::getByCondition(['shOrderId' => $id], true);
+            if (!empty($map)) {
+                $originOrderId = $map->orderId ?? 0;
+                $forwardMap['orderId'] = $originOrderId;
+            }
+        }
+        $detail['forwardMap'] = $forwardMap;
+
+        $shOrderMap = [];
+        if ($detail['hasForward'] == 1) {
+            $shOrderMap = OrderForwardClass::getAllByCondition(['orderId' => $id], null, '*');
+        }
+        $detail['shOrderMap'] = $shOrderMap;
+
+        $main = $this->main;
+        //是否走售后付款单模式判断 ssh
+        $ret = OrderClass::ifShPay($detail, $main, 0);
+        $shAddPay = $ret['shAddPay'];
+        $shAddPayReason = $ret['shAddPayReason'];
+        $detail['shAddPay'] = $shAddPay;
+        $detail['shAddPayReason'] = $shAddPayReason;
+
         util::success($detail);
     }
 

+ 65 - 0
app-hd/controllers/RechargeController.php

@@ -9,8 +9,10 @@ use biz\shop\classes\ShopClass;
 use biz\sj\classes\SjClass;
 use bizGhs\custom\classes\CustomClass;
 use bizHd\custom\classes\HdClass;
+use bizHd\order\classes\OrderClass;
 use bizHd\order\classes\SettleClass;
 use bizHd\wx\classes\WxOpenClass;
+use bizMall\wx\classes\WxMiniClass;
 use common\components\dict;
 use common\components\imgUtil;
 use common\components\miniUtil;
@@ -22,6 +24,34 @@ use Yii;
 class RechargeController extends BaseController
 {
 
+    //获取商城端充值页和订单页小程序短链接
+    public function actionGetMallRechargeShortLink()
+    {
+        $get = Yii::$app->request->get();
+        if (getenv('YII_ENV') == 'dev') {
+            $ip = Yii::$app->request->getUserIP();
+            if ($ip == '127.0.0.1') {
+                util::success(['rechargeAccountLink' => 'www.google.com', 'orderLink' => 'www.google.com']);
+            }
+        }
+        $orderId = $get['orderId'] ?? 0;
+        $account = $this->shopId;
+        $page = 'pages/member/recharge?account=' . $account;
+        $ret = WxMiniClass::getShortLink($page);
+        $link = $ret['link'] ?? '';
+        $orderLink = '';
+        if (!empty($orderId)) {
+            $order = OrderClass::getById($orderId, true);
+            if ($order->mainId != $this->mainId) {
+                util::fail('访问错误');
+            }
+            $orderPage = 'pages/order/detail?account=' . $account . '&id=' . $orderId;
+            $res = WxMiniClass::getShortLink($orderPage);
+            $orderLink = $res['link'] ?? '';
+        }
+        util::success(['rechargeAccountLink' => $link, 'orderLink' => $orderLink]);
+    }
+
     //获取扫码充值的小程序码 ssh 20250307
     public function actionGetRechargeCode()
     {
@@ -64,6 +94,7 @@ class RechargeController extends BaseController
             $amount = $post['amount'] ?? 0;
             $remark = $post['remark'] ?? '';
             $customId = $post['customId'] ?? 0;
+            $shOrderId = $post['shOrderId'] ?? 0;
             $custom = \bizHd\custom\classes\CustomClass::getById($customId, true);
             if (empty($custom)) {
                 util::fail('没有找到客户');
@@ -72,6 +103,31 @@ class RechargeController extends BaseController
             //避免重复提交
             util::checkRepeatCommit($customId, 4);
 
+            $shOrderSn = '';
+            if (!empty($shOrderId)) {
+                $shOrder = OrderClass::getById($shOrderId, true);
+                if ($shOrder->forward != 1) {
+                    util::fail('不是售后付款单');
+                }
+                if ($shOrder->mainId != $this->mainId) {
+                    util::fail('不是你的单');
+                }
+                //判断是否充值过了
+                OrderClass::shOrderRecharge($shOrder);
+                $shOrderSn = $shOrder->orderSn ?? '';
+            }
+
+            $refundOrderId = $post['refundOrderId'] ?? 0;
+            $refundOrderSn = '';
+            if (!empty($refundOrderId)) {
+                //线下订单售后,充值
+                $myOrder = OrderClass::getById($refundOrderId, true);
+                if ($myOrder->mainId != $this->mainId) {
+                    util::fail('不是你的订单');
+                }
+                $refundOrderSn = $myOrder->orderSn ?? '';
+            }
+
             $customName = $custom->name;
             $userId = $custom->userId ?? 0;
             $hdId = $custom->hdId;
@@ -102,6 +158,10 @@ class RechargeController extends BaseController
                 'customId' => $customId,
                 'customName' => $customName,
                 'userId' => $userId,
+                'shOrderId' => $shOrderId,
+                'shOrderSn' => $shOrderSn,
+                'refundOrderId' => $refundOrderId,
+                'refundOrderSn' => $refundOrderSn,
             ];
             $respond = \bizHd\recharge\classes\RechargeClass::addRecharge($rechargeData);
 
@@ -111,6 +171,11 @@ class RechargeController extends BaseController
             //充值成功并且销账
             \bizHd\recharge\classes\RechargeClass::complete($recharge, $payWay, $params);
 
+            if (!empty($shOrderId)) {
+                //售后付款标记为充值了
+                OrderClass::shOrderRecharge($shOrder, true);
+            }
+
             $transaction->commit();
             util::success($post);
         } catch (\Exception $e) {

+ 119 - 7
app-hd/controllers/RefundController.php

@@ -3,9 +3,11 @@
 namespace hd\controllers;
 
 use biz\shop\classes\ShopExtClass;
+use bizHd\custom\classes\CustomClass;
 use bizHd\order\classes\OrderClass;
 use bizHd\order\classes\OrderGoodsClass;
 use bizHd\order\classes\OrderItemClass;
+use bizHd\order\services\OrderService;
 use bizHd\refund\classes\HdRefundClass;
 use bizHd\refund\classes\HdRefundGoodsClass;
 use bizHd\refund\classes\HdRefundItemClass;
@@ -92,6 +94,9 @@ class RefundController extends BaseController
 
             $order = OrderClass::getById($id, true);
             OrderClass::valid($order, $this->mainId);
+            if ($order->payStatus == 0) {
+                util::fail('订单没有付款');
+            }
             if ($order->status == OrderClass::ORDER_STATUS_UN_PAY) {
                 util::fail("待付款订单无法退款");
             }
@@ -102,11 +107,7 @@ class RefundController extends BaseController
                 util::fail('请在美团APP发起退货退款');
             }
             if ($order->debt != 1 && $order->addTime < '2023-10-17 00:00:00') {
-                util::fail('10月17日前订单无法申请退款');
-            }
-
-            if ($order->payWay == 2) {
-                util::fail('余额支付订单暂不支持售后');
+                util::fail('2023年10月17日前订单无法申请退款');
             }
 
             $addTime = $order->addTime ?? '';
@@ -118,7 +119,11 @@ class RefundController extends BaseController
                 util::fail('历史订单,不能发起退款哦');
             }
 
-            //商品花材结构 property 0商品 1花材
+            if ($order->forward == 1) {
+                util::fail('负数订单不能发起售后');
+            }
+
+            //商品花材结构 property 0花束 1花材
             //[{productId:0,num:1,unitType:0,unitPrice:12,unitName:'扎',property:1}]
             $productJson = $post['product'] ?? '';
             if (empty($productJson)) {
@@ -145,7 +150,114 @@ class RefundController extends BaseController
             $shopAdmin = $this->shopAdmin;
             $adminName = $shopAdmin['name'] ?? '';
             $post['shopAdminName'] = $adminName;
-            HdRefundService::addRefund($post, $order);
+
+            $main = $this->main;
+            //判断是否开负数订单
+            $ret = OrderClass::ifShPay($order, $main, $post['price']);
+            $shAddPay = $ret['shAddPay'] ?? 0;
+
+            if ($shAddPay == 1) {
+                $customId = $order->customId ?? 0;
+                $custom = CustomClass::getById($customId, true);
+                if (empty($custom)) {
+                    util::fail('没有客户哈!');
+                }
+                //线下付款
+                $hasPay = 1;
+                $shopId = $order->shopId;
+                $staffId = $this->shopAdminId;
+                $staffName = $this->shopAdminName;
+                $refundType = $post['refundType'] ?? 1;//1退货并退款2只退款
+                $forwardStock = $refundType == 1 ? 0 : 1;
+                $refundPrice = $post['price'] ?? 0;
+
+                $hasItem = false;
+                $hasBouquet = false;
+                // property 0花束 1花材
+                $orderProductList = [];
+                foreach ($productList as $thisInfo) {
+                    $num = $thisInfo['num'] ?? 0;
+                    $unitType = $thisInfo['unitType'] ?? 0;
+                    $property = $thisInfo['property'] ?? 0;
+                    $unitPrice = $thisInfo['unitPrice'] ?? 0;
+                    $productId = $thisInfo['productId'] ?? 0;
+                    $orderProductList[] = [
+                        'productId' => $productId,
+                        'unitPrice' => $unitPrice,
+                        'remark' => '',
+                        'property' => $property,
+                        'unitType' => $unitType,
+                        'num' => $num,
+                    ];
+                    if ($property == 0) {
+                        $hasBouquet = true;
+                    }
+                    if ($property == 1) {
+                        $hasItem = true;
+                    }
+                }
+                $orderType = 0;
+                if ($hasBouquet) {
+                    $orderType = 1;
+                }
+                if ($hasItem) {
+                    $orderType = 2;
+                }
+                if ($hasItem && $hasBouquet) {
+                    $orderType = 3;
+                }
+
+                $sjId = $order->sjId;
+                $mainId = $order->mainId;
+                $deadline = time() + 8640000;
+                $hdId = $order->hdId;
+                $hdName = $order->hdName;
+                $customNamePy = $order->customNamePy;
+                $customName = $order->customName;
+                $orderData = [
+                    'hasPay' => 1,
+                    'payWay' => 0,
+                    'shopId' => $shopId,
+                    'customId' => $customId,
+                    'customName' => $customName,
+                    'customNamePy' => $customNamePy,
+                    'product' => $orderProductList,
+                    'needPrint' => 2,
+                    'getStaffId' => $staffId,
+                    'getStaffName' => $staffName,
+                    'shopAdminId' => $staffId,
+                    'shopAdminName' => $staffName,
+                    'dealPrice' => 1,
+                    'forward' => 1,
+                    'forwardStock' => $forwardStock,
+                    'modifyPrice' => $refundPrice,
+                    'orderType' => $orderType,
+                    'sjId' => $sjId,
+                    'mainId' => $mainId,
+                    'deadline' => $deadline,
+                    'staffId' => $staffId,
+                    'staffName' => $staffName,
+                    'flowerNum' => 0,
+                    'fromType' => 1,
+                    'hdId' => $hdId,
+                    'hdName' => $hdName,
+                    'sendType' => 1,
+                    'sendSide' => 2,
+                    'labourCost' => 0,
+                ];
+                //走负数订单,多处调用这个方法,注意同步修改,搜索关键词 createHdNewOrder
+                $returnOrder = OrderService::createHdOrder($orderData, $custom, $hasPay);
+                $shop = $this->shop;
+                $staff = $this->shopAdmin;
+                //售后开付款单,库存要变化,关系要建立,多处需要同步修改 sh_pay_change ssh
+                OrderClass::shPayChange($returnOrder, $shop, $staff, $order);
+                $transaction->commit();
+                $orderId = $returnOrder->id;
+                util::success(['forward' => 1, 'orderId' => $orderId]);
+            } else {
+                //走正常售后
+                HdRefundService::addRefund($post, $order);
+            }
             $transaction->commit();
 
             //制作单取消通知

+ 5 - 0
app-hd/controllers/StatCgGhsController.php

@@ -15,6 +15,11 @@ class StatCgGhsController extends BaseController
     //采购列表 ssh 20211017
     public function actionProfile()
     {
+
+        util::success(['list' => []]);
+
+        //数据不准确,重新开发
+
         $get = Yii::$app->request->get();
         $where = [];
         $where['mainId'] = $this->mainId;

+ 4 - 0
app-hd/controllers/StatItemController.php

@@ -16,6 +16,10 @@ class StatItemController extends BaseController
     public function actionProfile()
     {
 
+        util::success(['list' => []]);
+
+        //数据不准确,重新开发
+
         //查看财务的权限
         $lookMoney = \bizGhs\shop\classes\ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);
         if ($lookMoney == 0) {

+ 1 - 0
app-mall/controllers/BaseController.php

@@ -69,6 +69,7 @@ class BaseController extends PublicController
                             $customId = $hd->customId ?? 0;
                             $custom = CustomClass::getById($customId, true);
                             $this->custom = $custom;
+                            $this->customId = $customId;
                         }
                     }
                 }

+ 86 - 13
app-mall/controllers/OrderController.php

@@ -7,12 +7,15 @@ use bizHd\custom\classes\HdClass;
 use bizHd\wx\classes\WxOpenClass;
 use bizMall\custom\classes\CustomClass;
 use bizMall\goods\classes\GoodsClass;
+use bizMall\item\classes\ItemClass;
 use bizMall\order\classes\OrderClass;
+use bizMall\order\classes\OrderForwardClass;
 use bizMall\order\classes\OrderGoodsClass;
 use bizMall\order\classes\OrderItemClass;
 use bizMall\order\services\OrderService;
 use bizMall\promote\services\CouponService;
 use bizMall\saas\services\RegionService;
+use bizMall\shop\classes\ShopExtClass;
 use bizMall\user\services\UserService;
 use common\components\dateUtil;
 use common\components\dict;
@@ -457,7 +460,7 @@ class OrderController extends BaseController
         if (empty($shop)) {
             util::fail('没有找到门店信息');
         }
-        if (!empty($shop->shopName)) {
+        if (isset($shop->shopName) && !empty($shop->shopName)) {
             $name .= '(' . $shop->shopName . ')';
         }
         $totalFee = $order['mainPay'];
@@ -577,11 +580,53 @@ class OrderController extends BaseController
         $post = Yii::$app->request->post();
         $payWay = isset($post['payWay']) ? $post['payWay'] : 0;
         $shopId = $this->shopId;
+
+        $ext = ShopExtClass::getByCondition(['shopId' => $shopId], true);
+        $gatheringItem = !empty($ext) ? $ext->gatheringItem : 0;
+        if (empty($gatheringItem)) {
+            util::fail('请设置付款用的商品');
+        }
+        $gatheringItemInfo = ItemClass::getById($gatheringItem, true);
+        if (empty($gatheringItemInfo)) {
+            util::fail('付款用的商品没有设置');
+        }
+        $ptItemId = $gatheringItemInfo->itemId ?? 0;
+        $classId = $gatheringItemInfo->classId ?? 0;
+
+        $customId = $this->customId;
+        $custom = $this->custom;
+        $hdId = $this->hdId;
+        $hd = $this->hd;
+        if (!empty($customId) && !empty($hdId)) {
+            //考虑没有登录时的付款
+            $shop = $this->shop;
+            $defaultCustomId = $shop->defaultCustomId ?? 0;
+            if (empty($defaultCustomId)) {
+                util::fail('请设置快捷开单的客户');
+            }
+            $customId = $defaultCustomId;
+            $custom = CustomClass::getById($defaultCustomId, true);
+            if (empty($custom)) {
+                util::fail('请设置快捷客户');
+            }
+            $hdId = $custom->hdId;
+            $hd = \bizMall\hd\classes\HdClass::getById($hdId, true);
+            if (empty($hd)) {
+                util::fail('没有花店信息呢');
+            }
+        }
+        $post['hdId'] = $hdId;
+        $post['hdName'] = $hd->name ?? '';
+        $customName = $custom->name ?? '';
+        $customPy = $custom->py ?? '';
+        $post['customName'] = $customName;
+        $post['customNamePy'] = $customPy;
+        $post['gatheringItem'] = $gatheringItem;
         $post['shopId'] = $shopId;
         $post['mainId'] = $this->mainId;
         $post['sjId'] = $this->sjId;
         $post['store'] = 0;
-        $post['customId'] = $this->customId;
+        $post['customId'] = $customId;
         $user = isset($this->user->attributes) ? $this->user->attributes : [];
         $post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
         $bookMobile = !empty($post['bookMobile']) && stringUtil::isMobile($post['bookMobile']) ? $post['bookMobile'] : '';
@@ -597,7 +642,7 @@ class OrderController extends BaseController
         $post['actPrice'] = $actPrice;
         $post['realPrice'] = $actPrice;
         $post['mainPay'] = $actPrice;
-        $post['payStyle'] = 0;
+        $post['modifyPrice'] = $actPrice;
         $post['userId'] = $this->userId;
         $post['needPrint'] = dict::getDict('needPrint', 'noNeed');
         $now = time();
@@ -605,12 +650,23 @@ class OrderController extends BaseController
         $post['createTime'] = date("Y-m-d H:i:s", $now);
         $post['deadline'] = $expireTime;
         if ($actPrice <= 0) {
-            util::fail('请填写正确的金额');
+            util::fail('请填写付款金额');
         }
-        //微信支付订单提交不能修改价格
-        $post['modPrice'] = $this->isWx ? 0 : 1;
+
         $post['goodsNum'] = 1;
-        $post['fromType'] = $post['fromType'] ?? 1;
+        $product = [[
+            'productId' => $gatheringItem,
+            'bigNum' => 1,
+            'smallNum' => '',
+            'num' => 1,
+            'unitType' => 0,
+            'property' => 1,
+            'unitPrice' => $actPrice,
+            'itemId' => $classId,
+            'classId' => $classId
+        ]];
+        $post['product'] = $product;
+
         $post['reachDate'] = !empty($post['reachDate']) ? $post['reachDate'] : '00-00-00';
         $post['onlinePay'] = dict::getDict('onlinePay', 'yes');
 
@@ -637,11 +693,16 @@ class OrderController extends BaseController
             $floor = $post['receiveFloor'] ?? '';
             $post['fullAddress'] = $city . $address . $floor;
         }
-
-        $order = OrderClass::addOrder($post);
-        $orderId = $order['id'] ?? 0;
-        $orderSn = $order['orderSn'] ?? '';
+        $hasPay = 0;
+        $post['sendType'] = 1;
+        $post['orderType'] = 2;//花材订单
+        $post['dealPrice'] = 1;
+        $post['fromType'] = 1;
+        $order = \bizHd\order\services\OrderService::createHdOrder($post, $custom, $hasPay);
+        $orderId = $order->id ?? 0;
+        $orderSn = $order->orderSn ?? '';
         if ($payWay == 0) {
+            //微信
             $name = '购买商品';
             $totalFee = $actPrice;
             $user = UserService::getById($this->userId);
@@ -706,8 +767,8 @@ class OrderController extends BaseController
             util::success($new);
 
         } elseif ($payWay == 1) {
-
-            $totalFee = $order['realPrice'];
+            //支付宝
+            $totalFee = $order->actPrice;
             $subject = '购买花材';
             $capitalType = dict::getDict('capitalType', 'xhOrder', 'id');
             $shop = $this->shop;
@@ -758,8 +819,13 @@ class OrderController extends BaseController
     //订单列表 ssh 2019.12.12
     public function actionList()
     {
+        $get = Yii::$app->request->get();
+        $status = $get['status'] ?? 0;
         $userId = $this->userId;
         $where = ['userId' => $userId];
+        if (!empty($status)) {
+            $where['status'] = $status;
+        }
         $list = OrderService::getOrderList($where);
         util::success($list);
     }
@@ -782,6 +848,13 @@ class OrderController extends BaseController
     {
         $id = Yii::$app->request->get('id', 0);
         $detail = OrderClass::getOrderById($id);
+
+        $shOrderMap = [];
+        if ($detail['hasForward'] == 1) {
+            $shOrderMap = OrderForwardClass::getAllByCondition(['orderId' => $id], null, '*');
+        }
+        $detail['shOrderMap'] = $shOrderMap;
+
         util::success($detail);
     }
 

+ 18 - 0
biz-ghs/shop/classes/ShopMoneyClass.php

@@ -12,6 +12,23 @@ class ShopMoneyClass extends BaseClass
 
     public static $baseFile = '\bizGhs\shop\models\ShopMoney';
 
+    //散客用现金充值 ssh 20250804
+    public static function skRecharge($data, $main)
+    {
+        $amount = $data['amount'] ? floatval($data['amount']) : 0;
+        $main->money = bcadd($main->money, $amount, 2);
+        $main->save();
+        $balance = $main->money ?? 0;
+        $data['balance'] = $balance;
+        $data['io'] = 1;
+        $customName = $data['customName'] ?? '';
+        $event = $customName . '现金充值自己的余额' . $amount . '元';
+        $capitalType = dict::getDict('capitalType', 'xhRecharge', 'id');
+        $data['capitalType'] = $capitalType;
+        $data['event'] = $event;
+        return self::addData($data);
+    }
+
     //存入现金 ssh 20220811
     public static function inAmount($data, $main)
     {
@@ -55,6 +72,7 @@ class ShopMoneyClass extends BaseClass
         return $respond;
     }
 
+    //零售花店给散客退款转现金 ssh 20250804
     public static function hdRefundSkOutAmount($data, $main)
     {
         $amount = $data['amount'] ?? 0;

+ 20 - 31
biz-ghs/stat/classes/StatKdClass.php

@@ -288,24 +288,21 @@ class StatKdClass extends BaseClass
             $remainDebtPrice = $hdOrder['remainDebtPrice'] ?? 0;
             $onlinePay = $hdOrder['onlinePay'] ?? 0;
             $fromType = $hdOrder['fromType'] ?? 0;
-
-            $staffId = $ghsOrder['shopAdminId'] ?? 0;
-            $staffName = $ghsOrder['shopAdminName'] ?? '';
-
+            $staffId = $hdOrder['shopAdminId'] ?? 0;
+            $staffName = $hdOrder['shopAdminName'] ?? '';
             $repeat = $hdOrder['repeat'] ?? 0;
+            $forward = $hdOrder['forward'] ?? 0;
+            $tkPrice = $hdOrder['tkPrice'] ?? 0;
+            $mainPay = bcsub($mainPay, $tkPrice, 2);
 
-            if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
+            if ($forward == 1) {
+                //售后付款不属于收入
+                continue;
+            }
 
-                if (isset($staffAmountList[$staffId])) {
-                    $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
-                    $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $mainPay, 2);
-                } else {
-                    $staffAmountList[$staffId] = ['num' => 1, 'amount' => $mainPay, 'staffName' => $staffName];
-                }
+            $currentAmount = 0;
+            if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
 
-                //现金 和 微信支付宝付款,微信支付宝还存在退款情况
-                $tkPrice = $hdOrder['tkPrice'] ?? 0;
-                $mainPay = bcsub($mainPay, $tkPrice, 2);
                 $incomeList['system']['amount'] = bcadd($incomeList['system']['amount'], $mainPay, 2);
                 $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
                 $incomeList['system']['category']['ls']['amount'] = bcadd($incomeList['system']['category']['ls']['amount'], $mainPay, 2);
@@ -321,31 +318,21 @@ class StatKdClass extends BaseClass
                     $incomeList['cash']['category']['ls']['amount'] = bcadd($incomeList['cash']['category']['ls']['amount'], $cash, 2);
                     $incomeList['cash']['category']['ls']['num'] = bcadd($incomeList['cash']['category']['ls']['num'], 1);
                 }
+                $currentAmount = bcadd($mainPay, $cash, 2);
             } else {
 
-                if (isset($staffAmountList[$staffId])) {
-                    $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
-                    $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $actPrice, 2);
-                } else {
-                    $staffAmountList[$staffId] = ['num' => 1, 'amount' => $actPrice, 'staffName' => $staffName];
-                }
-
                 if ($fromType == dict::getDict('fromType', 'mt')) {
                     //美团!!!
                     $incomeList['mt']['amount'] = bcadd($incomeList['mt']['amount'], $actPrice, 2);
                     $incomeList['mt']['num'] = bcadd($incomeList['mt']['num'], 1);
                 } else {
-
-                    //非美团!!!
                     if ($debtPrice > 0) {
-
                         if ($remainDebtPrice > 0) {
                             $incomeList['debt']['amount'] = bcadd($incomeList['debt']['amount'], $remainDebtPrice, 2);
                             $incomeList['debt']['num'] = bcadd($incomeList['debt']['num'], 1);
                             $incomeList['debt']['category']['ls']['amount'] = bcadd($incomeList['debt']['category']['ls']['amount'], $remainDebtPrice, 2);
                             $incomeList['debt']['category']['ls']['num'] = bcadd($incomeList['debt']['category']['ls']['num'], 1);
                         }
-
                         $clearDebt = bcsub($debtPrice, $remainDebtPrice, 2);
                         if ($clearDebt > 0) {
                             $incomeList['debtClear']['amount'] = bcadd($incomeList['debtClear']['amount'], $clearDebt, 2);
@@ -353,13 +340,10 @@ class StatKdClass extends BaseClass
                             $incomeList['debtClear']['category']['ls']['amount'] = bcadd($incomeList['debtClear']['category']['ls']['amount'], $clearDebt, 2);
                             $incomeList['debtClear']['category']['ls']['num'] = bcadd($incomeList['debtClear']['category']['ls']['num'], 1);
                         }
-
-                        $currentAmount = bcsub($mainPay, $debtPrice, 2);
-
+                        $currentAmount = bcadd($remainDebtPrice, $clearDebt, 2);
                     } else {
                         $currentAmount = $mainPay;
                     }
-
                     if ($currentAmount > 0) {
                         //使用非在线支付
                         switch ($payWay) {
@@ -415,9 +399,14 @@ class StatKdClass extends BaseClass
                         }
                     }
                 }
-
             }
-
+            //员工业绩
+            if (isset($staffAmountList[$staffId])) {
+                $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
+                $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $currentAmount, 2);
+            } else {
+                $staffAmountList[$staffId] = ['num' => 1, 'amount' => $currentAmount, 'staffName' => $staffName];
+            }
         }
         return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome];
 

+ 6 - 1
biz-ghs/stat/classes/StatSaleClass.php

@@ -311,6 +311,11 @@ class StatSaleClass extends BaseClass
             $actPrice = $hdOrder['mainPay'] ?? 0;
             $onlinePay = $hdOrder['onlinePay'] ?? 1;
             $repeat = $hdOrder['repeat'] ?? 0;
+            $forward = $hdOrder['forward'] ?? 0;
+            if ($forward == 1) {
+                //售后付款不属于收入
+                continue;
+            }
 
             if ($hdOrder['tkPrice'] && $hdOrder['tkPrice'] > 0) {
                 $actPrice = bcsub($actPrice, $hdOrder['tkPrice'], 2);
@@ -320,7 +325,7 @@ class StatSaleClass extends BaseClass
             $sendCost = $hdOrder['sendCost'] ?? 0;
             $lsIncome = bcadd($actPrice, $lsIncome, 2);
             $lsIncome = bcadd($lsIncome, $cash, 2);
-            //退款取消先不计算成本
+            //退款取消先不计算成本
             if ($actPrice > 0) {
                 $lsSendCost = bcadd($lsSendCost, $sendCost, 2);
                 $lsServiceFee = bcadd($lsServiceFee, $serviceFee, 2);

+ 2 - 2
biz-hd/cg/classes/CgRefundClass.php

@@ -275,10 +275,10 @@ class CgRefundClass extends BaseClass
                     'orderSn' => $orderSn,
                     'refundAmount' => $refundFee,
                     'refundReason' => $refundReason,
-                    'thirdNo' => $transaction_id,
+                    'thirdNo' => $transaction_id,//这个参数必传,不然聚合收银合支付宝付款的退款不会成功
                 ];
                 $response = $laResource->refund($aliParams);
-                if (isset($response['code']) == false || $response['code'] != 'BBS00000') {
+                if (!isset($response['code']) || $response['code'] != 'BBS00000') {
                     $errMsg = $response['msg'] ?? '';
                     //$lklSjNo = $ghsShop->lklSjNo ?? '';
                     //noticeUtil::push('商户号:' . $lklSjNo . '的退款失败了哦,请注意:' . $errMsg . ' 金额:' . $refundFee, '15280215347');

+ 46 - 109
biz-hd/custom/classes/CustomClass.php

@@ -188,20 +188,24 @@ class CustomClass extends BaseClass
             $settleId = $set->id;
         }
 
-        $lastBalance = bcsub($custom->balance, $amount, 2);
-        $custom->balance = $lastBalance;
+        $customBalance = bcsub($custom->balance, $amount, 2);
+        $custom->balance = $customBalance;
         if ($custom->balance < 0) {
             $custom->isDebt = 1;
         }
         $custom->save();
 
-        $remain = bcsub($hd->balance, $amount, 2);
-        $hd->balance = $remain;
+        $hdBalance = bcsub($hd->balance, $amount, 2);
+        $hd->balance = $hdBalance;
         if ($hd->balance < 0) {
             $hd->debt = 2;
         }
         $hd->save();
 
+        if (floatval($customBalance) != floatval($hdBalance)) {
+            util::fail('余额有错,请联系管理员,编号' . $hdId);
+        }
+
         $relateId = $order->id ?? 0;
         $customId = $custom->id ?? 0;
         $orderSn = $order->orderSn ?? '';
@@ -218,14 +222,14 @@ class CustomClass extends BaseClass
             'onlinePay' => $onlinePay,
             'capitalType' => $capitalType,
             'amount' => $amount,
-            'balance' => $lastBalance,
+            'balance' => $customBalance,
             'io' => 0,
             'side' => $side,
             'payWay' => $payWay,
             'event' => $event,
             'staffId' => $staffId,
             'staffName' => $staffName,
-            'shopId' => $order->id,
+            'shopId' => $shopId,
             'mainId' => $order->mainId,
             'settleId' => $settleId,
             'settleNo' => $settleNo,
@@ -235,122 +239,70 @@ class CustomClass extends BaseClass
         BalanceChangeClass::add($change, true);
     }
 
-    //散客申请退款,零售门店欠款金额减少
+    //欠款和余额支付的售后 ssh 20250803
     public static function refundDebtAmountReduce($custom, $amount, $refund)
     {
-        $debtAmount = $custom->debtAmount ?? 0.00;
-        $remain = bcsub($debtAmount, $amount, 2);
-        if ($remain < 0) {
-            noticeUtil::push("零售客户欠款总金额:{$custom->debtAmount} 本次退款金额:{$amount} 客户ID:{$custom->id} 超出了,编号66379", '15280215347');
-            util::fail('操作失败,欠款金额会出现负数');
-        }
-        $custom->isDebt = $remain <= 0 ? 0 : 1;
-        $custom->debtAmount = $remain;
-        $custom->save();
-        $relateId = $refund->id ?? 0;
-        $customId = $custom->id ?? 0;
-        $capitalType = dict::getDict('capitalType', 'hdRefund', 'id');
-        $refundSn = $refund->refundSn ?? '';
-
-        $change = [
-            'relateId' => $relateId,
-            'customId' => $customId,
-            'ptStyle' => dict::getDict('ptStyle', 'hd'),
-            'capitalType' => $capitalType,
-            'amount' => $amount,
-            'balance' => $remain,
-            'io' => 0,
-            'payWay' => 0,
-            'event' => "客户申请退款,退款单号:{$refundSn}",
-            'sjId' => $refund->sjId ?? 0,
-            'shopId' => $refund->shopId ?? 0,
-            'mainId' => $refund->mainId ?? 0,
-        ];
-        CustomDebtRecordClass::addChange($change);
-
-        $mainId = $refund->mainId ?? 0;
-        $main = MainClass::getLockById($mainId);
-        if (empty($main)) {
-            util::fail('没有main信息39');
+        $hdId = $custom->hdId ?? 0;
+        $hd = HdClass::getLockById($hdId);
+        if (empty($hd)) {
+            util::fail('花店信息缺失,编号520');
         }
-        $debt = $main->debt ?? 0;
-        $totalRemain = bcsub($debt, $amount, 2);
-        $main->debt = $totalRemain;
-        $main->save();
-
-        $event = $custom->name . "申请退款,退款单号:{$refundSn}";
-        $change['balance'] = $totalRemain;
-        $change['event'] = $event;
-        TotalDebtChangeClass::addChange($change);
-    }
 
-    //客户结账欠款金额减少 ssh 20250627
-    public static function clearDebtAmountReduce($custom, $amount, $clear)
-    {
-        $balance = $custom->balance ?? 0.00;
-        $remainBalance = bcsub($balance, $amount, 2);
-        if ($remainBalance < 0) {
-            noticeUtil::push("零售客户欠款总金额:{$balance} 本次结账金额:{$amount} 客户ID:{$custom->id} 超出了,编号788965", '15280215347');
-            util::fail('操作失败,结账后欠款金额会出现负数');
+        $customBalance = bcadd($custom->balance, $amount, 2);
+        $custom->balance = $customBalance;
+        if ($custom->balance < 0) {
+            $custom->isDebt = 1;
         }
-        $custom->balance = $remainBalance;
         $custom->save();
 
-        $hdId = $custom->hdId ?? 0;
-        $hd = HdClass::getLockById($hdId);
-        if (empty($hd)) {
-            util::fail('店铺信息异常');
+        $hdBalance = bcadd($hd->balance, $amount, 2);
+        $hd->balance = $hdBalance;
+        if ($hd->balance < 0) {
+            $hd->debt = 2;
         }
-        $hdName = $hd->name ?? '';
-        $hdBalance = $hd->balance ?? 0;
-        $hdRemainBalance = bcsub($hdBalance, $amount, 2);
-        $hd->balance = $hdRemainBalance;
         $hd->save();
 
-        if (floatval($hdRemainBalance) != floatval($remainBalance)) {
-            util::fail('余额有问题');
+        if (floatval($customBalance) !== floatval($hdBalance)) {
+            util::fail('余额错误,请联系管理员,编号' . $hdId);
         }
 
-        $relateId = $clear->id ?? 0;
+        $relateId = $refund->id ?? 0;
         $customId = $custom->id ?? 0;
-        $capitalType = dict::getDict('capitalType', 'hdXsClear', 'id');
-        $orderSn = $clear->orderSn ?? '';
+        $refundSn = $refund->refundSn ?? '';
+        $orderSn = $refund->orderSn ?? '';
+        $orderId = $refund->orderId ?? 0;
+        $staffId = $refund->shopAdminId ?? 0;
+        $staffName = $refund->shopAdminName ?? '';
+        $capitalType = dict::getDict('capitalType', 'hdRefund', 'id');
+        $event = "订单售后 " . $refundSn;
         $customName = $custom->name ?? '';
-        $event = "结账,单号:{$orderSn}";
-        $staffId = $clear->hdShopAdminId ?? 0;
-        $staffName = $clear->hdShopAdminName ?? '';
-        $shopId = $clear->hdShopId ?? 0;
-        $mainId = $clear->mainId ?? 0;
-        $remark = '';
-        $payWay = $clear->payWay ?? 0;
+        $onlinePay = 1;
+        $side = 0;
+        $payWay = 2;//余额支付
         $change = [
             'customId' => $customId,
             'customName' => $customName,
-            'hdId' => $hdId,
-            'hdName' => $hdName,
             'relateId' => $relateId,
-            'onlinePay' => 1,
+            'relateSn' => $refundSn,
+            'onlinePay' => $onlinePay,
             'capitalType' => $capitalType,
             'amount' => $amount,
-            'balance' => $hdRemainBalance,
-            'io' => 0,
-            'side' => 0,
+            'balance' => $customBalance,
+            'io' => 1,
+            'side' => $side,
             'payWay' => $payWay,
             'event' => $event,
             'staffId' => $staffId,
             'staffName' => $staffName,
-            'shopId' => $shopId,
-            'mainId' => $mainId,
-            'remark' => $remark,
+            'shopId' => $refund->shopId,
+            'mainId' => $refund->mainId,
+            'refundOrderId' => $orderId,
+            'refundOrderSn' => $orderSn,
+            'remark' => '',
         ];
         BalanceChangeClass::add($change, true);
     }
 
-    public static function getCustomCacheKey($sjId, $shopId, $userId)
-    {
-        return 'hd_custom_key_' . $sjId . '_' . $shopId . '_' . $userId;
-    }
-
     //添加客户 ssh 2021.2.28
     public static function addCustom($data)
     {
@@ -486,19 +438,4 @@ class CustomClass extends BaseClass
         return $list;
     }
 
-    //更新客户信息 ssh 2021.3.23
-    public static function updateCustomInfo($custom, $data)
-    {
-        $userId = $custom['userId'];
-        $userData = [];
-        if (!empty($data['mobile'])) {
-            $userData['mobile'] = $data['mobile'];
-        }
-        if (!empty($userData)) {
-            UserClass::updateById($userId, $userData);
-        }
-        $id = $custom['id'];
-        self::updateById($id, $data);
-    }
-
 }

+ 164 - 3
biz-hd/order/classes/OrderClass.php

@@ -14,6 +14,7 @@ use biz\stat\classes\StatOrderCountClass;
 use biz\stat\classes\StatSaleClass;
 use biz\stock\classes\GoodsStockRecordClass;
 use biz\wx\classes\WxMessageClass;
+use bizGhs\order\classes\CheckOrderClass;
 use bizGhs\product\classes\ProductClass;
 use bizGhs\stat\classes\StatYjClass;
 use bizGhs\stock\classes\StockRecordClass;
@@ -86,9 +87,166 @@ class OrderClass extends BaseClass
         20000 => [90, 100],
     ];
 
+    /**
+     * 售后付款单是否已经充值过了 ssh 20250801
+     * @param $order
+     * @param $set false 判断是否充值 true 标记为充值
+     */
+    public static function shOrderRecharge($order, $set = false)
+    {
+        $orderId = $order->id;
+        $cacheKey = "sh_order_recharge_" . $orderId;
+        if ($set) {
+            Yii::$app->redis->executeCommand('SETEX', [$cacheKey, 864000, 'has']);
+        } else {
+            $has = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
+            if (!empty($has)) {
+                util::fail('已经充值过了,请勿重复操作');
+            }
+        }
+    }
+
+    //因为开负数订单时引导库存变化 ssh 20250731
+    public static function shPayChange($order, $shop, $staff, $originOrder = null)
+    {
+        $forward = $order['forward'] ?? 0;
+        if ($forward == 0) {
+            return false;
+        }
+        $forwardStock = $order['forwardStock'] ?? 0;
+        $orderSn = $order['orderSn'] ?? '';
+        $orderItemList = OrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
+        $orderGoodsList = OrderGoodsClass::getAllByCondition(['orderSn' => $orderSn], null, '*');
+        if (empty($orderItemList) && empty($orderGoodsList)) {
+            return false;
+        }
+        $shopId = $shop->id ?? 0;
+        $sjId = $shop->sjId ?? 0;
+        $adminId = $staff->adminId;
+        $staffName = $staff->name ?? '';
+        $mainId = $shop->mainId;
+        if (!empty($orderItemList)) {
+            $itemInfo = [];
+            $ids = array_column($orderItemList, 'itemId');
+            $infoList = ProductClass::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
+            foreach ($orderItemList as $orderItem) {
+                $unitType = $orderItem['unitType'] ?? 0;
+                $num = $orderItem['num'] ?? 0;
+                $productId = $orderItem['itemId'] ?? 0;
+                $info = $infoList[$productId] ?? [];
+                $stock = $info['stock'] ?? 0;
+                $ratio = $info['ratio'] ?? 20;
+                $map = ProductClass::formatStock($stock, $ratio);
+                $bigNum = $map['bigNum'] ?? 0;
+                $smallNum = $map['smallNum'] ?? 0;
+                $num = $forwardStock == 0 ? $num * 2 : $num;
+                if ($unitType == 0) {
+                    $bigNum = $bigNum + $num;
+                } else {
+                    $smallNum = $smallNum + $num;
+                }
+                $itemInfo[] = ['productId' => $productId, 'bigNum' => $bigNum, 'smallNum' => $smallNum];
+            }
+            $remark = $forwardStock == 0 ? '开负数订单,退货并退款' : '开负数订单,只退款';
+            $itemData = [
+                'remark' => $remark,
+                'itemInfo' => $itemInfo,
+                'sjId' => $sjId,
+                'shopId' => $shopId,
+                'adminId' => $adminId,
+                'staffName' => $staffName,
+            ];
+            CheckOrderClass::opOrder($itemData);
+        }
+        if (!empty($orderGoodsList)) {
+            foreach ($orderGoodsList as $orderGoods) {
+                $goodsId = $orderGoods['goodsId'] ?? 0;
+                $num = $orderGoods['num'] ?? 0;
+                $num = $forwardStock == 0 ? $num * 2 : $num;
+
+                $ret = \bizHd\goods\classes\GoodsClass::addStock($goodsId, $mainId, $num);
+                $oldStock = $ret['oldStock'] ?? 0;
+                $newStock = $ret['newStock'] ?? 0;
+                $recordData = [];
+                $recordData['sjId'] = $sjId;
+                $recordData['shopId'] = $shopId;
+                $recordData['mainId'] = $mainId;
+                $recordData['orderSn'] = '';
+                $recordData['goodsId'] = $goodsId;
+                $recordData['goodsNum'] = $num;
+                $recordData['oldStock'] = $oldStock;
+                $recordData['newStock'] = $newStock;
+                $recordData['relateName'] = $staffName;
+                GoodsStockRecordClass::pdGoods($recordData);
+
+            }
+        }
+        if (is_object($order) && !empty($originOrder)) {
+            //建立关系
+            $originOrder->hasForward = 1;
+            $originOrder->save();
+            $orderId = $originOrder->id ?? 0;
+            $orderSn = $originOrder->orderSn ?? '';
+            $shOrderId = $order->id ?? 0;
+            $shOrderSn = $order->orderSn ?? '';
+            $map = ['orderId' => $orderId, 'orderSn' => $orderSn, 'shOrderId' => $shOrderId, 'shOrderSn' => $shOrderSn];
+            OrderForwardClass::add($map, true);
+        }
+        return true;
+    }
+
+    /**
+     * @param $order
+     * @param $mainId
+     * @return array
+     * $shAddPay 0走正常流程售后,1走售后付款单
+     * $shAddPayReason 走售后付款单的原因:0、售后金额大于剩余欠款(剩余欠款可能没有了,可能还有);1、可售后时间到了
+     */
+    public static function ifShPay($order, $main, $refundAmount = 0)
+    {
+        $shAddPay = 0;
+        $shAddPayReason = 0;
+        $payStatus = $order['payStatus'] ?? 0;
+        if ($payStatus == 1) {
+            if ($order['payWay'] == 3) {
+                if ($order['remainDebtPrice'] <= 0) {
+                    //不管是否要售后,没有剩余欠款了,只能走开负数订单模式
+                    $shAddPay = 1;
+                } else {
+                    if ($refundAmount > 0 && $refundAmount > $order['remainDebtPrice']) {
+                        //如果需要售后,并且售后金额大于剩余欠款,走开负数订单模式
+                        $shAddPay = 1;
+                    }
+                }
+            }
+            $cRet = OrderClass::couldRefund($order, $main);
+            $could = $cRet['could'];
+            if (!$could) {
+                //可售后时间到了
+                $shAddPay = 1;
+                $shAddPayReason = 1;
+            }
+        }
+        return ['shAddPay' => $shAddPay, 'shAddPayReason' => $shAddPayReason];
+    }
+
+    //订单是否过了可以售后的时间 ssh 20250730
+    // $could false 过了售后时间,不能售后,true可以
+    public static function couldRefund($order, $main)
+    {
+        $refundLimit = $main->refundLimit ?? 0;
+        $payTime = $order['payTime'];
+        $currentPayTime = strtotime($payTime);
+        $addDateTime = $refundLimit * 86400;
+        $couldRefundTime = $currentPayTime + $addDateTime;
+        $now = time();
+        $could = $couldRefundTime > $now;
+        return ['could' => $could];
+    }
+
     public static function valid($order, $mainId)
     {
-        if (isset($order->mainId) == false || $order->mainId != $mainId) {
+        if (!isset($order->mainId) || $order->mainId != $mainId) {
             Yii::info(json_encode($order));
             Yii::info('mainId: ' . $mainId);
             util::fail('无法访问的订单');
@@ -173,7 +331,6 @@ class OrderClass extends BaseClass
         }
         $order['workList'] = $workList;
 
-        $payWay = $order['payWay'] ?? 0;
         $debtPrice = $order['debtPrice'] ?? 0;
         $remainDebtPrice = $order['remainDebtPrice'] ?? 0;
         $orderId = $order['id'] ?? 0;
@@ -621,7 +778,7 @@ class OrderClass extends BaseClass
         if (empty($order)) {
             return false;
         }
-        if ($must == false) {
+        if (!$must) {
             if ($order->needPrint != dict::getDict('needPrint', 'need')) {
                 return false;
             }
@@ -629,6 +786,10 @@ class OrderClass extends BaseClass
                 return false;
             }
         }
+        if ($order->forward == 1) {
+            //售后付款单暂时不能打印
+            return false;
+        }
 
         $shopId = $order->shopId ?? 0;
         $ext = ShopExtClass::getByCondition(['shopId' => $shopId]);

+ 14 - 0
biz-hd/order/classes/OrderForwardClass.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace bizHd\order\classes;
+
+use common\components\util;
+use Yii;
+use bizHd\base\classes\BaseClass;
+
+class OrderForwardClass extends BaseClass
+{
+
+    public static $baseFile = '\bizHd\order\models\OrderForward';
+
+}

+ 15 - 0
biz-hd/order/models/OrderForward.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace bizHd\order\models;
+
+use bizHd\base\models\Base;
+
+class OrderForward extends Base
+{
+
+	public static function tableName()
+	{
+		return 'xhOrderForward';
+	}
+
+}

+ 15 - 0
biz-hd/order/services/OrderForwardService.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace bizHd\order\services;
+
+use bizHd\base\services\BaseService;
+use common\components\stringUtil;
+use common\components\util;
+use Yii;
+
+class OrderForwardService extends BaseService
+{
+
+    public static $baseFile = '\bizHd\order\classes\OrderForwardClass';
+
+}

+ 7 - 13
biz-hd/order/services/OrderService.php

@@ -27,7 +27,7 @@ class OrderService extends BaseService
 
     public static $baseFile = '\bizHd\order\classes\OrderClass';
 
-    public static function createFinishOrder($data, $custom, $hasPay = 1)
+    public static function createHdOrder($data, $custom, $hasPay = 1)
     {
         $payWay = $data['payWay'] ?? 0;
         $orderSn = orderSn::getOrderSn();
@@ -37,7 +37,8 @@ class OrderService extends BaseService
         $sjId = $data['sjId'] ?? 0;
         $shopId = $data['shopId'] ?? 0;
         $mainId = $data['mainId'] ?? 0;
-
+        $forward = $data['forward'] ?? 0;
+        $forwardStock = $data['forwardStock'] ?? 0;
         $groupCover = '';
 
         $product = $data['product'] ?? [];
@@ -159,6 +160,8 @@ class OrderService extends BaseService
                     'mainId' => $mainId,
                     'kindId' => $kindId,
                     'kindName' => $kindName,
+                    'forward' => $forward,
+                    'forwardStock' => $forwardStock,
                 ];
                 OrderGoodsClass::addData($currentGoodsData);
                 $groupGoodsData[] = ['goodsId' => $currentId, 'num' => $num, 'name' => $name, 'unitPrice' => $unitPrice];
@@ -209,6 +212,8 @@ class OrderService extends BaseService
                     'classId' => $classId,
                     'price' => bcmul($unitPrice, $num, 2),
                     'belongCost' => $belongCost,
+                    'forward' => $forward,
+                    'forwardStock' => $forwardStock,
                 ];
 
                 //库存变化在这里
@@ -293,17 +298,6 @@ class OrderService extends BaseService
             $data['remainDebtPrice'] = $modifyPrice;
             $data['debt'] = 1;
             $payWay = dict::getDict('payWay', 'debtPay');
-        } else {
-            //如果有订金
-            if (isset($data['dj']) && $data['dj'] > 0) {
-                if ($data['dj'] >= $modifyPrice) {
-                    util::fail('订金要小于总金额');
-                }
-                $currentDebt = bcsub($modifyPrice, $data['dj'], 2);
-                $data['debtPrice'] = $currentDebt;
-                $data['remainDebtPrice'] = $currentDebt;
-                $data['debt'] = 1;
-            }
         }
 
         //hasPay balance 转化成余额支付方式

+ 29 - 3
biz-hd/recharge/classes/RechargeClass.php

@@ -3,6 +3,7 @@
 namespace bizHd\recharge\classes;
 
 use biz\shop\classes\ShopClass;
+use bizGhs\shop\classes\ShopMoneyClass;
 use bizHd\balance\classes\BalanceChangeClass;
 use bizHd\custom\classes\CustomClass;
 use bizHd\custom\classes\HdClass;
@@ -135,6 +136,9 @@ class RechargeClass extends BaseClass
         $capitalType = dict::getDict('capitalType', 'xhRecharge', 'id');
         $relateId = $recharge->id;
 
+        $shOrderId = $recharge->shOrderId ?? 0;
+        $shOrderSn = $recharge->shOrderSn ?? '';
+
         $custom = CustomClass::getLockById($customId);
         if (empty($custom)) {
             $msg = '充值回调失败,没有找到客户';
@@ -154,7 +158,7 @@ class RechargeClass extends BaseClass
         $rechargeWeal = $shop->rechargeWeal ?? 0;
         $addGiveAmount = 0;
 
-        //如果客户余额不足,本身有欠款,充值不享受任何福利;结账充值,不参与优惠
+        //如果客户有欠款和结账充值,不参与优惠
         if ($custom->balance >= 0 && $recharge->settleId == 0) {
             if ($rechargeWeal == 1 || $rechargeWeal == 2) {
                 $weal = MemberWealClass::getAllByCondition(['shopId' => $shopId], null, '*');
@@ -198,7 +202,14 @@ class RechargeClass extends BaseClass
         }
 
         $getBalance = $amount;
-        $event = $onlinePay == 2 ? '线上充值' : '线下充值';
+        if ($onlinePay == 2) {
+            $event = $payWay == 0 ? '线上微信 充值' : '线上支付宝 充值';
+        } else {
+            $payWayName = dict::getDict('payWayName');
+            $channel = $payWayName[$payWay] ?? '微信';
+            $event = "线下{$channel} 充值";
+        }
+
         //赠送的金额
         if ($addGiveAmount > 0) {
             $event .= floatval($getBalance) . "(送" . floatval($addGiveAmount) . ")";
@@ -295,6 +306,8 @@ class RechargeClass extends BaseClass
             'settleNo' => $settleNo,
             'settleAmount' => $settleAmount,
             'remark' => $remark,
+            'shOrderId' => $shOrderId,
+            'shOrderSn' => $shOrderSn,
         ];
         $returnChange = BalanceChangeClass::add($change, true);
         if ($recharge->onlinePay == 2) {
@@ -302,8 +315,21 @@ class RechargeClass extends BaseClass
             $shop = ShopClass::getLockById($shopId);
             $main = MainClass::getLockById($mainId);
             ShopClass::skRechargeAddBalance($main, $shop, $recharge);
+        } else {
+            if ($recharge->payWay == 4) {
+                //现在现金充值要增加现金
+                $main = MainClass::getLockById($mainId);
+                $cashData = [];
+                $cashData['mainId'] = $mainId;
+                $cashData['sjId'] = 0;
+                $cashData['amount'] = $amount;
+                $cashData['staffId'] = $staffId;
+                $cashData['staffName'] = $staffName;
+                $cashData['customName'] = $customName;
+                $cashData['ptStyle'] = dict::getDict('ptStyle', 'hd');
+                ShopMoneyClass::skRecharge($cashData, $main);
+            }
         }
-
         return $returnChange;
     }
 

+ 29 - 39
biz-hd/refund/services/HdRefundService.php

@@ -66,7 +66,8 @@ class HdRefundService extends BaseService
         $sjId = $post['sjId'] ?? 0;
         $shopId = $post['shopId'] ?? 0;
         $mainId = $post['mainId'] ?? 0;
-        $xsOrderSn = $order->orderSn ?? '';
+        $myOrderSn = $order->orderSn ?? '';
+        $thirdNo = $order->thirdNo ?? '';
         $data['sjId'] = $sjId;
         $data['shopId'] = $shopId;
         $data['mainId'] = $mainId;
@@ -82,6 +83,7 @@ class HdRefundService extends BaseService
         }
         $goodsInfoList = [];
         $itemInfoList = [];
+        $calcAmount = 0;
         foreach ($postProduct as $current) {
             $property = $current['property'] ?? 0;
             if ($property == 0) {
@@ -89,11 +91,20 @@ class HdRefundService extends BaseService
             } else {
                 $itemInfoList[] = $current;
             }
+            $calcNum = $current['num'] ?? 0;
+            $calcUnitPrice = $current['unitPrice'] ?? 0;
+            $calcPrice = bcmul($calcNum, $calcUnitPrice, 2);
+            $calcAmount = bcadd($calcAmount, $calcPrice, 2);
         }
+
+        if (floatval($refundPrice) != floatval($calcAmount)) {
+            util::fail('数量与单价的总乘积,与退款金额不一致');
+        }
+
         if (!empty($itemInfoList)) {
             $ids = array_column($itemInfoList, 'productId');
             $productInfo = ProductClass::getByids($ids, null, 'id');
-            $orderItemData = OrderItemClass::getAllByCondition(['orderSn' => $xsOrderSn], null, '*', 'itemId', true);
+            $orderItemData = OrderItemClass::getAllByCondition(['orderSn' => $myOrderSn], null, '*', 'itemId', true);
             if (empty($orderItemData)) {
                 util::fail('没有找到商品');
             }
@@ -147,7 +158,7 @@ class HdRefundService extends BaseService
         if (!empty($goodsInfoList)) {
             $ids = array_column($goodsInfoList, 'productId');
             $goodsData = GoodsClass::getByIds($ids, null, 'id');
-            $orderGoodsData = OrderGoodsClass::getAllByCondition(['orderSn' => $xsOrderSn], null, '*', 'goodsId', true);
+            $orderGoodsData = OrderGoodsClass::getAllByCondition(['orderSn' => $myOrderSn], null, '*', 'goodsId', true);
             foreach ($goodsInfoList as $currentGoods) {
                 $goodsId = $currentGoods['productId'] ?? 0;
                 $unitPrice = $currentGoods['unitPrice'] ?? 0;
@@ -185,7 +196,6 @@ class HdRefundService extends BaseService
             }
         }
 
-
         $data['customId'] = $order->customId ?? 0;
         $data['remark'] = $post['remark'] ?? '';
         $data['refundPrice'] = $refundPrice;
@@ -252,16 +262,17 @@ class HdRefundService extends BaseService
                 ];
                 $laResource = new Lakala($params);
                 $refundReason = '';
-                $aliParams = [
+                $refundParams = [
                     'refundSn' => $refundSn,
-                    'orderSn' => $xsOrderSn,
+                    'orderSn' => $myOrderSn,
                     'refundAmount' => $refundFee,
                     'refundReason' => $refundReason,
+                    'thirdNo' => $thirdNo,//这个参数必传,不然聚合收银合支付宝付款的退款不会成功
                 ];
-                $response = $laResource->refund($aliParams);
-                if (isset($response['code']) == false || $response['code'] != 'BBS00000') {
+                $response = $laResource->refund($refundParams);
+                if (!isset($response['code']) || $response['code'] != 'BBS00000') {
                     $errMsg = $response['msg'] ?? '';
-                    noticeUtil::push('退款失败' . $errMsg, '15280215347');
+                    noticeUtil::push('散客订单,支付宝,退款失败,原因:' . $errMsg . ' refundSn:' . $refundSn . ' orderSn:' . $myOrderSn, '15280215347');
                     util::fail('退款失败');
                 }
                 $wxRefundId = isset($response['resp_data']['trade_no']) ? $response['resp_data']['trade_no'] : '';
@@ -269,50 +280,26 @@ class HdRefundService extends BaseService
                 $refund->save();
             }
         } else {
-
-            //客户欠款金额减少
             $customId = $order->customId ?? 0;
             $custom = CustomClass::getLockById($customId);
             if (empty($custom)) {
                 util::fail('没有找到客户');
             }
-
             if ($payWay == dict::getDict('payWay', 'debtPay')) {
-
-                $settleId = $order->settleId;
-                if (!empty($settleId)) {
-                    util::fail('订单已结账,无法发起退款');
-                }
-
+                //如果欠款支付,减掉欠款,其实就是增加余额
                 $currentRemain = bcsub($order->remainDebtPrice, $refundPrice, 2);
+                if ($currentRemain < 0) {
+                    util::fail('剩余欠款不足售后金额');
+                }
                 $order->remainDebtPrice = $currentRemain;
                 if ($currentRemain <= 0) {
                     $order->debt = 0;
                 }
                 $order->save();
-
                 CustomClass::refundDebtAmountReduce($custom, $refundPrice, $refund);
-
-            } else {
-                //部分欠款的订单,付了订金的订单
-                if ($order->remainDebtPrice > 0) {
-                    if ($refundPrice > $order->remainDebtPrice) {
-                        CustomClass::refundDebtAmountReduce($custom, $order->remainDebtPrice, $refund);
-                        $order->remainDebtPrice = 0;
-                        $order->debt = 0;
-                        $order->save();
-                    } else {
-                        CustomClass::refundDebtAmountReduce($custom, $refundPrice, $refund);
-                        $currentRemain = bcsub($order->remainDebtPrice, $refundPrice, 2);
-                        $order->remainDebtPrice = $currentRemain;
-                        if ($currentRemain <= 0) {
-                            $order->debt = 0;
-                        }
-                        $order->save();
-                    }
-                }
             }
             if ($payWay == dict::getDict('payWay', 'cash')) {
+                //如果现金支付
                 $moneyData = [
                     'shopId' => $shopId,
                     'amount' => $refundPrice,
@@ -321,7 +308,10 @@ class HdRefundService extends BaseService
                 ];
                 ShopMoneyClass::hdRefundSkOutAmount($moneyData, $main);
             }
-
+            if ($payWay == dict::getDict('payWay', 'balancePay')) {
+                //如果是余额支付,客户的余额要增加
+                CustomClass::refundDebtAmountReduce($custom, $refundPrice, $refund);
+            }
         }
         return $refund;
     }

+ 29 - 0
biz-hd/wx/classes/WxMiniClass.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace bizHd\wx\classes;
+
+use common\components\dict;
+use common\components\dirUtil;
+use common\components\miniUtil;
+use Yii;
+use bizHd\base\classes\BaseClass;
+use yii\imagine\Image;
+use linslin\yii2\curl;
+
+class WxMiniClass extends BaseClass
+{
+
+    public static $baseFile = '\bizHd\wx\models\WxMiniBase';
+
+    //获取ShortLink ssh 20250729
+    //$page = 'pages/home/recent'
+    public static function getShortLink($page)
+    {
+        $merchant = WxOpenClass::getWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'hd');
+        $ret = miniUtil::generateShortLink($merchant, $page, '', $ptStyle);
+        $link = $ret['link'] ?? '';
+        return ['link' => $link];
+    }
+
+}

+ 13 - 0
biz-hd/wx/models/WxMini.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizHd\wx\models;
+use bizHd\base\models\Base;
+
+class WxMini extends Base
+{
+
+	public static function tableName()
+	{
+		return 'xhWxMini';
+	}
+
+}

+ 16 - 1
biz-mall/order/classes/OrderClass.php

@@ -62,6 +62,19 @@ class OrderClass extends BaseClass
     public static function getDebtList($where)
     {
         $list = self::getAllList('*', $where, 'addTime DESC');
+
+        if (!empty($list)) {
+            foreach ($list as $key => $value) {
+                $debtPrice = $value['debtPrice'] ?? 0;
+                $remainDebtPrice = $value['remainDebtPrice'] ?? 0;
+                $hasPayDebt = 0;
+                if ($debtPrice > $remainDebtPrice) {
+                    $hasPayDebt = bcsub($debtPrice, $remainDebtPrice, 2);
+                }
+                $list[$key]['hasPayDebt'] = floatval($hasPayDebt);
+            }
+        }
+
         $count = self::getCount($where);
         return ['list' => $list, 'debtNum' => $count];
     }
@@ -148,7 +161,7 @@ class OrderClass extends BaseClass
         $mainId = $shop->mainId ?? 0;
         $main = MainClass::getLockById($mainId);
         if (empty($main)) {
-            util::fail('没有main信息33');
+            util::fail('没有main信息呢!');
         }
         $riseNum = StatOrderCountClass::addOrder($shop, $main);
 
@@ -198,6 +211,7 @@ class OrderClass extends BaseClass
                 $shortCover = $val['cover'] ?? '';
                 $cover = imgUtil::groupImg($shortCover);
                 $goodsList[$key]['cover'] = $cover;
+                $goodsList[$key]['shortCover'] = $shortCover;
             }
         }
         $order['goodsInfoList'] = $goodsList;
@@ -207,6 +221,7 @@ class OrderClass extends BaseClass
                 $shortCover = $item['cover'] ?? '';
                 $cover = imgUtil::groupImg($shortCover);
                 $itemList[$key]['cover'] = $cover;
+                $itemList[$key]['shortCover'] = $shortCover;
             }
         }
         $order['itemList'] = $itemList;

+ 13 - 0
biz-mall/order/classes/OrderForwardClass.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace bizMall\order\classes;
+
+use Yii;
+use bizMall\base\classes\BaseClass;
+
+class OrderForwardClass extends BaseClass
+{
+
+    public static $baseFile = '\bizMall\order\models\OrderForward';
+
+}

+ 13 - 0
biz-mall/order/models/OrderForward.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace bizMall\order\models;
+
+use bizMall\base\models\Base;
+
+class OrderForward extends Base
+{
+	public static function tableName()
+	{
+		return 'xhOrderForward';
+	}
+}

+ 15 - 0
biz-mall/order/services/OrderForwardService.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace bizMall\order\services;
+
+use bizMall\base\services\BaseService;
+use common\components\util;
+use Yii;
+use linslin\yii2\curl;
+
+class OrderForwardService extends BaseService
+{
+
+    public static $baseFile = '\bizMall\order\classes\OrderForwardClass';
+
+}

+ 13 - 0
biz-mall/shop/classes/ShopExtClass.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace bizMall\shop\classes;
+
+use Yii;
+use bizMall\base\classes\BaseClass;
+
+class ShopExtClass extends BaseClass
+{
+
+    public static $baseFile = '\bizMall\shop\models\ShopExt';
+
+}

+ 13 - 0
biz-mall/shop/models/ShopExt.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizMall\shop\models;
+use bizMall\base\models\Base;
+
+class ShopExt extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhShopExt';
+    }
+
+}

+ 30 - 0
biz-mall/wx/classes/WxMiniClass.php

@@ -0,0 +1,30 @@
+<?php
+
+namespace bizMall\wx\classes;
+
+use bizHd\wx\classes\WxOpenClass;
+use common\components\dict;
+use common\components\dirUtil;
+use common\components\miniUtil;
+use Yii;
+use bizMall\base\classes\BaseClass;
+use yii\imagine\Image;
+use linslin\yii2\curl;
+
+class WxMiniClass extends BaseClass
+{
+
+    public static $baseFile = '\bizMall\wx\models\WxMini';
+
+    //获取ShortLink ssh 20250728
+    //$page = 'pages/home/recent'
+    public static function getShortLink($page)
+    {
+        $merchant = WxOpenClass::getMallWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'mall');
+        $ret = miniUtil::generateShortLink($merchant, $page, '', $ptStyle);
+        $link = $ret['link'] ?? '';
+        return ['link' => $link];
+    }
+
+}

+ 13 - 0
biz-mall/wx/models/WxMini.php

@@ -0,0 +1,13 @@
+<?php
+namespace bizMall\wx\models;
+use bizMall\base\models\Base;
+
+class WxMini extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhWxMini';
+    }
+
+}

+ 1 - 0
common/components/lakala/Lakala.php

@@ -287,6 +287,7 @@ class Lakala
         $refundSn = $params['refundSn'];
         $refundReason = $params['refundReason'];
         $refundAmount = $params['refundAmount'];
+        //这个参数必传,不然聚合收银合支付宝付款的退款不会成功
         $thirdNo = $params['thirdNo'] ?? '';
         $ip = $this->getClientIp();
         $location_info = ['request_ip' => $ip];