基础整理

This commit is contained in:
hoteas
2022-05-03 08:09:25 +08:00
parent 062e849d44
commit 0b09a13c17
31 changed files with 2501 additions and 618 deletions
+25 -20
View File
@@ -2,28 +2,33 @@ package app
import (
. "code.hoteas.com/golang/hotime"
"code.hoteas.com/golang/hotime/dri/ddsms"
)
var Sms = Ctr{
//只允许微信验证过的或者登录成功的发送短信
//"send": func(this *Context) {
//
// if len(this.Req.FormValue("token")) != 32 {
// this.Display(2, "没有授权")
// return
// }
//
// phone := this.Req.FormValue("phone")
// if len(phone) < 11 {
// this.Display(3, "手机号格式错误")
// return
// }
// code := getCode()
// this.Session("phone", phone)
// this.Session("code", code)
//
// ddsms.DDY.SendYZM(phone, this.Config.GetString("smsLogin"), map[string]string{"code": code})
//
// this.Display(0, "发送成功")
//},
"send": func(that *Context) {
if len(that.Req.FormValue("token")) != 32 {
that.Display(2, "没有授权")
return
}
if that.Session("wechat_id").Data == nil && that.Session("salesman_id").Data == nil {
that.Display(2, "没有登录不可发送短信")
return
}
phone := that.Req.FormValue("phone")
if len(phone) < 11 {
that.Display(3, "手机号格式错误")
return
}
code := getCode()
that.Session("phone", phone)
that.Session("code", code)
ddsms.DDY.SendYZM(phone, that.Config.GetString("smsLogin"), map[string]string{"code": code})
that.Display(0, "发送成功")
},
}