收藏
回答

小程序体验版怎么发服务通知?

public static void send() {
		resetAccessToken();
		//jsonpinjie
		Map map=new HashMap();
		map.put("touser", "********");
		map.put("template_id", "4JI-********-HSTvHg");
		//模板信息
		Map data = new HashMap();
		Map data1 = new HashMap();
		data1.put("value", "ceshi");
		Map data2 = new HashMap();
		data2.put("value", "2020-09-09 12:12:09");
		Map data3 = new HashMap();
		data3.put("value", "haha");
		data.put("thing1", data1);
		data.put("time2", data2);
		data.put("thing4", data3);
		map.put("data", data);
		System.out.println(JSON.toJSONString(map));
		//POST https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=ACCESS_TOKEN
		String result = PostUtil.httpsRequest(" https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token="
				+ access_token,"POST",JSON.toJSONString(map));
		JSONObject jsonobjkf = JSONObject.fromObject(result);
	}

//这样去发送,一直提示 INFO (  PostUtil) {"errmsg":"invalid openid rid: 5f585844-7754b9d2-0eb05a58","errcode":40003}
但是 openID 是通过授权存到数据库里面的,可是一直提示touser字段openid为空或者不正确
求解答,谢谢

JSON格式
{
    "data":{
        "thing1":{
            "value":"ceshi"
        },
        "thing4":{
            "value":"haha"
        },
        "time2":{
            "value":"2020-09-09 12:12:09"
        }
    },
    "miniprogramState":"trial",
    "template_id":"4JI-*********8-HSTvHg",
    "touser":"*******-Bv2Oo"
}

最后一次编辑于  09-10
回答关注问题邀请回答
收藏
登录 后发表内容
问题标签