Browse Source

feat: 获取erp用户信息

2637309949 4 years ago
parent
commit
e7155be719

+ 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-20210615090349-f7bddc376275
+	git.i2edu.net/i2/i2-bill-erp v0.0.0-20210622060700-13e3b8900ff0
 	github.com/dgrijalva/jwt-go v3.2.0+incompatible
 	github.com/satori/go.uuid v1.2.0
 	gopkg.in/yaml.v2 v2.4.0

+ 7 - 15
go.sum

@@ -1,10 +1,9 @@
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
-git.i2edu.net/i2/go-zero v1.0.0 h1:tB6YOQ4PwOkZwIrzXV+fv6rZajohZbdsBTLw+PHjo3E=
 git.i2edu.net/i2/go-zero v1.0.0/go.mod h1:a9idDtfMmMXrZIHyDg6XnYjWuCpKG0I6zv6Vo9Fpncc=
 git.i2edu.net/i2/go-zero v1.0.1-0.20210616091154-7fac117e009f h1:zD6rIG7+PhJwYXuQbHyw1pn/z5oUXzrUg9bo9F9+b5k=
 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-20210615090349-f7bddc376275 h1:HsXmEM5HnDNUd44de6CZ1OeDdCt/Z6oQN601WNZ5Pyo=
-git.i2edu.net/i2/i2-bill-erp v0.0.0-20210615090349-f7bddc376275/go.mod h1:oWdflHBfbc2hoh4cFsg8HaheBVGHcSTw38BnbGMrk7c=
+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=
 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=
@@ -41,7 +40,6 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
 github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQamW5YV28=
 github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
 github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
-github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
 github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
 github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -51,7 +49,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumC
 github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
 github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 h1:qk/FSDDxo05wdJH28W+p5yivv7LuLYLRXPPD8KQCtZs=
 github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
-github.com/emicklei/proto v1.9.0 h1:l0QiNT6Qs7Yj0Mb4X6dnWBQer4ebei2BFcgQLbGqUDc=
 github.com/emicklei/proto v1.9.0/go.mod h1:rn1FgRS/FANiZdD2djyH7TMA9jdRDcYQ9IEN9yvjX0A=
 github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
 github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -59,7 +56,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
 github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
 github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
-github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
 github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
 github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@@ -110,8 +106,9 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
 github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
 github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -132,8 +129,6 @@ github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplb
 github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 github.com/iancoleman/strcase v0.1.2/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
-github.com/iancoleman/strcase v0.1.3 h1:dJBk1m2/qjL1twPLf68JND55vvivMupZ4wIzE8CTdBw=
-github.com/iancoleman/strcase v0.1.3/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=
 github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
 github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
 github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
@@ -160,7 +155,6 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
 github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
 github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
 github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
 github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
@@ -218,7 +212,6 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
 github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
 github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
 github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
-github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
 github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
 github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
 github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
@@ -240,20 +233,18 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
 github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/thoas/go-funk v0.8.0/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
 github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
 github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc=
 github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
 github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
-github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
 github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
 github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
 github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
-github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 h1:zzrxE1FKn5ryBNl9eKOeqQ58Y/Qpo3Q9QNxKHX5uzzQ=
 github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2/go.mod h1:hzfGeIUDq/j97IG+FhNqkowIyEcD88LrW6fyU3K3WqY=
 github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
 github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox0hTHlnpkcOTuFIDQpZ1IN8rKKhX0=
 github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ=
-github.com/zeromicro/antlr v0.0.1 h1:CQpIn/dc0pUjgGQ81y98s/NGOm2Hfru2NNio2I9mQgk=
 github.com/zeromicro/antlr v0.0.1/go.mod h1:nfpjEwFR6Q4xGDJMcZnCL9tEfQRgszMwu3rDz2Z+p5M=
 go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg=
 go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
@@ -380,8 +371,9 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
 google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
-google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
 google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
+google.golang.org/protobuf v1.26.0-rc.1 h1:7QnIQpGRHE5RnLKnESfDoxm2dTapTZua5a0kS0A+VXQ=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
 gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

+ 13 - 12
i2bill.api

