forked from golang/hotime
重新索引
This commit is contained in:
parent
67a31c83c2
commit
951802ed7a
@ -1,11 +1,11 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"fmt"
|
||||
"github.com/chain-zhang/pinyin"
|
||||
"github.com/xuri/excelize"
|
||||
"github.com/Chain-Zhang/pinyin"
|
||||
"github.com/xuri/excelize/v2"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -1,11 +1,11 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"fmt"
|
||||
"github.com/chain-zhang/pinyin"
|
||||
"github.com/xuri/excelize"
|
||||
"github.com/Chain-Zhang/pinyin"
|
||||
"github.com/xuri/excelize/v2"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
|
@ -1,7 +1,7 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
|
@ -1,12 +1,12 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
"../../dri/baidu"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"code.hoteas.com/golang/hotime/dri/baidu"
|
||||
"fmt"
|
||||
"github.com/robertkrimen/otto"
|
||||
"github.com/xuri/excelize"
|
||||
"github.com/xuri/excelize/v2"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sort"
|
||||
@ -987,7 +987,7 @@ console.log("845458454" ); // 4
|
||||
// return
|
||||
//}
|
||||
|
||||
data1, _ := baidu.DefaultBaiDuMap.GetPosition("简阳市东溪镇奎星路28号", "")
|
||||
data1, _ := baidu.BaiDuMap.GetPosition("简阳市东溪镇奎星路28号", "")
|
||||
|
||||
this.Display(0, ObjToMap(data1))
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
)
|
||||
|
||||
var Org = map[int]OrgInterface{
|
||||
|
@ -1,10 +1,10 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"fmt"
|
||||
"github.com/xuri/excelize"
|
||||
"github.com/xuri/excelize/v2"
|
||||
"os"
|
||||
"sort"
|
||||
"time"
|
||||
|
@ -1,8 +1,8 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
//"strings"
|
||||
)
|
||||
|
||||
|
33
app/init.go
33
app/init.go
@ -1,13 +1,12 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
"../../dri/aliyun"
|
||||
"../../dri/tencent"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"code.hoteas.com/golang/hotime/dri/aliyun"
|
||||
"code.hoteas.com/golang/hotime/dri/tencent"
|
||||
"fmt"
|
||||
"github.com/silenceper/wechat"
|
||||
"github.com/silenceper/wechat/cache"
|
||||
"gopkg.in/chanxuehong/wechat.v2/mch/core"
|
||||
"gopkg.in/chanxuehong/wechat.v2/mch/pay"
|
||||
"io/ioutil"
|
||||
@ -42,7 +41,8 @@ func getCode() string {
|
||||
|
||||
func getCompany(name, path string) Map {
|
||||
os.Setenv("ZONEINFO", "config/data.zip")
|
||||
res := tencent.GetCompany("AKIDklZa1qBr3B0x1G643cg8B6UO5JZm2KX8o43G", "tdda7oro526h96dvicYkep1xsWFmHkt33xvqs2K", name)
|
||||
|
||||
res := tencent.Company.GetCompany(name)
|
||||
c := Map{}
|
||||
base := Map{}
|
||||
if res.GetInt("code") != 200 {
|
||||
@ -74,8 +74,7 @@ func getCompany(name, path string) Map {
|
||||
base["liquidation"] = c["liquidation"]
|
||||
}
|
||||
|
||||
aliyun.DefaultCompany.Init("06c6a07e89dd45c88de040ee1489eef7")
|
||||
data := aliyun.DefaultCompany.GetCompanyOtherAll(name)
|
||||
data := aliyun.Company.GetCompanyOtherAll(name)
|
||||
|
||||
base["OtherCopyrightsInfo"] = data.GetMap("OtherCopyrightsInfo").GetInt("total")
|
||||
base["PatentsInfo"] = data.GetMap("PatentsInfo").GetInt("total")
|
||||
@ -94,15 +93,15 @@ func getCompany(name, path string) Map {
|
||||
}
|
||||
|
||||
//微信获取个人信息
|
||||
func Weixin(this *Context) *wechat.Wechat {
|
||||
if weixin == nil {
|
||||
cache1 := cache.Cache(WechatCache{this.CacheIns})
|
||||
config := wechat.Config{Cache: cache1, AppID: this.Config.GetString("wechatAppID"), AppSecret: this.Config.GetString("wechatAppSecret")}
|
||||
weixin = wechat.NewWechat(&config)
|
||||
}
|
||||
|
||||
return weixin
|
||||
}
|
||||
//func Weixin(this *Context) *wechat.Wechat {
|
||||
// if weixin == nil {
|
||||
// cache1 := cache.Cache(WechatCache{this.CacheIns})
|
||||
// config := wechat.Config{Cache: cache1, AppID: this.Config.GetString("wechatAppID"), AppSecret: this.Config.GetString("wechatAppSecret")}
|
||||
// weixin = wechat.NewWechat(&config)
|
||||
// }
|
||||
//
|
||||
// return weixin
|
||||
//}
|
||||
|
||||
//微信获取个人信息
|
||||
func WxPayClient(this *Context, sn string, money int64, openid string) Map {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"fmt"
|
||||
"time"
|
||||
//"strings"
|
||||
|
@ -1,8 +1,8 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
"../../dri/ddsms"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
"code.hoteas.com/golang/hotime/dri/ddsms"
|
||||
)
|
||||
|
||||
var Sms = Ctr{
|
||||
@ -26,7 +26,7 @@ var Sms = Ctr{
|
||||
this.Session("phone", phone)
|
||||
this.Session("code", code)
|
||||
|
||||
ddsms.DefaultDDY.SendYZM(phone, this.Config.GetString("smsLogin"), map[string]string{"code": code})
|
||||
ddsms.DDY.SendYZM(phone, this.Config.GetString("smsLogin"), map[string]string{"code": code})
|
||||
|
||||
this.Display(0, "发送成功")
|
||||
},
|
||||
|
@ -1,8 +1,8 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
)
|
||||
|
||||
var tagCtr = Ctr{
|
||||
|
@ -1,7 +1,7 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../common"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
)
|
||||
|
||||
var ADataType = Map{
|
||||
|
14
app/user.go
14
app/user.go
@ -1,10 +1,10 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../common"
|
||||
"../../dri/download"
|
||||
"../../dri/tencent"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
"code.hoteas.com/golang/hotime/dri/download"
|
||||
"code.hoteas.com/golang/hotime/dri/tencent"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
@ -297,7 +297,8 @@ var User = Ctr{
|
||||
tp := this.Req.FormValue("type")
|
||||
|
||||
if tp == "company" {
|
||||
data := tencent.OCRCOMPANY(file)
|
||||
//data := tencent.OCRCOMPANY(file)
|
||||
data := tencent.Tencent.OCRCOMPANY(file)
|
||||
c := ObjToMap(data)
|
||||
if c != nil {
|
||||
c = c.GetMap("Response")
|
||||
@ -310,7 +311,8 @@ var User = Ctr{
|
||||
return
|
||||
}
|
||||
if tp == "common" {
|
||||
data := tencent.OCR(file)
|
||||
//data := tencent.OCR(file)
|
||||
data := tencent.Tencent.OCR(file)
|
||||
c := ObjToMap(data)
|
||||
if c != nil {
|
||||
c = c.GetMap("Response")
|
||||
|
261
app/wechat.go
261
app/wechat.go
@ -1,12 +1,11 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
. "../../../iedc-go"
|
||||
. "../../../iedc-go/cache"
|
||||
. "../../../iedc-go/common"
|
||||
"fmt"
|
||||
"github.com/silenceper/wechat"
|
||||
"github.com/silenceper/wechat/cache"
|
||||
. "code.hoteas.com/golang/hotime"
|
||||
. "code.hoteas.com/golang/hotime/cache"
|
||||
. "code.hoteas.com/golang/hotime/common"
|
||||
//"github.com/silenceper/wechat"
|
||||
//"github.com/silenceper/wechat/cache"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -45,133 +44,135 @@ var Wechat = Ctr{
|
||||
this.Display(0, this.Session("wechatInfo").ToMap())
|
||||
},
|
||||
//微信注册,0已经完整的注册了,1还没有注册
|
||||
"codebase": func(this *Context) {
|
||||
wx := Weixin(this)
|
||||
auth := wx.GetOauth(this.Req, this.Resp)
|
||||
resToken, err := auth.GetUserAccessToken(this.Req.FormValue("code"))
|
||||
if err != nil {
|
||||
this.Display(6, "code错误")
|
||||
return
|
||||
}
|
||||
|
||||
//判断用户是否已经注册
|
||||
user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
|
||||
if user != nil {
|
||||
this.Session("user_id", user.Get("id"))
|
||||
this.Display(0, 0)
|
||||
return
|
||||
}
|
||||
|
||||
user_id := this.Db.Insert("user", Map{"time": time.Now().Unix(), "state": 2})
|
||||
if user_id == 0 {
|
||||
this.Display(4, "创建用户失败")
|
||||
return
|
||||
}
|
||||
|
||||
wid := this.Db.Insert("wechat", Map{"openid": resToken.OpenID, "appid": this.Config.GetString("wechatAppID"), "state": 1, "user_id": user_id})
|
||||
if wid == 0 {
|
||||
this.Display(4, "关联微信失败!")
|
||||
return
|
||||
}
|
||||
|
||||
this.Session("user_id", user.Get("id"))
|
||||
|
||||
this.Display(0, 1)
|
||||
},
|
||||
//微信注册,0已经完整的注册了,1还没有注册
|
||||
"code": func(this *Context) {
|
||||
|
||||
orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||
//if orgId==0{
|
||||
// this.Display(3, "缺少组织id")
|
||||
// return
|
||||
//}
|
||||
|
||||
wx := Weixin(this)
|
||||
auth := wx.GetOauth(this.Req, this.Resp)
|
||||
resToken, err := auth.GetUserAccessToken(this.Req.FormValue("code"))
|
||||
if err != nil {
|
||||
this.Display(5, "code错误")
|
||||
return
|
||||
}
|
||||
|
||||
//判断用户是否已经注册
|
||||
user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
|
||||
if user != nil && user.GetCeilInt("id") != 0 && user.GetCeilInt("state") == 0 {
|
||||
this.Session("user_id", user.Get("id"))
|
||||
this.Display(0, Map{"type": 0, "token": this.SessionId})
|
||||
return
|
||||
}
|
||||
//getUserInfo
|
||||
userInfo, err := auth.GetUserInfo(resToken.AccessToken, resToken.OpenID)
|
||||
if err != nil {
|
||||
this.Display(6, "微信个人信息无法获取")
|
||||
return
|
||||
}
|
||||
|
||||
//wechatInfo := ObjToMap(userInfo)
|
||||
t := time.Now().Unix()
|
||||
wechatInfo := Map{
|
||||
"openid": userInfo.OpenID,
|
||||
"acttoken": resToken.AccessToken,
|
||||
"retoken": resToken.RefreshToken,
|
||||
"appid": this.Config.GetString("wechatAppID"),
|
||||
"unionid": userInfo.Unionid,
|
||||
"nickname": userInfo.Nickname,
|
||||
"avatar": userInfo.HeadImgURL,
|
||||
}
|
||||
if orgId != 0 {
|
||||
wechatInfo["org_id"] = orgId
|
||||
wechatInfo["status"] = 0
|
||||
}
|
||||
|
||||
wechatDb := this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
|
||||
|
||||
if wechatDb != nil {
|
||||
|
||||
this.Db.Update("wechat", wechatInfo, Map{"id": wechatDb.GetCeilInt("id")})
|
||||
//userInfo["wid"]=wechatDb.GetCeilInt("wid")
|
||||
} else {
|
||||
wechatInfo["create_time"] = t
|
||||
wechatInfo["id"] = this.Db.Insert("wechat", wechatInfo)
|
||||
}
|
||||
wechatDb = this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
|
||||
|
||||
this.Session("wechatInfo", wechatDb)
|
||||
fmt.Println(wechatDb)
|
||||
fmt.Println(this.Session("wechatInfo"))
|
||||
//this.Display(0, 1)
|
||||
this.Display(0, Map{"type": 1, "token": this.SessionId})
|
||||
},
|
||||
//"codebase": func(this *Context) {
|
||||
// wx := Weixin(this)
|
||||
// //auth := wx.GetOauth(this.Req, this.Resp)
|
||||
//auth :=wx.GetOauth()
|
||||
// resToken, err := auth.GetUserAccessToken(this.Req.FormValue("code"))
|
||||
// if err != nil {
|
||||
// this.Display(6, "code错误")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// //判断用户是否已经注册
|
||||
// user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
|
||||
// if user != nil {
|
||||
// this.Session("user_id", user.Get("id"))
|
||||
// this.Display(0, 0)
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// user_id := this.Db.Insert("user", Map{"time": time.Now().Unix(), "state": 2})
|
||||
// if user_id == 0 {
|
||||
// this.Display(4, "创建用户失败")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// wid := this.Db.Insert("wechat", Map{"openid": resToken.OpenID, "appid": this.Config.GetString("wechatAppID"), "state": 1, "user_id": user_id})
|
||||
// if wid == 0 {
|
||||
// this.Display(4, "关联微信失败!")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// this.Session("user_id", user.Get("id"))
|
||||
//
|
||||
// this.Display(0, 1)
|
||||
//},
|
||||
////微信注册,0已经完整的注册了,1还没有注册
|
||||
//"code": func(this *Context) {
|
||||
//
|
||||
// orgId := ObjToInt(this.Req.FormValue("org_id"))
|
||||
// //if orgId==0{
|
||||
// // this.Display(3, "缺少组织id")
|
||||
// // return
|
||||
// //}
|
||||
//
|
||||
// wx := Weixin(this)
|
||||
// //auth := wx.GetOauth(this.Req, this.Resp)
|
||||
// auth := wx.GetOauth()
|
||||
// resToken, err := auth.GetUserAccessToken(this.Req.FormValue("code"))
|
||||
// if err != nil {
|
||||
// this.Display(5, "code错误")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// //判断用户是否已经注册
|
||||
// user := this.Db.Get("wechat", Map{"[><]user": "wechat.user_id=user.id"}, "user.id,user.state", Map{"openid": resToken.OpenID})
|
||||
// if user != nil && user.GetCeilInt("id") != 0 && user.GetCeilInt("state") == 0 {
|
||||
// this.Session("user_id", user.Get("id"))
|
||||
// this.Display(0, Map{"type": 0, "token": this.SessionId})
|
||||
// return
|
||||
// }
|
||||
// //getUserInfo
|
||||
// userInfo, err := auth.GetUserInfo(resToken.AccessToken, resToken.OpenID)
|
||||
// if err != nil {
|
||||
// this.Display(6, "微信个人信息无法获取")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// //wechatInfo := ObjToMap(userInfo)
|
||||
// t := time.Now().Unix()
|
||||
// wechatInfo := Map{
|
||||
// "openid": userInfo.OpenID,
|
||||
// "acttoken": resToken.AccessToken,
|
||||
// "retoken": resToken.RefreshToken,
|
||||
// "appid": this.Config.GetString("wechatAppID"),
|
||||
// "unionid": userInfo.Unionid,
|
||||
// "nickname": userInfo.Nickname,
|
||||
// "avatar": userInfo.HeadImgURL,
|
||||
// }
|
||||
// if orgId != 0 {
|
||||
// wechatInfo["org_id"] = orgId
|
||||
// wechatInfo["status"] = 0
|
||||
// }
|
||||
//
|
||||
// wechatDb := this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
|
||||
//
|
||||
// if wechatDb != nil {
|
||||
//
|
||||
// this.Db.Update("wechat", wechatInfo, Map{"id": wechatDb.GetCeilInt("id")})
|
||||
// //userInfo["wid"]=wechatDb.GetCeilInt("wid")
|
||||
// } else {
|
||||
// wechatInfo["create_time"] = t
|
||||
// wechatInfo["id"] = this.Db.Insert("wechat", wechatInfo)
|
||||
// }
|
||||
// wechatDb = this.Db.Get("wechat", "*", Map{"openid": wechatInfo.GetString("openid")})
|
||||
//
|
||||
// this.Session("wechatInfo", wechatDb)
|
||||
// fmt.Println(wechatDb)
|
||||
// fmt.Println(this.Session("wechatInfo"))
|
||||
// //this.Display(0, 1)
|
||||
// this.Display(0, Map{"type": 1, "token": this.SessionId})
|
||||
//},
|
||||
//网页签名
|
||||
"sign": func(this *Context) {
|
||||
|
||||
if this.Req.FormValue("sign_url") == "" {
|
||||
this.Display(2, "参数不足")
|
||||
return
|
||||
}
|
||||
|
||||
if weixin == nil {
|
||||
cache1 := cache.Cache(WechatCache{this.CacheIns})
|
||||
config := wechat.Config{Cache: cache1, AppID: this.Config.GetString("wechatAppID"), AppSecret: this.Config.GetString("wechatAppSecret")}
|
||||
weixin = wechat.NewWechat(&config)
|
||||
}
|
||||
|
||||
js := weixin.GetJs(this.Req, this.Resp)
|
||||
cfg, e := js.GetConfig(this.Req.FormValue("sign_url"))
|
||||
if e != nil {
|
||||
this.Display(7, e)
|
||||
return
|
||||
}
|
||||
|
||||
sign := Map{
|
||||
"appId": cfg.AppID,
|
||||
"timestamp": cfg.TimeStamp,
|
||||
"nonceStr": cfg.NonceStr,
|
||||
"signature": cfg.Signature,
|
||||
}
|
||||
|
||||
this.Display(0, sign)
|
||||
//if this.Req.FormValue("sign_url") == "" {
|
||||
// this.Display(2, "参数不足")
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//if weixin == nil {
|
||||
// cache1 := cache.Cache(WechatCache{this.CacheIns})
|
||||
// config := wechat.Config{Cache: cache1, AppID: this.Config.GetString("wechatAppID"), AppSecret: this.Config.GetString("wechatAppSecret")}
|
||||
// weixin = wechat.NewWechat(&config)
|
||||
//}
|
||||
//
|
||||
//js := weixin.GetJs(this.Req, this.Resp)
|
||||
//cfg, e := js.GetConfig(this.Req.FormValue("sign_url"))
|
||||
//if e != nil {
|
||||
// this.Display(7, e)
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//sign := Map{
|
||||
// "appId": cfg.AppID,
|
||||
// "timestamp": cfg.TimeStamp,
|
||||
// "nonceStr": cfg.NonceStr,
|
||||
// "signature": cfg.Signature,
|
||||
//}
|
||||
//
|
||||
//this.Display(0, sign)
|
||||
|
||||
},
|
||||
}
|
||||
|
@ -11,16 +11,14 @@
|
||||
"timeout": 7200
|
||||
}
|
||||
},
|
||||
"codeConfig": {
|
||||
"admin": "config/app.json"
|
||||
},
|
||||
"codeConfig1": {
|
||||
"admin": {
|
||||
"config": "config/app.json",
|
||||
"package": "admin",
|
||||
"rule": "config/rule.json"
|
||||
"codeConfig": [
|
||||
{
|
||||
"config": "config/admin.json",
|
||||
"configDB": "config/adminDB.json",
|
||||
"rule": "config/rule.json",
|
||||
"table": "admin"
|
||||
}
|
||||
},
|
||||
],
|
||||
"crossDomain": "auto",
|
||||
"db": {
|
||||
"mysql": {
|
||||
|
@ -20,10 +20,17 @@
|
||||
},
|
||||
"注释": "可配置memory,db,redis,默认启用memory,默认优先级为memory\u003eredis\u003edb,memory与数据库缓存设置项一致,缓存数据填充会自动反方向反哺,加入memory缓存过期将自动从redis更新,但memory永远不会更新redis,如果是集群建议不要开启memory,配置即启用"
|
||||
},
|
||||
"codeConfig": {
|
||||
"packageName": "默认无,必须,包名称以及应用名,生成代码的配置文件地址,比如config/app.json,数据库有更新时自动更新配置文件以及对应的生成文件",
|
||||
"注释": "配置即启用,非必须,默认无"
|
||||
},
|
||||
"codeConfig": [
|
||||
"注释:配置即启用,非必须,默认无",
|
||||
{
|
||||
"config": "默认config/app.json,必须,接口描述配置文件",
|
||||
"configDB": "默认无,非必须,有则每次将数据库数据生成到此目录用于配置读写,无则不生成",
|
||||
"mode": "默认0,非必须,0为内嵌代码模式,1为生成代码模式",
|
||||
"name": "默认无,非必须,有则生成代码到此目录,无则采用缺省模式使用表名,如设置为:admin,将在admin目录生成包名为admin的代码",
|
||||
"rule": "默认config/rule.json,非必须,有则按改规则生成接口,无则按系统内嵌方式生成",
|
||||
"table": "默认admin,必须,根据数据库内当前表名做为用户生成数据"
|
||||
}
|
||||
],
|
||||
"crossDomain": "默认空 非必须,空字符串为不开启,如果需要跨域设置,auto为智能开启所有网站允许跨域,http://www.baidu.com为指定域允许跨域",
|
||||
"db": {
|
||||
"mysql": {
|
||||
|
38
main.go
38
main.go
@ -1,15 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"../../iedc-go"
|
||||
"code.hoteas.com/golang/hotime"
|
||||
"code.hoteas.com/golang/hotime/dri/aliyun"
|
||||
"code.hoteas.com/golang/hotime/dri/tencent"
|
||||
"strings"
|
||||
|
||||
//"../dri/aliyun"
|
||||
"../dri/baidu"
|
||||
"../dri/ddsms"
|
||||
"./admin"
|
||||
"./app"
|
||||
"code.hoteas.com/golang/hotime/dri/baidu"
|
||||
"code.hoteas.com/golang/hotime/dri/ddsms"
|
||||
"fmt"
|
||||
"iedc-go/admin"
|
||||
"iedc-go/app"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -17,7 +19,7 @@ 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")
|
||||
baidu.BaiDuMap.Init("ZeT902EZvVgIoGVWEFK3osUm")
|
||||
//fmt.Println("0123456"[1:7])
|
||||
appIns := hotime.Init("config/config.json")
|
||||
notNeedLogin := []string{"token", "login", "test", "auth", "upload", "info"} //不需要登录的操作
|
||||
@ -25,7 +27,7 @@ func main() {
|
||||
appIns.SetConnectListener(func(context *hotime.Context) bool {
|
||||
|
||||
if len(context.RouterString) > 0 && context.RouterString[0] == "admin" {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
//判断是否需要登录,不需要登录则直接执行mtd
|
||||
if len(context.RouterString) == 3 && !strings.Contains(context.RouterString[2], ".") {
|
||||
@ -38,48 +40,50 @@ func main() {
|
||||
}
|
||||
}
|
||||
if !isNeedLogin {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
}
|
||||
//微信操作无需登录
|
||||
if context.RouterString[0] == "app" && context.RouterString[1] == "wechat" {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
//微信操作无需登录
|
||||
if context.RouterString[0] == "app" && context.RouterString[1] == "sms" {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
//微信操作无需登录
|
||||
if context.RouterString[0] == "app" && context.RouterString[1] == "tag" {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
//微信操作无需登录
|
||||
if context.RouterString[0] == "app" && context.RouterString[1] == "analyse" {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
//微信操作无需登录
|
||||
if context.RouterString[0] == "app" && context.RouterString[1] == "category" {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
//没有登录
|
||||
if context.Session("user_id").Data == nil {
|
||||
context.Display(2, "没有登录")
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
//支撑权限设置
|
||||
return true
|
||||
return false
|
||||
})
|
||||
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"))
|
||||
if ddsms.DDY.ApiKey == "" {
|
||||
ddsms.DDY.Init(appIns.Config.GetString("smsKey"))
|
||||
}
|
||||
|
||||
tencent.Company.Init("AKIDklZa1qBr3B0x1G643cg8B6UO5JZm2KX8o43G", "tdda7oro526h96dvicYkep1xsWFmHkt33xvqs2K")
|
||||
aliyun.Company.Init("06c6a07e89dd45c88de040ee1489eef7")
|
||||
appIns.Run(hotime.Router{
|
||||
"app": app.Project,
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user