37 lines
1015 B
TypeScript
37 lines
1015 B
TypeScript
import axios from "axios";
|
|
import {Config} from "../cfg/Config";
|
|
|
|
let config: Config = require('../../config/config.json');
|
|
|
|
/**
|
|
* 获取卡组详情
|
|
* @param {string} accountid
|
|
* @param {number} heroid
|
|
* @param {string} cardgroup
|
|
* @return {Promise<AxiosResponse<any>>}
|
|
*/
|
|
export function getCardGroup(accountid: string, heroid: number, cardgroup: string) {
|
|
return axios.get(`${config.info_svr}/${accountid}/group_info/${heroid}/${cardgroup}`, )
|
|
.then(function (response) {
|
|
let res = response.data;
|
|
if (res.errcode) {
|
|
throw new Error(res.errmsg);
|
|
} else {
|
|
return res.data;
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 解锁英雄
|
|
* @param {string} accountid
|
|
* @param {number | string} heroid
|
|
* @return {Promise<AxiosResponse<any>>}
|
|
*/
|
|
export function requestUnlockHero(accountid: string, heroid: number | string) {
|
|
let data = {"type": 0};
|
|
return axios.post(`${config.info_svr}/${accountid}/hero/unlock/${heroid}`, data);
|
|
}
|
|
|
|
|