修复redis设置option问题
This commit is contained in:
parent
f48850bcc2
commit
05d76a08bc
|
|
@ -86,7 +86,7 @@ func SetUpVideoGroup(router *gin.Engine) {
|
|||
func GetWillDelVideoList(c *gin.Context) {
|
||||
id, _ := c.Get("id")
|
||||
videos := service.GetWillDelVideoList(int(id.(float64)))
|
||||
c.JSON(http.StatusOK, gin.H{"videos": videos, "code": 0, "message": "success"})
|
||||
c.JSON(http.StatusOK, gin.H{"videos": videos, "code": proto.SuccessCode, "message": "success"})
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ func UpdateVideo(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, gin.H{"error": "update video failed", "code": proto.OperationFailed, "message": "failed"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"code": 0, "message": "success", "data": "update success"})
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "message": "success", "data": "update success"})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "failed"})
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ func CreateVideo(c *gin.Context) {
|
|||
c.JSON(http.StatusOK, gin.H{"error": "create video failed", "code": proto.DataNotFound, "message": "failed"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"id": id, "code": 0, "message": "success"})
|
||||
c.JSON(http.StatusOK, gin.H{"id": id, "code": proto.SuccessCode, "message": "success"})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "failed"})
|
||||
}
|
||||
|
|
@ -158,7 +158,7 @@ func GetVideoList(c *gin.Context) {
|
|||
id, _ := c.Get("id")
|
||||
if err := c.ShouldBind(&gvl_req); err == nil {
|
||||
videos := service.GetVideoList(int(id.(float64)), gvl_req.StartTime, gvl_req.EndTime, gvl_req.Hour)
|
||||
c.JSON(http.StatusOK, gin.H{"data": videos, "code": 0, "message": "success"})
|
||||
c.JSON(http.StatusOK, gin.H{"data": videos, "code": proto.SuccessCode, "message": "success"})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "failed"})
|
||||
}
|
||||
|
|
@ -181,12 +181,12 @@ func DelayVideo(c *gin.Context) {
|
|||
cnt = service.DelayVideo(delay_req.ID, int(id.(float64)), delay_req.Day)
|
||||
}
|
||||
if cnt == 0 {
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.OperationFailed, "data": "延迟失败影响数据", "message": "failed,cnt:" + strconv.Itoa(cnt)})
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.OperationFailed, "data": "延迟失败数据", "message": "failed,cnt:" + strconv.Itoa(cnt)})
|
||||
} else {
|
||||
data := map[string]interface{}{"auth_id": int(id.(float64)), "delay_time": time.Now().Format("2006-01-02 15:04:05"), "delay_day": delay_req.Day, "option": delay_req.Option, "id": delay_req.ID}
|
||||
str, _ := json.Marshal(data)
|
||||
worker.PushRedisList(user.(string)+"-"+id.(string)+"-option", string(str))
|
||||
c.JSON(http.StatusOK, gin.H{"code": 0, "data": "延迟成功,影响记录:" + strconv.Itoa(cnt), "message": "success cnt:" + strconv.Itoa(cnt)})
|
||||
worker.PushRedisList(user.(string)+"-"+strconv.Itoa(int(id.(float64)))+"-option", string(str))
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "data": "延迟成功,影响记录:" + strconv.Itoa(cnt), "message": "success cnt:" + strconv.Itoa(cnt)})
|
||||
}
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "failed"})
|
||||
|
|
@ -202,8 +202,8 @@ func DeleteVideo(c *gin.Context) {
|
|||
if res != 0 {
|
||||
data := map[string]interface{}{"id": video_req.ID, "auth_id": int(id.(float64)), "delete_time": time.Now().Format("2006-01-02 15:04:05")}
|
||||
str, _ := json.Marshal(data)
|
||||
worker.PushRedisList(user.(string)+"-"+id.(string)+"-option", string(str))
|
||||
c.JSON(http.StatusOK, gin.H{"code": 0, "message": "success"})
|
||||
worker.PushRedisList(user.(string)+"-"+strconv.Itoa(int(id.(float64)))+"-option", string(str))
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.SuccessCode, "message": "success"})
|
||||
} else {
|
||||
c.JSON(http.StatusOK, gin.H{"code": proto.ParameterError, "message": "failed"})
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ func QuashOption(c *gin.Context) {
|
|||
id, _ := c.Get("id")
|
||||
user, _ := c.Get("username")
|
||||
if err := c.ShouldBind(&video_req); err == nil {
|
||||
res := worker.PopRedisList(user.(string) + "-" + id.(string) + "-option")
|
||||
res := worker.PopRedisList(user.(string) + "-" + strconv.Itoa(int(id.(float64))) + "-option")
|
||||
if res != "" {
|
||||
var retrievedData map[string]interface{}
|
||||
err2 := json.Unmarshal([]byte(res), &retrievedData)
|
||||
|
|
|
|||
Loading…
Reference in New Issue