金币记录
()
| 155 | |
| 156 | //金币记录 |
| 157 | func (this *UserController) Coin() { |
| 158 | uid, _ := this.GetInt(":uid") |
| 159 | p, _ := this.GetInt("p", 1) |
| 160 | if p < 1 { |
| 161 | p = 1 |
| 162 | } |
| 163 | if uid < 1 { |
| 164 | uid = this.IsLogin |
| 165 | } |
| 166 | |
| 167 | if uid <= 0 { |
| 168 | this.Redirect("/user/login", 302) |
| 169 | return |
| 170 | } |
| 171 | |
| 172 | listRows := 16 |
| 173 | lists, _, _ := models.GetList(models.GetTableCoinLog(), p, listRows, orm.NewCondition().And("Uid", uid), "-Id") |
| 174 | if p > 1 { // 当页码大于0,则以 JSON 返回数据 |
| 175 | this.ResponseJson(true, "数据获取成功", lists) |
| 176 | } |
| 177 | |
| 178 | user, rows, err := models.NewUser().GetById(uid) |
| 179 | if err != nil { |
| 180 | helper.Logger.Error(err.Error()) |
| 181 | } |
| 182 | if rows == 0 { |
| 183 | this.Redirect("/", 302) |
| 184 | return |
| 185 | } |
| 186 | |
| 187 | this.Data["Lists"] = lists |
| 188 | this.Data["User"] = user |
| 189 | this.Data["PageId"] = "wenku-user" |
| 190 | this.Data["Tab"] = "coin" |
| 191 | this.Data["IsUser"] = true |
| 192 | this.Data["Ranks"], _, err = models.NewUser().UserList(1, 8, "i.Document desc", "u.Id,u.Username,u.Avatar,u.Intro,i.Document", "i.Status=1") |
| 193 | if err != nil { |
| 194 | helper.Logger.Error(err.Error()) |
| 195 | } |
| 196 | this.Data["Seo"] = models.NewSeo().GetByPage("PC-Ucenter-Coin", "财富记录—会员中心-"+user["Username"].(string), "会员中心,财富记录,"+user["Username"].(string), "财富记录—会员中心-"+user["Username"].(string), this.Sys.Site) |
| 197 | this.TplName = "coin.html" |
| 198 | |
| 199 | } |
| 200 | |
| 201 | // 收藏夹 |
| 202 | func (this *UserController) Collect() { |
nothing calls this directly
no test coverage detected