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

596 lines
16 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
  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. XXX_unrecognized []byte `json:"-"`
  131. }
  132. func (m *UserResponse) Reset() { *m = UserResponse{} }
  133. func (m *UserResponse) String() string { return proto.CompactTextString(m) }
  134. func (*UserResponse) ProtoMessage() {}
  135. func (m *UserResponse) GetUserId() string {
  136. if m != nil && m.UserId != nil {
  137. return *m.UserId
  138. }
  139. return ""
  140. }
  141. func (m *UserResponse) GetUsername() string {
  142. if m != nil && m.Username != nil {
  143. return *m.Username
  144. }
  145. return ""
  146. }
  147. func (m *UserResponse) GetNickname() string {
  148. if m != nil && m.Nickname != nil {
  149. return *m.Nickname
  150. }
  151. return ""
  152. }
  153. func (m *UserResponse) GetMobile() string {
  154. if m != nil && m.Mobile != nil {
  155. return *m.Mobile
  156. }
  157. return ""
  158. }
  159. func (m *UserResponse) GetEmail() string {
  160. if m != nil && m.Email != nil {
  161. return *m.Email
  162. }
  163. return ""
  164. }
  165. func (m *UserResponse) GetStatus() string {
  166. if m != nil && m.Status != nil {
  167. return *m.Status
  168. }
  169. return ""
  170. }
  171. func (m *UserResponse) GetBusinessId() string {
  172. if m != nil && m.BusinessId != nil {
  173. return *m.BusinessId
  174. }
  175. return ""
  176. }
  177. func (m *UserResponse) GetStoreId() string {
  178. if m != nil && m.StoreId != nil {
  179. return *m.StoreId
  180. }
  181. return ""
  182. }
  183. func (m *UserResponse) GetFansTo() string {
  184. if m != nil && m.FansTo != nil {
  185. return *m.FansTo
  186. }
  187. return ""
  188. }
  189. func (m *UserResponse) GetIsVip() string {
  190. if m != nil && m.IsVip != nil {
  191. return *m.IsVip
  192. }
  193. return ""
  194. }
  195. func (m *UserResponse) GetUsercode() string {
  196. if m != nil && m.Usercode != nil {
  197. return *m.Usercode
  198. }
  199. return ""
  200. }
  201. func (m *UserResponse) GetGroupId() string {
  202. if m != nil && m.GroupId != nil {
  203. return *m.GroupId
  204. }
  205. return ""
  206. }
  207. func (m *UserResponse) GetType() string {
  208. if m != nil && m.Type != nil {
  209. return *m.Type
  210. }
  211. return ""
  212. }
  213. // 用户登录请求结构
  214. type LoginRequest struct {
  215. Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"`
  216. Account *string `protobuf:"bytes,2,opt,name=account" json:"account,omitempty"`
  217. Password *string `protobuf:"bytes,3,opt,name=password" json:"password,omitempty"`
  218. XXX_unrecognized []byte `json:"-"`
  219. }
  220. func (m *LoginRequest) Reset() { *m = LoginRequest{} }
  221. func (m *LoginRequest) String() string { return proto.CompactTextString(m) }
  222. func (*LoginRequest) ProtoMessage() {}
  223. func (m *LoginRequest) GetDbname() string {
  224. if m != nil && m.Dbname != nil {
  225. return *m.Dbname
  226. }
  227. return ""
  228. }
  229. func (m *LoginRequest) GetAccount() string {
  230. if m != nil && m.Account != nil {
  231. return *m.Account
  232. }
  233. return ""
  234. }
  235. func (m *LoginRequest) GetPassword() string {
  236. if m != nil && m.Password != nil {
  237. return *m.Password
  238. }
  239. return ""
  240. }
  241. // 使用token查询用户信息响应结构
  242. type LoginResponse struct {
  243. UserId *string `protobuf:"bytes,1,opt,name=user_id" json:"user_id,omitempty"`
  244. Username *string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
  245. Nickname *string `protobuf:"bytes,3,opt,name=nickname" json:"nickname,omitempty"`
  246. Mobile *string `protobuf:"bytes,4,opt,name=mobile" json:"mobile,omitempty"`
  247. Email *string `protobuf:"bytes,5,opt,name=email" json:"email,omitempty"`
  248. Status *string `protobuf:"bytes,6,opt,name=status" json:"status,omitempty"`
  249. BusinessId *string `protobuf:"bytes,7,opt,name=business_id" json:"business_id,omitempty"`
  250. StoreId *string `protobuf:"bytes,8,opt,name=store_id" json:"store_id,omitempty"`
  251. FansTo *string `protobuf:"bytes,9,opt,name=fans_to" json:"fans_to,omitempty"`
  252. IsVip *string `protobuf:"bytes,10,opt,name=is_vip" json:"is_vip,omitempty"`
  253. Token *string `protobuf:"bytes,11,opt,name=token" json:"token,omitempty"`
  254. Usercode *string `protobuf:"bytes,12,opt,name=usercode" json:"usercode,omitempty"`
  255. GroupId *string `protobuf:"bytes,13,opt,name=group_id" json:"group_id,omitempty"`
  256. Type *string `protobuf:"bytes,14,opt,name=type" json:"type,omitempty"`
  257. XXX_unrecognized []byte `json:"-"`
  258. }
  259. func (m *LoginResponse) Reset() { *m = LoginResponse{} }
  260. func (m *LoginResponse) String() string { return proto.CompactTextString(m) }
  261. func (*LoginResponse) ProtoMessage() {}
  262. func (m *LoginResponse) GetUserId() string {
  263. if m != nil && m.UserId != nil {
  264. return *m.UserId
  265. }
  266. return ""
  267. }
  268. func (m *LoginResponse) GetUsername() string {
  269. if m != nil && m.Username != nil {
  270. return *m.Username
  271. }
  272. return ""
  273. }
  274. func (m *LoginResponse) GetNickname() string {
  275. if m != nil && m.Nickname != nil {
  276. return *m.Nickname
  277. }
  278. return ""
  279. }
  280. func (m *LoginResponse) GetMobile() string {
  281. if m != nil && m.Mobile != nil {
  282. return *m.Mobile
  283. }
  284. return ""
  285. }
  286. func (m *LoginResponse) GetEmail() string {
  287. if m != nil && m.Email != nil {
  288. return *m.Email
  289. }
  290. return ""
  291. }
  292. func (m *LoginResponse) GetStatus() string {
  293. if m != nil && m.Status != nil {
  294. return *m.Status
  295. }
  296. return ""
  297. }
  298. func (m *LoginResponse) GetBusinessId() string {
  299. if m != nil && m.BusinessId != nil {
  300. return *m.BusinessId
  301. }
  302. return ""
  303. }
  304. func (m *LoginResponse) GetStoreId() string {
  305. if m != nil && m.StoreId != nil {
  306. return *m.StoreId
  307. }
  308. return ""
  309. }
  310. func (m *LoginResponse) GetFansTo() string {
  311. if m != nil && m.FansTo != nil {
  312. return *m.FansTo
  313. }
  314. return ""
  315. }
  316. func (m *LoginResponse) GetIsVip() string {
  317. if m != nil && m.IsVip != nil {
  318. return *m.IsVip
  319. }
  320. return ""
  321. }
  322. func (m *LoginResponse) GetToken() string {
  323. if m != nil && m.Token != nil {
  324. return *m.Token
  325. }
  326. return ""
  327. }
  328. func (m *LoginResponse) GetUsercode() string {
  329. if m != nil && m.Usercode != nil {
  330. return *m.Usercode
  331. }
  332. return ""
  333. }
  334. func (m *LoginResponse) GetGroupId() string {
  335. if m != nil && m.GroupId != nil {
  336. return *m.GroupId
  337. }
  338. return ""
  339. }
  340. func (m *LoginResponse) GetType() string {
  341. if m != nil && m.Type != nil {
  342. return *m.Type
  343. }
  344. return ""
  345. }
  346. // 信息请求结构
  347. type Request struct {
  348. Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
  349. Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
  350. Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
  351. XXX_unrecognized []byte `json:"-"`
  352. }
  353. func (m *Request) Reset() { *m = Request{} }
  354. func (m *Request) String() string { return proto.CompactTextString(m) }
  355. func (*Request) ProtoMessage() {}
  356. func (m *Request) GetData() string {
  357. if m != nil && m.Data != nil {
  358. return *m.Data
  359. }
  360. return ""
  361. }
  362. func (m *Request) GetTime() string {
  363. if m != nil && m.Time != nil {
  364. return *m.Time
  365. }
  366. return ""
  367. }
  368. func (m *Request) GetSign() string {
  369. if m != nil && m.Sign != nil {
  370. return *m.Sign
  371. }
  372. return ""
  373. }
  374. // 信息响应结构
  375. type Response 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 *Response) Reset() { *m = Response{} }
  382. func (m *Response) String() string { return proto.CompactTextString(m) }
  383. func (*Response) ProtoMessage() {}
  384. func (m *Response) GetData() string {
  385. if m != nil && m.Data != nil {
  386. return *m.Data
  387. }
  388. return ""
  389. }
  390. func (m *Response) GetTime() string {
  391. if m != nil && m.Time != nil {
  392. return *m.Time
  393. }
  394. return ""
  395. }
  396. func (m *Response) GetSign() string {
  397. if m != nil && m.Sign != nil {
  398. return *m.Sign
  399. }
  400. return ""
  401. }
  402. func init() {
  403. }
  404. type UserService interface {
  405. GetByToken(in *UserRequest, out *UserResponse) error
  406. Login(in *LoginRequest, out *LoginResponse) error
  407. GetByUsername(in *UserInfoByUsername, out *UserResponse) error
  408. GetByUsercode(in *UserInfoByUsercode, out *UserResponse) error
  409. BindThird(in *Request, out *Response) error
  410. GetThird(in *Request, out *Response) error
  411. GetBusiness(in *Request, out *Response) error
  412. GetById(in *Request, out *Response) error
  413. }
  414. // AcceptUserServiceClient accepts connections on the listener and serves requests
  415. // for each incoming connection. Accept blocks; the caller typically
  416. // invokes it in a go statement.
  417. func AcceptUserServiceClient(lis net.Listener, x UserService) {
  418. srv := rpc.NewServer()
  419. if err := srv.RegisterName("UserService", x); err != nil {
  420. log.Fatal(err)
  421. }
  422. for {
  423. conn, err := lis.Accept()
  424. if err != nil {
  425. log.Fatalf("lis.Accept(): %v\n", err)
  426. }
  427. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  428. }
  429. }
  430. // RegisterUserService publish the given UserService implementation on the server.
  431. func RegisterUserService(srv *rpc.Server, x UserService) error {
  432. if err := srv.RegisterName("UserService", x); err != nil {
  433. return err
  434. }
  435. return nil
  436. }
  437. // NewUserServiceServer returns a new UserService Server.
  438. func NewUserServiceServer(x UserService) *rpc.Server {
  439. srv := rpc.NewServer()
  440. if err := srv.RegisterName("UserService", x); err != nil {
  441. log.Fatal(err)
  442. }
  443. return srv
  444. }
  445. // ListenAndServeUserService listen announces on the local network address laddr
  446. // and serves the given UserService implementation.
  447. func ListenAndServeUserService(network, addr string, x UserService) error {
  448. lis, err := net.Listen(network, addr)
  449. if err != nil {
  450. return err
  451. }
  452. defer lis.Close()
  453. srv := rpc.NewServer()
  454. if err := srv.RegisterName("UserService", x); err != nil {
  455. return err
  456. }
  457. for {
  458. conn, err := lis.Accept()
  459. if err != nil {
  460. log.Fatalf("lis.Accept(): %v\n", err)
  461. }
  462. go srv.ServeCodec(protorpc.NewServerCodec(conn))
  463. }
  464. }
  465. type UserServiceClient struct {
  466. *rpc.Client
  467. }
  468. // NewUserServiceClient returns a UserService rpc.Client and stub to handle
  469. // requests to the set of UserService at the other end of the connection.
  470. func NewUserServiceClient(conn io.ReadWriteCloser) (*UserServiceClient, *rpc.Client) {
  471. c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
  472. return &UserServiceClient{c}, c
  473. }
  474. func (c *UserServiceClient) GetByToken(in *UserRequest, out *UserResponse) error {
  475. return c.Call("UserService.GetByToken", in, out)
  476. }
  477. func (c *UserServiceClient) Login(in *LoginRequest, out *LoginResponse) error {
  478. return c.Call("UserService.Login", in, out)
  479. }
  480. func (c *UserServiceClient) GetByUsername(in *UserInfoByUsername, out *UserResponse) error {
  481. return c.Call("UserService.GetByUsername", in, out)
  482. }
  483. func (c *UserServiceClient) GetByUsercode(in *UserInfoByUsercode, out *UserResponse) error {
  484. return c.Call("UserService.GetByUsercode", in, out)
  485. }
  486. func (c *UserServiceClient) BindThird(in *Request, out *Response) error {
  487. return c.Call("UserService.BindThird", in, out)
  488. }
  489. func (c *UserServiceClient) GetThird(in *Request, out *Response) error {
  490. return c.Call("UserService.GetThird", in, out)
  491. }
  492. func (c *UserServiceClient) GetBusiness(in *Request, out *Response) error {
  493. return c.Call("UserService.GetBusiness", in, out)
  494. }
  495. func (c *UserServiceClient) GetById(in *Request, out *Response) error {
  496. return c.Call("UserService.GetById", in, out)
  497. }
  498. // DialUserService connects to an UserService at the specified network address.
  499. func DialUserService(network, addr string) (*UserServiceClient, *rpc.Client, error) {
  500. c, err := protorpc.Dial(network, addr)
  501. if err != nil {
  502. return nil, nil, err
  503. }
  504. return &UserServiceClient{c}, c, nil
  505. }
  506. // DialUserServiceTimeout connects to an UserService at the specified network address.
  507. func DialUserServiceTimeout(network, addr string,
  508. timeout time.Duration) (*UserServiceClient, *rpc.Client, error) {
  509. c, err := protorpc.DialTimeout(network, addr, timeout)
  510. if err != nil {
  511. return nil, nil, err
  512. }
  513. return &UserServiceClient{c}, c, nil
  514. }