Commit f1678c23 authored by honghuiliu's avatar honghuiliu 💬

修改redis 前缀 以及bug修复

parent 39150375
......@@ -29,7 +29,8 @@ func Login(c *gin.Context) {
u := &system.SysUser{Username: l.Username, Password: l.Password}
key := ghelp.Md5(ghelp.CreateUnique())
prefixKey := "qsh_wc:" + key
prefix := global.GVA_VP.GetString("redis.prefix")
prefixKey := prefix + key
if user, err := userService.Login(u); err != nil {
global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Error(err))
response.FailWithMessage("用户名不存在或者密码错误", c)
......
......@@ -118,6 +118,7 @@ qiniu:
secret-key: ""
use-cdn-domains: false
redis:
prefix: "qsh_wc_prod:"
db: 0
addr: "r-bp1cm5ncyvq2hnul81.redis.rds.aliyuncs.com:6379"
password: "rRk2k3nf9JJi283lk119Jvwz"
......
......@@ -118,6 +118,7 @@ qiniu:
secret-key: ""
use-cdn-domains: false
redis:
prefix: "qsh_wc:"
db: 0
addr: "r-bp1cm5ncyvq2hnul81.redis.rds.aliyuncs.com:6379"
password: "rRk2k3nf9JJi283lk119Jvwz"
......
......@@ -118,6 +118,7 @@ qiniu:
secret-key: ""
use-cdn-domains: false
redis:
prefix: "qsh_wc:"
db: 0
addr: "r-bp1cm5ncyvq2hnul81pd.redis.rds.aliyuncs.com:16379"
password: "rRk2k3nf9JJi283lk119Jvwz"
......
......@@ -23,7 +23,8 @@ func Token() gin.HandlerFunc {
c.Abort()
return
}
res := global.GVA_REDIS.Get(c, "qsh_wc:"+token)
prefix := global.GVA_VP.GetString("redis.prefix")
res := global.GVA_REDIS.Get(c, prefix+token)
if res.Err() != nil {
response.Result(1000, "", "token不存在", c)
......
......@@ -7,6 +7,7 @@ type PatrolList struct {
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Type int `json:"type"`
ToiletId int `json:"toilet_id"`
}
type GetPatrolId struct {
......
......@@ -60,6 +60,9 @@ func (qshPartolService *QshPartolService) GetQshPartolInfoList(info adminReq.Qsh
if info.Type != 0 {
db = db.Where("type = ?", info.Type)
}
if info.ToiletId != 0 {
db = db.Where("toilet_id = ?", info.Toilet)
}
err = db.Count(&total).Error
if err != nil {
return
......
......@@ -28,11 +28,14 @@ func (l *PatrolService) GetPatrolList(arg request.PatrolList) ([]admin.QshPatrol
if arg.Type != 0 {
db.Where("type = ?", arg.Type)
}
if arg.ToiletId != 0 {
db.Where("toilet_id = ?", arg.ToiletId)
}
err := db.Count(&total).Error
if err != nil {
return patrolList, total, err
}
err = db.Limit(limit).Offset(offset).Preload("Toilet").Find(&patrolList).Error
err = db.Debug().Limit(limit).Offset(offset).Preload("Toilet").Find(&patrolList).Error
if err != nil {
return patrolList, total, err
}
......
......@@ -26,7 +26,8 @@ func (l *ToiletService) GetToiletList(toilet request.Toilet) ([]admin.QshToilet,
func (l *ToiletService) GetToiletDetail(toilet request.GetId) (admin.QshToilet, error) {
var toiletInfo admin.QshToilet
err := global.GVA_DB.Model(toiletInfo).First(&toiletInfo).Error
err := global.GVA_DB.Model(toiletInfo).Where("id = ?", toilet.ID).First(&toiletInfo).Error
if err != nil {
return toiletInfo, err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment