diff --git a/docs/bbs.md b/docs/bbs.md index e5fcadf378..3bc9a9e252 100644 --- a/docs/bbs.md +++ b/docs/bbs.md @@ -175,6 +175,21 @@ pageClass: routes +### 录取结果 + + +::: warning 三个 id 获取方式 + +1. 打开 https://offer.1point3acres.com +2. 打开控制台 +3. 切换到 Network 面板 +4. 点击 搜索 按钮 +5. 点击 results?ps=15&pg=1 POST 请求 +6. 找到 Request Payload 请求参数,例如 filters: {planyr: "13", planmajor: "1", outname_w: "ACADIAU"} ,则三个 id 分别为: 13,1,ACADIAU + +::: + + ## 直播吧 ### 子论坛 diff --git a/lib/router.js b/lib/router.js index eb4d440cfe..47140ba6cf 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1345,6 +1345,7 @@ router.get('/vocus/user/:id', require('./routes/vocus/user')); // 一亩三分地 1point3acres router.get('/1point3acres/user/:id/threads', require('./routes/1point3acres/threads')); router.get('/1point3acres/user/:id/posts', require('./routes/1point3acres/posts')); +router.get('/1point3acres/offer/:year?/:major?/:school?', require('./routes/1point3acres/offer')); // 广东海洋大学 router.get('/gdoujwc', require('./routes/universities/gdou/jwc/jwtz')); diff --git a/lib/routes/1point3acres/offer.js b/lib/routes/1point3acres/offer.js new file mode 100644 index 0000000000..711585f175 --- /dev/null +++ b/lib/routes/1point3acres/offer.js @@ -0,0 +1,204 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + // const { id } = ctx.params; + // const { year } = ctx.params.year || 'null'; + // year 2017-2022 + // 2017:6 2018:11 2019:12 2020:13 2021:14 2022:15 + // const { major } = ctx.params.major || 'null'; + // CS:1 MIS:2 + // const { school } = ctx.params.school || 'null'; + const year = ctx.params.year || 'null'; + const major = ctx.params.major || 'null'; + const school = ctx.params.school || 'null'; + // school == 'null' ? outname_w : 'CMU' + const url = 'https://api.1point3acres.com/offer/results?ps=15&pg=1'; + // const filter = '{"filters": {"planyr": "12", "planmajor": "1", "outname_w": "CMU"}}'; + // const filter = 'filters: {planyr: "12", planmajor: "1", outname_w: "CMU"}'; + let responseBasic; + // eslint-disable-next-line eqeqeq + if (year == 'null') { + // eslint-disable-next-line eqeqeq + if (major == 'null') { + // eslint-disable-next-line eqeqeq + if (school == 'null') { + // year空 major空 school空 + responseBasic = await got({ + method: 'post', + url: url, + json: true, + data: { + filters: {}, + }, + }); + } else { + // year空 major空 school不空 + responseBasic = await got({ + method: 'post', + url: url, + json: true, + data: { + filters: { + outname_w: school, + }, + }, + }); + } + } else { + // year空 major不空 + // eslint-disable-next-line eqeqeq + if (school == 'null') { + // year空 major不空 school空 + responseBasic = await got({ + method: 'post', + url: url, + json: true, + data: { + filters: { + planmajor: major, + }, + }, + }); + } else { + // year空 major不空 school不空 + responseBasic = await got({ + method: 'post', + url: url, + json: true, + data: { + filters: { + planmajor: major, + outname_w: school, + }, + }, + }); + } + } + } else { + // eslint-disable-next-line eqeqeq + if (major == 'null') { + // eslint-disable-next-line eqeqeq + if (school == 'null') { + // year不空 major空 school空 + responseBasic = await got({ + method: 'post', + url: url, + json: true, + data: { + filters: { + planyr: year, + }, + }, + }); + } else { + // year不空 major空 school不空 + responseBasic = await got({ + method: 'post', + url: url, + json: true, + data: { + filters: { + planyr: year, + outname_w: school, + }, + }, + }); + } + } else { + // eslint-disable-next-line eqeqeq + if (school == 'null') { + // year不空 major不空 school空 + responseBasic = await got({ + method: 'post', + url: url, + json: true, + data: { + filters: { + planyr: year, + planmajor: major, + }, + }, + }); + } else { + // year不空 major不空 school不空 + responseBasic = await got({ + method: 'post', + url: url, + json: true, + data: { + filters: { + planyr: year, + planmajor: major, + outname_w: school, + }, + }, + }); + } + } + } + const data = responseBasic.data.results; + // let responseBasic_1; + // responseBasic_1 = await got({ + // method: 'get', + // url: `https://api.1point3acres.com/offer/results/A7m20e4g/backgrounds`, + // headers: { + // authorization: `eyJhbGciOiJIUzUxMiIsImlhdCI6MTU3Njk5Njc5OSwiZXhwIjoxNTg0ODU5MTk5fQ.eyJ1aWQiOjQ1NzQyN30.0ei5UE6OgLBzN2_IS7xUIbIfW_S1Wzl42q2UeusbboxuzvctO_4Mz6YRr6f0PBLUVZMETxt8F0_4-yqIJ3_kUQ`, + // }, + // }); + // const tid = responseBasic_1.data.background.tid; + ctx.state.data = { + title: `录取结果 - 一亩三分地`, + link: `https://offer.1point3acres.com`, + description: `录取结果 - 一亩三分地`, + item: data.map((item) => ({ + title: item.planyr + `年` + item.planmajor + `@` + item.outname_w + ` ` + item.result + ` - 一亩三分地`, // `${year_result}年${major_result}@${outname_w_result} ${result_result}`, + description: + `国家:` + + item.country + + `
` + + `学校:` + + item.outname_w + + ` ` + + item.outname + + '
' + + `录取学位:` + + item.plandegree + + '
' + + `录取项目:` + + item.planmajor + + `-` + + item.planprogram + + '
' + + `录取结果:` + + item.result + + '
' + + `录取时间:` + + item.outtime + + '
' + + `通知方式:` + + item.noticemethod + + '
' + + `全奖/自费:` + + item.planfin + + '
' + + `申入学学期:` + + item.planterm + + '
' + + `申入学年度:` + + item.planyr + + '
' + + `提交时间:` + + item.submittime + + '
', + pubDate: new Date(item.submittime + ' GMT+8').toUTCString(), + link: `https://offer.1point3acres.com`, + // responseBasic_1 =await got({ + // method: 'get', + // url: `https://api.1point3acres.com/offer/results/${item.id}/backgrounds`, + // headers: { + // authorization: `eyJhbGciOiJIUzUxMiIsImlhdCI6MTU3Njk5Njc5OSwiZXhwIjoxNTg0ODU5MTk5fQ.eyJ1aWQiOjQ1NzQyN30.0ei5UE6OgLBzN2_IS7xUIbIfW_S1Wzl42q2UeusbboxuzvctO_4Mz6YRr6f0PBLUVZMETxt8F0_4-yqIJ3_kUQ`, + // }, + // }).data.data.background.tid, + })), + }; +};