|
|
@@ -2688,6 +2688,19 @@ async function recordDetailData(input, current) {
|
|
|
}
|
|
|
return { words, addon: order ? [{...order, ...(notesReview ? {reviewContentMode:'notes'} : {})}] : [], record };
|
|
|
}
|
|
|
+function compactReviewRecord(detail) {
|
|
|
+ const wordKeys = ['GeneralID','Title','ID','id','gid','NodeID','nodeId','word','Word','sy','jssy','Translate','Meaning','meaning','yb','Phonetic','phonetic','audio','yp','dy','gldy','check'];
|
|
|
+ const pick = (row, keys) => Object.fromEntries(keys.filter(key => row[key] !== undefined).map(key => [key, row[key]]));
|
|
|
+ return {
|
|
|
+ words: detail.words.map(word => {
|
|
|
+ const nested = Array.isArray(word.detail) ? word.detail[0] : word.detail;
|
|
|
+ const fields = pick(word, wordKeys);
|
|
|
+ if (nested && typeof nested === 'object') fields.detail = [pick(nested, wordKeys)];
|
|
|
+ return fields;
|
|
|
+ }),
|
|
|
+ addon: detail.addon.map(order => pick(order, ['if_writing','if_writing_tips','reviewContentMode'])),
|
|
|
+ };
|
|
|
+}
|
|
|
async function newWordPage(input, current) {
|
|
|
const uid = await (isWordbookCoach(current) ? coachWordbookTarget(current, input.uid) : authorizeRequestedUser(current, input.uid));
|
|
|
const paging = largePageInput(input);
|
|
|
@@ -3334,7 +3347,12 @@ async function handler(request, response) {
|
|
|
if (action === 'e_get_21list_tj') return response.json(envelope(await memoryCompletedCount(input,current)));
|
|
|
if (action === 'e_words_list') { const result = await newWordPage(input, current); return response.json(envelope(result.rows, undefined, result.page)); }
|
|
|
if (action === 'e_order_detail') { const found = await orderDetailRow(input.id, current); if(found) found.feedback=await Psql.oneOrNone('SELECT *, "updatedAt"::text AS "revision" FROM "LessonCompletionReport" WHERE "company"=$1 AND "appointmentGeneralId"::text=$2 LIMIT 1',[DEFAULT_COMPANY_ID,String(found.GeneralID||input.id)]); return found ? response.json(envelope([await lessonOrderCapabilities(found,current)])) : response.status(404).json(reject('预约记录不存在')); }
|
|
|
- if (action === 'e_record_detail') { const found = await recordDetailData(input, current); return found ? response.json(envelope(found.words, found.addon)) : response.status(404).json(reject('学习记录不存在')); }
|
|
|
+ if (action === 'e_record_detail') {
|
|
|
+ const found = await recordDetailData(input, current);
|
|
|
+ if (!found) return response.status(404).json(reject('学习记录不存在'));
|
|
|
+ const detail = input.compactReview === true ? compactReviewRecord(found) : found;
|
|
|
+ return response.json(envelope(detail.words, detail.addon));
|
|
|
+ }
|
|
|
if (action === 'user_point_list') { const result = await pointHistoryPage(input,current); return response.json(envelope(result.rows,result.addon,result.page)); }
|
|
|
if (['app_support_requests_list','app_support_request_read'].includes(action)) return response.json(envelope(await appSupportRequests(input,current)));
|
|
|
if (action === 'guestbook_add') return response.json(envelope(await createGuestbook(input,current)));
|