|
@@ -16,6 +16,7 @@ import (
|
|
|
"log"
|
|
|
"net/url"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
|
|
|
. "app.yhyue.com/moapp/jybase/api"
|
|
@@ -119,11 +120,32 @@ func (this *SalesCreateOrder) CreateBySeller() {
|
|
|
saleDep = qutil.ObjToString(sellData["ts"])
|
|
|
deptId = qutil.IntAll(sellData["ti"])
|
|
|
if inserMap.VipEndTime != "" {
|
|
|
+ tm := qutil.InterfaceToStr(data["time"])
|
|
|
+ var isSend bool
|
|
|
+ switch { //大于一年才赠送
|
|
|
+ case strings.Contains(tm, "年"):
|
|
|
+ dateStr := strings.Replace(tm, "年", "", -1)
|
|
|
+ if qutil.IntAll(dateStr) >= 1 {
|
|
|
+ isSend = true
|
|
|
+ }
|
|
|
+ case strings.Contains(tm, "季"):
|
|
|
+ dateStr := strings.Replace(tm, "季", "", -1)
|
|
|
+ if qutil.IntAll(dateStr) >= 4 {
|
|
|
+ isSend = true
|
|
|
+ }
|
|
|
+ case strings.Contains(tm, "月"):
|
|
|
+ dateStr := strings.Replace(tm, "月", "", -1)
|
|
|
+ if qutil.IntAll(dateStr) >= 12 {
|
|
|
+ isSend = true
|
|
|
+ }
|
|
|
+ }
|
|
|
endTime, _ := time.ParseInLocation(Date_Full_Layout, inserMap.VipEndTime, time.Local)
|
|
|
- if tt == 1 {
|
|
|
- endTime = endTime.AddDate(0, 0, tn)
|
|
|
- } else if tt == 2 {
|
|
|
- endTime = endTime.AddDate(0, tn, 0)
|
|
|
+ if isSend {
|
|
|
+ if tt == 1 {
|
|
|
+ endTime = endTime.AddDate(0, 0, tn)
|
|
|
+ } else if tt == 2 {
|
|
|
+ endTime = endTime.AddDate(0, tn, 0)
|
|
|
+ }
|
|
|
}
|
|
|
inserMap.VipEndTime = endTime.Format(Date_Full_Layout)
|
|
|
}
|