Pārlūkot izejas kodu

群主升级成功清除缓存

abiao 5 gadi atpakaļ
vecāks
revīzija
e6058aa1ea

+ 6 - 0
go/gopath/src/fohow.com/apps/controllers/pay_controller/after_pay_controller.go

@@ -16,6 +16,7 @@ import (
 	"fohow.com/apps/models/balance_model"
 	"fohow.com/apps/models/order_model"
 	"fohow.com/apps/models/pay_model"
+	"fohow.com/cache"
 	"fohow.com/libs/wx_mp"
 	"github.com/astaxie/beego"
 	"strconv"
@@ -150,6 +151,11 @@ func UpdateIntroUser(wxUser *user_model.WxUser) {
 	//更改下级群主关系
 	inviteList := user_model.GetWxUsersByInviteIdAll(wxUser.Id, false)
 	go user_model.UpdateClass(inviteList, wxUser.Id, wxUser.IntroUserId)
+	//消除user,wxuser缓存
+	userKey := fmt.Sprintf("user.GetByUid[%d]", wxUser.UserId)
+	wxUserKey := cache.GetKey(cache.GetWxUserById, wxUser.Id)
+	cache.Cache.Delete(userKey)
+	cache.Cache.Delete(wxUserKey)
 }
 
 func FindInviter(wxUser *user_model.WxUser) *user_model.WxUser {

+ 7 - 0
go/gopath/src/fohow.com/apps/controllers/railsadmin_controller/intro_user_controller.go

@@ -1,8 +1,10 @@
 package railsadmin_controller
 
 import (
+	"fmt"
 	"fohow.com/apps"
 	"fohow.com/apps/models/user_model"
+	"fohow.com/cache"
 	"github.com/astaxie/beego"
 	"strconv"
 	"time"
@@ -30,5 +32,10 @@ func (self *RailsadminController) UpdateIntroUser() {
 	//更改下级会员群主ID
 	inviteList := user_model.GetWxUsersByInviteIdAll(wxUser.Id, false)
 	go user_model.UpdateClass(inviteList, wxUser.Id, wxUser.IntroUserId)
+	//消除user,wxuser缓存
+	userKey := fmt.Sprintf("user.GetByUid[%d]", wxUser.UserId)
+	wxUserKey := cache.GetKey(cache.GetWxUserById, wxUser.Id)
+	cache.Cache.Delete(userKey)
+	cache.Cache.Delete(wxUserKey)
 	self.ServeJSON()
 }