...
|
...
|
@@ -2,7 +2,7 @@ |
|
|
* @Author: Targaryen
|
|
|
* @Date: 2016-05-25 18:16:59
|
|
|
* @Last Modified by: Targaryen
|
|
|
* @Last Modified time: 2016-06-08 16:17:06
|
|
|
* @Last Modified time: 2016-06-08 16:32:07
|
|
|
*/
|
|
|
|
|
|
'use strict';
|
...
|
...
|
@@ -10,7 +10,7 @@ const library = '../../../library'; |
|
|
const helpers = require(`${library}/helpers`);
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
// const aMinute = 60000;
|
|
|
const aMinute = 60000;
|
|
|
const anHour = 3600000;
|
|
|
const aDay = anHour * 24;
|
|
|
const timeFormat = {
|
...
|
...
|
@@ -52,28 +52,28 @@ const processTime = (time) => { |
|
|
* @param {[string]} time
|
|
|
* @return {[boject]}
|
|
|
*/
|
|
|
// const processTimes = (time) => {
|
|
|
// let data = {};
|
|
|
// let type = '';
|
|
|
|
|
|
// if (time > aDay) {
|
|
|
// type = 'dhms';
|
|
|
// } else {
|
|
|
// if (time > anHour) {
|
|
|
// type = 'hms';
|
|
|
// } else {
|
|
|
// if (time > aMinute) {
|
|
|
// type = 'ms';
|
|
|
// } else {
|
|
|
// type = 's';
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// data.time = helpers.dateDiffFormat(timeFormat[type], time, 'ms');
|
|
|
|
|
|
// return data;
|
|
|
// };
|
|
|
const processTimes = (time) => {
|
|
|
let data = {};
|
|
|
let type = '';
|
|
|
|
|
|
if (time > aDay) {
|
|
|
type = 'dhms';
|
|
|
} else {
|
|
|
if (time > anHour) {
|
|
|
type = 'hms';
|
|
|
} else {
|
|
|
if (time > aMinute) {
|
|
|
type = 'ms';
|
|
|
} else {
|
|
|
type = 's';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
data.time = helpers.dateDiffFormat(timeFormat[type], time, 'ms');
|
|
|
|
|
|
return data.time;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 折扣文本切割
|
...
|
...
|
@@ -556,7 +556,7 @@ exports.handleDiscountTitleData = (origin) => { |
|
|
dest.title = origin.title;
|
|
|
dest.up = true;
|
|
|
dest.discount = origin.promotion_name;
|
|
|
dest.time = processTime(origin.left_time);
|
|
|
dest.time = processTimes(origin.left_time);
|
|
|
|
|
|
return dest;
|
|
|
};
|
...
|
...
|
|