人丑就要多读书(7)

人还是有惰性的,而我还有更加严重的拖延症......

今天找领导签了三方,估计要半个月左右,不过还是不错的,导师也认可了我的工作,开心,虽然我感觉自己的水平不是特别好>_<

今天其实没干啥,帮忙把强制引导的id加了进去,这个是比较简单的;然后把定时推送的代码也写好了,感觉自己本地测试通过了,不知道实际测试怎么样,要回学校啦参加毕业典礼了,哈哈= =

关于推送的主要流程,就是从GameContextManager中获得所有在线的用户,然后向他们推送信息。流程是这样的,现在spring-quartz.xml中配置定时任务,参考点击打开链接点击打开链接,然后启动方法,方法中从contextManager中获得所有在线用户

Collection<GameContext> contexts =  contextManager.getGameContexts();
Iterator iterator = contexts.iterator();
while(iterator.hasNext()){
GameContext context = (GameContext) iterator.next();
String id = context.getPlayer().getUid();
int day = context.getPlayer().getSignInfo().getCount();
day++;
push(id, new SignNotify(0, day%7==0 ? 7:(day%7)));
},
public void push(String account, EncodeResponse response) {
    GameContext context = contextManager.getContextByAccount(account);
    if (context != null) {
        context.push(response);
    }
}
SignNotify推送:
class SignNotify extends EncodeResponse{
    @Override
    protected Map<String, ?> encodeBody() {
        Map<String, Object> map = Maps.newHashMap();
        map.put("get", day)
        map.put("day", day)
        return map
    }
SignNotify(int get, int day) {
    this.get = get
    this.day = day
}

}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值