Cron_Admin/app/http/entities/backend/user.go

62 lines
2.0 KiB
Go

package backend
import (
"cron_admin/app/models/cronusermodel"
"time"
)
type UserListRequest struct {
Page int `json:"page" validate:"required" form:"page" example:"1"`
Limit int `json:"limit" validate:"required" form:"limit" example:"10"`
Tel string `json:"tel" form:"tel" example:"155555555"`
Status int `json:"status" form:"status" example:"1"`
Name string `json:"name" form:"name" example:"46516"`
UserIds []string `json:"user_ids"`
}
type UserInfoRequest struct {
Id int `json:"id" form:"id" validate:"required" example:"1"`
}
type UserListResponse struct {
UserId int `json:"user_id" form:"id"`
Name string `json:"name"`
Tel string `json:"tel"`
DtalkUserId string `json:"'DtalkUserId' varchar(200)"`
DtalkDepId string `json:"'DtalkDepId' varchar(200)"`
WxOpenId string `json:"'WxOpenId' varchar(200)"`
Status int `json:"'Status' TINYINT"`
CreateTime string `json:"'CreateTime' datetime"`
}
type UserAddRequest struct {
Name string `json:"name"`
Tel string `json:"tel"`
DtalkUserId string `json:"'dtalk_user_id' varchar(200)"`
DtalkDepId string `json:"'dtalk_user_id' varchar(200)"`
WxOpenId string `json:"'WxOpenId' varchar(200)"`
Status int `json:"'Status' TINYINT"`
}
type UserEditRequest struct {
UserId int `json:"user_id" validate:"required" form:"db_id" example:""`
Name string `json:"name"`
Tel string `json:"tel"`
DtalkUserId string `json:"'DtalkUserId' varchar(200)"`
DtalkDepId string `json:"'DtalkDepId' varchar(200)"`
WxOpenId string `json:"'WxOpenId' varchar(200)"`
Status int `json:"'Status' TINYINT"`
}
func (response *UserListResponse) ResponseFromDb(l cronusermodel.CronUser) {
response.UserId = l.UserId
response.Name = l.Name
response.Tel = l.Tel
response.Status = l.Status
response.DtalkUserId = l.DtalkUserId
response.DtalkDepId = l.DtalkDepId
response.WxOpenId = l.WxOpenId
response.CreateTime = l.CreateTime.Format(time.DateTime)
return
}