Authored by htoooth

fix

  1 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:01:25","_id":"0KGu42ESbnFJy8JC"}
  2 +{"name":"tao.huang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 17:08:24\"}","createdAt":"2018-11-30 17:08:37","_id":"2E5oFB84rfHKtkkC"}
  3 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:03:12","_id":"2qzoyn803BSxrkgX"}
  4 +{"name":"tao.huang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 17:02:52\"}","createdAt":"2018-11-30 17:03:05","_id":"32UE9GlvyVo6HpqM"}
  5 +{"name":"tao.huang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:00:09","_id":"DMD1WWrMHALHkWxd"}
  6 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 16:53:55","_id":"HsQgMGfOjKnrOlu7"}
  7 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:04:28","_id":"Jgni7kdySFc91cWg"}
  8 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:01:22","_id":"QCZ7f0RfpNE9P769"}
  9 +{"name":"jam.wang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 17:12:20\"}","createdAt":"2018-11-30 17:12:33","_id":"SJs6uh8TsmEhLQ4w"}
  10 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:05:23","_id":"Strs5cYPHOacUyR9"}
  11 +{"name":"tao.huang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 16:56:08","_id":"VTnIpb1kzKzz2NpL"}
  12 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:10:19","_id":"XQInAsMGcqVLVk8d"}
  13 +{"name":"tao.huang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 17:01:43\"}","createdAt":"2018-11-30 17:01:56","_id":"YXWSU8WOn9S8dc0A"}
  14 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:10:40","_id":"Zs0sCF9d0OxllEuG"}
  15 +{"name":"tao.huang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 17:00:15\"}","createdAt":"2018-11-30 17:00:28","_id":"a9seczSVGvcVKKz3"}
  16 +{"name":"tao.huang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 16:41:55\"}","createdAt":"2018-11-30 16:42:07","_id":"bVhX5ufMGgcQr8j1"}
  17 +{"name":"tao.huang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:00:20","_id":"efnBVkMFts1AVDCG"}
  18 +{"name":"tao.huang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 16:59:40","_id":"jbFO2up4HgWeceWg"}
  19 +{"name":"tao.huang","message":"签出成功 {\"result\":\"签出成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 16:42:27\"}","createdAt":"2018-11-30 16:42:40","_id":"m6ElrOjciJHbJ5GP"}
  20 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:09:15","_id":"rqXh9UgVVUS6a7PH"}
  21 +{"name":"jam.wang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:01:25","_id":"sUJ0k2tR1o6aMILP"}
  22 +{"name":"tao.huang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 17:00:30\"}","createdAt":"2018-11-30 17:00:43","_id":"tter1UT1hLQhEkuK"}
  23 +{"name":"tao.huang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:02:16","_id":"uZhrqBfR7egIv4S4"}
  24 +{"name":"tao.huang","message":"用户名,密码或设备id 错误,请改正","createdAt":"2018-11-30 17:02:13","_id":"w4k8LrrZo2qnvevh"}
  25 +{"name":"tao.huang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 17:00:27\"}","createdAt":"2018-11-30 17:00:39","_id":"yGurlS9KYm1eqweS"}
  26 +{"name":"jam.wang","message":"签到成功 {\"result\":\"签到成功\",\"msg\":\"如因工作原因迟到或早退请提交相应流程,签到(签退)时间:2018-11-30 17:24:54\"}","createdAt":"2018-11-30 17:25:07","_id":"fWSX0oPr2hlEV81Y"}
1 -{"name":"tao.huang","password":"huangtao3.1415926","udid":"868233033762392","_id":"jiZcM7rqzJI1nlIE","autoAm":1,"autoCheckin":1,"autoCheckout":1} 1 +{"name":"tao.huang","password":"Huangtao2","udid":"868233033762392","_id":"jiZcM7rqzJI1nlIE","autoAm":1,"autoCheckin":1,"autoCheckout":1,"device":"android"}
  2 +{"name":"jam.wang","password":"Wang1234","udid":"7683D66E-3D76-4DD7-83B7-A89D83FF7937","_id":"jiZcM7rqzJI1nlIF","autoAm":1,"autoCheckin":1,"autoCheckout":1,"device":"iPhone"}
