用户接口远程调用
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.

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