政企超链接开始集成

This commit is contained in:
hoteas
2022-02-24 06:26:36 +08:00
parent 32319d52f0
commit 2a98f0dcad
206 changed files with 117722 additions and 997 deletions
+44
View File
@@ -2,6 +2,8 @@ package main
import (
"../../hotime"
"strings"
//"../dri/aliyun"
"../dri/baidu"
"../dri/ddsms"
@@ -18,8 +20,50 @@ func main() {
baidu.DefaultBaiDuMap.Init("ZeT902EZvVgIoGVWEFK3osUm")
//fmt.Println("0123456"[1:7])
appIns := hotime.Init("config/config.json")
notNeedLogin := []string{"login", "test", "auth", "upload"} //不需要登录的操作
//RESTfull接口适配
appIns.SetConnectListener(func(context *hotime.Context) bool {
if 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.Session("user_id").Data == nil {
context.Display(2, "没有登录")
return false
}
}
//支撑权限设置
return true
})