shish 5 lat temu
rodzic
commit
e89af69b87

+ 1 - 0
app-hd/controllers/OrderController.php

@@ -181,6 +181,7 @@ class OrderController extends BaseController
             $post['sendCost'] = $sendCost;
             $currentPrice = bcadd($currentPrice, $sendCost, 2);
             $post['prePrice'] = $currentPrice;
+
             if (isset($post['modifyPrice'])) {
                 //商家打折,修改金额
                 $modifyPrice = $post['modifyPrice'] ?? 0;

+ 18 - 7
app-pt/controllers/CashController.php

@@ -6,6 +6,7 @@ use biz\shop\classes\ShopAdminClass;
 use biz\shop\classes\ShopClass;
 use biz\sj\classes\CashClass;
 use biz\wx\classes\WxMessageClass;
+use common\components\dict;
 use common\components\noticeUtil;
 use common\components\util;
 use Yii;
@@ -48,7 +49,7 @@ class CashController extends BaseController
             if (empty($shop)) {
                 util::fail('没有找到门店');
             }
-
+            $ptStyle = $shop->ptStyle ?? dict::getDict('ptStyle', 'hd');
             $cashAmount = isset($cash->amount) ? floatval($cash->amount) : 0;
             if ($cashAmount <= 0) {
                 util::fail('提现金额有问题');
@@ -59,6 +60,16 @@ class CashController extends BaseController
                 }
             }
 
+            if ($cashAmount < 10) {
+                util::fail('提现金额不足10元');
+            }
+
+            $getCashAmount = $cashAmount;
+            //零售店提现需要扣除千分之六的手续费
+            if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
+                $getCashAmount = bcmul($cashAmount, 0.006, 2);
+            }
+
             if ($status != CashClass::STATUS_CHECK_YES) {
                 $cash->remark = $remark;
                 $cash->status = CashClass::STATUS_CHECK_NO;
@@ -83,6 +94,9 @@ class CashController extends BaseController
                 util::fail('没有找到订单号');
             }
 
+            if (bccomp($cashAmount, $shop->freezeBalance) == 1) {
+                util::fail('冻结金额不足提现');
+            }
 
             $aliWap = Yii::getAlias("@vendor/alipayWap");
             require_once($aliWap . '/aop/AopClient.php');
@@ -124,7 +138,7 @@ class CashController extends BaseController
                 "\"out_biz_no\":\"" . $cashSn . "\"," .
                 "\"payee_type\":\"ALIPAY_LOGONID\"," .
                 "\"payee_account\":\"" . $cashAccount . "\"," .
-                "\"amount\":\"" . $cashAmount . "\"," .
+                "\"amount\":\"" . $getCashAmount . "\"," .
                 "\"payee_real_name\":\"" . $cashName . "\"," .
                 "\"payer_show_name\":\"厦门中花汇信息科技有限公司\"," .
                 "\"remark\":\"提现申请\"" .
@@ -138,21 +152,18 @@ class CashController extends BaseController
                 $cash->thirdOrderSn = $returnOrderId;
                 $cash->status = CashClass::STATUS_CHECK_YES;
                 $cash->remark = $remark;
+                $cash->getCashAmount = $getCashAmount;
                 $cash->cashName = $cashName;
                 $cash->cashAccount = $cashAccount;
                 $cash->save();
                 //扣掉冻结的金额
-
-                if (bccomp($cashAmount, $shop->freezeBalance) == 1) {
-                    util::fail('冻结金额不足提现');
-                }
                 $shop->freezeBalance = bcsub($shop->freezeBalance, $cashAmount, 2);
                 $shop->save();
                 $transaction->commit();
                 //微信通知申请提现人
                 WxMessageClass::cashInform($shop, $cash);
                 //通知管理员
-                noticeUtil::push("客户提现审核通过,转帐{$cashAmount}元", '15280215347');
+                noticeUtil::push("客户提现审核通过,转帐{$getCashAmount}元", '15280215347');
                 util::complete();
             } else {
                 $msg = $result->$responseNode->msg ?? '';