MCPcopy Index your code
hub / github.com/TruthHun/DocHub / Coin

Method Coin

controllers/HomeControllers/UserController.go:157–199  ·  view source on GitHub ↗

金币记录

()

Source from the content-addressed store, hash-verified

155
156//金币记录
157func (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// 收藏夹
202func (this *UserController) Collect() {

Callers

nothing calls this directly

Calls 4

UserListMethod · 0.80
GetByPageMethod · 0.80
ResponseJsonMethod · 0.45
GetByIdMethod · 0.45

Tested by

no test coverage detected