|
@@ -2,10 +2,9 @@ package test_controller
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"fmt"
|
|
"fmt"
|
|
|
- "fohow.com/apps/models/dollar_win_model"
|
|
|
|
|
|
|
+ "fohow.com/apps/helpers"
|
|
|
"fohow.com/apps/models/order_model"
|
|
"fohow.com/apps/models/order_model"
|
|
|
- "github.com/astaxie/beego"
|
|
|
|
|
- "strconv"
|
|
|
|
|
|
|
+ "fohow.com/apps/models/user_model"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
type LabiReturn struct {
|
|
type LabiReturn struct {
|
|
@@ -14,24 +13,6 @@ type LabiReturn struct {
|
|
|
TradeNo string `json:"trade_no"`
|
|
TradeNo string `json:"trade_no"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (self *TestController) UpdateInviteCount() {
|
|
|
|
|
- _zt_id := self.Ctx.Input.Param(":zt_id")
|
|
|
|
|
- zt_id, _ := strconv.ParseInt(_zt_id, 10, 64)
|
|
|
|
|
- _temp_user_id := self.Ctx.Input.Param(":temp_user_id")
|
|
|
|
|
- temp_user_id, _ := strconv.ParseInt(_temp_user_id, 10, 64)
|
|
|
|
|
- //获取所有我推荐参与的会员
|
|
|
|
|
- frendJoinList := dollar_win_model.GetJoinFrendPaiedWinListByZtConfigId(zt_id, temp_user_id, false)
|
|
|
|
|
- frendCount := len(frendJoinList)
|
|
|
|
|
- self.SetSession("dollar_count", frendCount)
|
|
|
|
|
- self.UpdateCount(frendJoinList, zt_id)
|
|
|
|
|
- count := self.GetSession("dollar_count").(int)
|
|
|
|
|
- type Ret struct {
|
|
|
|
|
- Count int64 `json:"Count"`
|
|
|
|
|
- }
|
|
|
|
|
- self.Data["json"] = &Ret{Count: int64(count)}
|
|
|
|
|
- self.ServeJSON()
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
//测试订单
|
|
//测试订单
|
|
|
func (self *TestController) TestOrderListen() {
|
|
func (self *TestController) TestOrderListen() {
|
|
|
orderId := self.GetString("order_id")
|
|
orderId := self.GetString("order_id")
|
|
@@ -62,21 +43,23 @@ func (self *TestController) TestOrderListen() {
|
|
|
self.ServeJSON()
|
|
self.ServeJSON()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (self *TestController) UpdateCount(list []*dollar_win_model.DollarWinZtJoin, ztConfigId int64) {
|
|
|
|
|
|
|
+//测试redis 存储userInfo
|
|
|
|
|
+func (self *TestController) GetUserInfoFromRedis() {
|
|
|
|
|
+ userId := int64(1388)
|
|
|
|
|
+ key := fmt.Sprintf("userinfo_%d", userId)
|
|
|
|
|
+ var user user_model.User
|
|
|
|
|
+ ok, resp := helpers.GetRedisValue(key, user)
|
|
|
|
|
+ if !ok {
|
|
|
|
|
+ //发送请求
|
|
|
|
|
+ resp = user_model.GetUserById(userId, false)
|
|
|
|
|
+ helpers.SetJsonEx(key, resp, 90*60)
|
|
|
|
|
|
|
|
- for _, item := range list {
|
|
|
|
|
- if item.UserId == 600110 || item.UserId == 600113 || item.UserId == 602368 || item.UserId == 600106 {
|
|
|
|
|
- continue
|
|
|
|
|
- }
|
|
|
|
|
- //更新直接下级推荐数量
|
|
|
|
|
- beego.BeeLogger.Warn("dollar_win_model.UpdateCount().CinviteId(%d)", item.UserId)
|
|
|
|
|
- inviteJoinList := dollar_win_model.GetJoinFrendPaiedWinListByZtConfigId(ztConfigId, item.UserId, false)
|
|
|
|
|
- count := int(len(inviteJoinList))
|
|
|
|
|
- oldCount := self.GetSession("dollar_count").(int)
|
|
|
|
|
- count += oldCount
|
|
|
|
|
- //更新参与数量
|
|
|
|
|
- self.SetSession("dollar_count", count)
|
|
|
|
|
- //递归调用
|
|
|
|
|
- self.UpdateCount(inviteJoinList, ztConfigId)
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ type Ret struct {
|
|
|
|
|
+ Resp interface{} `json:"resp"`
|
|
|
|
|
+ }
|
|
|
|
|
+ ret := &Ret{}
|
|
|
|
|
+ ret.Resp = resp
|
|
|
|
|
+ self.Data["json"] = ret
|
|
|
|
|
+ self.ServeJSON()
|
|
|
}
|
|
}
|