refactor(app): 重构动物相关功能
- 移除了未使用的 AnimalPreferMode 常量 - 修正了 AnimalModePrefer 的使用 - 在 Chat 结构中添加了 Mode 和 CatsId 字段
This commit is contained in:
		
							parent
							
								
									05383358ff
								
							
						
					
					
						commit
						1c696523a3
					
				
							
								
								
									
										6
									
								
								app/global/consts/api_mode.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								app/global/consts/api_mode.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
package consts
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// TAG animal/ 接口模式
 | 
			
		||||
	AnimalModePrefer string = "prefer"
 | 
			
		||||
)
 | 
			
		||||
@ -72,7 +72,4 @@ const (
 | 
			
		||||
	CaptchaCheckOkMsg             string = "验证码校验通过"
 | 
			
		||||
	CaptchaCheckFailCode          int    = -400355
 | 
			
		||||
	CaptchaCheckFailMsg           string = "验证码校验失败"
 | 
			
		||||
 | 
			
		||||
	// TAG animal/ 接口模式
 | 
			
		||||
	AnimalPreferMode string = "prefer"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -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) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user