mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
opt qrcode
This commit is contained in:
parent
daee4f8811
commit
b3fa9b9523
@ -229,7 +229,7 @@ func (web *Frame) HandleCmd(m *ice.Message, key string, cmd *ice.Command) {
|
|||||||
w.Header().Set("Content-Type", kit.Select("text/html", msg.Append("type")))
|
w.Header().Set("Content-Type", kit.Select("text/html", msg.Append("type")))
|
||||||
http.ServeFile(w, r, msg.Append("file"))
|
http.ServeFile(w, r, msg.Append("file"))
|
||||||
case "qrcode":
|
case "qrcode":
|
||||||
if qr, e := qrcode.New(msg.Append("qrcode"), qrcode.Medium); m.Assert(e) {
|
if qr, e := qrcode.New(msg.Result(), qrcode.Medium); m.Assert(e) {
|
||||||
w.Header().Set("Content-Type", "image/png")
|
w.Header().Set("Content-Type", "image/png")
|
||||||
m.Assert(qr.Write(256, w))
|
m.Assert(qr.Write(256, w))
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@ var Index = &ice.Context{Name: "web", Help: "网页模块",
|
|||||||
// 请求数据
|
// 请求数据
|
||||||
head := map[string]string{}
|
head := map[string]string{}
|
||||||
body, ok := m.Optionv("body").(io.Reader)
|
body, ok := m.Optionv("body").(io.Reader)
|
||||||
if !ok && len(arg) > 0 {
|
if !ok && len(arg) > 0 && method != "GET" {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "file":
|
case "file":
|
||||||
if f, e := os.Open(arg[1]); m.Warn(e != nil, "%s", e) {
|
if f, e := os.Open(arg[1]); m.Warn(e != nil, "%s", e) {
|
||||||
@ -526,6 +526,7 @@ var Index = &ice.Context{Name: "web", Help: "网页模块",
|
|||||||
head["Content-Type"] = "application/json"
|
head["Content-Type"] = "application/json"
|
||||||
body = bytes.NewBuffer(b)
|
body = bytes.NewBuffer(b)
|
||||||
}
|
}
|
||||||
|
m.Log(ice.LOG_EXPORT, "json: %s", kit.Format(data))
|
||||||
}
|
}
|
||||||
arg = arg[:0]
|
arg = arg[:0]
|
||||||
}
|
}
|
||||||
@ -1430,7 +1431,7 @@ var Index = &ice.Context{Name: "web", Help: "网页模块",
|
|||||||
|
|
||||||
case "qrcode":
|
case "qrcode":
|
||||||
m.Push("_output", "qrcode")
|
m.Push("_output", "qrcode")
|
||||||
m.Push("qrcode", value["text"])
|
m.Echo("%s", value["text"])
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if m.Cmdy(ice.WEB_STORY, "index", value["data"]); m.Append("file") != "" {
|
if m.Cmdy(ice.WEB_STORY, "index", value["data"]); m.Append("file") != "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user