wangshan 5 vuotta sitten
vanhempi
commit
ed7bc3c9c0
1 muutettua tiedostoa jossa 11 lisäystä ja 3 poistoa
  1. 11 3
      src/jfw/modules/subscribepay/src/util/vrew.go

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

@@ -276,7 +276,7 @@ func GetDATE(val int, m int, endtime int64) (_endtime time.Time) {
 	date_d, _ := strconv.Atoi(strings.Split(endFormat, "-")[2])
 	if date_m+m > 12 {
 		date_y = date_y + (date_m+m)/12
-		date_m = date_m + m - 12*(date_m+m)/12
+		date_m = date_m + m - 12*((date_m+m)/12)
 	} else {
 		date_m = date_m + m
 	}
@@ -288,11 +288,19 @@ func GetDATE(val int, m int, endtime int64) (_endtime time.Time) {
 	p, _ := time.ParseInLocation(qutil.Date_Short_Layout, _date, time.Local)
 	date := time.Unix(p.Unix(), 0).AddDate(0, 1, -1)
 	thisD, _ := strconv.Atoi(strings.Split(qutil.FormatDate(&date, qutil.Date_Short_Layout), "-")[2])
+	dstr := "01"
 	if thisD < date_d {
-		_date = strconv.Itoa(date_y) + "-" + mstr + "-" + strconv.Itoa(thisD)
+		dstr = strconv.Itoa(thisD)
+		if thisD < 10 {
+			dstr = "0" + strconv.Itoa(thisD)
+		}
 	} else {
-		_date = strconv.Itoa(date_y) + "-" + mstr + "-" + strconv.Itoa(date_d)
+		dstr = strconv.Itoa(date_d)
+		if date_d < 10 {
+			dstr = "0" + strconv.Itoa(date_d)
+		}
 	}
+	_date = strconv.Itoa(date_y) + "-" + mstr + "-" + dstr
 	lastDate, _ := time.ParseInLocation(qutil.Date_Short_Layout, _date, time.Local)
 	return lastDate
 }