目前使用了c# 生成小程序码,已经可以生成了,但是在工具点用二维码编译,取不到参数,参数是空 的。
if(options.scene) {
let scene = decodeURIComponent(options.scene);
console.log('参数',scene)
// 后续处理scene
}
------------------------------------
string paras = "5555555555555555"; //参数值设置
string aa = wxmp_accesstoken(); //可以更改小程序二维码的色系
int r = 102;
int g = 178;
int b = 56;
c# 生成代码(部份)
public byte[] getMpBuffer(string access_token, string scene, int width, int linecolor_R, int linecolor_G, int linecolor_B)
{
var url = string.Format("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={0}", access_token);
var postData = "{\"scene\":\"" + scene + "\",\"width\":" + width.ToString() + ",\"line_color\":{\"r\":" + linecolor_R.ToString() + ",\"g\":" + linecolor_G.ToString() + ",\"b\":" + linecolor_B.ToString() + "}}";
System.Net.HttpWebRequest request;
request = (System.Net.HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "application/json;charset=UTF-8";
byte[] payload;
payload = System.Text.Encoding.UTF8.GetBytes(postData);
request.ContentLength = payload.Length;
Stream writer = request.GetRequestStream();
writer.Write(payload, 0, payload.Length);
writer.Close();
System.Net.HttpWebResponse response;
response = (System.Net.HttpWebResponse)request.GetResponse();
System.IO.Stream stream;
stream = response.GetResponseStream();
List<byte> bytes = new List<byte>();
int temp = stream.ReadByte();
while (temp != -1)
{
bytes.Add((byte)temp);
temp = stream.ReadByte();
}
byte[] result = bytes.ToArray();
return result;
}
------------------------------可以正常生成小程序码,小程序未发布,目前取不到 scene 值
怎么没有人回答呢?