hotime/example/main.go
2022-05-13 15:31:55 +08:00

89 lines
2.6 KiB
Go

package main
import (
. "code.hoteas.com/golang/hotime"
"code.hoteas.com/golang/hotime/dri/aliyun"
"code.hoteas.com/golang/hotime/dri/ddsms"
"code.hoteas.com/golang/hotime/dri/tencent"
"code.hoteas.com/golang/hotime/dri/wechat"
"code.hoteas.com/golang/hotime/example/app"
"code.hoteas.com/golang/hotime/example/provider"
//. "code.hoteas.com/golang/hotime/common"
"fmt"
"time"
)
func main() {
date, _ := time.Parse("2006-01-02 15:04", time.Now().Format("2006-01-02")+" 14:00")
fmt.Println(date, date.Unix())
//fmt.Println("开始测试")
//t:=common.Map{"t":1652425167}
//fmt.Println(t.GetTime("t"))
//t["t"]=1652425167123
//fmt.Println(t.GetTime("t"))
//t["t"]=1652425167123456
//fmt.Println(t.GetTime("t"))
//t["t"]=1652425167123456789
//fmt.Println(t.GetTime("t"))
//fmt.Println("开始测试2")
//t["t"]="2006-01-02 15:04:05"
//fmt.Println(t.GetTime("t"))
//t["t"]="2006-01-02 15"
//fmt.Println(t.GetTime("t"))
//t["t"]="2006-01-02"
//fmt.Println(t.GetTime("t"))
//t["t"]="2006-01"
//fmt.Println(t.GetTime("t"))
//t["t"]="2006-01"
//fmt.Println(t.GetTime("t"))
//t["t"]="2006"
//fmt.Println(t.GetTime("t"))
//
//t["t"]="06"
//fmt.Println(t.GetTime("t"))
//fmt.Println("0123456"[1:7])
appIns := Init("config/config.json")
aliyun.Company.Init(appIns.Config.GetString("aliyunCode"))
//初始化短信配置
ddsms.DDY.Init(appIns.Config.GetString("smsKey"))
//初始化公众号配置
wechat.H5Program.Init(appIns.Config.GetString("wechatAppID"), appIns.Config.GetString("wechatAppSecret"))
//初始化小程序配置
wechat.MiniProgram.Init(appIns.Config.GetString("wechatMiniAppID"), appIns.Config.GetString("wechatMiniAppSecret"))
//初始化小程序及公众号支付配置
wechat.WxPay.Init(appIns.Config.GetString("wechatPayMCHID"),
appIns.Config.GetString("wechatPaySerialNo"),
appIns.Config.GetString("wechatPayMApiV3Key"),
appIns.Config.GetString("wechatPayPrivateKey"))
tencent.Tencent.Init(appIns.Config.GetString("tencentId"), appIns.Config.GetString("tencentKey"))
//用户侧访问前设置
appIns.SetConnectListener(func(that *Context) (isFinished bool) {
//发送短信校验
//that.RespFunc = func() {
// go func(Form url.Values, RespData common.Map) {
// fmt.Println(Form)
// fmt.Println(RespData)
// }(that.Req.Form, that.RespData)
//
//}
return isFinished
})
//appIns.SetConnectListener(func(that *Context) (isFinished bool) {
//
// return isFinished
//})
//appIns.Db.Action(func(db db.HoTimeDB) (isSuccess bool) {
// return isSuccess
//})
appIns.Run(Router{
"provider": provider.Project,
"app": app.Project,
})
}