mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-04-02 06:25:17 +08:00
- 实现pullJsonConfig函数用于拉取指定uid的JSON配置数据 - 实现pushAllJsonConfig函数用于推送全部JSON配置数据 - 在配置中添加bgi_tools相关API接口地址配置项 - 新增bgi_tools加载类型支持并添加到加载映射表中 - 更新加载模式界面选项增加bgi_tools加载选项 - 修改加载顺序逻辑支持按优先级排序 - 修复自动域参数初始化时副本轮数传递问题 - 更新多选框组件标签文本增加http获取配置说明 - 添加OCR区域资源释放后的空行格式化调整
48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
import {config} from "../config/config";
|
|
|
|
/**
|
|
* 拉取对应uid的Json数据
|
|
* @param uid
|
|
* @param http_api
|
|
* @returns {Promise<HttpResponse>}
|
|
*/
|
|
async function pullJsonConfig(uid, http_api = config.bgi_tools.api.httpPullJsonConfig) {
|
|
const result = http.request("GET", http_api, JSON.stringify({
|
|
uid: uid,
|
|
})
|
|
// , JSON.stringify({"Content-Type": "application/json"})
|
|
).then(res => {
|
|
log.debug(`[{0}]res=>{1}`, 'next', JSON.stringify(res))
|
|
if (res.status_code === 200 && res.body) {
|
|
let result_json = JSON.parse(res.body);
|
|
if (result_json?.code === 200) {
|
|
return result_json?.data
|
|
}
|
|
throw new Error("请求失败,error:" + result_json?.message)
|
|
}
|
|
return undefined
|
|
})
|
|
return result
|
|
}
|
|
|
|
/**
|
|
* 推送全部Json数据
|
|
* @param Json
|
|
* @param http_api
|
|
* @returns {Promise<void>}
|
|
*/
|
|
async function pushAllJsonConfig(Json = "[]", http_api = config.bgi_tools.api.httpPushAllJsonConfig) {
|
|
const result = http.request("POST", http_api, Json
|
|
, JSON.stringify({"Content-Type": "application/json"})
|
|
).then(res => {
|
|
log.debug(`[{0}]res=>{1}`, 'next', JSON.stringify(res))
|
|
if (res.status_code === 200 && res.body) {
|
|
let result_json = JSON.parse(res.body);
|
|
if (result_json?.code === 200) {
|
|
return result_json?.data
|
|
}
|
|
throw new Error("请求失败,error:" + result_json?.message)
|
|
}
|
|
return undefined
|
|
})
|
|
} |