package weixinrpc
|
|
|
|
const DES_KEY = "wxserrpc"
|
|
|
|
type WxApiRes struct {
|
|
Errcode int
|
|
Errmsg string
|
|
}
|
|
|
|
type Req struct {
|
|
SiteId string
|
|
Dbname string
|
|
}
|
|
|
|
type AccessTokenReq struct {
|
|
Req
|
|
Appid string
|
|
Secret string
|
|
}
|
|
|
|
type AccessTokenRes struct {
|
|
AccessToken string
|
|
}
|
|
|
|
type UniformMessageReq struct {
|
|
Req
|
|
Appid string
|
|
Secret string
|
|
Touser string
|
|
MpAppid string
|
|
TemplateId string
|
|
Url string
|
|
MiniProgram string
|
|
Data interface{}
|
|
}
|
|
|
|
func rpc_server_conn(url ...string) (*WeixinRpcServiceClient, error) {
|
|
|
|
var wx_rpc_url string = "127.0.0.1:7969"
|
|
if len(url) > 0 && url[0] != "" {
|
|
wx_rpc_url = url[0]
|
|
}
|
|
conn, _, err := DialWeixinRpcService("tcp", wx_rpc_url)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return conn, nil
|
|
}
|