wangshan 4 жил өмнө
parent
commit
40bce24c2e

+ 11 - 2
src/jfw/modules/subscribepay/src/service/vipSubscribeChange.go

@@ -6,8 +6,6 @@ import (
 	"entity"
 	"errors"
 	"fmt"
-	"github.com/go-xweb/xweb"
-	"go.mongodb.org/mongo-driver/bson"
 	"log"
 	"math"
 	"pay"
@@ -16,6 +14,9 @@ import (
 	"strings"
 	"time"
 	"util"
+
+	"github.com/go-xweb/xweb"
+	"go.mongodb.org/mongo-driver/bson"
 )
 
 //订阅修改 or 升级
@@ -131,6 +132,7 @@ func (this *SubscribeChange) Upgrade() {
 		now := time.Now()
 		date_count, date_unit, needRenew := 0, 0, false
 		endUnix := qutil.Int64All((*rData)["l_vip_endtime"])
+		startUnix := qutil.Int64All((*rData)["l_vip_starttime"])
 
 		if timeRenew != "" {
 			var err error
@@ -260,6 +262,13 @@ func (this *SubscribeChange) Upgrade() {
 		if orderid == -1 {
 			return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
 		}
+		//老用户升级 一个省 全行业 时间不变 会出现零元升级得情况 0元升级直接到支付成功页面 开通超级订阅
+		if req_price == 0 && 0 == final_price && oldBuyset.Upgrade == 0 {
+			if !entity.JyVipSubStruct.StartSubVip(userId, filter, time.Unix(startUnix, 0), time.Unix(endUnix, 0), false) { //设置开始试用
+				return &entity.FuncResult{false, errors.New("老用户升级超级订阅高版本异常"), nil}
+			}
+			return &entity.FuncResult{true, nil, map[string]interface{}{"code": ordercode, "needPay": false}}
+		}
 		//绑定卡卷
 		if userLotteryId != "" && lotteryId != "" {
 			go func(userId, userLotteryId, order_code string) {