Просмотр исходного кода

wip:开通企业权益判断修改

duxin 2 лет назад
Родитель
Сommit
3b8aa6df7d
2 измененных файлов с 20 добавлено и 7 удалено
  1. 17 4
      src/order/orderManageService.go
  2. 3 3
      src/order/otherOrderService.go

+ 17 - 4
src/order/orderManageService.go

@@ -3786,7 +3786,7 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
 		})
 		// 企业主体判断是否开通权益
 		if param.BuySubject == "2" {
-			entService, userCount = EntServiceOpen(qutil.IntAll(paramOrder["entId"]), param.BuySubject, param.StartTime)
+			entService, userCount = EntServiceOpen(qutil.IntAll(paramOrder["entId"]), "1", param.StartTime)
 			_d := util.JysqlDB.FindOne("dataexport_order", map[string]interface{}{"order_code": code}, "id", "")
 			if _d != nil && len(*_d) > 0 {
 				orderId := qutil.IntAll((*_d)["id"])
@@ -4086,6 +4086,7 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
 	return nil
 }
 
+// subject 0 超级订阅 1大会员
 func EntServiceOpen(entId int, subject string, st int64) (bool, int) {
 	if st == 4070880000 {
 		return false, 0
@@ -4096,13 +4097,25 @@ func EntServiceOpen(entId int, subject string, st int64) (bool, int) {
 	  		    return false, 0
 	  	      }
 	          }*/
-	data, _ := util.MQFW.FindOne("entniche_rule", map[string]interface{}{
+	data, _ := util.MQFW.FindOne("ent_user", map[string]interface{}{
 		"i_userid": map[string]interface{}{
 			"$exists": false,
 		},
 		"i_entid": entId,
 	})
-	if qutil.Int64All((*data)["l_endtime"]) < time.Now().Local().Unix() {
+	var status, isTime bool
+	if subject == "1" {
+		status = qutil.Int64All((*data)["i_member_status"]) > 0
+		if endtime, ok := (*data)["l_member_endtime"]; ok && qutil.Int64All(endtime) >= time.Now().Local().Unix() {
+			isTime = true
+		}
+	} else {
+		status = qutil.Int64All((*data)["i_vip_status"]) > 0
+		if endtime, ok := (*data)["l_vip_endtime"]; ok && qutil.Int64All(endtime) >= time.Now().Local().Unix() {
+			isTime = true
+		}
+	}
+	if status && isTime {
 		return false, 0
 	}
 	return true, 1
@@ -4243,7 +4256,7 @@ func UpdateNewBigOrder(subStatus, dateType int, now, startdate, enddate time.Tim
 		)
 		//主体为企业
 		if param.BuySubject == "2" {
-			entService, userCount = EntServiceOpen(qutil.IntAll(paramOrder["entId"]), param.BuySubject, param.StartTime)
+			entService, userCount = EntServiceOpen(qutil.IntAll(paramOrder["entId"]), "1", param.StartTime)
 			_d := util.JysqlDB.FindOne("dataexport_order", map[string]interface{}{"order_code": param.OrderCode}, "id", "")
 			if _d != nil && len(*_d) > 0 {
 				orderId := qutil.IntAll((*_d)["id"])

+ 3 - 3
src/order/otherOrderService.go

@@ -902,7 +902,7 @@ func createVipOrder(param *CreateOtherOrderParams, code string) (bool, string) {
 			}
 			_d := util.JysqlDB.FindOne("dataexport_order", map[string]interface{}{"order_code": code}, "id,ent_id", "")
 			if _d != nil && len(*_d) > 0 {
-				entService, userCount = EntServiceOpen(qutil.IntAll((*_d)["ent_id"]), param.BuySubject, ss)
+				entService, userCount = EntServiceOpen(qutil.IntAll((*_d)["ent_id"]), "0", ss)
 				orderId := qutil.IntAll((*_d)["id"])
 				if qutil.IntAll((*_d)["ent_id"]) != 0 && param.Open && param.VipStartTime != "2099-01-01" && param.BuyCount > 0 {
 					regRuler := "^1[3456789]{1}\\d{9}$"
@@ -1246,7 +1246,7 @@ func updateVipOrder(param *CreateOtherOrderParams, code string, returnStatus int
 			}
 			_d := util.JysqlDB.FindOne("dataexport_order", map[string]interface{}{"order_code": code}, "id,ent_id", "")
 			if _d != nil && len(*_d) > 0 {
-				entService, userCount = EntServiceOpen(qutil.IntAll((*_d)["ent_id"]), param.BuySubject, ss)
+				entService, userCount = EntServiceOpen(qutil.IntAll((*_d)["ent_id"]), "0", ss)
 				orderId := qutil.IntAll((*_d)["id"])
 				if qutil.IntAll((*_d)["ent_id"]) != 0 && param.VipStartTime != "2099-01-01" && param.BuyCount > 0 {
 					regRuler := "^1[3456789]{1}\\d{9}$"
@@ -1825,7 +1825,7 @@ func GetNameList(name string) (rs *[]map[string]interface{}) {
 
 }
 
-//企业订阅时间修改
+// 企业订阅时间修改
 func UpdateRule(entId int, startTime, endTime time.Time, status interface{}, types int) bool {
 	ok := false
 	if entId > 0 {