Browse Source

Merge branch 'dev2.8.5' of http://192.168.3.207:10080/qmx/jy into dev2.8.5

xuzhiheng 5 years ago
parent
commit
140c278fae

+ 4 - 2
src/jfw/modules/subscribepay/src/entity/subscribeVip.go

@@ -73,11 +73,13 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 	var endTime time.Time
 	if vmsg.OrderType == 1 { //新订单 计算开始时间 结束时间
 		startTime := time.Now()
-		if vmsg.Cycleunit == 1 { //年
+		/*if vmsg.Cycleunit == 1 { //年
 			endTime = startTime.AddDate(vmsg.Cyclecount, 0, 0)
 		} else if vmsg.Cycleunit == 2 { //月
 			endTime = startTime.AddDate(0, vmsg.Cyclecount, 0)
-		}
+		}*/
+		endTime := util.GetDATE(vmsg.Cycleunit, vmsg.Cyclecount, startTime.Unix())
+
 		updateMap["vip_starttime"] = qutil.FormatDate(&startTime, qutil.Date_Full_Layout)
 		updateMap["vip_endtime"] = qutil.FormatDate(&endTime, qutil.Date_Full_Layout)
 	}

+ 3 - 2
src/jfw/modules/subscribepay/src/service/vipSubscribePay.go

@@ -124,12 +124,13 @@ func (this *SubVipPayOrder) CreateOrder() {
 		if orderType == 5 { //插入生效时间和结束时间
 			timeStamp := qutil.Int64All((*userData)["l_vip_endtime"])
 			startTime := time.Unix(timeStamp, 0)
-			var endTime time.Time
+			/*var endTime time.Time
 			if filter.Cycleunit == 1 { //年
 				endTime = startTime.AddDate(filter.Cyclecount, 0, 0)
 			} else if filter.Cycleunit == 2 { //月
 				endTime = startTime.AddDate(0, filter.Cyclecount, 0)
-			}
+			}*/
+			endTime := util.GetDATE(filter.Cycleunit, filter.Cycleunit, timeStamp)
 			insertMap["vip_starttime"] = qutil.FormatDate(&startTime, qutil.Date_Full_Layout)
 			insertMap["vip_endtime"] = qutil.FormatDate(&endTime, qutil.Date_Full_Layout)
 		}

+ 3 - 2
src/jfw/modules/subscribepay/src/util/vrew.go

@@ -8,6 +8,7 @@ import (
 	"qfw/util/elastic"
 	"strconv"
 	"strings"
+	"time"
 
 	"gopkg.in/mgo.v2/bson"
 )
@@ -265,7 +266,7 @@ func MergeKws(userId string) {
 }
 
 //m 月 超过一年传12+n月 如14 endtime 当前周期结束时间戳 int64
-func GetDATE(val int, m int, endtime int64) (_endtime int64) {
+func GetDATE(val int, m int, endtime int64) (_endtime time.Time) {
 	if val == 1 {
 		m = m * 12
 	}
@@ -293,5 +294,5 @@ func GetDATE(val int, m int, endtime int64) (_endtime int64) {
 		_date = strconv.Itoa(date_y) + "-" + mstr + "-" + strconv.Itoa(date_d)
 	}
 	lastDate, _ := time.ParseInLocation(qutil.Date_Short_Layout, _date, time.Local)
-	return lastDate.Unix()
+	return lastDate
 }