微信接口的RPC包
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.

38 lines
585 B

  1. package weixinrpc
  2. const DES_KEY = "wxserrpc"
  3. type WxApiRes struct {
  4. Errcode string
  5. Errmsg string
  6. }
  7. type Req struct {
  8. SiteId string
  9. Dbname string
  10. }
  11. type AccessTokenReq struct {
  12. Req
  13. Appid string
  14. Secret string
  15. }
  16. type AccessTokenRes struct {
  17. AccessToken string
  18. }
  19. func rpc_server_conn(url ...string) (*WeixinRpcServiceClient, error) {
  20. var wx_rpc_url string = "127.0.0.1:7969"
  21. if len(url) > 0 && url[0] != "" {
  22. wx_rpc_url = url[0]
  23. }
  24. conn, _, err := DialWeixinRpcService("tcp", wx_rpc_url)
  25. if err != nil {
  26. return nil, err
  27. }
  28. defer conn.Close()
  29. return conn, nil
  30. }