34 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2025-06-06 15:17:30 +08:00
const fetchWechat = require("fetch-wechat");
let whiteModels =
/23054RA19C|23078RKD5C|2311DRK48C|22101316C|22122RK93C|22101316UCP|22101316UC|23046PNC9C|2312DRAABC|2312DRA50C|23090RA98C|2210132C|22041211AC|23013RK75C|M2006C3LC|21091116AC|22095RA98C|M2103K19C|22101317C|22120RN86C|22041216UC|22041216C|M2006J10C|V2183A|V2309A|V2324A|V2241HA|V2242A|V2241A|V2133A|V2344A|V2323A|V2334A|V2284A|V2282A|V2285A|PFFM20|PGX110|PGBM10|PFCM00|PFZM10|PJB110|PJG110|LLY-AN00|CLK-AN00|CRT-AN00|DIO-AN00|GIA-AN8|RKY-AN00|DIO-AN00|SDY-AN00|HPB-AN00|OCE-AN00|NOH-AN00|NOP-AN00/i;
function initializePlugin(threshold, enhanced) {
const plugin = requirePlugin('aiSport');
let url = 'https://yuedong-wechatapplet.oss-cn-shanghai.aliyuncs.com/plug_in/model/model.json'; //替换您部署的url访问urlmodel部署请参考集成指南
plugin.initialize({
modelUrl: url,
fetchFunc: fetchWechat.fetchFunc(),
humanPointThreshold: threshold || 0.3,
debugEnabled: true
});
}
function judgeEnhanced(spec) {
let ehd = spec || false;
if (typeof spec !== 'boolean') {
const deviceInfo = wx.getDeviceInfo();
ehd = whiteModels.test(deviceInfo.model);
}
return ehd;
}
// 初始化
initializePlugin();
module.exports = {
initializePlugin,
judgeEnhanced
};