1
This commit is contained in:
@@ -586,17 +586,14 @@ module.exports = {
|
||||
const authDays = accountData.authorization_days || 0;
|
||||
|
||||
// 计算剩余天数
|
||||
let remaining_days = 0;
|
||||
let is_expired = false;
|
||||
const { calculateRemainingDays } = require('../utils/account_utils');
|
||||
const remaining_days = calculateRemainingDays(authDate, authDays);
|
||||
const is_expired = remaining_days <= 0;
|
||||
let end_date = null;
|
||||
|
||||
if (authDate && authDays > 0) {
|
||||
const startDate = dayjs(authDate);
|
||||
end_date = startDate.add(authDays, 'day').toDate();
|
||||
const now = dayjs();
|
||||
const remaining = dayjs(end_date).diff(now, 'day', true);
|
||||
remaining_days = Math.max(0, Math.ceil(remaining));
|
||||
is_expired = remaining_days <= 0;
|
||||
}
|
||||
|
||||
return ctx.success({
|
||||
@@ -675,10 +672,9 @@ module.exports = {
|
||||
});
|
||||
|
||||
// 计算更新后的剩余天数
|
||||
const { calculateRemainingDays } = require('../utils/account_utils');
|
||||
const remaining_days = calculateRemainingDays(authDate, authorization_days);
|
||||
const end_date = dayjs(authDate).add(authorization_days, 'day').toDate();
|
||||
const now = dayjs();
|
||||
const remaining = dayjs(end_date).diff(now, 'day', true);
|
||||
const remaining_days = Math.max(0, Math.ceil(remaining));
|
||||
|
||||
return ctx.success({
|
||||
message: '授权信息更新成功',
|
||||
|
||||
Reference in New Issue
Block a user