xuzhiheng před 2 roky
rodič
revize
3484dac168
3 změnil soubory, kde provedl 8 přidání a 25 odebrání
  1. 0 1
      entity/entity.go
  2. 1 1
      rpc/etc/entmanageapplication.yaml
  3. 7 23
      service/service.go

+ 0 - 1
entity/entity.go

@@ -8,7 +8,6 @@ import (
 )
 
 const (
-	BigKey                    = "bigmember_power_3_userid"
 	NewOther                  = "newother"
 	PowerCacheDb              = "other"
 	PowerCacheKey             = "bigmember_power_3_%s"

+ 1 - 1
rpc/etc/entmanageapplication.yaml

@@ -1,5 +1,5 @@
 Name: entmanageapplication.rpc
-ListenOn: 192.168.3.240:9998
+ListenOn: 0.0.0.0:9998
 Etcd:
   Hosts:
   - 192.168.3.240:2379

+ 7 - 23
service/service.go

@@ -159,8 +159,10 @@ func addPower(waitEmpowerId int64, entUserId int) {
 			productType := common.ObjToString((*orderData)["product_type"])
 			userId := getUserId(entUserId)
 			if productType == "VIP订阅" {
+				log.Println("开通超级订阅", userId)
 				openPowerVip(*orderData, userId)
 			} else if productType == "大会员" {
+				log.Println("开通大会员", userId)
 				openPowerBig(*orderData, userId)
 			}
 		}
@@ -337,7 +339,7 @@ func GetServerPid() map[int]int {
 }
 
 func RedisDel(userId string) {
-	redis.Del(NewOther, BigKey+userId)
+	redis.Del(NewOther, "pl_indexMessage_"+userId)
 	cacheKey := fmt.Sprintf(PowerCacheKey, userId)
 	baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
 	redisMenuKeyPC := fmt.Sprintf(RedisMenuKeyPC, userId)
@@ -394,8 +396,7 @@ func StartSubVip(phone string, area map[string]interface{}, newBuyset SubvipBuyS
 
 	go func() {
 		MergeKws(userId)
-		redis.Del(NewOther, "pl_indexMessage_"+userId)
-		ClearBigVipUserPower(userId)
+		RedisDel(userId)
 	}()
 	if isOk {
 		return true
@@ -421,21 +422,6 @@ func MergeKws(userId string) {
 	}
 }
 
-func ClearBigVipUserPower(userId string) {
-	cacheKey := fmt.Sprintf(PowerCacheKey, userId)
-	baseInfoCacheKey := fmt.Sprintf(IsGetUserBaseInfoRedisKey, userId)
-	redisMenuKeyPC := fmt.Sprintf(RedisMenuKeyPC, userId)
-	redisMenuKeyWX := fmt.Sprintf(RedisMenuKeyWX, userId)
-	redisMenuKeyAPP := fmt.Sprintf(RedisMenuKeyAPP, userId)
-	userPowerRedisKey := fmt.Sprintf(UserPowerRedisKey, time.Now().Day(), userId)
-	redis.Del(NewOther, cacheKey)
-	redis.Del(NewOther, baseInfoCacheKey)
-	redis.Del(NewOther, redisMenuKeyPC)
-	redis.Del(NewOther, redisMenuKeyWX)
-	redis.Del(NewOther, redisMenuKeyAPP)
-	redis.Del(NewOther, userPowerRedisKey)
-}
-
 func delPower(id int64) {
 	data := JyMysql.FindOne(EntnichePower, map[string]interface{}{"id": id}, "", "")
 	if data != nil && len(*data) > 0 {
@@ -450,14 +436,12 @@ func delPower(id int64) {
 				productType := common.ObjToString((*orderData)["product_type"])
 				userId := getUserId(entUserId)
 				if productType == "VIP订阅" {
-					Mgo.UpdateById("user", userId, map[string]interface{}{"$set": map[string]interface{}{"i_vip_status": -2}})
-					ClearBigVipUserPower(userId)
+					Mgo.UpdateById("user", userId, map[string]interface{}{"$unset": map[string]interface{}{"i_vip_status": 1, "l_vip_starttime": 1, "l_vip_endtime": 1}})
 				} else if productType == "大会员" {
-					Mgo.UpdateById("user", userId, map[string]interface{}{"$set": map[string]interface{}{"i_member_status": -2}})
-					RedisDel(userId)
-					ClearBigVipUserPower(userId)
+					Mgo.UpdateById("user", userId, map[string]interface{}{"$unset": map[string]interface{}{"i_member_status": 1, "i_member_starttime": 1, "i_member_endtime": 1}})
 					JyMysql.Update(BigServiceUser, map[string]interface{}{"s_userid": userId}, map[string]interface{}{"i_status": -1})
 				}
+				RedisDel(userId)
 			}
 		}
 	}