@@ -50,7 +50,6 @@ type loginByWeixinRequest {
 type AuthUserInfo {
 	ID       int64  `json:"id"`
 	Mobile   string `json:"mobile"`
-	ErpRoles string `json:"erpRoles"`
 	UserName string `json:"username"`
 	NickName string `json:"nickname"`
 	Gender   int64  `json:"gender"`
@@ -77,14 +76,16 @@ type bindMobileResponse {
 	Id int64 `json:"id"`
 }
 
-type request {
-	// TODO: add members here and delete this comment
-	Id int64 `form:"id"`
-}
-
-type response {
-	// TODO: add members here and delete this comment
-	Id int64 `json:"id"`
+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"`
 }
 
 service i2bill-api {
@@ -99,11 +100,11 @@ service i2bill-api {
 )
 service i2bill-api {
 	@handler JzQrCode
-	get /api/users/share/jzQrcode returns(jzQrcodeResponse)
+	get /api/user/share/jzQrcode returns(jzQrcodeResponse)
 	
 	@handler BindMobile
-	post /api/users/bindMobile(bindMobileRequest) returns(bindMobileResponse)
+	post /api/user/bindMobile(bindMobileRequest) returns(bindMobileResponse)
 	
 	@handler GetUser
-	get /api/users/id/:userId(request) returns(response)
+	get /api/user/info returns(infoResponse)
 }

+ 1 - 7
internal/handler/getuserhandler.go

@@ -5,7 +5,6 @@ import (
 
 	"git.i2edu.net/i2/i2-bill-api/internal/logic"
 	"git.i2edu.net/i2/i2-bill-api/internal/svc"
-	"git.i2edu.net/i2/i2-bill-api/internal/types"
 	"git.i2edu.net/i2/i2-bill-api/internal/utils"
 
 	"git.i2edu.net/i2/go-zero/rest/httpx"
@@ -13,11 +12,6 @@ import (
 
 func GetUserHandler(ctx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.Request
-		if err := httpx.Parse(r, &req); err != nil {
-			httpx.OkJson(w, utils.ReturnHTTPFail(err))
-			return
-		}
 		uid, err := ctx.GetUserId(r)
 		if err != nil {
 			httpx.OkJson(w, utils.ReturnHTTPFail(err))
@@ -31,7 +25,7 @@ func GetUserHandler(ctx *svc.ServiceContext) http.HandlerFunc {
 		l := logic.NewGetUserLogic(r.Context(), ctx)
 		l.UserId = uid
 		l.SessionKey = sid
-		resp, err := l.GetUser(req)
+		resp, err := l.GetUser()
 		if err != nil {
 			httpx.OkJson(w, utils.ReturnHTTPFail(err))
 		} else {

+ 3 - 3
internal/handler/routes.go

@@ -29,17 +29,17 @@ func RegisterHandlers(engine *rest.Server, serverCtx *svc.ServiceContext) {
 		[]rest.Route{
 			{
 				Method:  http.MethodGet,
-				Path:    "/api/users/share/jzQrcode",
+				Path:    "/api/user/share/jzQrcode",
 				Handler: JzQrCodeHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodPost,
-				Path:    "/api/users/bindMobile",
+				Path:    "/api/user/bindMobile",
 				Handler: BindMobileHandler(serverCtx),
 			},
 			{
 				Method:  http.MethodGet,
-				Path:    "/api/users/id/:userId",
+				Path:    "/api/user/info",
 				Handler: GetUserHandler(serverCtx),
 			},
 		},

+ 24 - 2
internal/logic/getuserlogic.go

@@ -5,6 +5,8 @@ import (
 
 	"git.i2edu.net/i2/i2-bill-api/internal/svc"
 	"git.i2edu.net/i2/i2-bill-api/internal/types"
+	"git.i2edu.net/i2/i2-bill-api/model"
+	"git.i2edu.net/i2/i2-bill-erp/transform"
 
 	"git.i2edu.net/i2/go-zero/core/logx"
 )
@@ -25,6 +27,26 @@ func NewGetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) GetUserLog
 	}
 }
 
-func (l *GetUserLogic) GetUser(req types.Request) (*types.Response, error) {
-	return &types.Response{}, nil
+func (l *GetUserLogic) GetUser() (*types.InfoResponse, error) {
+	var user model.User
+	err := l.svcCtx.SqlConn.QueryRow(&user, "select id, erp_id, avatar, birthday, username, nickname, gender, mobile from user where `id` = ? limit 1", l.UserId)
+	if err != nil {
+		logx.Error(err)
+		return nil, err
+	}
+	resp, err := l.svcCtx.Transformer.GetUser(l.ctx, &transform.UserRequest{Id: user.ErpId, Phone: user.Mobile})
+	if err != nil {
+		logx.Error(err)
+		return nil, err
+	}
+	info := &types.InfoResponse{}
+	info.ID = user.Id
+	info.Avatar = user.Avatar
+	info.Birthday = user.Birthday
+	info.UserName = user.Username
+	info.NickName = user.Nickname
+	info.Gender = user.Gender
+	info.IsJzMem = resp.IsJzMem
+	info.IsJzMk = resp.IsJzMk
+	return info, nil
 }

+ 3 - 0
internal/svc/servicecontext.go

@@ -130,6 +130,7 @@ func (wc *Wechat) DecryptMobile(sessionKey, encryptedData, iv string) (string, e
 	return decryptData.PhoneNumber, err
 }
 
+// GenQrCode defined TODO
 func (wc *Wechat) GenQrCode(scene, page string) (string, error) {
 	token, err := wc.GetAccessToken()
 	if err != nil {
@@ -154,6 +155,7 @@ type ServiceContext struct {
 	Transformer transformclient.Transform
 }
 
+// GetUserId defined TODO
 func (sc *ServiceContext) GetUserId(r *http.Request) (int64, error) {
 	parser := token.NewTokenParser(token.WithResetDuration(time.Minute))
 	tok, err := parser.ParseToken(r, sc.Config.JwtAuth.AccessSecret, "")
@@ -163,6 +165,7 @@ func (sc *ServiceContext) GetUserId(r *http.Request) (int64, error) {
 	return tok.Claims.(jwt.MapClaims)["user_id"].(int64), err
 }
 
+// GetSessionKey defined TODO
 func (sc *ServiceContext) GetSessionKey(r *http.Request) (string, error) {
 	parser := token.NewTokenParser(token.WithResetDuration(time.Minute))
 	tok, err := parser.ParseToken(r, sc.Config.JwtAuth.AccessSecret, "")

+ 10 - 7
internal/types/types.go

@@ -43,7 +43,6 @@ type LoginByWeixinRequest struct {
 type AuthUserInfo struct {
 	ID       int64  `json:"id"`
 	Mobile   string `json:"mobile"`
-	ErpRoles string `json:"erpRoles"`
 	UserName string `json:"username"`
 	NickName string `json:"nickname"`
 	Gender   int64  `json:"gender"`
@@ -70,10 +69,14 @@ type BindMobileResponse struct {
 	Id int64 `json:"id"`
 }
 
-type Request struct {
-	Id int64 `form:"id"`
-}
-
-type Response struct {
-	Id int64 `json:"id"`
+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"`
 }

+ 1 - 1
model/user.sql

@@ -1,7 +1,7 @@
 DROP TABLE IF EXISTS `user`;
 CREATE TABLE `user` (
   `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
-  `erp_id` int(11) unsigned NOT NULL DEFAULT '0',
+  `erp_id` varchar(36) NOT NULL DEFAULT '',
   `username` varchar(60) NOT NULL DEFAULT '',
   `password` varchar(32) NOT NULL DEFAULT '',
   `gender` tinyint(1) unsigned NOT NULL DEFAULT '0',

+ 1 - 1
model/usermodel.go

@@ -55,7 +55,7 @@ type (
 		LastLoginTime int64  `db:"last_login_time"`
 		Nickname      string `db:"nickname"`
 		Id            int64  `db:"id"`
-		ErpId         int64  `db:"erp_id"`
+		ErpId         string `db:"erp_id"`
 		Username      string `db:"username"`
 		Gender        int64  `db:"gender"`
 		UserLevelId   int64  `db:"user_level_id"`