|
|
@@ -52,8 +52,8 @@ async function Main() {
|
|
|
|
|
|
async function checkHandleRequest(){
|
|
|
const request = magicJS.request;
|
|
|
- magicJS.logger.info(request.url);
|
|
|
- magicJS.logger.info(`请求url=${request.url}#${request.method}`);
|
|
|
+ // magicJS.logger.info(request.url);
|
|
|
+ // magicJS.logger.info(`请求url=${request.url}#${request.method}`);
|
|
|
if(request.method == 'OPTIONS'){
|
|
|
return;
|
|
|
}
|
|
|
@@ -64,28 +64,25 @@ async function checkHandleRequest(){
|
|
|
magicJS.logger.info('333333333333');
|
|
|
await handlePointHomeData();
|
|
|
} else if (path.match(/\/user\/info/)) {
|
|
|
- // handlePointHomeData();
|
|
|
+ // await handlePointHomeData();
|
|
|
} else {
|
|
|
- // switch (path) {
|
|
|
- // default:
|
|
|
- // break;
|
|
|
- // }
|
|
|
+ switch (path) {
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
async function handlePointHomeData(){
|
|
|
- magicJS.logger.info('!!!!!!!!!!!!!!!!');
|
|
|
const request = magicJS.request;
|
|
|
const cookie = request.headers.Cookie;
|
|
|
const body = request.url.split('?')[1];
|
|
|
// 获取UserId
|
|
|
magicJS.logger.info(cookie);
|
|
|
- magicJS.logger.info('!!!!!!!!!!!!!!!!#1');
|
|
|
const userId = await magicJS.utils.retry(getUserId, 3, 500)(cookie).catch(err => {
|
|
|
magicJS.notification.post(err);
|
|
|
magicJS.done();
|
|
|
});
|
|
|
- magicJS.logger.info('!!!!!!!!!!!!!!!!#2');
|
|
|
let hisCookie = magicJS.data.read(dingDongCookieKey, "", userId);
|
|
|
if (cookie !== hisCookie) {
|
|
|
magicJS.data.write(dingDongCookieKey, cookie, userId);
|
|
|
@@ -120,9 +117,8 @@ function getUserId(cookie) {
|
|
|
}
|
|
|
}).then(resp => {
|
|
|
const obj = resp.body;
|
|
|
- magicJS.logger.info(JSON.stringify(obj));
|
|
|
if (obj.code === 0) {
|
|
|
- magicJS.logger.info(`当前登录用户Id:${obj.data.id},手机号:${obj.mobile}`);
|
|
|
+ magicJS.logger.info(`当前登录用户Id:${obj.data.id},手机号:${obj.data.mobile}`);
|
|
|
resolve(obj.data.id);
|
|
|
} else {
|
|
|
const msg = `获取UserId失败\n${JSON.stringify(resp)}`;
|