🐛 bad word
This commit is contained in:
parent
7ae67826e4
commit
7b8a545f59
@ -17,13 +17,13 @@ func (a *Animals) List(context *gin.Context) {
|
|||||||
attrs := context.GetString(consts.ValidatorPrefix + "attrs")
|
attrs := context.GetString(consts.ValidatorPrefix + "attrs")
|
||||||
gender := context.GetString(consts.ValidatorPrefix + "gender")
|
gender := context.GetString(consts.ValidatorPrefix + "gender")
|
||||||
breed := context.GetString(consts.ValidatorPrefix + "breed")
|
breed := context.GetString(consts.ValidatorPrefix + "breed")
|
||||||
sterilzation := context.GetString(consts.ValidatorPrefix + "sterilzation")
|
sterilization := context.GetString(consts.ValidatorPrefix + "sterilization")
|
||||||
status := context.GetString(consts.ValidatorPrefix + "status")
|
status := context.GetString(consts.ValidatorPrefix + "status")
|
||||||
num := context.GetFloat64(consts.ValidatorPrefix + "num")
|
num := context.GetFloat64(consts.ValidatorPrefix + "num")
|
||||||
skip := context.GetFloat64(consts.ValidatorPrefix + "skip")
|
skip := context.GetFloat64(consts.ValidatorPrefix + "skip")
|
||||||
userId := context.GetFloat64(consts.ValidatorPrefix + "user_id")
|
userId := context.GetFloat64(consts.ValidatorPrefix + "user_id")
|
||||||
|
|
||||||
animals := curd.CreateAnimalsCurdFactory().List(attrs, gender, breed, sterilzation, status, int(num), int(skip), int(userId))
|
animals := curd.CreateAnimalsCurdFactory().List(attrs, gender, breed, sterilization, status, int(num), int(skip), int(userId))
|
||||||
if animals != nil {
|
if animals != nil {
|
||||||
response.Success(context, consts.CurdStatusOkMsg, animals)
|
response.Success(context, consts.CurdStatusOkMsg, animals)
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,14 +10,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type List struct {
|
type List struct {
|
||||||
Attrs string `form:"attrs" json:"attrs"`
|
Attrs string `form:"attrs" json:"attrs"`
|
||||||
Gender string `form:"gender" json:"gender"`
|
Gender string `form:"gender" json:"gender"`
|
||||||
Breed string `form:"breed" json:"breed"`
|
Breed string `form:"breed" json:"breed"`
|
||||||
Sterilzation string `form:"sterilzation" json:"sterilzation"`
|
Sterilization string `form:"sterilization" json:"sterilization"`
|
||||||
Status string `form:"status" json:"status"`
|
Status string `form:"status" json:"status"`
|
||||||
Num int `form:"num" json:"num"`
|
Num int `form:"num" json:"num"`
|
||||||
Skip int `form:"skip" json:"skip"`
|
Skip int `form:"skip" json:"skip"`
|
||||||
UserId int `form:"user_id" json:"user_id"`
|
UserId int `form:"user_id" json:"user_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l List) CheckParams(context *gin.Context) {
|
func (l List) CheckParams(context *gin.Context) {
|
||||||
|
@ -47,14 +47,14 @@ func (a *Animal) TableName() string {
|
|||||||
return "animals"
|
return "animals"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Animal) Show(attrs []string, gender []uint8, breed []uint8, sterilzation []uint8, status []uint8, num int, skip int) (temp []Animal) {
|
func (a *Animal) Show(attrs []string, gender []uint8, breed []uint8, sterilization []uint8, status []uint8, num int, skip int) (temp []Animal) {
|
||||||
db := a.DB.Table(a.TableName()).Limit(int(num)).Offset(int(skip)).Select(attrs)
|
db := a.DB.Table(a.TableName()).Limit(int(num)).Offset(int(skip)).Select(attrs)
|
||||||
|
|
||||||
// 创建条件映射
|
// 创建条件映射
|
||||||
conditions := map[string][]uint8{
|
conditions := map[string][]uint8{
|
||||||
"gender": gender,
|
"gender": gender,
|
||||||
"breed": breed,
|
"breed": breed,
|
||||||
"sterilization": sterilzation,
|
"sterilization": sterilization,
|
||||||
"status": status,
|
"status": status,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,18 +48,18 @@ func getSelectAttrs(attrs string) (validSelectedFields []string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AnimalsCurd) List(attrs string, gender string, breed string, sterilzation string, status string, num int, skip int, userId int) (temp []model.AnimalWithLikeList) {
|
func (a *AnimalsCurd) List(attrs string, gender string, breed string, sterilization string, status string, num int, skip int, userId int) (temp []model.AnimalWithLikeList) {
|
||||||
validSelectedFields := getSelectAttrs(attrs)
|
validSelectedFields := getSelectAttrs(attrs)
|
||||||
genderArray := query_handler.StringToUint8Array(gender)
|
genderArray := query_handler.StringToUint8Array(gender)
|
||||||
breedArray := query_handler.StringToUint8Array(breed)
|
breedArray := query_handler.StringToUint8Array(breed)
|
||||||
sterilzationArray := query_handler.StringToUint8Array(sterilzation)
|
sterilizationArray := query_handler.StringToUint8Array(sterilization)
|
||||||
statusArray := query_handler.StringToUint8Array(status)
|
statusArray := query_handler.StringToUint8Array(status)
|
||||||
|
|
||||||
if num == 0 {
|
if num == 0 {
|
||||||
num = 10
|
num = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
animals := model.CreateAnimalFactory("").Show(validSelectedFields, genderArray, breedArray, sterilzationArray, statusArray, num, skip)
|
animals := model.CreateAnimalFactory("").Show(validSelectedFields, genderArray, breedArray, sterilizationArray, statusArray, num, skip)
|
||||||
|
|
||||||
if userId > 0 {
|
if userId > 0 {
|
||||||
for i := range animals {
|
for i := range animals {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user