UP 视频模块
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/models"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Album(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
PhotoTemplate := models.Template.Album
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
PhotoTemplate.WriteError(w, err)
|
||||
}
|
||||
|
||||
PhotoTemplate.WriteData(w, models.BuildViewData("Album", map[string]interface{}{
|
||||
"memos_url": config.Cfg.MemosURL,
|
||||
"memos_user": config.Cfg.MemosUser,
|
||||
"memos_tag": config.Cfg.MemosAlbumTag,
|
||||
}))
|
||||
|
||||
}
|
41
controller/memos.go
Normal file
41
controller/memos.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/models"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Memos(w http.ResponseWriter, r *http.Request) {
|
||||
if err := r.ParseForm(); err != nil {
|
||||
http.Error(w, "参数解析错误", http.StatusInternalServerError)
|
||||
}
|
||||
fun := r.Form.Get("name")
|
||||
log.Printf("R:%v,name:%s\n", r.Form, fun)
|
||||
switch fun {
|
||||
case "talk":
|
||||
Template := models.Template.Talk
|
||||
|
||||
Template.WriteData(w, models.BuildViewData("Talk", map[string]interface{}{
|
||||
"url": config.Cfg.MemosURL,
|
||||
"user": config.Cfg.MemosUser,
|
||||
"tag": config.Cfg.MemosTalkTag,
|
||||
"author": config.Cfg.Author,
|
||||
"qq": config.Cfg.Qq,
|
||||
}))
|
||||
case "album":
|
||||
Template := models.Template.Album
|
||||
tag := strings.Split(config.Cfg.MemosAlbumTag, ",")
|
||||
Template.WriteData(w, models.BuildViewData("Album", map[string]interface{}{
|
||||
"url": config.Cfg.MemosURL,
|
||||
"user": config.Cfg.MemosUser,
|
||||
"image": tag[0],
|
||||
"video": tag[1],
|
||||
}))
|
||||
default:
|
||||
http.Error(w, "无法解析页面请求"+fun, http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blog/config"
|
||||
"blog/models"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Talk(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
TalkTemplate := models.Template.Talk
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
TalkTemplate.WriteError(w, err)
|
||||
}
|
||||
|
||||
TalkTemplate.WriteData(w, models.BuildViewData("Talk", map[string]interface{}{
|
||||
"memos_url": config.Cfg.MemosURL,
|
||||
"memos_user": config.Cfg.MemosUser,
|
||||
"memos_tag": config.Cfg.MemosTalkTag,
|
||||
"author": config.Cfg.Author,
|
||||
"qq": config.Cfg.Qq,
|
||||
}))
|
||||
|
||||
}
|
Reference in New Issue
Block a user