|
@@ -8,6 +8,33 @@ const accessHeader = {
|
|
|
const notWxApiPath = urlsDef.urls.baseUrl + '/schoolbaby/api/';
|
|
|
const apiPath = urlsDef.urls.baseUrl + '/schoolbaby/api/wx/';
|
|
|
|
|
|
+
|
|
|
+function fun_date(num) {
|
|
|
+ var date1 = new Date();
|
|
|
+ //今天时间
|
|
|
+ var time1 = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate()
|
|
|
+ var date2 = new Date(date1);
|
|
|
+ date2.setDate(date1.getDate() + num);
|
|
|
+ //num是正数表示之后的时间,num负数表示之前的时间,0表示今天
|
|
|
+ var month = date2.getMonth() + 1
|
|
|
+ if(month < 10) {
|
|
|
+ month = "0" + month
|
|
|
+ }
|
|
|
+ var date = date2.getDate()
|
|
|
+ if(date < 10) {
|
|
|
+ date = "0" + date
|
|
|
+ }
|
|
|
+ var time2 = date2.getFullYear() + "-" + (month) + "-" + date;
|
|
|
+ return time2;
|
|
|
+ }
|
|
|
+
|
|
|
+ function fun_week(datestr){
|
|
|
+ var weekArray = new Array("周日", "周一", "周二", "周三", "周四", "周五", "周六");
|
|
|
+ var week = weekArray[new Date(datestr).getDay()];
|
|
|
+ return week;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
//经纬度算距离
|
|
|
function distance(la1, lo1, la2, lo2) {
|
|
|
var La1 = la1 * Math.PI / 180.0;
|
|
@@ -262,4 +289,7 @@ module.exports = {
|
|
|
setAccessHeader: setAccessHeader,
|
|
|
distance: distance,
|
|
|
apiPost: apiPost,
|
|
|
+ fun_date:fun_date,
|
|
|
+ fun_week: fun_week
|
|
|
+
|
|
|
}
|