Przeglądaj źródła

Merge branch 'zhongqi-delivery' of git.huaml.com:zhh/huahuibao into zhongqi-delivery

shizhongqi 8 miesięcy temu
rodzic
commit
e9fc8b303d

+ 3 - 2
app-ghs/controllers/NoticeController.php

@@ -35,6 +35,7 @@ class NoticeController extends PublicController
         $total_fee = $postObj->total_fee;
         $totalFee = $total_fee / 100;
         $attach = $postObj->attach;
+        $transactionId = $postObj->transaction_id ?? '';
         //接收流水类型、代金劵
         parse_str($attach);
         //流水类型
@@ -57,12 +58,12 @@ class NoticeController extends PublicController
         try {
             $wxPay = dict::getDict('payWay', 'wxPay');
             //支付成功后续流程
-            payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
+            payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
             $transaction->commit();
             echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
 
             if ($capitalType == dict::getDict('capitalType', 'xhRenew', 'id')) {
-                noticeUtil::push("有客户续费:" . $orderSn . ' ' . $totalFee, '15280215347');
+                noticeUtil::push("有客户付款成功:" . $orderSn . ' ' . $totalFee, '15280215347');
             }
 
         } catch (\Exception $e) {

+ 3 - 7
app-ghs/controllers/RenewController.php

@@ -90,6 +90,7 @@ class RenewController extends BaseController
         $get = Yii::$app->request->get();
         $year = $get['year'] ?? 1;
         $type = $get['type'] ?? 0;
+        $remark = $get['remark'] ?? '';
         $orderSn = orderSn::getRenewSn();
         $staff = $this->shopAdmin;
         $staffId = $staff->id ?? 0;
@@ -121,13 +122,7 @@ class RenewController extends BaseController
             if ($price <= 0) {
                 util::fail('请输入金额');
             }
-            if (getenv('YII_ENV') == 'production') {
-                $staff = $this->shopAdmin;
-                if ($price < 1580 && $staff->mobile != 15280215347) {
-                    //util::fail('金额不能低于年费');
-                }
-            }
-            $name = "购买系统";
+            $name = "购买套餐/购买设备";
         }
         $data = [
             'orderSn' => $orderSn,
@@ -146,6 +141,7 @@ class RenewController extends BaseController
             'beforeDeadline' => $beforeDeadline,
             'status' => 0,
             'type' => $type,
+            'remark' => $remark,
         ];
         $ret = RenewClass::add($data, true);
         $id = $ret->id ?? 0;

+ 1 - 2
biz-ghs/product/classes/ProductClass.php

@@ -519,8 +519,7 @@ class ProductClass extends BaseClass
                 $list[$k]['skPrice'] = floatval($v['skDiscountPrice']);
             }
             $list[$k]['price'] = $price;
-
-            $cost = $v['cost'] ?? 0;
+            $cost = $v['avCost'] ?? 0;
             $ml = 0;
             if ($price > 0) {
                 $profit = bcsub($price, $cost, 2);

+ 1 - 1
biz-hd/product/classes/ProductClass.php

@@ -257,7 +257,7 @@ class ProductClass extends BaseClass
             }
             $list[$k]['price'] = $price;
 
-            $cost = $v['cost'] ?? 0;
+            $cost = $v['avCost'] ?? 0;
             $ml = 0;
             if ($price > 0) {
                 $profit = bcsub($price, $cost, 2);

+ 20 - 21
biz/renew/classes/RenewClass.php

@@ -20,7 +20,7 @@ class RenewClass extends BaseClass
         return $data;
     }
 
-    public static function thirdPay($payWay, $orderSn, $totalFee, $attach)
+    public static function thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId)
     {
         $renew = self::getByCondition(['orderSn' => $orderSn], true);
         if (empty($renew)) {
@@ -49,33 +49,32 @@ class RenewClass extends BaseClass
         $mainId = $shop->mainId ?? 0;
         $before = $shop->deadline ?? '';
         $beforeTime = strtotime($before);
-        if ($renew->type == 1) {
-            //首次续费,赠送一个月
-            //$time = $beforeTime + 34128000;
-            $time = $beforeTime + 31536000;
+        if ($renew->type == 2) {
+            //购买设备,不需要有操作
         } else {
             //每次续费一年
             $time = $beforeTime + 31536000;
-        }
-        $newDate = date("Y-m-d H:i:s", $time);
+            $newDate = date("Y-m-d H:i:s", $time);
 
-        $renew->payTime = date("Y-m-d H:i:s");
-        $renew->status = 1;
-        $renew->deadline = $newDate;
-        $renew->beforeDeadline = $before;
-        $renew->save();
+            $renew->deadline = $newDate;
+            $renew->beforeDeadline = $before;
 
-        $shopList = ShopClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
-        if (!empty($shopList)) {
-            foreach ($shopList as $myShop) {
-                $myShop->beforeDeadline = $before;
-                $myShop->deadline = $newDate;
-                $myShop->hasRenew = 1;
-                $myShop->needRenew = 0;
-                $myShop->save();
+            $shopList = ShopClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
+            if (!empty($shopList)) {
+                foreach ($shopList as $myShop) {
+                    $myShop->beforeDeadline = $before;
+                    $myShop->deadline = $newDate;
+                    $myShop->hasRenew = 1;
+                    $myShop->needRenew = 0;
+                    $myShop->save();
+                }
             }
         }
-
+        $renew->returnCode = $transactionId;
+        $renew->payTime = date("Y-m-d H:i:s");
+        $renew->status = 1;
+        $renew->save();
     }
 
+
 }

+ 0 - 1
common/components/book.php

@@ -99,7 +99,6 @@ class book
             ['style' => 'info', 'value' => '软件年费1580元,年费需每年付一次,客户通过小程序下单,会扣0.33手续费,即100元扣3毛3。',],
             ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国200家鲜花批发店和11万家花店磨合使用,非常成熟好用,请放心购买使用,以下套餐已含第一年年费。',],
             ['style' => 'miniTitle', 'value' => '软件的研发成本巨大,不管是年费、费率和套餐,都已经底价,没有商量的空间,请理解。付费后不支持退货。',],
-            ['style' => 'info', 'value' => '首次开通系统,另外赠送30天有效期,保证有足够时间试运营。',],
             ['style' => 'info', 'value' => '提供上门培训服务,培训时间3天,需报销差旅住宿费用,公司地址在福建厦门。',],
             ['style' => 'smallTitle', 'value' => '仓库版',],
             ['style' => 'info', 'value' => '整套软件功能(一年)',],

+ 2 - 2
common/components/payUtil.php

@@ -51,8 +51,8 @@ class payUtil
                 ScanPayClass::thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId);
                 break;
             case dict::getDict('capitalType', 'xhRenew', 'id'):
-                //商家续期
-                RenewClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
+                //商家续期、购买套餐和设备
+                RenewClass::thirdPay($payWay, $orderSn, $totalFee, $attach, $transactionId);
                 break;
             case dict::getDict('capitalType', 'pxApply', 'id'):
                 //培训报名