用户接口远程调用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

562 lines
15 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. // Code generated by protoc-gen-go.
  2. // source: user.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package userrpc is a generated protocol buffer package.
  6. It is generated from these files:
  7. user.proto
  8. It has these top-level messages:
  9. UserRequest
  10. UserInfoByUsername
  11. UserInfoByUsercode
  12. UserResponse
  13. LoginRequest
  14. LoginResponse
  15. Request
  16. Response
  17. */
  18. package userrpc
  19. import proto "github.com/chai2010/protorpc/proto"
  20. import math "math"
  21. import "io"
  22. import "log"
  23. import "net"
  24. import "net/rpc"
  25. import "time"
  26. import protorpc "github.com/chai2010/protorpc"
  27. // Reference imports to suppress errors if they are not otherwise used.
  28. var _ = proto.Marshal
  29. var _ = math.Inf
  30. // 使用token查询用户信息请求结构
  31. type UserRequest struct {
  32. Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
  33. Token *string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"`
  34. XXX_unrecognized []byte `json:"-"`
  35. }
  36. func (m *UserRequest) Reset() { *m = UserRequest{} }
  37. func (m *UserRequest) String() string { return proto.CompactTextString(m) }
  38. func (*UserRequest) ProtoMessage() {}
  39. func (m *UserRequest) GetDbname() string {
  40. if m != nil && m.Dbname != nil {
  41. return *m.Dbname
  42. }
  43. return ""
  44. }
  45. func (m *UserRequest) GetToken() string {
  46. if m != nil && m.Token != nil {
  47. return *m.Token
  48. }
  49. return ""
  50. }
  51. // 使用username查询用户信息请求结构
  52. type UserInfoByUsername struct {
  53. Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
  54. Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
  55. XXX_unrecognized []byte `json:"-"`
  56. }
  57. func (m *UserInfoByUsername) Reset() { *m = UserInfoByUsername{} }
  58. func (m *UserInfoByUsername) String() string { return proto.CompactTextString(m) }
  59. func (*UserInfoByUsername) ProtoMessage() {}
  60. func (m *UserInfoByUsername) GetDbname() string {
  61. if m != nil && m.Dbname != nil {
  62. return *m.Dbname
  63. }
  64. return ""
  65. }
  66. func (m *UserInfoByUsername) GetUsername() string {
  67. if m != nil && m.Username != nil {
  68. return *m.Username
  69. }
  70. return ""
  71. }
  72. // 使用usercode查询用户信息请求结构
  73. type UserInfoByUsercode struct {
  74. Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
  75. Usercode *string `protobuf:"bytes,2,opt,name=usercode" json:"usercode,omitempty"`
  76. XXX_unrecognized []byte `json:"-"`
  77. }
  78. func (m *UserInfoByUsercode) Reset() { *m = UserInfoByUsercode{} }
  79. func (m *UserInfoByUsercode) String() string { return proto.CompactTextString(m) }
  80. func (*UserInfoByUsercode) ProtoMessage() {}
  81. func (m *UserInfoByUsercode) GetDbname() string {
  82. if m != nil && m.Dbname != nil {
  83. return *m.Dbname
  84. }
  85. return ""
  86. }
  87. func (m *UserInfoByUsercode) GetUsercode() string {
  88. if m != nil && m.Usercode != nil {
  89. return *m.Usercode
  90. }
  91. return ""
  92. }
  93. // 使用token查询用户信息响应结构
  94. type UserResponse struct {
  95. UserId *string `protobuf:"bytes,1,opt,name=user_id" json:"user_id,omitempty"`
  96. Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
  97. Nickname *string `protobuf:"bytes,3,opt,name=nickname" json:"nickname,omitempty"`
  98. Mobile *string `protobuf:"bytes,4,opt,name=mobile" json:"mobile,omitempty"`
  99. Email *string `protobuf:"bytes,5,opt,name=email" json:"email,omitempty"`
  100. Status *string `protobuf:"bytes,6,opt,name=status" json:"status,omitempty"`
  101. BusinessId *string `protobuf:"bytes,7,opt,name=business_id" json:"business_id,omitempty"`
  102. StoreId *string `protobuf:"bytes,8,opt,name=store_id" json:"store_id,omitempty"`
  103. FansTo *string `protobuf:"bytes,9,opt,name=fans_to" json:"fans_to,omitempty"`
  104. IsVip *string `protobuf:"bytes,10,opt,name=is_vip" json:"is_vip,omitempty"`
  105. Usercode *string `protobuf:"bytes,11,opt,name=usercode" json:"usercode,omitempty"`
  106. GroupId *string `protobuf:"bytes,12,opt,name=group_id" json:"group_id,omitempty"`
  107. Type *string `protobuf:"bytes,13,opt,name=type" json:"type,omitempty"`
  108. XXX_unrecognized []byte `json:"-"`
  109. }
  110. func (m *UserResponse) Reset() { *m = UserResponse{} }
  111. func (m *UserResponse) String() string { return proto.CompactTextString(m) }
  112. func (*UserResponse) ProtoMessage() {}
  113. func (m *UserResponse) GetUserId() string {
  114. if m != nil && m.UserId != nil {
  115. return *m.UserId
  116. }
  117. return ""
  118. }
  119. func (m *UserResponse) GetUsername() string {
  120. if m != nil && m.Username != nil {
  121. return *m.Username
  122. }
  123. return ""
  124. }
  125. func (m *UserResponse) GetNickname() string {
  126. if m != nil && m.Nickname != nil {
  127. return *m.Nickname
  128. }
  129. return ""
  130. }
  131. func (m *UserResponse) GetMobile() string {
  132. if m != nil && m.Mobile != nil {
  133. return *m.Mobile
  134. }
  135. return ""
  136. }
  137. func (m *UserResponse) GetEmail() string {
  138. if m != nil && m.Email != nil {
  139. return *m.Email
  140. }
  141. return ""
  142. }
  143. func (m *UserResponse) GetStatus() string {
  144. if m != nil && m.Status != nil {
  145. return *m.Status
  146. }
  147. return ""
  148. }
  149. func (m *UserResponse) GetBusinessId() string {
  150. if m != nil && m.BusinessId != nil {
  151. return *m.BusinessId
  152. }
  153. return ""
  154. }
  155. func (m *UserResponse) GetStoreId() string {
  156. if m != nil && m.StoreId != nil {
  157. return *m.StoreId
  158. }
  159. return ""
  160. }
  161. func (m *UserResponse) GetFansTo() string {
  162. if m != nil && m.FansTo != nil {
  163. return *m.FansTo
  164. }
  165. return ""
  166. }
  167. func (m *UserResponse) GetIsVip() string {
  168. if m != nil && m.IsVip != nil {
  169. return *m.IsVip
  170. }
  171. return ""
  172. }
  173. func (m *UserResponse) GetUsercode() string {
  174. if m != nil && m.Usercode != nil {
  175. return *m.Usercode
  176. }
  177. return ""
  178. }
  179. func (m *UserResponse) GetGroupId() string {
  180. if m != nil && m.GroupId != nil {
  181. return *m.GroupId
  182. }
  183. return ""
  184. }
  185. func (m *UserResponse) GetType() string {
  186. if m != nil && m.Type != nil {
  187. return *m.Type
  188. }
  189. return ""
  190. }
  191. // 用户登录请求结构
  192. type LoginRequest struct {
  193. Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
  194. Account *string `protobuf:"bytes,2,opt,name=account" json:"account,omitempty"`
  195. Password *string `protobuf:"bytes,3,opt,name=password" json:"password,omitempty"`
  196. XXX_unrecognized []byte `json:"-"`
  197. }
  198. func (m *LoginRequest) Reset() { *m = LoginRequest{} }
  199. func (m *LoginRequest) String() string { return proto.CompactTextString(m) }
  200. func (*LoginRequest) ProtoMessage() {}
  201. func (m *LoginRequest) GetDbname() string {
  202. if m != nil && m.Dbname != nil {
  203. return *m.Dbname
  204. }
  205. return ""
  206. }
  207. func (m *LoginRequest) GetAccount() string {
  208. if m != nil && m.Account != nil {
  209. return *m.Account
  210. }
  211. return ""
  212. }
  213. func (m *LoginRequest) GetPassword() string {
  214. if m != nil && m.Password != nil {
  215. return *m.Password
  216. }
  217. return ""
  218. }
  219. // 使用token查询用户信息响应结构
  220. type LoginResponse struct {
  221. UserId *string `protobuf:"bytes,1,opt,name=user_id" json:"user_id,omitempty"`
  222. Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
  223. Nickname *string `protobuf:"bytes,3,opt,name=nickname" json:"nickname,omitempty"`
  224. Mobile *string `protobuf:"bytes,4,opt,name=mobile" json:"mobile,omitempty"`
  225. Email *string `protobuf:"bytes,5,opt,name=email" json:"email,omitempty"`
  226. Status *string `protobuf:"bytes,6,opt,name=status" json:"status,omitempty"`
  227. BusinessId *string `protobuf:"bytes,7,opt,name=business_id" json:"business_id,omitempty"`
  228. StoreId *string `protobuf:"bytes,8,opt,name=store_id" json:"store_id,omitempty"`
  229. FansTo *string `protobuf:"bytes,9,opt,name=fans_to" json:"fans_to,omitempty"`
  230. IsVip *string `protobuf:"bytes,10,opt,name=is_vip" json:"is_vip,omitempty"`
  231. Token *string `protobuf:"bytes,11,opt,name=token" json:"token,omitempty"`
  232. Usercode *string `protobuf:"bytes,12,opt,name=usercode" json:"usercode,omitempty"`
  233. GroupId *string `protobuf:"bytes,13,opt,name=group_id" json:"group_id,omitempty"`
  234. Type *string `protobuf:"bytes,14,opt,name=type" json:"type,omitempty"`
  235. XXX_unrecognized []byte `json:"-"`
  236. }
  237. func (m *LoginResponse) Reset() { *m = LoginResponse{} }
  238. func (m *LoginResponse) String() string { return proto.CompactTextString(m) }
  239. func (*LoginResponse) ProtoMessage() {}
  240. func (m *LoginResponse) GetUserId() string {
  241. if m != nil && m.UserId != nil {
  242. return *m.UserId
  243. }
  244. return ""
  245. }
  246. func (m *LoginResponse) GetUsername() string {
  247. if m != nil && m.Username != nil {
  248. return *m.Username
  249. }
  250. return ""
  251. }
  252. func (m *LoginResponse) GetNickname() string {
  253. if m != nil && m.Nickname != nil {
  254. return *m.Nickname
  255. }
  256. return ""
  257. }
  258. func (m *LoginResponse) GetMobile() string {
  259. if m != nil && m.Mobile != nil {
  260. return *m.Mobile
  261. }
  262. return ""
  263. }
  264. func (m *LoginResponse) GetEmail() string {
  265. if m != nil && m.Email != nil {
  266. return *m.Email
  267. }
  268. return ""
  269. }
  270. func (m *LoginResponse) GetStatus() string {
  271. if m != nil && m.Status != nil {
  272. return *m.Status
  273. }
  274. return ""
  275. }
  276. func (m *LoginResponse) GetBusinessId() string {
  277. if m != nil && m.BusinessId != nil {
  278. return *m.BusinessId
  279. }
  280. return ""
  281. }
  282. func (m *LoginResponse) GetStoreId() string {
  283. if m != nil && m.StoreId != nil {
  284. return *m.StoreId
  285. }
  286. return ""
  287. }
  288. func (m *LoginResponse) GetFansTo() string {
  289. if m != nil && m.FansTo != nil {
  290. return *m.FansTo
  291. }
  292. return ""
  293. }
  294. func (m *LoginResponse) GetIsVip() string {
  295. if m != nil && m.IsVip != nil {
  296. return *m.IsVip
  297. }
  298. return ""
  299. }
  300. func (m *LoginResponse) GetToken() string {
  301. if m != nil && m.Token != nil {
  302. return *m.Token
  303. }
  304. return ""
  305. }
  306. func (m *LoginResponse) GetUsercode() string {
  307. if m != nil && m.Usercode != nil {
  308. return *m.Usercode
  309. }
  310. return ""
  311. }
  312. func (m *LoginResponse) GetGroupId() string {
  313. if m != nil && m.GroupId != nil {
  314. return *m.GroupId
  315. }
  316. return ""
  317. }
  318. func (m *LoginResponse) GetType() string {
  319. if m != nil && m.Type != nil {
  320. return *m.Type
  321. }
  322. return ""
  323. }
  324. // 信息请求结构
  325. type Request struct {
  326. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  327. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  328. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  329. XXX_unrecognized []byte `json:"-"`
  330. }
  331. func (m *Request) Reset() { *m = Request{} }
  332. func (m *Request) String() string { return proto.CompactTextString(m) }
  333. func (*Request) ProtoMessage() {}
  334. func (m *Request) GetData() string {
  335. if m != nil && m.Data != nil {
  336. return *m.Data
  337. }
  338. return ""
  339. }
  340. func (m *Request) GetTime() string {
  341. if m != nil && m.Time != nil {
  342. return *m.Time
  343. }
  344. return ""
  345. }
  346. func (m *Request) GetSign() string {
  347. if m != nil && m.Sign != nil {
  348. return *m.Sign
  349. }
  350. return ""
  351. }
  352. // 信息响应结构
  353. type Response struct {
  354. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  355. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  356. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  357. XXX_unrecognized []byte `json:"-"`
  358. }
  359. func (m *Response) Reset() { *m = Response{} }
  360. func (m *Response) String() string { return proto.CompactTextString(m) }
  361. func (*Response) ProtoMessage() {}
  362. func (m *Response) GetData() string {
  363. if m != nil && m.Data != nil {
  364. return *m.Data
  365. }
  366. return ""
  367. }
  368. func (m *Response) GetTime() string {
  369. if m != nil && m.Time != nil {
  370. return *m.Time
  371. }
  372. return ""
  373. }
  374. func (m *Response) GetSign() string {
  375. if m != nil && m.Sign != nil {
  376. return *m.Sign
  377. }
  378. return ""
  379. }
  380. func init() {
  381. }
  382. type UserService interface {
  383. GetByToken(in *UserRequest, out *UserResponse) error
  384. Login(in *LoginRequest, out *LoginResponse) error
  385. GetByUsername(in *UserInfoByUsername, out *UserResponse) error
  386. GetByUsercode(in *UserInfoByUsercode, out *UserResponse) error
  387. BindThird(in *Request, out *Response) error
  388. GetThird(in *Request, out *Response) error
  389. }
  390. // AcceptUserServiceClient accepts connections on the listener and serves requests
  391. // for each incoming connection. Accept blocks; the caller typically
  392. // invokes it in a go statement.
  393. func AcceptUserServiceClient(lis net.Listener, x UserService) {
  394. srv := rpc.NewServer()
  395. if err := srv.RegisterName("UserService", x); err != nil {
  396. log.Fatal(err)
  397. }
  398. for {
  399. conn, err := lis.Accept()
  400. if err != nil {
  401. log.Fatalf("lis.Accept(): %v\n", err)
  402. }
  403. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  404. }
  405. }
  406. // RegisterUserService publish the given UserService implementation on the server.
  407. func RegisterUserService(srv *rpc.Server, x UserService) error {
  408. if err := srv.RegisterName("UserService", x); err != nil {
  409. return err
  410. }
  411. return nil
  412. }
  413. // NewUserServiceServer returns a new UserService Server.
  414. func NewUserServiceServer(x UserService) *rpc.Server {
  415. srv := rpc.NewServer()
  416. if err := srv.RegisterName("UserService", x); err != nil {
  417. log.Fatal(err)
  418. }
  419. return srv
  420. }
  421. // ListenAndServeUserService listen announces on the local network address laddr
  422. // and serves the given UserService implementation.
  423. func ListenAndServeUserService(network, addr string, x UserService) error {
  424. lis, err := net.Listen(network, addr)
  425. if err != nil {
  426. return err
  427. }
  428. defer lis.Close()
  429. srv := rpc.NewServer()
  430. if err := srv.RegisterName("UserService", x); err != nil {
  431. return err
  432. }
  433. for {
  434. conn, err := lis.Accept()
  435. if err != nil {
  436. log.Fatalf("lis.Accept(): %v\n", err)
  437. }
  438. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  439. }
  440. }
  441. type UserServiceClient struct {
  442. *rpc.Client
  443. }
  444. // NewUserServiceClient returns a UserService rpc.Client and stub to handle
  445. // requests to the set of UserService at the other end of the connection.
  446. func NewUserServiceClient(conn io.ReadWriteCloser) (*UserServiceClient, *rpc.Client) {
  447. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  448. return &UserServiceClient{c}, c
  449. }
  450. func (c *UserServiceClient) GetByToken(in *UserRequest, out *UserResponse) error {
  451. return c.Call("UserService.GetByToken", in, out)
  452. }
  453. func (c *UserServiceClient) Login(in *LoginRequest, out *LoginResponse) error {
  454. return c.Call("UserService.Login", in, out)
  455. }
  456. func (c *UserServiceClient) GetByUsername(in *UserInfoByUsername, out *UserResponse) error {
  457. return c.Call("UserService.GetByUsername", in, out)
  458. }
  459. func (c *UserServiceClient) GetByUsercode(in *UserInfoByUsercode, out *UserResponse) error {
  460. return c.Call("UserService.GetByUsercode", in, out)
  461. }
  462. func (c *UserServiceClient) BindThird(in *Request, out *Response) error {
  463. return c.Call("UserService.BindThird", in, out)
  464. }
  465. func (c *UserServiceClient) GetThird(in *Request, out *Response) error {
  466. return c.Call("UserService.GetThird", in, out)
  467. }
  468. // DialUserService connects to an UserService at the specified network address.
  469. func DialUserService(network, addr string) (*UserServiceClient, *rpc.Client, error) {
  470. c, err := protorpc.Dial(network, addr)
  471. if err != nil {
  472. return nil, nil, err
  473. }
  474. return &UserServiceClient{c}, c, nil
  475. }
  476. // DialUserServiceTimeout connects to an UserService at the specified network address.
  477. func DialUserServiceTimeout(network, addr string,
  478. timeout time.Duration) (*UserServiceClient, *rpc.Client, error) {
  479. c, err := protorpc.DialTimeout(network, addr, timeout)
  480. if err != nil {
  481. return nil, nil, err
  482. }
  483. return &UserServiceClient{c}, c, nil
  484. }