以下代码是对接联众代码:

2023-07-07 14:52:14 浏览数 (1)

以下代码是对接联众代码:

代码语言:javascript复制
/*
username:联众账号
password:联众密码
img:验证码图片

softwareId:开发者ID,在开发者后台获取
softwareSecret:开发者秘钥,在开发者后台获取
captchaType:验证码类型,截图问联众客服

*/

function 联众(username, password, img) {
    var url = "https://v2-api.jsdama.com/upload";
    var pa = {
        softwareId: 14589,
        softwareSecret: "LsKF2ERj2qDTst8eVeZiWGGoew88AdzsuIFrgzTA",
        username: username,
        password: password,
        captchaData:  img,
        captchaType: 1310,
        captchaMinLength: 0,
        captchaMaxLength: 0,
        workerTipsId: 0
    };
    do {
        var x = http.postJSON(url, pa, 10 * 1000, {"User-Agent": "test"});
        toast(" 联众返回值     "   x);
        if (x != null) {
            break;
        }
    }while (true)
    var d =JSON.parse(x);
    toast("json:" d);
    logd("坐标属性:" d.data.recognition);
    return d.data.recognition;
}

相关

http.postJSON 发送JSON

  • HTTP POST JSON数据
  • @param url 请求的URL
  • @param json json数据
  • @param timeout – 超时时间 单位毫秒
  • @param headers – 头标志例如{“a”:“11”}
  • @return 字符串 请求后返回的字符串

代码语言:javascript复制
function main(){
    var url = "http://192.168.0.5:8081/api/postJSON";
    var pa = {"b": "我是b的值"};
    var x = http.postJSON(url, pa, 10 * 1000, {"User-Agent": "test"});
    toast(" result->     "   x);
    loge("result ->     "   x);
}
main();

0 人点赞