123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?php
- /**
- * Mem.php UTF-8
- * 玩家事件处理
- *
- * @date : 2018/5/30 16:46
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\controller\data;
- use huo\logic\data\DataLogic;
- use huolib\queue\request\Channel;
- use huolib\queue\request\Common;
- use huolib\queue\request\Device;
- use huolib\queue\request\Game;
- use huolib\queue\request\Mem as MemRq;
- class Mem {
- /**
- * 玩家创建
- * 记录玩家创建账户的日志,在该账户首次生成时调用。
- * http://doc.1tsdk.com/138?page_id=3379
- *
- * @param Common $com_rq
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- * @param MemRq $mem_rq
- *
- * @return bool
- */
- public function create(Common $com_rq, Device $device_rq, Game $game_rq, Channel $agent_rq, MemRq $mem_rq) {
- $_dm_class = new DayMem();
- $_dm_class->setIsLogin(2);
- $_role_rq = new \huolib\queue\request\Role();
- $_order_rq = new \huolib\queue\request\Order();
- $_return = $_dm_class->updateDayMem($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $_role_rq, $_order_rq);
- // $_day_class = new Day();
- // $_day_class->setSumLoginCnt($_dm_class->getSumLoginCnt());
- // $_day_class->setDate(date('Y-m-d', $com_rq->getTs()));
- // $_day_class->setAppId($com_rq->getAppId());
- // $_day_class->setAgentId($agent_rq->getCh());
- // $_day_class->setUserCnt(1); /* 新增一个用户 */
- // $_day_class->setRegCnt(1); /* 新增一个用户 */
- // $_rs = \huo\controller\common\Device::isRepeat($device_rq->getDeviceId());
- // if (false == $_rs) {
- // $_day_class->setRegDeviceCnt(1);
- // }
- // /* 更新每日游戏渠道数据 */
- // $_day_logic = new DataLogic();
- // $_return = $_day_logic->upDayGameAgent($_day_class->toArray());
- // if (\huolib\oa\Oa::hasOa()) {
- // $_oa_login = new \huolib\oa\OaLogin();
- // $_param = array();
- // $_param['flag'] = 1;/* 1 注册 其它登陆 */
- // $_param['reg_time'] = $mem_rq->getRegTime();
- // $_param['app_id'] = $com_rq->getAppId();
- // $_param['mem_id'] = $mem_rq->getMemId();
- // $_param['agent_id'] = $agent_rq->getCh();
- // $_param['login_ip'] = $device_rq->getIp();
- // $_param['imei'] = $device_rq->getDeviceId();
- // $_param['userua'] = $device_rq->getUserua();
- // $_param['from'] = \huolib\oa\Oa::osToFrom($device_rq->getOs());
- // $_oa_login->login($_param);
- // }
- return $_return;
- }
- /**
- * 玩家登陆
- * 记录玩家账号登录的日志,输入账户和密码后,进入到“选择服务器”界面即可调用。
- * http://doc.1tsdk.com/138?page_id=3380
- *
- * @param Common $com_rq
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- * @param MemRq $mem_rq
- *
- * @return bool
- */
- public function online(Common $com_rq, Device $device_rq, Game $game_rq, Channel $agent_rq, MemRq $mem_rq) {
- $_dm_class = new DayMem();
- $_dm_class->setIsLogin(1);
- $_role_rq = new \huolib\queue\request\Role();
- $_order_rq = new \huolib\queue\request\Order();
- $_rs = $_dm_class->updateDayMem($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $_role_rq, $_order_rq);
- if ($_dm_class->getLoginCnt() > 1) {
- /* 同一游戏登陆多次 不重复计算 */
- return true;
- }
- return $_rs;
- // $_day_class = new Day();
- // $_day_class->setSumLoginCnt($_dm_class->getSumLoginCnt());
- // $_day_class->setDate(date('Y-m-d', $com_rq->getTs()));
- // $_day_class->setAppId($com_rq->getAppId());
- // $_day_class->setAgentId($agent_rq->getCh());
- // /* 活跃用户 */
- // $_day_class->setUserCnt(1);
- // $_reg_days = $_dm_class->getRegDays();
- // $_reg_days += 1;
- // if (in_array($_reg_days, $_day_class->getRetainDayArr())) {
- // $_func = 'setDay'.$_reg_days;
- // $_day_class->$_func(1);
- // $_rs = \huo\controller\common\Device::isRepeat($device_rq->getDeviceId(), date('Y-m-d'));
- // if (false == $_rs) {
- // $_func = 'setDeviceDay'.$_reg_days;
- // $_day_class->$_func(1);
- // }
- // }
- // /* 更新每日游戏渠道数据 */
- // $_day_logic = new DataLogic();
- // if (\huolib\oa\Oa::hasOa()) {
- // $_oa_login = new \huolib\oa\OaLogin();
- // $_param = array();
- // $_param['flag'] = 2;/* 1 注册 其它登陆 */
- // $_param['login_time'] = $com_rq->getTs();
- // $_param['app_id'] = $game_rq->getHAppId();
- // $_param['agent_id'] = $agent_rq->getCh();
- // $_param['login_ip'] = $device_rq->getIp();
- // $_param['imei'] = $device_rq->getDeviceId();
- // $_param['userua'] = $device_rq->getUserua();
- // $_param['from'] = \huolib\oa\Oa::osToFrom($device_rq->getOs());
- // $_oa_login->login($_param);
- // }
- // return $_day_logic->upDayGameAgent($_day_class->toArray());
- }
- /**
- * 玩家登出
- * 记录玩家登出游戏的日志,执行“切换账户”、“退出游戏”操作时调用。
- * http://doc.1tsdk.com/138?page_id=3382
- *
- * @param Common $com_rq
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- * @param MemRq $mem_rq
- *
- * @return bool
- */
- public function offline(Common $com_rq, Device $device_rq, Game $game_rq, Channel $agent_rq, MemRq $mem_rq) {
- // TODO: wuyonghong 2018/5/31
- return true;
- }
- }
|