forked from golang/hotime
This commit is contained in:
parent
fcb784e351
commit
8c177e45c5
@ -11,6 +11,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Application struct {
|
type Application struct {
|
||||||
@ -231,13 +232,17 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
|
|||||||
sessionId = cookie.Value
|
sessionId = cookie.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unescapeUrl,err:=url.QueryUnescape(req.RequestURI)
|
||||||
|
if err!=nil{
|
||||||
|
unescapeUrl=req.RequestURI
|
||||||
|
}
|
||||||
//访问实例
|
//访问实例
|
||||||
context := Context{SessionIns: SessionIns{SessionId: sessionId,
|
context := Context{SessionIns: SessionIns{SessionId: sessionId,
|
||||||
LongCache: this.sessionLong,
|
LongCache: this.sessionLong,
|
||||||
ShortCache: this.sessionShort,
|
ShortCache: this.sessionShort,
|
||||||
},
|
},
|
||||||
CacheIns: this.CacheIns,
|
CacheIns: this.CacheIns,
|
||||||
Resp: w, Req: req, Application: this, RouterString: s, Config: this.Config, Db: &this.Db, HandlerStr: req.RequestURI}
|
Resp: w, Req: req, Application: this, RouterString: s, Config: this.Config, Db: &this.Db, HandlerStr: unescapeUrl}
|
||||||
//header默认设置
|
//header默认设置
|
||||||
header := w.Header()
|
header := w.Header()
|
||||||
header.Set("Content-Type", "text/html; charset=utf-8")
|
header.Set("Content-Type", "text/html; charset=utf-8")
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
//"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DDY struct {
|
type DDY struct {
|
||||||
@ -17,7 +18,7 @@ type DDY struct {
|
|||||||
|
|
||||||
func (this *DDY) Init(apikey string) {
|
func (this *DDY) Init(apikey string) {
|
||||||
this.ApiKey = apikey
|
this.ApiKey = apikey
|
||||||
this.YzmUrl = "https://api.dingdongcloud.com/v1/sms/captcha/send"
|
this.YzmUrl = "https://api.dingdongcloud.com/v2/sms/single_send"
|
||||||
this.TzUrl = "https://api.dingdongcloud.com/v1/sms/notice/multi_send"
|
this.TzUrl = "https://api.dingdongcloud.com/v1/sms/notice/multi_send"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,12 +56,14 @@ func (this *DDY) send(mUrl string, umoblie string, content string) (bool, error)
|
|||||||
return false, errors.New("连接错误")
|
return false, errors.New("连接错误")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var msg interface{}
|
var msg interface{}
|
||||||
err1 := json.Unmarshal([]byte(res), &msg)
|
err1 := json.Unmarshal([]byte(res), &msg)
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
return false, errors.New("json解析错误")
|
return false, errors.New("json解析错误")
|
||||||
}
|
}
|
||||||
|
//fmt.Println(msg)
|
||||||
resmsg := msg.(map[string]interface{})
|
resmsg := msg.(map[string]interface{})
|
||||||
rcode := int(resmsg["code"].(float64))
|
rcode := int(resmsg["code"].(float64))
|
||||||
result := resmsg["msg"].(string)
|
result := resmsg["msg"].(string)
|
||||||
|
Loading…
Reference in New Issue
Block a user