Procházet zdrojové kódy

add cash to balance function

abiao před 5 roky
rodič
revize
6167f7f720

+ 6 - 2
go/gopath/src/fohow.com/apps/controllers/user_controller/user_controller.go

@@ -67,7 +67,7 @@ func (self *UserController) CheckLogin() {
 		Rank     int64 `json:"rank"` //级别
 	}
 	userInfo := new(UserInfo)
-	useCache, err := self.GetBool("cache", false)
+	useCache, err := self.GetBool("cache", true)
 	if err != nil {
 		useCache = false
 	}
@@ -526,7 +526,11 @@ func (self *UserController) SysUserBind() {
 		s := "sys_init"
 		new(balance_model.Balance).Create(sysWxUser.Id, sysWxUser.UserId, c.Cash*int64(100), s, relateId, remark)
 	}
-
+	//清掉wxuser缓存
+	userKey := fmt.Sprintf("user.GetByUid[%d]", wxUser.UserId)
+	wxUserKey := cache.GetKey(cache.GetWxUserById, wxUser.Id)
+	cache.Cache.Delete(userKey)
+	cache.Cache.Delete(wxUserKey)
 	type Ret struct {
 		Result bool `json:"result"`
 	}