Browse Source

bugs

master
LinskRuis.32G 4 years ago
parent
commit
4f3505a448
  1. 2
      go.mod
  2. 4
      go.sum
  3. 9
      modeluis/sys_role.go
  4. 12
      webs/sys/main.go
  5. 4
      webs/sys/route/index.go
  6. 3
      webs/sys/routehb/user.go

2
go.mod

@ -7,7 +7,7 @@ require (
github.com/gin-gonic/gin v1.7.1 github.com/gin-gonic/gin v1.7.1
github.com/go-sql-driver/mysql v1.5.0 github.com/go-sql-driver/mysql v1.5.0
github.com/mgr9525/HyperByte-Transfer-Protocol v0.0.0-20210422034730-0b85fcf3afe0 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/mgr9525/go-ruisutil v1.0.8-0.20210317093428-f69295935056
github.com/qiniu/qmgo v0.9.2 github.com/qiniu/qmgo v0.9.2
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1

4
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/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 h1:pnIfNO1DHHY5QSTZZD6bIJa2yDoI+saVY4YaQd8EdA8=
github.com/mgr9525/HyperByte-Transfer-Protocol v0.0.0-20210422034730-0b85fcf3afe0/go.mod h1:U2OZ06VD1PHu3ZLZ8tuEHooaOZnoke/4ZKAZfL44bUQ= 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 h1:JhXsFUB3mFWwiDc8c//E/6cUazJUX1lIiLgiM0asNjA=
github.com/mgr9525/go-ruisutil v1.0.8-0.20210317093428-f69295935056/go.mod h1:qXUWVKpHdwoxR0KERCkvL1JH2DETY6b5TMG9t6g9Pls= 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= github.com/mgr9525/logrus-file-hook v0.0.0-20210315103109-42681d084c3b h1:sGrxWDbhC2XpDKOLdNrYVo3Ga9YIFMr0AfjnP2gli0o=

9
modeluis/sys_role.go

@ -4,15 +4,6 @@ import (
"time" "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 { type SysURole struct {
Id int64 `xorm:"pk autoincr BIGINT(20)"` Id int64 `xorm:"pk autoincr BIGINT(20)"`
Xid string `xorm:"not null pk VARCHAR(64)"` Xid string `xorm:"not null pk VARCHAR(64)"`

12
webs/sys/main.go

@ -6,8 +6,6 @@ import (
"GoClouds/webs/sys/route" "GoClouds/webs/sys/route"
"GoClouds/webs/sys/routehb" "GoClouds/webs/sys/routehb"
"context" "context"
"errors"
"fmt"
hbtp "github.com/mgr9525/HyperByte-Transfer-Protocol" hbtp "github.com/mgr9525/HyperByte-Transfer-Protocol"
"github.com/mgr9525/go-cloud" "github.com/mgr9525/go-cloud"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
@ -28,6 +26,7 @@ func main() {
println("initFuns err:" + err.Error()) println("initFuns err:" + err.Error())
os.Exit(1) os.Exit(1)
} }
go StartConnEngine(gocloud.CloudConf.Custom.GetString("hbtpHost"))
if err := gocloud.Run(); err != nil { if err := gocloud.Run(); err != nil {
logrus.Errorf("gocloud run err:%v", err) logrus.Errorf("gocloud run err:%v", err)
} }
@ -42,11 +41,6 @@ func initFuns() error {
if err != nil { if err != nil {
return err 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.Web.Use(gocloud.MidAccessAllowFun)
gocloud.RegController(&route.IndexHandler{}) gocloud.RegController(&route.IndexHandler{})
/*gocloud.Web.FuncMap["MgrsHost"] = func() string { /*gocloud.Web.FuncMap["MgrsHost"] = func() string {
@ -66,6 +60,10 @@ func SyncTable() error {
} }
func StartConnEngine(host string) { func StartConnEngine(host string) {
if host == "" {
logrus.Error("StartConnEngine run err:host is empty")
os.Exit(1)
}
eng := hbtp.NewEngine(context.Background()) eng := hbtp.NewEngine(context.Background())
eng.RegFun(1, hbtp.RPCFunHandle(&routehb.CommRPC{})) eng.RegFun(1, hbtp.RPCFunHandle(&routehb.CommRPC{}))
eng.RegFun(2, hbtp.RPCFunHandle(&routehb.UserRPC{})) eng.RegFun(2, hbtp.RPCFunHandle(&routehb.UserRPC{}))

4
webs/sys/route/index.go

@ -13,8 +13,8 @@ func (IndexHandler) GetMid() gin.HandlerFunc {
return nil return nil
} }
func (c *IndexHandler) Routes(g gin.IRoutes) { 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") c.String(200, "hello")
} }

3
webs/sys/routehb/user.go

@ -2,6 +2,7 @@ package routehb
import ( import (
"GoClouds/core/bean/sysBean" "GoClouds/core/bean/sysBean"
"GoClouds/core/cloud/commCloud"
"GoClouds/core/comms" "GoClouds/core/comms"
"GoClouds/core/utils" "GoClouds/core/utils"
"GoClouds/models" "GoClouds/models"
@ -178,7 +179,7 @@ func (UserRPC) Uppass(c *hbtp.Context, m *sysBean.UppassReq) {
c.ResJson(hbtp.ResStatusOk, ret) c.ResJson(hbtp.ResStatusOk, ret)
return return
} }
if ne.Name == "bbtpt" /*||sysCloud.CheckPermission(ne.Id,"user:uppass")*/ {
if commCloud.CheckPermission(ne.Xid, "comm:uppass") {
ret.Errs = "该用户禁止修改密码" ret.Errs = "该用户禁止修改密码"
c.ResJson(hbtp.ResStatusOk, ret) c.ResJson(hbtp.ResStatusOk, ret)
return return

Loading…
Cancel
Save