...
|
...
|
@@ -13,25 +13,6 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model |
|
|
const _ = require('lodash');
|
|
|
const urlP = require('url');
|
|
|
|
|
|
/**
|
|
|
* 处理旧版本的app兼容新接口
|
|
|
* @param {*} url url
|
|
|
* @param {*} data data
|
|
|
* @param {*} param param
|
|
|
* @param {*} method method
|
|
|
*/
|
|
|
const middleApi = (url, data, param, method) => {
|
|
|
try {
|
|
|
let promise = method === 'post' ? api.post : api.get;
|
|
|
|
|
|
if (!_.get(data, 'uid.sessionKey', '') && data.uid) {
|
|
|
data.app_version = '5.5.0';
|
|
|
}
|
|
|
return promise.call(api, url, data, param);
|
|
|
} catch (err) {
|
|
|
return null;
|
|
|
}
|
|
|
};
|
|
|
const getResource = code => {
|
|
|
return serviceApi.get('operations/api/v5/resource/get', {
|
|
|
content_code: code,
|
...
|
...
|
@@ -39,43 +20,43 @@ const getResource = code => { |
|
|
});
|
|
|
};
|
|
|
const vip = (limit) => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.student.vip',
|
|
|
limit: limit || 60
|
|
|
});
|
|
|
};
|
|
|
const verifiedStudentTotal = () => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.student.verifiedStudentTotal'
|
|
|
});
|
|
|
};
|
|
|
const getProvince = () => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.studentMarket.getAddressList'
|
|
|
}, {
|
|
|
cache: true
|
|
|
});
|
|
|
};
|
|
|
const getSchool = code => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.studentMarket.getSchoolInfoList',
|
|
|
areaCode: code
|
|
|
});
|
|
|
};
|
|
|
const getEducationLevelList = () => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.studentMarket.getEducationLevelList'
|
|
|
});
|
|
|
};
|
|
|
const userAcquireStatus = (uid, couponIds) => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.coupons.userAcquireStatus',
|
|
|
uid: uid,
|
|
|
couponIds: couponIds
|
|
|
});
|
|
|
};
|
|
|
const verifyStudent = (uid, collegename, educationdegree, enrollmentyear) => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.student.verifyStudent',
|
|
|
uid: uid,
|
|
|
client_type: 'h5',
|
...
|
...
|
@@ -85,7 +66,7 @@ const verifyStudent = (uid, collegename, educationdegree, enrollmentyear) => { |
|
|
});
|
|
|
};
|
|
|
const verifyIdentity = (uid, certno, name, pageurl) => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.student.verifyIdentity',
|
|
|
uid: uid,
|
|
|
client_type: 'h5',
|
...
|
...
|
@@ -101,7 +82,7 @@ const getUser = (uid) => { |
|
|
data: {}
|
|
|
});
|
|
|
}
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.passport.profile',
|
|
|
uid: uid
|
|
|
}, {
|
...
|
...
|
@@ -153,7 +134,7 @@ const getPlatForm = (req) => { |
|
|
if (isProduction) {
|
|
|
yoho.http = 'https:';
|
|
|
}
|
|
|
yoho.uid = req.user.uid;
|
|
|
yoho.uid = req.user.uid || req.query.uid;
|
|
|
yoho.isLogin = yoho.uid ? true : false;
|
|
|
return co(function*() {
|
|
|
let data = yield getUser(yoho.uid);
|
...
|
...
|
@@ -391,7 +372,7 @@ exports.verifyidentity = (req, res, next) => { |
|
|
|
|
|
// 添加分享成功记录
|
|
|
const addStudent = (ownuid, shareId) => {
|
|
|
return middleApi('', {
|
|
|
return api.get('', {
|
|
|
method: 'app.student.addShare',
|
|
|
uid: ownuid,
|
|
|
shareUid: shareId
|
...
|
...
|
|