iedc-go/example/main.go

90 lines
2.6 KiB
Go
Raw Permalink Normal View History

2017-08-17 02:37:00 +00:00
package main
import (
2022-03-13 09:02:19 +00:00
. "code.hoteas.com/golang/hotime"
2022-05-03 00:09:25 +00:00
"code.hoteas.com/golang/hotime/dri/aliyun"
2022-05-02 07:42:54 +00:00
"code.hoteas.com/golang/hotime/dri/ddsms"
2022-05-13 01:30:09 +00:00
"code.hoteas.com/golang/hotime/dri/tencent"
2022-05-02 07:42:54 +00:00
"code.hoteas.com/golang/hotime/dri/wechat"
2022-03-14 08:48:19 +00:00
"code.hoteas.com/golang/hotime/example/app"
2022-05-03 00:09:25 +00:00
"code.hoteas.com/golang/hotime/example/provider"
2022-03-12 21:06:28 +00:00
//. "code.hoteas.com/golang/hotime/common"
2017-09-05 03:09:13 +00:00
"fmt"
2018-04-08 16:02:13 +00:00
"time"
2017-08-17 02:37:00 +00:00
)
//
2017-08-17 02:37:00 +00:00
func main() {
date, _ := time.Parse("2006-01-02 15:04", time.Now().Format("2006-01-02")+" 14:00")
fmt.Println(date, date.Unix())
2022-05-13 07:31:55 +00:00
//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"))
2021-10-26 16:27:24 +00:00
//fmt.Println("0123456"[1:7])
2022-03-13 09:02:19 +00:00
appIns := Init("config/config.json")
2022-05-03 00:09:25 +00:00
aliyun.Company.Init(appIns.Config.GetString("aliyunCode"))
//初始化短信配置
2022-05-02 07:42:54 +00:00
ddsms.DDY.Init(appIns.Config.GetString("smsKey"))
//初始化公众号配置
wechat.H5Program.Init(appIns.Config.GetString("wechatAppID"), appIns.Config.GetString("wechatAppSecret"))
2022-05-03 00:09:25 +00:00
//初始化小程序配置
2022-05-02 07:42:54 +00:00
wechat.MiniProgram.Init(appIns.Config.GetString("wechatMiniAppID"), appIns.Config.GetString("wechatMiniAppSecret"))
2022-05-03 14:40:02 +00:00
//初始化小程序及公众号支付配置
wechat.WxPay.Init(appIns.Config.GetString("wechatPayMCHID"),
appIns.Config.GetString("wechatPaySerialNo"),
appIns.Config.GetString("wechatPayMApiV3Key"),
appIns.Config.GetString("wechatPayPrivateKey"))
2022-05-13 01:30:09 +00:00
tencent.Tencent.Init(appIns.Config.GetString("tencentId"), appIns.Config.GetString("tencentKey"))
2022-05-02 07:42:54 +00:00
2022-05-03 00:09:25 +00:00
//用户侧访问前设置
2022-03-13 09:02:19 +00:00
appIns.SetConnectListener(func(that *Context) (isFinished bool) {
2022-05-03 00:09:25 +00:00
//发送短信校验
2022-05-12 10:27:01 +00:00
//that.RespFunc = func() {
// go func(Form url.Values, RespData common.Map) {
// fmt.Println(Form)
// fmt.Println(RespData)
// }(that.Req.Form, that.RespData)
//
//}
2022-03-26 08:53:40 +00:00
2022-03-13 09:02:19 +00:00
return isFinished
})
2022-04-17 22:28:01 +00:00
2022-04-20 14:47:58 +00:00
//appIns.SetConnectListener(func(that *Context) (isFinished bool) {
//
// return isFinished
//})
2022-03-13 09:02:19 +00:00
//appIns.Db.Action(func(db db.HoTimeDB) (isSuccess bool) {
// return isSuccess
//})
2022-03-14 08:48:19 +00:00
appIns.Run(Router{
2022-05-03 00:09:25 +00:00
"provider": provider.Project,
2022-05-02 07:42:54 +00:00
"app": app.Project,
2022-03-14 08:48:19 +00:00
})
2017-08-17 02:37:00 +00:00
}