shish 5 лет назад
Родитель
Сommit
b8cf16616e

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

@@ -8,7 +8,7 @@ use bizGhs\order\classes\OrderExpressClass;
 use bizGhs\order\classes\OrderSendClass;
 use bizGhs\order\services\OrderService;
 use common\components\dict;
-use common\components\pay;
+use common\components\payUtil;
 use Yii;
 use common\components\util;
 use biz\recharge\classes\RechargeClass;
@@ -43,7 +43,7 @@ class NoticeController extends PublicController
 
         $wxPay = dict::getDict('payWay', 'wxPay');
         //支付成功后续流程
-        pay::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
+        payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
 
         echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
     }
@@ -124,7 +124,7 @@ class NoticeController extends PublicController
 
             $aliPay = dict::getDict('payWay', 'alipay');
             //支付成功后续流程
-            pay::thirdPay($aliPay, $capitalType, $orderSn, $totalFee, $attach);
+            payUtil::thirdPay($aliPay, $capitalType, $orderSn, $totalFee, $attach);
 
         }
         //请不要修改

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

@@ -2,6 +2,7 @@
 
 namespace ghs\controllers;
 
+use biz\set\classes\SetClass;
 use biz\sj\services\MerchantExtendService;
 use biz\sj\services\MerchantService;
 use bizHd\saas\services\RenewService;
@@ -31,10 +32,17 @@ class RenewController extends BaseController
         $addData['shopAdminId'] = $shopAdminId;
         $shopAdmin = $this->shopAdmin;
         $adminName = $shopAdmin['name'] ?? '';
+        $sjId = $shopAdmin['merchantId'];
         $addData['shopAdminName'] = $adminName;
-        $price = 0.01;
+
+        $set = SetClass::getByCondition(['style' => SetClass::SET_STYLE_GHS], true, 'id asc');
+        if (empty($set)) {
+            util::fail('没有找到套餐');
+        }
+        $price = $set->price;
         $prePrice = $price;
         $actPrice = $price;
+        $setId = $set->id;
         $addData['actPrice'] = $actPrice;
         $addData['prePrice'] = $prePrice;
         $addData['merchantId'] = $this->sjId;
@@ -45,14 +53,15 @@ class RenewController extends BaseController
         $orderId = $order['id'];
         $orderSn = $order['orderSn'];
         $couponId = 0;
-        $name = '基础版开通续费';
+        $name = $set->name . '开通续费';
         $totalFee = $actPrice;
         $admin = $this->admin;
         //小程序使用miniOpenId
         $openId = $admin['miniOpenId'];
 
         $capitalType = dict::getDict('capitalType', 'xhRenew', 'id');
-        $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId;//将流水类型、优惠卷传过去
+        //将流水类型、优惠卷传过去
+        $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&setId=' . $setId . '&sjId=' . $sjId;
         $wx = Yii::getAlias("@vendor/weixin");
         require_once($wx . '/lib/WxPay.Api.php');
         require_once($wx . '/example/WxPay.JsApiPay.php');

+ 3 - 3
app-hd/controllers/NoticeController.php

@@ -3,7 +3,7 @@
 namespace hd\controllers;
 
 use common\components\dict;
-use common\components\pay;
+use common\components\payUtil;
 use Yii;
 use common\components\util;
 
@@ -39,7 +39,7 @@ class NoticeController extends PublicController
 
         $wxPay = dict::getDict('payWay', 'wxPay');
         //支付成功后续流程
-        pay::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
+        payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
 
         echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
     }
@@ -120,7 +120,7 @@ class NoticeController extends PublicController
 
             $aliPay = dict::getDict('payWay', 'alipay');
             //支付成功后续流程
-            pay::thirdPay($aliPay, $capitalType, $orderSn, $totalFee, $attach);
+            payUtil::thirdPay($aliPay, $capitalType, $orderSn, $totalFee, $attach);
 
         }
         //请不要修改

+ 12 - 3
app-hd/controllers/RenewController.php

@@ -2,6 +2,7 @@
 
 namespace hd\controllers;
 
+use biz\set\classes\SetClass;
 use biz\sj\services\MerchantExtendService;
 use biz\sj\services\MerchantService;
 use bizHd\saas\services\RenewService;
@@ -31,10 +32,17 @@ class RenewController extends BaseController
         $addData['shopAdminId'] = $shopAdminId;
         $shopAdmin = $this->shopAdmin;
         $adminName = $shopAdmin['name'] ?? '';
+        $sjId = $shopAdmin['merchantId'] ?? 0;
         $addData['shopAdminName'] = $adminName;
-        $price = 0.01;
+
+        $set = SetClass::getByCondition(['style' => SetClass::SET_STYLE_GHS], true, 'id asc');
+        if (empty($set)) {
+            util::fail('没有找到套餐');
+        }
+        $price = $set->price;
         $prePrice = $price;
         $actPrice = $price;