@@ -61,6 +61,7 @@ class UserModel extends Model { @@ -61,6 +61,7 @@ class UserModel extends Model {
61 loginid: doc.name, 61 loginid: doc.name,
62 password: doc.password, 62 password: doc.password,
63 udid: doc.udid, 63 udid: doc.udid,
  64 + clienttype: doc.device
64 }) 65 })
65 }) 66 })
66 }) 67 })
@@ -80,6 +81,7 @@ class UserModel extends Model { @@ -80,6 +81,7 @@ class UserModel extends Model {
80 loginid: u.name, 81 loginid: u.name,
81 password: u.password, 82 password: u.password,
82 udid: u.udid, 83 udid: u.udid,
  84 + clienttype: u.device
83 } 85 }
84 }) 86 })
85 87
@@ -102,6 +104,7 @@ class UserModel extends Model { @@ -102,6 +104,7 @@ class UserModel extends Model {
102 loginid: u.name, 104 loginid: u.name,
103 password: u.password, 105 password: u.password,
104 udid: u.udid, 106 udid: u.udid,
  107 + clienttype: u.device
105 } 108 }
106 }) 109 })
107 110
@@ -4,14 +4,31 @@ const END_POINT = 'http://holiday-api.leanapp.cn/api/v1/work' @@ -4,14 +4,31 @@ const END_POINT = 'http://holiday-api.leanapp.cn/api/v1/work'
4 4
5 async function getWorkday(date) { 5 async function getWorkday(date) {
6 return new Promise(function(resolve, reject) { 6 return new Promise(function(resolve, reject) {
7 - request.get(END_POINT, {qs: {date}, json:true}, function(err, res, body) {  
8 - if (err) {  
9 - reject(err)  
10 - return  
11 - } 7 + // request.get(END_POINT, {qs: {date}, json:true}, function(err, res, body) {
  8 + // if (err) {
  9 + // reject(err)
  10 + // return
  11 + // }
  12 +
  13 + // resolve(body)
  14 + // })
  15 +
  16 + const now = new Date();
  17 + const n = now.getDay();
12 18
13 - resolve(body)  
14 - }) 19 + if ([0, 1].includes(n)) {
  20 + return resolve({
  21 + data: {
  22 + shouldWork: 'N'
  23 + }
  24 + });
  25 + }
  26 +
  27 + return resolve({
  28 + data: {
  29 + shouldWork: 'Y'
  30 + }
  31 + });
15 }) 32 })
16 } 33 }
17 34
  1 +
  2 +const _ = require('lodash');
  3 +
1 const data = { 4 const data = {
2 "method": "login", 5 "method": "login",
3 - "isneedmoulds": 1,  
4 - "client": 1,  
5 - "clientver": "6.5.38",  
6 - "clientos": "NMF26X",  
7 - "clientosver": "7.1.1", 6 + // "isneedmoulds": 1,
  7 + // "client": 1,
  8 + // "clientver": "6.5.38",
  9 + // "clientos": "NMF26X",
  10 + // "clientosver": "7.1.1",
  11 + // "clienttype": "iPhone",
8 "clienttype": "android", 12 "clienttype": "android",
9 - "language": "en",  
10 - "country": "US",  
11 - "relogin": 1 13 + // "relogin": 1
12 } 14 }
13 15
14 async function login(session, params) { 16 async function login(session, params) {
15 return new Promise(function(resolve, reject) { 17 return new Promise(function(resolve, reject) {
16 session.post('/client.do', { 18 session.post('/client.do', {
17 - form: Object.assign({}, data, params), 19 + form: _.merge({}, data, params),
18 json: true, 20 json: true,
19 }, function(err, res, body) { 21 }, function(err, res, body) {
20 if (err) { 22 if (err) {