Commit 774280b7 by chenjinjing

no message

parent fac1c0bc
......@@ -45,7 +45,7 @@ export async function getData(req, res) {
let 最新一条数据 = await get最近一条淘汰赛时间();
let data = await get积分赛淘汰赛数据(最新一条数据.time || new Date());
let dataName = 最新一条数据.type == 1 ? "淘汰赛" : "校内积分赛";
let dataName = "校内积分赛";
ret["matchlist"] = getListData(dataName, data, ["排名","照片","学员","场次","胜场","负场","积分"], {"排名":"rank","照片":"self_pic","学员":"p_name","场次":"gameCount","胜场":"win","负场":"lose","积分":"points"} );
ret["api12"] = await 基础数据();
......
......@@ -5,7 +5,7 @@ export async function getBaseData(id) {
let result = {};
let sql = 'select * from students_detail where p_id=Placeholder1';
let baseObj = { "img":"SELF_PIC","姓名":"P_NAME", "性别" :"SEX", "英语名字":"EN_NAME", "主教练" :"COACH", "出生年份" :"BIRTH", "身高" :"HEIGHT", "体重" :"WEIGHT", "比赛场次" :"MATCH_COUNT", "胜场" :"WIN_COUNT", "胜率" :"WIN_RATE&%", "排名" :"RANK", "惯用手" :"HABITUAL_HAND" };
let baseObj = { "img":"SELF_PIC","姓名":"P_NAME", "性别" :"SEX", "英语名字":"EN_NAME", "主教练" :"COACH", "出生年份" :"BIRTH&年", "身高" :"HEIGHT&米", "体重" :"WEIGHT&公斤", "比赛场次" :"MATCH_COUNT", "胜场" :"WIN_COUNT", "胜率" :"WIN_RATE&%", "排名" :"RANK", "惯用手" :"HABITUAL_HAND" };
let scoreObj = { "击球速度":"HIT_SPEED", "击球力量":"HIT_POWER", "正手能力":"FOREHAND", "反手能力":"BACKHAND", "得分率":"SCORE_RATE&%"};
let selectResult = await selectOnceObjectData(sql, id);
......@@ -31,11 +31,34 @@ function checkUnit(str, data, allUnit?) {
if (allUnit) {
return `${data[str]}%`;
}
let checkValue = str.replace(/&d/,"");
let result = `${data[checkValue] || 0}`;
if (checkValue.length != str.length) return `${result}%`;
return result;
let configs = [
{
test:/&d/,
str:"%"
},
{
test:/&年/,
str:"年"
},
{
test:/&米/,
str:"米"
},
{
test:/&公斤/,
str:"公斤"
}
];
let result = "";
for (let i = 0; i < configs.length; i++) {
let {test, str} = configs[i];
let checkValue = str.replace(test,"");
result = `${data[checkValue] || 0}`;
if (checkValue.length != str.length) return `${result}${str}`;
}
return result;
}
......
......@@ -168,6 +168,7 @@ export async function 基础数据() {
let {P_ID, BIRTH, HABITUAL_HAND, MATCH_COUNT, WIN_COUNT, WIN_RATE, SELF_NAME, SELF_SCORE, OPPONENT_SCORE, OPPONENT_NAME, M_ID, SELF_PIC} = info;
if (!distinctMap[P_ID]) {
distinctMap[P_ID] = {
"pid":P_ID,
"出生日期": BIRTH,
"惯用手": HABITUAL_HAND,
"比赛场次": MATCH_COUNT,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment