diff --git a/go.mod b/go.mod index 9e82fc3..e1c0bfd 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/gin-gonic/gin v1.7.1 github.com/go-sql-driver/mysql v1.5.0 github.com/mgr9525/HyperByte-Transfer-Protocol v0.0.0-20210422034730-0b85fcf3afe0 - github.com/mgr9525/go-cloud v1.0.6-0.20210423020002-1f8b2e313a5a + github.com/mgr9525/go-cloud v1.0.6-0.20210424024331-339280d1729c github.com/mgr9525/go-ruisutil v1.0.8-0.20210317093428-f69295935056 github.com/qiniu/qmgo v0.9.2 github.com/sirupsen/logrus v1.8.1 diff --git a/go.sum b/go.sum index 7f86bcd..c0d248b 100644 --- a/go.sum +++ b/go.sum @@ -99,8 +99,8 @@ github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/ github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus= github.com/mgr9525/HyperByte-Transfer-Protocol v0.0.0-20210422034730-0b85fcf3afe0 h1:pnIfNO1DHHY5QSTZZD6bIJa2yDoI+saVY4YaQd8EdA8= github.com/mgr9525/HyperByte-Transfer-Protocol v0.0.0-20210422034730-0b85fcf3afe0/go.mod h1:U2OZ06VD1PHu3ZLZ8tuEHooaOZnoke/4ZKAZfL44bUQ= -github.com/mgr9525/go-cloud v1.0.6-0.20210423020002-1f8b2e313a5a h1:7vvaTEyYxLI864HvDEdqHFHYIn/m6k4sxGwUe4wj4Pw= -github.com/mgr9525/go-cloud v1.0.6-0.20210423020002-1f8b2e313a5a/go.mod h1:VkCKgivVD2OX75Zwh+AO3zuJyxGCsuo0zdy+UXCYy9I= +github.com/mgr9525/go-cloud v1.0.6-0.20210424024331-339280d1729c h1:lwcgKx7MJyY1pVZ4omKblNpxaeWVWWovJZYYwast6EM= +github.com/mgr9525/go-cloud v1.0.6-0.20210424024331-339280d1729c/go.mod h1:VkCKgivVD2OX75Zwh+AO3zuJyxGCsuo0zdy+UXCYy9I= github.com/mgr9525/go-ruisutil v1.0.8-0.20210317093428-f69295935056 h1:JhXsFUB3mFWwiDc8c//E/6cUazJUX1lIiLgiM0asNjA= github.com/mgr9525/go-ruisutil v1.0.8-0.20210317093428-f69295935056/go.mod h1:qXUWVKpHdwoxR0KERCkvL1JH2DETY6b5TMG9t6g9Pls= github.com/mgr9525/logrus-file-hook v0.0.0-20210315103109-42681d084c3b h1:sGrxWDbhC2XpDKOLdNrYVo3Ga9YIFMr0AfjnP2gli0o= diff --git a/modeluis/sys_role.go b/modeluis/sys_role.go index 985fe41..eb779ba 100644 --- a/modeluis/sys_role.go +++ b/modeluis/sys_role.go @@ -4,15 +4,6 @@ import ( "time" ) -type SysRole struct { - Id int64 `xorm:"pk autoincr BIGINT(20)"` - Xid string `xorm:"not null pk VARCHAR(64)"` - Title string `xorm:"VARCHAR(100)"` - Perms string `xorm:"TEXT"` - Times time.Time `xorm:"TIMESTAMP"` - Timeds string - Permls string -} type SysURole struct { Id int64 `xorm:"pk autoincr BIGINT(20)"` Xid string `xorm:"not null pk VARCHAR(64)"` diff --git a/webs/sys/main.go b/webs/sys/main.go index b818065..0f78f69 100644 --- a/webs/sys/main.go +++ b/webs/sys/main.go @@ -6,8 +6,6 @@ import ( "GoClouds/webs/sys/route" "GoClouds/webs/sys/routehb" "context" - "errors" - "fmt" hbtp "github.com/mgr9525/HyperByte-Transfer-Protocol" "github.com/mgr9525/go-cloud" "github.com/sirupsen/logrus" @@ -28,6 +26,7 @@ func main() { println("initFuns err:" + err.Error()) os.Exit(1) } + go StartConnEngine(gocloud.CloudConf.Custom.GetString("hbtpHost")) if err := gocloud.Run(); err != nil { logrus.Errorf("gocloud run err:%v", err) } @@ -42,11 +41,6 @@ func initFuns() error { if err != nil { return err } - hbhost := fmt.Sprintf("%v", gocloud.CloudConf.Custom["hbtpHost"]) - if gocloud.CloudConf.Custom["hbtpHost"] == nil || hbhost == "" { - return errors.New("hbtp bind host err") - } - go StartConnEngine(hbhost) gocloud.Web.Use(gocloud.MidAccessAllowFun) gocloud.RegController(&route.IndexHandler{}) /*gocloud.Web.FuncMap["MgrsHost"] = func() string { @@ -66,6 +60,10 @@ func SyncTable() error { } func StartConnEngine(host string) { + if host == "" { + logrus.Error("StartConnEngine run err:host is empty") + os.Exit(1) + } eng := hbtp.NewEngine(context.Background()) eng.RegFun(1, hbtp.RPCFunHandle(&routehb.CommRPC{})) eng.RegFun(2, hbtp.RPCFunHandle(&routehb.UserRPC{})) diff --git a/webs/sys/route/index.go b/webs/sys/route/index.go index d7bc4dc..1b47f06 100644 --- a/webs/sys/route/index.go +++ b/webs/sys/route/index.go @@ -13,8 +13,8 @@ func (IndexHandler) GetMid() gin.HandlerFunc { return nil } func (c *IndexHandler) Routes(g gin.IRoutes) { - g.Any("/stat", c.stat) + g.Any("/", c.index) } -func (IndexHandler) stat(c *gin.Context) { +func (IndexHandler) index(c *gin.Context) { c.String(200, "hello") } diff --git a/webs/sys/routehb/user.go b/webs/sys/routehb/user.go index f80389b..5abb9a4 100644 --- a/webs/sys/routehb/user.go +++ b/webs/sys/routehb/user.go @@ -2,6 +2,7 @@ package routehb import ( "GoClouds/core/bean/sysBean" + "GoClouds/core/cloud/commCloud" "GoClouds/core/comms" "GoClouds/core/utils" "GoClouds/models" @@ -178,7 +179,7 @@ func (UserRPC) Uppass(c *hbtp.Context, m *sysBean.UppassReq) { c.ResJson(hbtp.ResStatusOk, ret) return } - if ne.Name == "bbtpt" /*||sysCloud.CheckPermission(ne.Id,"user:uppass")*/ { + if commCloud.CheckPermission(ne.Xid, "comm:uppass") { ret.Errs = "该用户禁止修改密码" c.ResJson(hbtp.ResStatusOk, ret) return