Commit 74fd707f by lixinming
parents 2ca62d38 49238be9
...@@ -6,7 +6,7 @@ export async function getBaseData(id) { ...@@ -6,7 +6,7 @@ export async function getBaseData(id) {
let sql = 'select * from students_detail where p_id=Placeholder1'; 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 scoreObj = { "击球速度":"HIT_SPEED", "击球力量":"HIT_POWER", "正手能力":"FOREHAND", "反手能力":"BACKHAND", "得分率":"SCORE_RATE"};
let selectResult = await selectOnceObjectData(sql, id); let selectResult = await selectOnceObjectData(sql, id);
...@@ -63,7 +63,7 @@ function checkUnit(checkString, data, allUnit?) { ...@@ -63,7 +63,7 @@ function checkUnit(checkString, data, allUnit?) {
export async function get近期比赛概览(PID, checkDate) { export async function get近期比赛概览(PID, checkDate) {
let sql = "select * from recent_match where self_pid = Placeholder1 and m_date < Placeholder2"; let sql = "select * from recent_match where self_pid = Placeholder1 and m_date <= Placeholder2";
let selectResult = await selectData(sql, PID, checkDate); let selectResult = await selectData(sql, PID, checkDate);
let result = []; let result = [];
let firstDate = ""; let firstDate = "";
...@@ -89,7 +89,7 @@ export async function get近期比赛概览(PID, checkDate) { ...@@ -89,7 +89,7 @@ export async function get近期比赛概览(PID, checkDate) {
} }
export async function get全部比赛日期() { export async function get全部比赛日期() {
let sql = "select to_char(m_date,'yyyy/mm/dd') m_time from recent_match group by m_date"; let sql = "select to_char(m_date,'yyyy-mm-dd') m_time from recent_match group by m_date";
let selectResult = await selectData(sql); // [{to_char:'日期'},...] let selectResult = await selectData(sql); // [{to_char:'日期'},...]
let result = []; let result = [];
selectResult.forEach(info => { selectResult.forEach(info => {
...@@ -116,17 +116,19 @@ function dataFormatInSubKey(time) { ...@@ -116,17 +116,19 @@ function dataFormatInSubKey(time) {
let date = new Date(time); let date = new Date(time);
let match = date.getMonth() + 1; let match = date.getMonth() + 1;
let matchStr = match > 9 ? `${match}` : `0${match}`; let matchStr = match > 9 ? `${match}` : `0${match}`;
let day = date.getDate() + 1;
return `${date.getFullYear()}-${matchStr}`; return `${date.getFullYear()}-${matchStr}`;
} }
export async function get比赛详情(mid) { export async function get比赛详情(mid) {
let sql = "select * from match_information where m_id = Placeholder1"; let sql = "select * from match_information where m_id = Placeholder1";
let subSql = "select m_date from recent_match where m_id = Placeholder1 " let subSql = "select m_date from recent_match where m_id <= Placeholder1 "
let selectInfo = await selectOnceObjectData(sql, mid); let selectInfo = await selectOnceObjectData(sql, mid);
let timeInfo = await selectOnceObjectData(subSql, mid); let timeInfo = await selectOnceObjectData(subSql, mid);
let selfScore = selectInfo.SELF_SCORE || 0; let selfScore = selectInfo.SELF_SCORE || 0;
let opponentScore = selectInfo.OPPONENT_SCORE || 0; let opponentScore = selectInfo.OPPONENT_SCORE || 0;
let matchResult = selfScore > opponentScore ? "胜" : "负"; let matchResult = selfScore > opponentScore ? "胜" : "负";
//let firstDate = dataFormatInSubKey(timeInfo.M_DATE);
let result = { let result = {
mid:selectInfo.M_ID, mid:selectInfo.M_ID,
selfName:selectInfo.SELF_NAME, selfName:selectInfo.SELF_NAME,
...@@ -137,7 +139,7 @@ export async function get比赛详情(mid) { ...@@ -137,7 +139,7 @@ export async function get比赛详情(mid) {
opponentScore:opponentScore, opponentScore:opponentScore,
videoUrl:selectInfo.VIDEO_URL, videoUrl:selectInfo.VIDEO_URL,
result:matchResult, result:matchResult,
date:timeInfo.M_DATE date:dataFormat(timeInfo.M_DATE)
}; };
return result; return result;
} }
......
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