123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <?php
- /**
- * Order.php UTF-8
- * 订单事件
- *
- * @date : 2018/5/30 16:52
- *
- * @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;
- use huolib\queue\request\Order as OrderRq;
- use huolib\queue\request\Role as RoleRq;
- class Order {
- /**
- * 玩家充值下单
- * 玩家下单时调用
- * http://doc.1tsdk.com/138?page_id=3387
- *
- * @param Common $com_rq
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- * @param MemRq $mem_rq
- * @param RoleRq $role_rq
- * @param OrderRq $order_rq
- *
- * @return bool
- */
- public function create(
- Common $com_rq,
- Device $device_rq,
- Game $game_rq,
- Channel $agent_rq,
- MemRq $mem_rq,
- RoleRq $role_rq,
- OrderRq $order_rq
- ) {
- /* 更新玩家角色信息 */
- //(new Role())->upRole($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $role_rq, $order_rq->getProductPrice());
- //只创建订单不需要传入金额,成功的才需要传入 chenbingling 2018-11-6
- (new Role())->upRole($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $role_rq);
- return true;
- }
- /**
- * 充值成功
- * 记录玩家充值行为成功的日志。游戏服务端在收到第三方支付端返回的充值结果<成功或失败>,
- * 同步虚拟币到客户端,应区分该虚拟币是由充值成功获得的,在此处进行埋点。
- * http://doc.1tsdk.com/138?page_id=3388
- *
- * @param Common $com_rq
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- * @param MemRq $mem_rq
- * @param RoleRq $role_rq
- * @param OrderRq $order_rq
- *
- * @return bool
- */
- public function success(
- Common $com_rq,
- Device $device_rq,
- Game $game_rq,
- Channel $agent_rq,
- MemRq $mem_rq,
- RoleRq $role_rq,
- OrderRq $order_rq
- ) {
- /* 更新玩家每日 */
- $_dm_class = new DayMem();
- $_dm_class->updateDayMem($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $role_rq, $order_rq);
- /* 更新玩家角色信息 */
- return (new Role())->upRole($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $role_rq, $order_rq->getProductPrice());
- // $_day_class = new Day();
- // $_day_class->setDate(date('Y-m-d', $com_rq->getTs()));
- // $_day_class->setAppId($com_rq->getAppId());
- // $_day_class->setAgentId($agent_rq->getCh());
- // $_reg_days = $_dm_class->getRegDays();
- // if (0 == $_reg_days) {
- // $_day_class->setRegOrderCnt(1);
- // $_day_class->setRegSumMoney($order_rq->getProductPrice());
- // }
- // if ($_dm_class->getIsNew()) {
- // $_day_class->setSumLoginCnt($_dm_class->getSumLoginCnt());
- // $_day_class->setUserCnt(1); /* 今日活跃用户 */
- // }
- // if ($_dm_class->getOrderSucCnt() <= 1) {
- // /* 成功订单数少于1 表示今日还未支付 */
- // $_day_class->setPayUserCnt(1);
- // if (0 == $_reg_days) {
- // $_day_class->setRegPayCnt(1);
- // }
- // } else {
- // $_day_class->setPayUserCnt($_day_class->getPayUserCnt() + 1);
- // if (0 == $_reg_days) {
- // $_day_class->setRegPayCnt($_day_class->getRegPayCnt() + 1);
- // }
- // }
- // $_day_class->setOrderCnt(1);
- // $_day_class->setSumMoney($order_rq->getProductPrice());
- // /* 更新每日游戏渠道数据 */
- // $_day_logic = new DataLogic();
- // if (\huolib\oa\Oa::hasOa()) {
- // $_oa_login = new \huolib\oa\OaPay();
- // $_param = array();
- // $_param['create_time'] = $mem_rq->getTs();
- // $_param['app_id'] = $game_rq->getHAppId();
- // $_param['agent_id'] = $agent_rq->getCh();
- // $_param['pay_ip'] = $device_rq->getIp();
- // $_param['imei'] = $device_rq->getDeviceId();
- // $_param['userua'] = $device_rq->getUserua();
- // $_param['role_level'] = $role_rq->getRoleLevel();
- // $_param['role_id'] = $role_rq->getRoleId();
- // $_param['role_name'] = $role_rq->getRoleName();
- // $_param['server_id'] = $role_rq->getServerId();
- // $_param['server_name'] = $role_rq->getServerName();
- // $_param['order_id'] = $order_rq->getOrderId();
- // $_param['payway'] = $order_rq->getPayway();
- // $_param['amount'] = $order_rq->getProductPrice();
- // $_param['real_amount'] = $order_rq->getProductPrice();
- // $_param['status'] = $order_rq->getStatus();
- // if (empty($_param['status'])) {
- // $_param['status'] = 2;
- // }
- // $_param['from'] = \huolib\oa\Oa::osToFrom($device_rq->getOs());
- // $_p_re = $_oa_login->pay($_param);
- // if ($_p_re) {
- // }
- // /* 处理渠道信息显示 */
- // $_agent_param = array();
- // $_agent_param['agent_id'] = $_param['agent_id'];
- // $_agent_param['app_id'] = $_param['app_id'];
- // $_agent_param['now_time'] = $_param['create_time'];
- // $_agent_oa_class = new \huolib\oa\AgentOa($_agent_param['agent_id']);
- // $_a_re = $_agent_oa_class->baseUpdate($_agent_param);
- // if ($_a_re) {
- // }
- // }
- //
- // return $_day_logic->upDayGameAgent($_day_class->toArray());
- }
- }
|