WH01243 2 年 前
コミット
76a6dba199
2 ファイル変更19 行追加20 行削除
  1. 13 18
      src/order/orderManageService.go
  2. 6 2
      src/order/otherOrderService.go

+ 13 - 18
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"]), param.Phone, fmt.Sprintf("%s%s", "大会员", sName), 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"])
@@ -3804,7 +3804,6 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
 				}
 			}
 			if !entService {
-				//ClearBigVipUserPower(userId)
 				return nil
 			}
 		}
@@ -4085,26 +4084,22 @@ func NewBigOrder(subStatus, dateType int, startdate, enddate time.Time, userId,
 	return nil
 }
 
-func EntServiceOpen(entId int, subject string, st int64) (bool, int) {
+func EntServiceOpen(entId int, phone, productType string, st int64) (bool, int) {
 	if st == 4070880000 {
 		return false, 0
 	}
-	/*data, _ := util.MQFW.FindById("user", userid, "")
-	          if data != nil && len(*data) > 0 {
-	  	      if qutil.IntAll((*data)["i_vip_status"]) > 0 || qutil.IntAll((*data)["i_member_status"]) > 0 {
-	  		    return false, 0
-	  	      }
-	          }*/
-	data, _ := util.MQFW.FindOne("entniche_rule", map[string]interface{}{
-		"i_userid": map[string]interface{}{
-			"$exists": false,
-		},
-		"i_entid": entId,
-	})
-	if qutil.IntAll((*data)["i_vip_status"]) > 0 || qutil.IntAll((*data)["i_member_status"]) > 0 {
+	user := util.JysqlDB.FindOne("entniche_user", map[string]interface{}{"phone": phone, "ent_id": entId}, "id", "")
+	if user == nil {
 		return false, 0
 	}
-	return true, 1
+	sql := "SELECT  COUNT(1)  FROM  entniche_power a  INNER JOIN entniche_wait_empower b ON a.wait_empower_id = b.id  where  a.ent_id=" + qutil.InterfaceToStr(entId) + " and a.ent_user_id=" + qutil.InterfaceToStr((*user)["id"]) + " and  a.`status`=1 and  b.product_type='" + productType + "'"
+	number := util.JysqlDB.CountBySql(sql)
+	if number == 0 {
+		return true, 1
+	} else {
+		return false, 0
+	}
+
 }
 func UpdateNewBigOrder(subStatus, dateType int, now, startdate, enddate time.Time, userId, code, sName string, param *Params, return_status int) error {
 	log.Println("大会员创建订单user表大会员状态更新", subStatus, dateType, now, startdate, enddate, userId, code)
@@ -4241,7 +4236,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"]), param.Phone, fmt.Sprintf("%s%s", "大会员", sName), 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"])

+ 6 - 2
src/order/otherOrderService.go

@@ -29,6 +29,7 @@ const (
 	RedisMenuKeyWX            = "jy_workdesktopmenu_10000_WX_%s"  //剑鱼appid:10000
 	RedisMenuKeyAPP           = "jy_workdesktopmenu_10000_APP_%s" //剑鱼appid:10000
 	UserPowerRedisKey         = "jy_userpowerredis_10000_%d_%s"   //工作桌面 用户功能缓存(类似bigmember_power_3_%s)
+
 )
 
 // 插入合同表信息和订单表信息
@@ -902,7 +903,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"]), "0", ss)
+				entService, userCount = EntServiceOpen(qutil.IntAll((*_d)["ent_id"]), param.Phone, param.ProductType, 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}$"
@@ -1260,7 +1261,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"]), "0", ss)
+				entService, userCount = EntServiceOpen(qutil.IntAll((*_d)["ent_id"]), param.Phone, param.ProductType, 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}$"
@@ -1394,6 +1395,9 @@ func ClearBigVipUserPower(userId string) {
 	userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, time.Now().Day(), userId)
 	redis.Del(NewOther, cacheKey)
 	redis.Del("newother", config.SysConfigs.BigmemberKey+userId)
+	redis.Del(NewOther, fmt.Sprintf("jy_workdesktopmenu_10000_menu1_%s", userId))
+	redis.Del(NewOther, fmt.Sprintf("jy_userpowerredis_10000_17_%s", userId))
+	redis.Del(NewOther, fmt.Sprintf("jy_workdesktopmenu_10000_menu2_%s", userId))
 	redis.Del(NewOther, fmt.Sprintf("user_power_info_%s", userId))
 	redis.Del(NewOther, baseInfoCacheKey)
 	redis.Del(NewOther, redisMenuKeyPC)