Bladeren bron

fix: ErpRoleType

2637309949 4 jaren geleden
bovenliggende
commit
deea15a6cb
7 gewijzigde bestanden met toevoegingen van 30 en 25 verwijderingen
  1. 1 1
      go.mod
  2. 3 0
      go.sum
  3. 8 9
      i2bill.api
  4. 1 2
      internal/logic/bindmobilelogic.go
  5. 4 3
      internal/logic/getuserlogic.go
  6. 5 1
      internal/logic/hellologic.go
  7. 8 9
      internal/types/types.go

+ 1 - 1
go.mod

@@ -4,7 +4,7 @@ go 1.16
 
 require (
 	git.i2edu.net/i2/go-zero v1.0.1-0.20210616091154-7fac117e009f
-	git.i2edu.net/i2/i2-bill-erp v0.0.0-20210622060700-13e3b8900ff0
+	git.i2edu.net/i2/i2-bill-erp v0.0.0-20210623022310-19bfc0a41451
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
 	github.com/satori/go.uuid v1.2.0
 	gopkg.in/yaml.v2 v2.4.0

+ 3 - 0
go.sum

@@ -4,6 +4,8 @@ git.i2edu.net/i2/go-zero v1.0.1-0.20210616091154-7fac117e009f h1:zD6rIG7+PhJwYXu
 git.i2edu.net/i2/go-zero v1.0.1-0.20210616091154-7fac117e009f/go.mod h1:a9idDtfMmMXrZIHyDg6XnYjWuCpKG0I6zv6Vo9Fpncc=
 git.i2edu.net/i2/i2-bill-erp v0.0.0-20210622060700-13e3b8900ff0 h1:uP58UiI5mHqh1AaYzl5/SSGFQe2VApGxlMQZwjddmmo=
 git.i2edu.net/i2/i2-bill-erp v0.0.0-20210622060700-13e3b8900ff0/go.mod h1:z41FgmYvzNObeFdF0YekAkJpq7UwvLKfruqjqMLyhTw=
+git.i2edu.net/i2/i2-bill-erp v0.0.0-20210623022310-19bfc0a41451 h1:uDtYmC19dlGyhyfHMSORWUfizSTpf1T/nqg/c5DW0XE=
+git.i2edu.net/i2/i2-bill-erp v0.0.0-20210623022310-19bfc0a41451/go.mod h1:WymRAuTBomfIIWmSxOKOkF/0jPQw8KoQlw4C5W7D2rU=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 github.com/ClickHouse/clickhouse-go v1.4.3/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI=
@@ -61,6 +63,7 @@ github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03D
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
+github.com/go-errors/errors v1.4.0/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=

+ 8 - 9
i2bill.api

@@ -77,15 +77,14 @@ type bindMobileResponse {
 }
 
 type infoResponse {
-	ID       int64  `json:"id"`
-	Mobile   string `json:"mobile"`
-	UserName string `json:"username"`
-	NickName string `json:"nickname"`
-	Gender   int64  `json:"gender"`
-	Avatar   string `json:"avatar"`
-	Birthday int64  `json:"birthday"`
-	IsJzMem  bool   `json:"isJzMem"`
-	IsJzMk   bool   `json:"isJzMk"`
+	ID          int64  `json:"id"`
+	Mobile      string `json:"mobile"`
+	UserName    string `json:"username"`
+	NickName    string `json:"nickname"`
+	Gender      int64  `json:"gender"`
+	Avatar      string `json:"avatar"`
+	Birthday    int64  `json:"birthday"`
+	ErpRoleType int64  `json:"erpRoleType"`
 }
 
 service i2bill-api {

+ 1 - 2
internal/logic/bindmobilelogic.go

@@ -31,8 +31,7 @@ func (l *BindMobileLogic) BindMobile(req types.BindMobileRequest) (*types.BindMo
 		logx.Error(err)
 		return nil, err
 	}
-	_, err = l.svcCtx.SqlConn.Exec(`update user set 
-	mobile = ? where id = ?`, mobile, l.UserId)
+	_, err = l.svcCtx.SqlConn.Exec(`update user set mobile = ? where id = ?`, mobile, l.UserId)
 	if err != nil {
 		logx.Error(err)
 		return nil, err

+ 4 - 3
internal/logic/getuserlogic.go

@@ -34,7 +34,9 @@ func (l *GetUserLogic) GetUser() (*types.InfoResponse, error) {
 		logx.Error(err)
 		return nil, err
 	}
-	resp, err := l.svcCtx.Transformer.GetUser(l.ctx, &transform.UserRequest{Id: user.ErpId, Phone: user.Mobile})
+	// 每次都去查找, 暂时没有绑定
+	// resp, err := l.svcCtx.Transformer.GetUser(l.ctx, &transform.UserRequest{Id: user.ErpId, Phone: user.Mobile})
+	resp, err := l.svcCtx.Transformer.GetUser(l.ctx, &transform.UserRequest{Phone: user.Mobile})
 	if err != nil {
 		logx.Error(err)
 		return nil, err
@@ -46,7 +48,6 @@ func (l *GetUserLogic) GetUser() (*types.InfoResponse, error) {
 	info.UserName = user.Username
 	info.NickName = user.Nickname
 	info.Gender = user.Gender
-	info.IsJzMem = resp.IsJzMem
-	info.IsJzMk = resp.IsJzMk
+	info.ErpRoleType = resp.ErpRoleType
 	return info, nil
 }

+ 5 - 1
internal/logic/hellologic.go

@@ -23,6 +23,10 @@ func NewHelloLogic(ctx context.Context, svcCtx *svc.ServiceContext) HelloLogic {
 
 func (l *HelloLogic) Hello() error {
 	// todo: add your logic here and delete this line
-	l.svcCtx.Wechat.GetAccessToken()
+	// l.svcCtx.Wechat.GetAccessToken()
+	// _, err := l.svcCtx.Transformer.GetUser(l.ctx, &transform.UserRequest{Phone: "123123"})
+	// if err != nil {
+	// 	logx.Error(err)
+	// }
 	return nil
 }

+ 8 - 9
internal/types/types.go

@@ -70,13 +70,12 @@ type BindMobileResponse struct {
 }
 
 type InfoResponse struct {
-	ID       int64  `json:"id"`
-	Mobile   string `json:"mobile"`
-	UserName string `json:"username"`
-	NickName string `json:"nickname"`
-	Gender   int64  `json:"gender"`
-	Avatar   string `json:"avatar"`
-	Birthday int64  `json:"birthday"`
-	IsJzMem  bool   `json:"isJzMem"`
-	IsJzMk   bool   `json:"isJzMk"`
+	ID          int64  `json:"id"`
+	Mobile      string `json:"mobile"`
+	UserName    string `json:"username"`
+	NickName    string `json:"nickname"`
+	Gender      int64  `json:"gender"`
+	Avatar      string `json:"avatar"`
+	Birthday    int64  `json:"birthday"`
+	ErpRoleType int64  `json:"erpRoleType"`
 }