+        $setId = $set->id;
         $addData['actPrice'] = $actPrice;
         $addData['prePrice'] = $prePrice;
         $addData['merchantId'] = $this->sjId;
@@ -45,14 +53,15 @@ class RenewController extends BaseController
         $orderId = $order['id'];
         $orderSn = $order['orderSn'];
         $couponId = 0;
-        $name = '基础版开通续费';
+        $name = $set->name . '开通续费';
         $totalFee = $actPrice;
         $admin = $this->admin;
         //小程序使用miniOpenId
         $openId = $admin['miniOpenId'];
 
         $capitalType = dict::getDict('capitalType', 'xhRenew', 'id');
-        $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId;//将流水类型、优惠卷传过去
+        //将流水类型、优惠卷传过去
+        $attach = 'capitalType=' . $capitalType . '&couponId=' . $couponId . '&setId=' . $setId . '&sjId=' . $sjId;
         $wx = Yii::getAlias("@vendor/weixin");
         require_once($wx . '/lib/WxPay.Api.php');
         require_once($wx . '/example/WxPay.JsApiPay.php');

+ 3 - 3
app-mall/controllers/NoticeController.php

@@ -2,7 +2,7 @@
 
 namespace mall\controllers;
 
-use common\components\pay;
+use common\components\payUtil;
 use Yii;
 use common\components\util;
 use common\components\dict;
@@ -37,7 +37,7 @@ class NoticeController extends PublicController
 
         $wxPay = dict::getDict('payWay', 'wxPay');
         //支付成功后续流程
-        pay::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
+        payUtil::thirdPay($wxPay, $capitalType, $orderSn, $totalFee, $attach);
 
         echo '<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>';
     }
@@ -118,7 +118,7 @@ class NoticeController extends PublicController
 
             $aliPay = dict::getDict('payWay', 'alipay');
             //支付成功后续流程
-            pay::thirdPay($aliPay, $capitalType, $orderSn, $totalFee, $attach);
+            payUtil::thirdPay($aliPay, $capitalType, $orderSn, $totalFee, $attach);
 
         }
         //请不要修改

+ 1 - 1
biz-hd/saas/models/SetMeal.php

@@ -9,7 +9,7 @@ class SetMeal extends Base
 
 	public static function tableName()
 	{
-		return 'xhSetMeal';
+		return 'xhSet';
 	}
 	
 }

+ 1 - 1
biz-mall/saas/models/SetMeal.php

@@ -9,7 +9,7 @@ class SetMeal extends Base
 
 	public static function tableName()
 	{
-		return 'xhSetMeal';
+		return 'xhSet';
 	}
 	
 }

+ 49 - 0
biz/renew/classes/RenewClass.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace biz\renew\classes;
+
+use biz\base\classes\BaseClass;
+use biz\sj\classes\SjClass;
+use common\components\util;
+use Yii;
+
+class RenewClass extends BaseClass
+{
+
+    public static $baseFile = '\biz\renew\models\Renew';
+
+    const STATUS_UN_PAY = 1;
+    const STATUS_HAS_PAY = 2;
+
+    public static function thirdPay($payWay, $orderSn, $totalFee, $attach)
+    {
+        $order = self::getByCondition(['orderSn' => $orderSn], true);
+        if (empty($order)) {
+            $msg = "没有找到购买续期订单 orderSn:{$orderSn}";
+            Yii::info($msg);
+            util::fail($msg);
+        }
+        if ($order->actPrice != $totalFee) {
+            $msg = "购买续期订单金额与回调通知金额不一致 orderSn:{$orderSn} {$order->actPrice} {$totalFee}";
+            Yii::info($msg);
+            util::fail($msg);
+        }
+        if (isset($order->status) == false) {
+            util::fail('没有找到订单状态');
+        }
+        if ($order->status != self::STATUS_UN_PAY) {
+            util::fail('订单不是待付款状态');
+        }
+        parse_str($attach);
+        //是否充值免费续期
+        $sjId = isset($sjId) ? $sjId : 0;
+        $setId = isset($setId) ? $setId : 0;
+        $order->merchantId = $sjId;
+        $order->setId = $setId;
+        $order->status = self::STATUS_HAS_PAY;
+        $order->payWay = $payWay;
+        $order->save();
+        SjClass::renewOneYear($sjId, 2, ['amount' => $order->actPrice, 'orderSn' => $orderSn]);
+    }
+
+}

+ 15 - 0
biz/renew/models/Renew.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace biz\renew\models;
+
+use biz\base\models\Base;
+
+class Renew extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhRenew';
+    }
+
+}

