Skip to content

Commit

Permalink
로그인 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
aerain committed Aug 24, 2019
1 parent c99b0a7 commit d808885
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions tool/jedaero/lib/dreamy.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import encode64 from "./encode64";
import { Platform } from 'react-native';
import RNFetchBlob from "rn-fetch-blob";

const fetchData = async (uri, body) => RNFetchBlob.config({trusty: true}).fetch('POST', uri, {"Content-Type": "application/x-www-form-urlencoded"}, body)

/**
* Dreamy Connection with fetch API.
*/
const Dreamy = {
_openSession: async function (account, password) {
const uri = 'https://dreamy.jejunu.ac.kr/frame/sysUser.do?next=';
const body = `tmpu=${encode64(account)}&tmpw=${encode64(password)}&mobile=&app=&z=N&userid=&password=`
const body = `tmpu=${encode64(account)}&tmpw=${encode64(password)}&mobile=y&app=null&z=Y&userid=&password=`
// 세션 확보
return this.fetchData(uri, body);
return fetchData(uri, body);
},

_getBaseInfo: async function (account) {
const uri = 'https://dreamy.jejunu.ac.kr/hjju/hj/sta_hj_1010q.jejunu';
const body = `mode=doValue&student_no=${account}&_=`
return (await fetchData(uri, body)).json();
},

return (await this.fetchData(uri, body)).json();
_logout: async function() {
const uri = 'https://dreamy.jejunu.ac.kr/frame/sysUser.do?mode=logout';
return RNFetchBlob.config({trusty: true}).fetch('GET', uri);
},

getTimeTable: async function (account, year, month, day) {
Expand All @@ -37,7 +44,7 @@ const Dreamy = {
*/
const uri = 'https://dreamy.jejunu.ac.kr/susj/su/sta_su_6170q.jejunu';
const body = `mode=doListTimetable&curri_year=${year}&term_gb=${semester}&su_dt=${year}${month <= 9 ? `0${month}` : month}${day <= 9 ? `0${day}` : day}&student_no=${account}&_=`;
return (await this.fetchData(uri, body)).json()
return (await fetchData(uri, body)).json()
},

isValidAccount: async function(account = '', password = '') {
Expand All @@ -56,27 +63,28 @@ const Dreamy = {
getCredit: async function (account) {
const uri = 'https://dreamy.jejunu.ac.kr/susj/sj/sta_sj_3230q.jejunu';
const body = `mode=doSearch&student_no=${account}&del_gb=&_=`;
return (await this.fetchData(uri, body)).json();
return (await fetchData(uri, body)).json();
},
getCreditDetail: async function (account, year, semester, outsideSeq, groupGb) {
const uri = 'https://dreamy.jejunu.ac.kr/susj/sj/sta_sj_3220q.jejunu';
const body = `mode=doList&year=${year}&term_gb=${semester}&group_gb=${groupGb}&student_no=${account}&outside_seq=${outsideSeq}&del_gb=AND%20SJ_DEL_GB%20IS%20NULL&_=`;
return (await this.fetchData(uri, body)).json();
return (await fetchData(uri, body)).json();
},
getLectureBoard: async function(account, name, userGb, year, semester) {
const uri = 'https://dreamy.jejunu.ac.kr/frame/doumi_1020e.jejunu';
const body = `mode=doListSugangBanNo&common_curri_year=${year}&common_term_gb=${semester}&common_student_no=${account}&common_subject_nm=${name}&common_prof_no=${account}&common_prof_nm=${name}&common_user_gb=${userGb}&mng_dept_cd=&_=`;
return (await this.fetchData(uri, body)).json();
console.log(body);
return (await fetchData(uri, body)).json();
},
getLectureItemBoard: async function(year, semester, classCode) {
const uri = 'https://dreamy.jejunu.ac.kr/frame/doumi_1020e.jejunu';
const body = `mode=doList&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&title&content&name&_=`;
return (await this.fetchData(uri, body)).json();
return (await fetchData(uri, body)).json();
},
getLecturePost: async function(year, semester, classCode, num, root) {
const uri = 'https://dreamy.jejunu.ac.kr/frame/doumi_1020e.jejunu';
const body = `mode=doGetBoardDetail&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&num=${num}&root=${root}&prevnextyn=0&_=`
return (await this.fetchData(uri, body)).json();
return (await fetchData(uri, body)).json();
},
downloadLecurePostFile: async function (
account = '',
Expand Down Expand Up @@ -122,17 +130,18 @@ const Dreamy = {
isPassDormitory: async function (account) {
const uri = 'https://dreamy.jejunu.ac.kr/stsv/ht/sts_ht_0509e.jejunu';
const body = `mode=doValue&campus_gb=A&student_no=${account}&_=`;
return (await this.fetchData(uri, body)).json();
console.log(body);
return (await fetchData(uri, body)).json();
},
getLecturePlanList: async function ({year, semester, search: {classCode = '', professorName = '', lectureName = ''}}) {
const uri = 'https://dreamy.jejunu.ac.kr/susj/su/sta_su_7020q.jejunu';
const body = `mode=doList&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&emp_nm=${professorName}&emp_no=&subject_nm=${lectureName}&_=`;
return (await this.fetchData(uri, body)).json();
return (await fetchData(uri, body)).json();
},
getLecturePlanSummary: async function ({year, semester, lecture: {classCode, lectureCode}}) {
const uri = 'https://dreamy.jejunu.ac.kr/susj/su/sta_su_7020q.jejunu';
const body = `mode=doGetListDetail&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&subject_cd=${lectureCode}&_=`
return (await this.fetchData(uri, body)).json();
return (await fetchData(uri, body)).json();
},

/**
Expand All @@ -141,14 +150,13 @@ const Dreamy = {
getLecturePlanDetail: async function({mode, year, semester, classCode}) {
const uri = 'https://dreamy.jejunu.ac.kr/susj/su/sta_su_7012e.jejunu';
const body = `mode=doSearch&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&_=`
return (await this.fetchData(uri, body)).json();
return (await fetchData(uri, body)).json();
},
getLecturePlanDetailWeekList: async function ({year, semester, classCode}) {
const uri = 'https://dreamy.jejunu.ac.kr/susj/su/sta_su_7012e.jejunu';
const body = `mode=doListMst&curri_year=${year}&term_gb=${semester}&ban_no=${classCode}&_=`
return (await this.fetchData(uri, body)).json();
},
fetchData: (uri, body) => RNFetchBlob.config({trusty: true}).fetch('POST', uri, {"Content-Type": "application/x-www-form-urlencoded"}, body)
return (await fetchData(uri, body)).json();
}
};

export default Dreamy;

0 comments on commit d808885

Please sign in to comment.