Browse Source

修改参数类型

master v0.1.8
guzeng 3 years ago
parent
commit
386f58a565
3 changed files with 7 additions and 5 deletions
  1. +1
    -1
      common.go
  2. +1
    -1
      send_uniform_message.client.go
  3. +5
    -3
      send_uniform_message.client_test.go

+ 1
- 1
common.go View File

@ -30,7 +30,7 @@ type UniformMessageReq struct {
MpAppid string MpAppid string
TemplateId string TemplateId string
Url string Url string
MiniProgram string
MiniProgram interface{}
Data interface{} Data interface{}
} }


+ 1
- 1
send_uniform_message.client.go View File

@ -21,7 +21,7 @@ import (
* data 公众号模板消息的数据 * data 公众号模板消息的数据
*/ */
func SendUniformMessage(dbname, site_id string, appid, secret, touser, mp_appid, temp_id, redirect_url, mini_program string, data interface{}, url ...string) (*WxApiRes, error) {
func SendUniformMessage(dbname, site_id string, appid, secret, touser, mp_appid, temp_id, redirect_url string, mini_program, data interface{}, url ...string) (*WxApiRes, error) {
conn, err := rpc_server_conn(url...) conn, err := rpc_server_conn(url...)


+ 5
- 3
send_uniform_message.client_test.go View File

@ -1,7 +1,6 @@
package weixinrpc package weixinrpc
import ( import (
"encoding/json"
"testing" "testing"
) )
@ -15,7 +14,10 @@ func Test_SendUniformMessage(t *testing.T) {
mp_appid := "wx056995d61ca222f5" mp_appid := "wx056995d61ca222f5"
temp_id := "6xgj_65KivigMvwdJgiveR4wLXJLDpzsT2-hShczLmU" temp_id := "6xgj_65KivigMvwdJgiveR4wLXJLDpzsT2-hShczLmU"
url := "" url := ""
mini_program := "wx7be627d0325135f4"
mini_program := map[string]string{
"appid": "wx7be627d0325135f4",
"pagepath": "pages/index/index",
}
data := map[string]map[string]string{ data := map[string]map[string]string{
"first": map[string]string{"value": "来新订单了"}, "first": map[string]string{"value": "来新订单了"},
"keyword1": map[string]string{"value": "订单号是。。。"}, "keyword1": map[string]string{"value": "订单号是。。。"},
@ -26,7 +28,7 @@ func Test_SendUniformMessage(t *testing.T) {
"remark": map[string]string{"value": "这是备注"}, "remark": map[string]string{"value": "这是备注"},
} }
data_json, _ := json.Marshal(data)
// data_json, _ := json.Marshal(data)
ret, err := SendUniformMessage(db, site_id, appid, secret, touser, mp_appid, temp_id, url, mini_program, data) ret, err := SendUniformMessage(db, site_id, appid, secret, touser, mp_appid, temp_id, url, mini_program, data)
t.Log(ret, err) t.Log(ret, err)


Loading…
Cancel
Save