diff --git a/handler/video.go b/handler/video.go index 2cabe45..2c10996 100644 --- a/handler/video.go +++ b/handler/video.go @@ -185,7 +185,7 @@ func DelayVideo(c *gin.Context) { } 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)+"-"+strconv.Itoa(delay_req.ID), string(str)) + 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)}) } } else { @@ -202,7 +202,7 @@ 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)+"-"+strconv.Itoa(video_req.ID), string(str)) + worker.PushRedisList(user.(string)+"-"+id.(string)+"-option", string(str)) c.JSON(http.StatusOK, gin.H{"code": 0, "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) + "-" + strconv.Itoa(video_req.ID)) + res := worker.PopRedisList(user.(string) + "-" + id.(string) + "-option") if res != "" { var retrievedData map[string]interface{} err2 := json.Unmarshal([]byte(res), &retrievedData) diff --git a/proto/conf.go b/proto/conf.go index 245fdea..29fc03a 100644 --- a/proto/conf.go +++ b/proto/conf.go @@ -1,11 +1,12 @@ package proto const ( - MYSQL_USER = "root" - MYSQL_PASSWORD - MYSQL_HOST - MYSQL_PORT - MYSQL_DSN = "video_t2:2t2SKHmWEYj2xFKF@tcp(127.0.0.1:3306)/video_t2?charset=utf8mb4&parseTime=True&loc=Local" + MYSQL_USER = "video_t2" + MYSQL_DB = "video_t2" + MYSQL_PASSWORD = "2t2SKHmWEYj2xFKF" + MYSQL_PORT = "3306" + MYSQL_HOST = "127.0.0.1" + MYSQL_DSN = MYSQL_USER + ":" + MYSQL_PASSWORD + "(" + MYSQL_HOST + ":" + MYSQL_PORT + ")/" + MYSQL_DB + "?charset=utf8mb4&parseTime=True&loc=Local" REDIS_ADDR = "127.0.0.1:6379" REDIS_PASSWORD = "lj502138" diff --git a/test/conf_test.go b/test/conf_test.go new file mode 100644 index 0000000..08bb0c2 --- /dev/null +++ b/test/conf_test.go @@ -0,0 +1,11 @@ +package test + +import ( + "fmt" + "testing" + "videoplayer/proto" +) + +func TestConf(t *testing.T) { + fmt.Println(proto.MYSQL_DSN) +}