+ 17 - 0
biz/set/classes/SetClass.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace biz\set\classes;
+
+use bizHd\base\classes\BaseClass;
+
+class SetClass extends BaseClass
+{
+
+    public static $baseFile = '\biz\set\models\Set';
+
+    const SET_STYLE_HD = 1;
+    const SET_STYLE_GHS = 2;
+    const SET_STYLE_KM_GHS = 3;
+
+
+}

+ 15 - 0
biz/set/models/Set.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace biz\set\models;
+
+use biz\base\models\Base;
+
+class Set extends Base
+{
+
+    public static function tableName()
+    {
+        return 'xhSet';
+    }
+
+}

+ 13 - 0
biz/set/services/SetService.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace biz\sj\services;
+
+use biz\base\services\BaseService;
+use Yii;
+
+class SetService extends BaseService
+{
+
+    public static $baseFile = '\biz\set\classes\SetClass';
+
+}

+ 2 - 1
biz/sj/classes/SjClass.php

@@ -41,8 +41,9 @@ class SjClass extends BaseClass
         $sj->deadline = $newDeadline;
         $sj->save();
 
-        $event = '购买续期';
+        $event = '';
         if ($type == 1) {
+            $event = "付款续期 付款订单号:" . $params['orderSn'];
         } elseif ($type == 2) {
             $event = "充值花款" . $params['amount'] . "元续期 充值订单号:" . $params['orderSn'];
             $sjExt = MerchantExtendClass::getByMerchantId($sjId, true);

+ 6 - 3
common/components/pay.php → common/components/payUtil.php

@@ -3,13 +3,13 @@
 namespace common\components;
 
 use biz\recharge\classes\RechargeClass;
+use biz\renew\classes\RenewClass;
 use bizHd\order\classes\OrderClass;
-use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseClearClass;
 use bizHd\purchase\services\PurchaseService;
 use Yii;
 
-class pay
+class payUtil
 {
 
     public static function thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach)
@@ -36,9 +36,12 @@ class pay
                     //零售订单
                     OrderClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
                     break;
+                case dict::getDict('capitalType', 'xhRenew', 'id'):
+                    //零售和供货商续费订单
+                    RenewClass::thirdPay($payWay, $orderSn, $totalFee, $attach);
+                    break;
                 default:
             }
-
             $transaction->commit();
         } catch (Exception $exception) {
             $transaction->rollBack();

+ 1 - 1
common/models/xhSetMeal.php

@@ -19,7 +19,7 @@ class xhSetMeal extends xhBaseModel
      */
     public static function tableName()
     {
-        return 'xhSetMeal';
+        return 'xhSet';
     }
 
 }

+ 2 - 2
common/services/xhSetMealService.php

@@ -20,7 +20,7 @@ class xhSetMealService {
 
 	public static function getById($id)
 	{
-		$cacheKey		= dict::getCacheKey('xhSetMeal').$id;
+		$cacheKey		= dict::getCacheKey('xhSet').$id;
 		$set			= Yii::$app->redis->executeCommand('HGETALL', [$cacheKey]);
 		if(!empty($set)){
 			$arr		= [];
@@ -60,7 +60,7 @@ class xhSetMealService {
 	{
 		$return			= xhSetMeal::add($data);
 		$id				= $return['id'];
-		$cacheKey		= dict::getCacheKey('xhSetMeal').$id;
+		$cacheKey		= dict::getCacheKey('xhSet').$id;
 		$params			= [$cacheKey];
 		if(!empty($return)){
 			foreach($return as $key => $val){

+ 14 - 1
sql.sql

@@ -2512,4 +2512,17 @@ ALTER TABLE xhShopAdmin ADD remark VARCHAR(1000) NOT NULL DEFAULT '' COMMENT ''
 
 -----shish 2021
 #采购单到期脚本
-*/1 * * * * /usr/local/nginx/html/huahuibao/yii purchase/expire-order
+*/1 * * * * /usr/local/nginx/html/huahuibao/yii purchase/expire-order
+
+阿里云 线上 bucket 需要独立出来 不再跟测试环境混在一起使用
+
+-----shish 20210516
+ALTER TABLE `xhSetMeal` ADD `style` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '商家类型 1花店 2供货商 3昆明供货商' AFTER `id`;
+ALTER TABLE `xhSetMeal` DROP COLUMN `createTime`;
+ALTER TABLE `xhSetMeal` DROP COLUMN `updateTime`;
+ALTER TABLE `xhSetMeal` ADD `addTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间' AFTER `num`;
+ALTER TABLE `xhSetMeal` ADD `updateTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间' AFTER `addTime`;
+TRUNCATE `xhSetMeal`;
+INSERT INTO xhSetMeal(id,`style`,`name`,price,num) VALUES(NULL,1,'基础版',1980,0),(NULL,2,'基础版',2980,0);
+ALTER TABLE `xhSetMeal` RENAME TO `xhSet`;
+ALTER TABLE xhRenew MODIFY `status` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '1 待付款 2已付款';