瀏覽代碼

Merge branch 'master' of https://git.i2edu.net/i2/i2-bill-api into master

 Conflicts:
	go.sum
	i2bill.api
	internal/types/types.go
icole 4 年之前
父節點
當前提交
988a949211

二進制
asserts/qrcode/123.png


+ 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
 	github.com/tal-tech/go-zero v1.1.7 // indirect

+ 7 - 20
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,10 +56,8 @@ 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 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
 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=
@@ -111,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=
@@ -133,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=
@@ -161,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=
@@ -183,7 +176,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
 github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
 github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
-github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
 github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
 github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
 github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
@@ -220,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=
@@ -242,22 +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/tal-tech/go-zero v1.1.7 h1:rs78kI5ZiBx1RIl562qDzkBV8P7CdnbCiljknyC4mXg=
-github.com/tal-tech/go-zero v1.1.7/go.mod h1:BEylLQnv5moldpMT1lH3kUoMEcdaIp+r9Lgp+41dXxg=
+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=
@@ -291,7 +278,6 @@ golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7
 golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
 golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
 golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
-golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
 golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
 golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -385,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=

+ 46 - 21
i2bill.api

@@ -21,16 +21,17 @@ type Watermark {
 }
 
 type WXUserInfo {
-	OpenID    string    `json:"openId,omitempty"`
-	NickName  string    `json:"nickName"`
-	AvatarUrl string    `json:"avatarUrl"`
-	Gender    int64     `json:"gender"`
-	Country   string    `json:"country"`
-	Province  string    `json:"province"`
-	City      string    `json:"city"`
-	UnionID   string    `json:"unionId,omitempty"`
-	Language  string    `json:"language"`
-	Watermark Watermark `json:"watermark,omitempty"`
+	OpenID     string    `json:"openId,omitempty"`
+	SessionKey string    `json:"SessionKey"`
+	NickName   string    `json:"nickName"`
+	AvatarUrl  string    `json:"avatarUrl"`
+	Gender     int64     `json:"gender"`
+	Country    string    `json:"country"`
+	Province   string    `json:"province"`
+	City       string    `json:"city"`
+	UnionID    string    `json:"unionId,omitempty"`
+	Language   string    `json:"language"`
+	Watermark  Watermark `json:"watermark,omitempty"`
 }
 
 type ResUserInfo {
@@ -41,7 +42,7 @@ type ResUserInfo {
 	IV            string     `json:"iv"`
 }
 
-type authLoginBody {
+type loginByWeixinRequest {
 	Code string `json:"code"`
 	// UserInfo ResUserInfo `json:"userInfo"`
 }
@@ -49,7 +50,6 @@ type authLoginBody {
 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"`
@@ -57,18 +57,22 @@ type AuthUserInfo {
 	Birthday int64  `json:"birthday"`
 }
 
-type authResponse {
+type loginByWeixinResponse {
 	Token    string       `json:"token"`
 	UserInfo AuthUserInfo `json:"userInfo"`
 }
 
-type request {
-	// TODO: add members here and delete this comment
-	Id int64 `form:"id"`
+type jzQrcodeResponse {
+	Id     int64  `json:"id"`
+	FileId string `json:"fileId"`
 }
 
-type response {
-	// TODO: add members here and delete this comment
+type bindMobileRequest {
+	Iv            string `json:"iv"`
+	EncryptedData string `json:"encryptedData"`
+}
+
+type bindMobileResponse {
 	Id int64 `json:"id"`
 }
 
@@ -80,19 +84,40 @@ type partTimeUserAddRequest {
 	CityId      int64  `json:"city_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 {
-	@handler Hello // TODO
+	@handler Hello
 	get /api/hello
-	@handler LoginByWeixin // TODO
-	post /api/auth/loginByWeixin(authLoginBody) returns(authResponse)
+	@handler LoginByWeixin
+	post /api/auth/loginByWeixin(loginByWeixinRequest) returns(loginByWeixinResponse)
 }
 
 @server(
 	jwt: JwtAuth
 )
 service i2bill-api {
+	@handler JzQrCode
+	get /api/user/share/jzQrcode returns(jzQrcodeResponse)
+
+	@handler BindMobile
+	post /api/user/bindMobile(bindMobileRequest) returns(bindMobileResponse)
+
+	@handler GetUser
+	get /api/user/info returns(infoResponse)
 	@handler GetUser // TODO: set handler name and delete this comment
 	get /api/users/id/:userId(request) returns(response)
+
 	@handler  PartTimeUserAd
 	post /api/v1/part_time_user/add (partTimeUserAddRequest) returns(response)
 }

+ 36 - 0
internal/handler/bindmobilehandler.go

@@ -0,0 +1,36 @@
+package handler
+
+import (
+	"net/http"
+
+	"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"
+)
+
+func BindMobileHandler(ctx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.BindMobileRequest
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.OkJson(w, utils.ReturnHTTPFail(err))
+			return
+		}
+		uid, skey, err := ctx.GetClaims(r)
+		if err != nil {
+			httpx.OkJson(w, utils.ReturnHTTPFail(err))
+			return
+		}
+		l := logic.NewBindMobileLogic(r.Context(), ctx)
+		l.UserId = uid
+		l.SessionKey = skey
+		resp, err := l.BindMobile(req)
+		if err != nil {
+			httpx.OkJson(w, utils.ReturnHTTPFail(err))
+		} else {
+			httpx.OkJson(w, utils.ReturnHTTPSuccess(resp))
+		}
+	}
+}

+ 9 - 15
internal/handler/getuserhandler.go

@@ -1,36 +1,30 @@
 package handler
 
 import (
-	"fmt"
 	"net/http"
-	"time"
 
 	"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"
-	"git.i2edu.net/i2/go-zero/rest/token"
 )
 
 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.Error(w, err)
+		uid, skey, err := ctx.GetClaims(r)
+		if err != nil {
+			httpx.OkJson(w, utils.ReturnHTTPFail(err))
 			return
 		}
-		token.NewTokenParser()
-		parser := token.NewTokenParser(token.WithResetDuration(time.Minute))
-		tok, err := parser.ParseToken(r, ctx.Config.JwtAuth.AccessSecret, "")
-		fmt.Println("tok", tok)
-		fmt.Println("err", err)
 		l := logic.NewGetUserLogic(r.Context(), ctx)
-		resp, err := l.GetUser(req)
+		l.UserId = uid
+		l.SessionKey = skey
+		resp, err := l.GetUser()
 		if err != nil {
-			httpx.Error(w, err)
+			httpx.OkJson(w, utils.ReturnHTTPFail(err))
 		} else {
-			httpx.OkJson(w, resp)
+			httpx.OkJson(w, utils.ReturnHTTPSuccess(resp))
 		}
 	}
 }

+ 29 - 0
internal/handler/jzqrcodehandler.go

@@ -0,0 +1,29 @@
+package handler
+
+import (
+	"net/http"
+
+	"git.i2edu.net/i2/go-zero/rest/httpx"
+	"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/utils"
+)
+
+func JzQrCodeHandler(ctx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		uid, skey, err := ctx.GetClaims(r)
+		if err != nil {
+			httpx.OkJson(w, utils.ReturnHTTPFail(err))
+			return
+		}
+		l := logic.NewJzQrCodeLogic(r.Context(), ctx)
+		l.UserId = uid
+		l.SessionKey = skey
+		resp, err := l.JzQrCode()
+		if err != nil {
+			httpx.OkJson(w, utils.ReturnHTTPFail(err))
+		} else {
+			httpx.OkJson(w, utils.ReturnHTTPSuccess(resp))
+		}
+	}
+}

+ 4 - 4
internal/handler/loginbyweixinhandler.go

@@ -12,17 +12,17 @@ import (
 
 func LoginByWeixinHandler(ctx *svc.ServiceContext) http.HandlerFunc {
 	return func(w http.ResponseWriter, r *http.Request) {
-		var req types.AuthLoginBody
+		var req types.LoginByWeixinRequest
 		if err := httpx.Parse(r, &req); err != nil {
-			httpx.Error(w, err)
+			httpx.OkJson(w, utils.ReturnHTTPFail(err))
 			return
 		}
 		l := logic.NewLoginByWeixinLogic(r.Context(), ctx)
-		res, err := l.LoginByWeixin(req)
+		resp, err := l.LoginByWeixin(req)
 		if err != nil {
 			httpx.OkJson(w, utils.ReturnHTTPFail(err))
 		} else {
-			httpx.OkJson(w, utils.ReturnHTTPSuccess(res))
+			httpx.OkJson(w, utils.ReturnHTTPSuccess(resp))
 		}
 	}
 }

+ 11 - 1
internal/handler/routes.go

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

+ 43 - 0
internal/logic/bindmobilelogic.go

@@ -0,0 +1,43 @@
+package logic
+
+import (
+	"context"
+
+	"git.i2edu.net/i2/i2-bill-api/internal/svc"
+	"git.i2edu.net/i2/i2-bill-api/internal/types"
+
+	"git.i2edu.net/i2/go-zero/core/logx"
+)
+
+type BindMobileLogic struct {
+	logx.Logger
+	ctx        context.Context
+	svcCtx     *svc.ServiceContext
+	UserId     int64
+	SessionKey string
+}
+
+func NewBindMobileLogic(ctx context.Context, svcCtx *svc.ServiceContext) BindMobileLogic {
+	return BindMobileLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *BindMobileLogic) BindMobile(req types.BindMobileRequest) (*types.BindMobileResponse, error) {
+	mobile, err := l.svcCtx.Wechat.DecryptMobile(l.SessionKey, req.EncryptedData, req.Iv)
+	if err != nil {
+		logx.Error(err)
+		return nil, err
+	}
+	_, err = l.svcCtx.SqlConn.Exec(`update user set 
+	mobile = ? where id = ?`, mobile, l.UserId)
+	if err != nil {
+		logx.Error(err)
+		return nil, err
+	}
+	return &types.BindMobileResponse{
+		Id: l.UserId,
+	}, nil
+}

+ 28 - 4
internal/logic/getuserlogic.go

@@ -5,14 +5,18 @@ 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"
 )
 
 type GetUserLogic struct {
 	logx.Logger
-	ctx    context.Context
-	svcCtx *svc.ServiceContext
+	ctx        context.Context
+	svcCtx     *svc.ServiceContext
+	UserId     int64
+	SessionKey string
 }
 
 func NewGetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) GetUserLogic {
@@ -23,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.QueryRowPartial(&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
 }

+ 41 - 0
internal/logic/jzqrcodelogic.go

@@ -0,0 +1,41 @@
+package logic
+
+import (
+	"context"
+
+	"git.i2edu.net/i2/i2-bill-api/internal/svc"
+	"git.i2edu.net/i2/i2-bill-api/internal/types"
+
+	"git.i2edu.net/i2/go-zero/core/logx"
+)
+
+type JzQrCodeLogic struct {
+	logx.Logger
+	ctx        context.Context
+	svcCtx     *svc.ServiceContext
+	UserId     int64
+	SessionKey string
+}
+
+var qrcodeJzPrefix = "qrcode:jz:%v"
+
+func NewJzQrCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) JzQrCodeLogic {
+	return JzQrCodeLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *JzQrCodeLogic) JzQrCode() (*types.JzQrcodeResponse, error) {
+	uid, err := l.svcCtx.Wechat.GenQrId(qrcodeJzPrefix, map[string]interface{}{
+		"userId": l.UserId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	uri, err := l.svcCtx.Wechat.GenQrCode(uid, "index/user")
+	return &types.JzQrcodeResponse{
+		FileId: uri,
+	}, err
+}

+ 18 - 8
internal/logic/loginbyweixinlogic.go

@@ -29,15 +29,16 @@ func NewLoginByWeixinLogic(ctx context.Context, svcCtx *svc.ServiceContext) Logi
 	}
 }
 
-func (l *LoginByWeixinLogic) LoginByWeixin(req types.AuthLoginBody) (*types.AuthResponse, error) {
-	alb, rtnInfo := req, types.AuthResponse{}
+func (l *LoginByWeixinLogic) LoginByWeixin(req types.LoginByWeixinRequest) (*types.LoginByWeixinResponse, error) {
+	alb, rtnInfo := req, types.LoginByWeixinResponse{}
 	userInfo, err := l.Login(alb.Code)
 	if err != nil {
+		logx.Error(err)
 		return nil, err
 	}
 	err = l.svcCtx.SqlConn.Transact(func(session sqlx.Session) error {
 		var user model.User
-		err := session.QueryRow(&user, fmt.Sprintf("select %s from user where `weixin_openid` = ? limit 1", model.UserRows), userInfo.OpenID)
+		err := session.QueryRowPartial(&user, fmt.Sprintf("select %s from user where `weixin_openid` = ? limit 1", model.UserRows), userInfo.OpenID)
 		if err == sqlc.ErrNotFound {
 			user.Username = utils.GetUUID()
 			user.Password = ""
@@ -48,12 +49,17 @@ func (l *LoginByWeixinLogic) LoginByWeixin(req types.AuthLoginBody) (*types.Auth
 			user.Avatar = userInfo.AvatarUrl
 			user.Gender = userInfo.Gender
 			user.Nickname = userInfo.NickName
-			_, err = session.Exec(fmt.Sprintf("insert into user (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", model.UserRowsExpectAutoSet), user.Mobile, user.Avatar, user.WeixinOpenid, user.Password, user.Birthday, user.RegisterTime, user.LastLoginTime, user.Nickname, user.Username, user.Gender, user.UserLevelId, user.RegisterIp, user.LastLoginIp)
+			_, err = session.Exec(`insert into user (%s) values (
+				mobile, avatar, weixin_openid, password, birthday, register_time, last_login_time, nickname, erp_id, username, gender, user_level_id, register_ip, last_login_ip
+			)`,
+				user.Mobile, user.Avatar, user.WeixinOpenid, user.Password, user.Birthday, user.RegisterTime, user.LastLoginTime, user.Nickname, user.ErpId, user.Username, user.Gender, user.UserLevelId, user.RegisterIp, user.LastLoginIp)
 			if err != nil {
+				logx.Error(err)
 				return err
 			}
-			err = session.QueryRow(&user, fmt.Sprintf("select %s from user where `weixin_openid` = ? limit 1", model.UserRows), userInfo.OpenID)
+			err = session.QueryRowPartial(&user, fmt.Sprintf("select %s from user where `weixin_openid` = ? limit 1", model.UserRows), userInfo.OpenID)
 			if err != nil {
+				logx.Error(err)
 				return err
 			}
 		}
@@ -68,8 +74,10 @@ func (l *LoginByWeixinLogic) LoginByWeixin(req types.AuthLoginBody) (*types.Auth
 
 		user.LastLoginIp = ""
 		user.LastLoginTime = utils.GetTimestamp()
-		_, err = session.Exec(fmt.Sprintf("update user set %s where `id` = ?", model.UserRowsWithPlaceHolder), user.Mobile, user.Avatar, user.WeixinOpenid, user.Password, user.Birthday, user.RegisterTime, user.LastLoginTime, user.Nickname, user.Username, user.Gender, user.UserLevelId, user.RegisterIp, user.LastLoginIp, user.Id)
+		_, err = session.Exec(`update user set 
+		mobile = ?, avatar = ?, weixin_openid = ?, password = ?, birthday = ?, register_time = ?, last_login_time = ?, nickname = ?, erp_id = ?, username = ?, gender = ?, user_level_id = ?, register_ip = ?, last_login_ip = ? where id = ?`, user.Mobile, user.Avatar, user.WeixinOpenid, user.Password, user.Birthday, user.RegisterTime, user.LastLoginTime, user.Nickname, user.ErpId, user.Username, user.Gender, user.UserLevelId, user.RegisterIp, user.LastLoginIp, user.Id)
 		if err != nil {
+			logx.Error(err)
 			return err
 		}
 		return nil
@@ -80,10 +88,12 @@ func (l *LoginByWeixinLogic) LoginByWeixin(req types.AuthLoginBody) (*types.Auth
 	var accessExpire = l.svcCtx.Config.JwtAuth.AccessExpire
 	now := time.Now().Unix()
 	payloads := map[string]interface{}{
-		"user_id": rtnInfo.UserInfo.ID,
+		"userId":     rtnInfo.UserInfo.ID,
+		"sessionKey": userInfo.SessionKey,
 	}
 	accessToken, err := l.CreateJWT(now, l.svcCtx.Config.JwtAuth.AccessSecret, payloads, accessExpire)
 	if err != nil {
+		logx.Error(err)
 		return nil, err
 	}
 	rtnInfo.Token = accessToken
@@ -113,9 +123,9 @@ func (l *LoginByWeixinLogic) Login(code string) (*types.WXUserInfo, error) {
 
 	var res types.WXLoginResponse
 	req.ToJSON(&res)
-
 	userinfo, err := l.DecryptUserInfoData(res.SessionKey)
 	userinfo.OpenID = res.OpenID
+	userinfo.SessionKey = res.SessionKey
 	return userinfo, err
 
 }

+ 118 - 6
internal/svc/servicecontext.go

@@ -1,16 +1,24 @@
 package svc
 
 import (
+	"crypto/aes"
+	"crypto/cipher"
+	"encoding/base64"
+	"encoding/json"
 	"fmt"
+	"net/http"
 	"path"
+	"strconv"
 	"time"
 
 	"git.i2edu.net/i2/go-zero/core/stores/sqlx"
+	"git.i2edu.net/i2/go-zero/rest/token"
 	"git.i2edu.net/i2/go-zero/zrpc"
 	"git.i2edu.net/i2/i2-bill-api/internal/config"
 	"git.i2edu.net/i2/i2-bill-api/internal/utils"
 	"git.i2edu.net/i2/i2-bill-api/model"
 	"git.i2edu.net/i2/i2-bill-erp/transformclient"
+	"github.com/dgrijalva/jwt-go"
 )
 
 const cacheWechatTokenPrefix = "cache:wechat:token:"
@@ -28,7 +36,18 @@ type Wechat struct {
 	c     config.Config
 }
 
-// GetAccessToken defined
+// WechatPhonedecrypt defined TODO
+type WechatPhonedecrypt struct {
+	PhoneNumber     string `json:"phoneNumber"`
+	PurePhoneNumber string `json:"purePhoneNumber"`
+	CountryCode     string `json:"countryCode"`
+	Watermark       struct {
+		Appid     string `json:"appid"`
+		Timestamp int32  `json:"timestamp"`
+	} `json:"watermark"`
+}
+
+// GetAccessToken defined TODO
 func (wc *Wechat) GetAccessToken() (string, error) {
 	token := ""
 	err := wc.RdCli.GetCache(cacheWechatTokenPrefix, &token)
@@ -45,7 +64,6 @@ func (wc *Wechat) GetAccessToken() (string, error) {
 		if err != nil {
 			return "", err
 		}
-		fmt.Println(res)
 		token = res.AccessToken
 		err := wc.RdCli.SetWithExpire(cacheWechatTokenPrefix, res.AccessToken, time.Duration((res.ExpiresIn-60*2))*time.Second)
 		if err != nil {
@@ -55,14 +73,72 @@ func (wc *Wechat) GetAccessToken() (string, error) {
 	return token, nil
 }
 
-// GetAccessToken defined
-func (wc *Wechat) GetQrCode(scene, page string) (string, error) {
+// GenQrId defined TODO
+func (wc *Wechat) GenQrId(prefix string, params interface{}) (string, error) {
+	uuid := utils.GetUUID()
+	ube, err := json.Marshal(params)
+	if err != nil {
+		return "", err
+	}
+	err = wc.RdCli.SetWithExpire(fmt.Sprintf(prefix, uuid), string(ube), time.Duration(1)*time.Hour)
+	return uuid, err
+}
+
+// GetQrParams defined TODO
+func (wc *Wechat) GetQrParams(prefix string, uuid string, params interface{}) error {
+	ube := ""
+	err := wc.RdCli.GetCache(fmt.Sprintf(prefix, uuid), &ube)
+	if err != nil {
+		return err
+	}
+	err = json.Unmarshal([]byte(ube), params)
+	if err != nil {
+		return err
+	}
+	return err
+}
+
+// GetQrParams defined TODO
+func (wc *Wechat) DecryptMobile(sessionKey, encryptedData, iv string) (string, error) {
+	key, err := base64.StdEncoding.DecodeString(sessionKey)
+	if err != nil {
+		return "", err
+	}
+	bIv, err := base64.StdEncoding.DecodeString(iv)
+	if err != nil {
+		return "", err
+	}
+	bEncryptedData, err := base64.StdEncoding.DecodeString(encryptedData)
+	if err != nil {
+		return "", err
+	}
+	block, err := aes.NewCipher(key)
+	if err != nil {
+		return "", err
+	}
+	var decrypt = bEncryptedData
+	blockMode := cipher.NewCBCDecrypter(block, bIv)
+	blockMode.CryptBlocks(decrypt, bEncryptedData)
+	length := len(decrypt)
+	unpadding := int(decrypt[length-1])
+	decData := decrypt[:(length - unpadding)]
+
+	decryptData := WechatPhonedecrypt{}
+	err = json.Unmarshal(decData, &decryptData)
+	if err != nil {
+		return "", err
+	}
+	return decryptData.PhoneNumber, err
+}
+
+// GenQrCode defined TODO
+func (wc *Wechat) GenQrCode(scene, page string) (string, error) {
 	token, err := wc.GetAccessToken()
 	if err != nil {
 		return "", err
 	}
-	req := utils.Post("https://api.weixin.qq.com/wxa/getwxacodeunlimit")
-	req.Param("access_token", token)
+	req := utils.Post("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + token)
+	req.JSONBody(map[string]interface{}{"scene": scene})
 	ph := path.Join("asserts", "qrcode", scene+".png")
 	err = req.ToFile(ph)
 	if err != nil {
@@ -80,6 +156,42 @@ type ServiceContext struct {
 	Transformer transformclient.Transform
 }
 
+// GetUserId defined TODO
+func (sc *ServiceContext) GetClaims(r *http.Request) (int64, string, error) {
+	parser := token.NewTokenParser(token.WithResetDuration(time.Minute))
+	tok, err := parser.ParseToken(r, sc.Config.JwtAuth.AccessSecret, "")
+	if err != nil {
+		return 0, "", err
+	}
+	userId, sessionKey := int64(0), ""
+	m := tok.Claims.(jwt.MapClaims)
+	switch nbf := m["userId"].(type) {
+	case string:
+		i, err := strconv.ParseInt(nbf, 10, 64)
+		if err != nil {
+			return 0, "", err
+		}
+		userId = i
+	case json.Number:
+		v, err := nbf.Int64()
+		if err != nil {
+			return 0, "", err
+		}
+		userId = v
+	}
+	switch nbf := m["sessionKey"].(type) {
+	case string:
+		sessionKey = nbf
+	case json.Number:
+		v, err := nbf.Int64()
+		if err != nil {
+			return 0, "", err
+		}
+		sessionKey = fmt.Sprintf("%v", v)
+	}
+	return userId, sessionKey, err
+}
+
 func NewServiceContext(c config.Config) *ServiceContext {
 	svc := &ServiceContext{
 		Config:      c,

+ 34 - 16
internal/types/types.go

@@ -15,16 +15,17 @@ type Watermark struct {
 }
 
 type WXUserInfo struct {
-	OpenID    string    `json:"openId,omitempty"`
-	NickName  string    `json:"nickName"`
-	AvatarUrl string    `json:"avatarUrl"`
-	Gender    int64     `json:"gender"`
-	Country   string    `json:"country"`
-	Province  string    `json:"province"`
-	City      string    `json:"city"`
-	UnionID   string    `json:"unionId,omitempty"`
-	Language  string    `json:"language"`
-	Watermark Watermark `json:"watermark,omitempty"`
+	OpenID     string    `json:"openId,omitempty"`
+	SessionKey string    `json:"SessionKey"`
+	NickName   string    `json:"nickName"`
+	AvatarUrl  string    `json:"avatarUrl"`
+	Gender     int64     `json:"gender"`
+	Country    string    `json:"country"`
+	Province   string    `json:"province"`
+	City       string    `json:"city"`
+	UnionID    string    `json:"unionId,omitempty"`
+	Language   string    `json:"language"`
+	Watermark  Watermark `json:"watermark,omitempty"`
 }
 
 type ResUserInfo struct {
@@ -35,14 +36,13 @@ type ResUserInfo struct {
 	IV            string     `json:"iv"`
 }
 
-type AuthLoginBody struct {
+type LoginByWeixinRequest struct {
 	Code string `json:"code"`
 }
 
 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"`
@@ -50,19 +50,37 @@ type AuthUserInfo struct {
 	Birthday int64  `json:"birthday"`
 }
 
-type AuthResponse struct {
+type LoginByWeixinResponse struct {
 	Token    string       `json:"token"`
 	UserInfo AuthUserInfo `json:"userInfo"`
 }
 
-type Request struct {
-	Id int64 `form:"id"`
+type JzQrcodeResponse struct {
+	Id     int64  `json:"id"`
+	FileId string `json:"fileId"`
 }
 
-type Response struct {
+type BindMobileRequest struct {
+	Iv            string `json:"iv"`
+	EncryptedData string `json:"encryptedData"`
+}
+
+type BindMobileResponse 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"`
+}
+
 type PartTimeUserAddRequest struct {
 	Name        string `json:"name"`
 	IponeNumber string `json:"ipone_number"`

+ 2 - 1
internal/utils/http.go

@@ -7,6 +7,7 @@ import (
 	"crypto/tls"
 	"encoding/json"
 	"encoding/xml"
+	"fmt"
 	"io"
 	"io/ioutil"
 	"log"
@@ -405,6 +406,7 @@ func (b *HTTPRequest) getResponse() (*http.Response, error) {
 	if b.resp.StatusCode != 0 {
 		return b.resp, nil
 	}
+	fmt.Println(b.req.URL)
 	resp, err := b.DoRequest()
 	if err != nil {
 		return nil, err
@@ -438,7 +440,6 @@ func (b *HTTPRequest) doRequest(ctx context.Context) (resp *http.Response, err e
 		paramBody = buf.String()
 		paramBody = paramBody[0 : len(paramBody)-1]
 	}
-
 	b.buildURL(paramBody)
 	urlParsed, err := url.Parse(b.url)
 	if err != nil {

+ 1 - 1
model/user.sql

@@ -2,7 +2,7 @@
 DROP TABLE IF EXISTS `user`;
 CREATE TABLE `i2bill_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 - 2
model/usermodel.go

@@ -44,7 +44,6 @@ type (
 		sqlc.CachedConn
 		table string
 	}
-
 	User struct {
 		Mobile        string `db:"mobile"`
 		Avatar        string `db:"avatar"`
@@ -55,7 +54,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"`