feat: change order by for login log and reward records

This commit is contained in:
RockYang 2023-08-22 22:04:46 +08:00
parent 0f8a0f89e3
commit aa376f1737
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ func NewRewardHandler(app *core.AppServer, db *gorm.DB) *RewardHandler {
func (h *RewardHandler) List(c *gin.Context) {
var items []model.Reward
res := h.db.Find(&items)
res := h.db.Order("id DESC").Find(&items)
var rewards = make([]vo.Reward, 0)
if res.Error == nil {
userIds := make([]uint, 0)

View File

@ -204,7 +204,7 @@ func (h *UserHandler) LoginLog(c *gin.Context) {
h.db.Model(&model.UserLoginLog{}).Count(&total)
offset := (page - 1) * pageSize
var items []model.UserLoginLog
res := h.db.Offset(offset).Limit(pageSize).Find(&items)
res := h.db.Offset(offset).Limit(pageSize).Order("id DESC").Find(&items)
if res.Error != nil {
resp.ERROR(c, "获取数据失败")
return