20 lines
611 B
TypeScript
20 lines
611 B
TypeScript
import { generateKeyValStr } from '../utils/string.util'
|
|
import axios from 'axios'
|
|
|
|
const CONFIG_URL = 'https://center.kingsome.cn/api/cfg_list'
|
|
|
|
/**
|
|
* 获取jcfw中该游戏的配置
|
|
* @param {string} gameid
|
|
* @param {string} channel
|
|
*/
|
|
export function getGameConfig(gameid: string, channel: string) {
|
|
let url = `${ CONFIG_URL }?game_id=${gameid}&channel_id=${channel}`
|
|
return axios.get(url).then((res: any) => {
|
|
if (res.data.errorcode && res.data.result) {
|
|
throw new Error(`error get game cfg, code: ${res.errorcode}, msg: ${res.errmsg}`)
|
|
}
|
|
return JSON.parse(res.data.result)
|
|
})
|
|
}
|