时间:整理时间方法
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { Application, BackendSession, ChannelService } from "pinus";
|
||||
import { resResult, getRandEelm, getResStr, shouldRefresh, getRefTime, sortArrRandom } from "../../../pubUtils/util";
|
||||
import { resResult, getRandEelm, getResStr, shouldRefresh, sortArrRandom } from "../../../pubUtils/util";
|
||||
import { STATUS, ROLE_SELECT, FRIEND_DROP_TYPE, FRIEND_RELATION_TYPE, POPULATE_TYPE, BLOCK_OPEATE, CONSUME_TYPE, ITID, HERO_SELECT, EQUIP_SELECT, REDIS_KEY, MSG_SOURCE, MSG_TYPE, TASK_TYPE } from "../../../consts";
|
||||
import Role, { RoleModel, RoleType } from "../../../db/Role";
|
||||
import { getBeforeHourSeconds } from "../../../pubUtils/timeUtil";
|
||||
import { RoleModel, RoleType } from "../../../db/Role";
|
||||
import { getTimeFun, getZeroPointD } from "../../../pubUtils/timeUtil";
|
||||
import { FriendApplyModel } from "../../../db/FriendApply";
|
||||
import { FriendApplyParams, FriendListParam, FriendRecommendParams, BlackListParam, FriendValueListParam } from "../../../domain/roleField/friend";
|
||||
import { FriendShipModel, FriendShipType } from "../../../db/FriendShip";
|
||||
@@ -40,13 +40,13 @@ export class FriendHandler {
|
||||
public async getRecommend(msg: { }, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
|
||||
const day = getBeforeHourSeconds(FRIEND.FRIEND_RECONMMEND_ACTIVETIME);
|
||||
const day = <number>getTimeFun().getBeforeHour(FRIEND.FRIEND_RECONMMEND_ACTIVETIME);
|
||||
|
||||
const { lv, serverId: myServerId, userInfo: { serverType: myServerType } } = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_MY_SERVER);
|
||||
let allList = await RoleModel.getRecommedList(lv - FRIEND.FRIEND_RECONMMEND_LEVEL, lv + FRIEND.FRIEND_RECONMMEND_LEVEL, day);
|
||||
|
||||
// 筛掉自己今天申请过的人
|
||||
let applyList = await FriendApplyModel.getSentApplyList(roleId, getRefTime(new Date(), 0));
|
||||
let applyList = await FriendApplyModel.getSentApplyList(roleId, getZeroPointD());
|
||||
allList = allList.filter(cur => {
|
||||
return !applyList.find(ccur => ccur.roleId == cur.roleId);
|
||||
});
|
||||
@@ -294,7 +294,7 @@ export class FriendHandler {
|
||||
if(!friendRole || !friendShip) continue;
|
||||
|
||||
let fs = <FriendShipType>friend.friendShip;
|
||||
let ref = shouldRefresh(fs.refTime, new Date(), 0);
|
||||
let ref = shouldRefresh(fs.refTime, new Date());
|
||||
if(ref) {
|
||||
friendShip = await FriendShipModel.refreshSendAndReceive(roleId, friendRole.roleId);
|
||||
}
|
||||
@@ -525,7 +525,7 @@ export class FriendHandler {
|
||||
|
||||
if(todaySendCnt + FRIEND.FRIEND_FRIENDPOINT_ADD > max) break;
|
||||
let fs = <FriendShipType>relation.friendShip;
|
||||
let ref = shouldRefresh(fs.refTime, new Date(), 0);
|
||||
let ref = shouldRefresh(fs.refTime, new Date());
|
||||
let sendHeartRec = await FriendShipModel.sendHeart(roleId, relation.roleId, 1, FRIEND.FRIEND_RECEIVE_SINGLE, ref);
|
||||
if(!sendHeartRec) continue;
|
||||
|
||||
@@ -592,7 +592,7 @@ export class FriendHandler {
|
||||
|
||||
// 收取爱心
|
||||
let fs = <FriendShipType>relation.friendShip;
|
||||
let ref = shouldRefresh(fs.refTime, new Date(), 0);
|
||||
let ref = shouldRefresh(fs.refTime, new Date());
|
||||
let receiveHeartRec = await FriendShipModel.receiveHeart(roleId, relation.roleId, 1, relation.beSentHeart, ref);
|
||||
if(!receiveHeartRec) continue;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Application, BackendSession, pinus } from "pinus";
|
||||
import { resResult, parseGoodStr, getRandSingleEelm } from "../../../pubUtils/util";
|
||||
import { STATUS, TASK_FUN_TYPE } from "../../../consts";
|
||||
import { STATUS, TASK_FUN_TYPE, SHOP_REFRESH_TYPE } from "../../../consts";
|
||||
import { gameData } from "../../../pubUtils/data";
|
||||
import { UserTaskRecModel } from "../../../db/UserTaskRec";
|
||||
import { addItems } from "../../../services/rewardService";
|
||||
import { UserTaskModel } from "../../../db/UserTask";
|
||||
import { getCurWeekDate, nowSeconds } from "../../../pubUtils/timeUtil";
|
||||
import { nowSeconds, getZeroPointD } from "../../../pubUtils/timeUtil";
|
||||
import { DicDailyTask, DicAchievement, DicMainTask } from "../../../pubUtils/dictionary/DicTask";
|
||||
import { getMainTask, refDailyTaskBox, removeHistoryTask, getCurTask, checkTask } from "../../../services/taskService";
|
||||
import { TASK } from "../../../pubUtils/dicParam";
|
||||
@@ -41,7 +41,7 @@ export class ShopHandler {
|
||||
if(type == TASK_FUN_TYPE.DAILY) { // 增加积分
|
||||
let userTask = await UserTaskModel.findByRole(roleId);
|
||||
let dic = <DicDailyTask>dicTask;
|
||||
let curWeek = getCurWeekDate(1, 5);
|
||||
let curWeek = getZeroPointD(SHOP_REFRESH_TYPE.WEEKLY);
|
||||
if(curWeek > userTask.dailyTaskRefWeekly) {
|
||||
userTask = await UserTaskModel.resetDailyScore(roleId, dic.point, curWeek);
|
||||
} else {
|
||||
@@ -139,7 +139,7 @@ export class ShopHandler {
|
||||
let point = 0, weeklyPoint = 0, box: number[] = [];
|
||||
// 每日、成就增加积分
|
||||
if(type == TASK_FUN_TYPE.DAILY) { // 增加积分
|
||||
let curWeek = getCurWeekDate(1, 5);
|
||||
let curWeek = getZeroPointD(SHOP_REFRESH_TYPE.WEEKLY);
|
||||
let shouldRefresh = false;
|
||||
let { dailyTaskPointWeekly, dailyTaskBox, dailyTaskRefWeekly } = userTask;
|
||||
|
||||
@@ -263,7 +263,7 @@ export class ShopHandler {
|
||||
let point = 0, weeklyPoint = 0;
|
||||
if(type == TASK_FUN_TYPE.DAILY) { // 增加积分
|
||||
let userTask = await UserTaskModel.findByRole(roleId);
|
||||
let curWeek = getCurWeekDate(1, 5);
|
||||
let curWeek = getZeroPointD(SHOP_REFRESH_TYPE.WEEKLY);
|
||||
if(curWeek > userTask.dailyTaskRefWeekly) {
|
||||
userTask = await UserTaskModel.resetDailyScore(roleId, incPoint, curWeek);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user