From 283985df52cd22e622710ef4da05bb0a34e9c885 Mon Sep 17 00:00:00 2001 From: hoteas Date: Sun, 13 Mar 2022 00:26:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E5=85=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/main.go | 69 ------------------------------------------------- 1 file changed, 69 deletions(-) diff --git a/example/main.go b/example/main.go index 6c3043b..2d5cfc7 100644 --- a/example/main.go +++ b/example/main.go @@ -2,11 +2,7 @@ package main import ( "../../hotime" - "strings" - //"../dri/aliyun" - "../dri/baidu" - "../dri/ddsms" "fmt" "time" ) @@ -14,71 +10,6 @@ import ( func main() { date, _ := time.Parse("2006-01-02 15:04", time.Now().Format("2006-01-02")+" 14:00") fmt.Println(date, date.Unix()) - - baidu.DefaultBaiDuMap.Init("ZeT902EZvVgIoGVWEFK3osUm") //fmt.Println("0123456"[1:7]) appIns := hotime.Init("config/config.json") - notNeedLogin := []string{"token", "login", "test", "auth", "upload", "info"} //不需要登录的操作 - //RESTfull接口适配 - appIns.SetConnectListener(func(context *hotime.Context) bool { - - if len(context.RouterString) > 0 && context.RouterString[0] == "admin" { - return true - } - //判断是否需要登录,不需要登录则直接执行mtd - if len(context.RouterString) == 3 && !strings.Contains(context.RouterString[2], ".") { - if context.RouterString[0] == "app" && context.RouterString[1] == "user" { - isNeedLogin := true - for i := 0; i < len(notNeedLogin); i++ { - if notNeedLogin[i] == context.RouterString[2] { - isNeedLogin = false - break - } - } - if !isNeedLogin { - return true - } - } - //微信操作无需登录 - if context.RouterString[0] == "app" && context.RouterString[1] == "wechat" { - return true - } - //微信操作无需登录 - if context.RouterString[0] == "app" && context.RouterString[1] == "sms" { - return true - } - //微信操作无需登录 - if context.RouterString[0] == "app" && context.RouterString[1] == "tag" { - return true - } - //微信操作无需登录 - if context.RouterString[0] == "app" && context.RouterString[1] == "analyse" { - return true - } - //微信操作无需登录 - if context.RouterString[0] == "app" && context.RouterString[1] == "category" { - return true - } - //没有登录 - if context.Session("user_id").Data == nil { - context.Display(2, "没有登录") - return false - } - - } - //支撑权限设置 - return true - }) - appIns.Router["admin"]["company_inout"] = admin.CompanyInOutCtr - appIns.Router["admin"]["test"] = admin.TestCtr - - //makeCode := code.MakeCode{} - //fmt.Println(common.ObjToStr(makeCode.Db2JSON("admin","test",appIns.Db))) - if ddsms.DefaultDDY.ApiKey == "" { - ddsms.DefaultDDY.Init(appIns.Config.GetString("smsKey")) - } - - appIns.Run(hotime.Router{ - "app": app.Project, - }) }