update encounter List
This commit is contained in:
parent
e1f169f793
commit
127ef0722b
@ -53,7 +53,7 @@ func (e *Encounter) InsertDate(c *gin.Context) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *Encounter) Show(num, skip int) (temp []EncounterList) {
|
func (e *Encounter) Show(num, skip int) (temp []EncounterList) {
|
||||||
sql := `SELECT user_id, title, avatar, avatar_height, avatar_width, e.updated_at,
|
sql := `SELECT e.id, user_id, title, avatar, avatar_height, avatar_width, e.updated_at,
|
||||||
user_name, user_avatar FROM encounters e JOIN tb_users u ON e.user_id = u.id
|
user_name, user_avatar FROM encounters e JOIN tb_users u ON e.user_id = u.id
|
||||||
LIMIT ? OFFSET ?
|
LIMIT ? OFFSET ?
|
||||||
`
|
`
|
||||||
|
@ -4,12 +4,14 @@ import "time"
|
|||||||
|
|
||||||
// TIP 用这种方式绑定 GORM 的 Raw 就会比较有效了。
|
// TIP 用这种方式绑定 GORM 的 Raw 就会比较有效了。
|
||||||
type EncounterList struct {
|
type EncounterList struct {
|
||||||
UserId int `form:"user_id" json:"user_id"`
|
Id int `form:"id" json:"id"`
|
||||||
Title string
|
UserId int `form:"user_id" json:"user_id"`
|
||||||
Avatar string
|
Title string `form:"title" json:"title"`
|
||||||
AvatarHeight int `form:"avatar_height" json:"avatar_height"`
|
Avatar string `form:"avatar" json:"url"`
|
||||||
AvatarWidth int `form:"avatar_width" json:"avatar_width"`
|
AvatarHeight int `form:"avatar_height" json:"height"`
|
||||||
UpdatedAt *time.Time `json:"updated_at,omitempty"` // TIP 设为 *time.Time,omitempty 和 autoUpdated 就都可以生效
|
AvatarWidth int `form:"avatar_width" json:"width"`
|
||||||
|
UpdatedAt *time.Time `form:"updated_at" json:"time"` // TIP 设为 *time.Time,omitempty 和 autoUpdated 就都可以生效
|
||||||
|
|
||||||
UserName string `form:"user_name" json:"user_name"`
|
UserName string `form:"user_name" json:"userName"`
|
||||||
|
UserAvatar string `form:"user_avatar" json:"userAvatar"`
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user