refactor(app): 重构动物相关功能

- 移除了未使用的 AnimalPreferMode 常量
- 修正了 AnimalModePrefer 的使用
- 在 Chat 结构中添加了 Mode 和 CatsId 字段
This commit is contained in:
Havoc412 2024-11-20 12:24:19 +08:00
parent 05383358ff
commit 1c696523a3
4 changed files with 10 additions and 4 deletions

View File

@ -0,0 +1,6 @@
package consts
const (
// TAG animal/ 接口模式
AnimalModePrefer string = "prefer"
)

View File

@ -72,7 +72,4 @@ const (
CaptchaCheckOkMsg string = "验证码校验通过"
CaptchaCheckFailCode int = -400355
CaptchaCheckFailMsg string = "验证码校验失败"
// TAG animal/ 接口模式
AnimalPreferMode string = "prefer"
)

View File

@ -39,7 +39,7 @@ func (a *Animals) List(context *gin.Context) {
// TAG prefer MODE 查询模式。
redis_selctedCatsId := model_redis.CreateSelectedAnimal4Prefer()
var animalsWithLike []model.AnimalWithLikeList
if mode == consts.AnimalPreferMode {
if mode == consts.AnimalModePrefer {
key := int64(context.GetFloat64(consts.ValidatorPrefix + "key"))
if key != 0 {

View File

@ -13,6 +13,9 @@ import (
type Chat struct {
Query string `form:"query" json:"query" binding:"required"`
Token string `form:"token" json:"token"` // UPDATE 暂时不想启用 user 的 token就先单独处理。
Mode string `form:"mode" json:"mode"`
CatsId string `form:"cats_id" json:"cats_id"` //
}
func (c Chat) CheckParams(context *gin.Context) {