Order.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?php
  2. /**
  3. * Order.php UTF-8
  4. * 订单事件
  5. *
  6. * @date : 2018/5/30 16:52
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\controller\data;
  13. use huo\logic\data\DataLogic;
  14. use huolib\queue\request\Channel;
  15. use huolib\queue\request\Common;
  16. use huolib\queue\request\Device;
  17. use huolib\queue\request\Game;
  18. use huolib\queue\request\Mem as MemRq;
  19. use huolib\queue\request\Order as OrderRq;
  20. use huolib\queue\request\Role as RoleRq;
  21. class Order {
  22. /**
  23. * 玩家充值下单
  24. * 玩家下单时调用
  25. * http://doc.1tsdk.com/138?page_id=3387
  26. *
  27. * @param Common $com_rq
  28. * @param Device $device_rq
  29. * @param Game $game_rq
  30. * @param Channel $agent_rq
  31. * @param MemRq $mem_rq
  32. * @param RoleRq $role_rq
  33. * @param OrderRq $order_rq
  34. *
  35. * @return bool
  36. */
  37. public function create(
  38. Common $com_rq,
  39. Device $device_rq,
  40. Game $game_rq,
  41. Channel $agent_rq,
  42. MemRq $mem_rq,
  43. RoleRq $role_rq,
  44. OrderRq $order_rq
  45. ) {
  46. /* 更新玩家角色信息 */
  47. //(new Role())->upRole($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $role_rq, $order_rq->getProductPrice());
  48. //只创建订单不需要传入金额,成功的才需要传入 chenbingling 2018-11-6
  49. (new Role())->upRole($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $role_rq);
  50. return true;
  51. }
  52. /**
  53. * 充值成功
  54. * 记录玩家充值行为成功的日志。游戏服务端在收到第三方支付端返回的充值结果<成功或失败>,
  55. * 同步虚拟币到客户端,应区分该虚拟币是由充值成功获得的,在此处进行埋点。
  56. * http://doc.1tsdk.com/138?page_id=3388
  57. *
  58. * @param Common $com_rq
  59. * @param Device $device_rq
  60. * @param Game $game_rq
  61. * @param Channel $agent_rq
  62. * @param MemRq $mem_rq
  63. * @param RoleRq $role_rq
  64. * @param OrderRq $order_rq
  65. *
  66. * @return bool
  67. */
  68. public function success(
  69. Common $com_rq,
  70. Device $device_rq,
  71. Game $game_rq,
  72. Channel $agent_rq,
  73. MemRq $mem_rq,
  74. RoleRq $role_rq,
  75. OrderRq $order_rq
  76. ) {
  77. /* 更新玩家每日 */
  78. $_dm_class = new DayMem();
  79. $_dm_class->updateDayMem($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $role_rq, $order_rq);
  80. /* 更新玩家角色信息 */
  81. return (new Role())->upRole($com_rq, $device_rq, $game_rq, $agent_rq, $mem_rq, $role_rq, $order_rq->getProductPrice());
  82. // $_day_class = new Day();
  83. // $_day_class->setDate(date('Y-m-d', $com_rq->getTs()));
  84. // $_day_class->setAppId($com_rq->getAppId());
  85. // $_day_class->setAgentId($agent_rq->getCh());
  86. // $_reg_days = $_dm_class->getRegDays();
  87. // if (0 == $_reg_days) {
  88. // $_day_class->setRegOrderCnt(1);
  89. // $_day_class->setRegSumMoney($order_rq->getProductPrice());
  90. // }
  91. // if ($_dm_class->getIsNew()) {
  92. // $_day_class->setSumLoginCnt($_dm_class->getSumLoginCnt());
  93. // $_day_class->setUserCnt(1); /* 今日活跃用户 */
  94. // }
  95. // if ($_dm_class->getOrderSucCnt() <= 1) {
  96. // /* 成功订单数少于1 表示今日还未支付 */
  97. // $_day_class->setPayUserCnt(1);
  98. // if (0 == $_reg_days) {
  99. // $_day_class->setRegPayCnt(1);
  100. // }
  101. // } else {
  102. // $_day_class->setPayUserCnt($_day_class->getPayUserCnt() + 1);
  103. // if (0 == $_reg_days) {
  104. // $_day_class->setRegPayCnt($_day_class->getRegPayCnt() + 1);
  105. // }
  106. // }
  107. // $_day_class->setOrderCnt(1);
  108. // $_day_class->setSumMoney($order_rq->getProductPrice());
  109. // /* 更新每日游戏渠道数据 */
  110. // $_day_logic = new DataLogic();
  111. // if (\huolib\oa\Oa::hasOa()) {
  112. // $_oa_login = new \huolib\oa\OaPay();
  113. // $_param = array();
  114. // $_param['create_time'] = $mem_rq->getTs();
  115. // $_param['app_id'] = $game_rq->getHAppId();
  116. // $_param['agent_id'] = $agent_rq->getCh();
  117. // $_param['pay_ip'] = $device_rq->getIp();
  118. // $_param['imei'] = $device_rq->getDeviceId();
  119. // $_param['userua'] = $device_rq->getUserua();
  120. // $_param['role_level'] = $role_rq->getRoleLevel();
  121. // $_param['role_id'] = $role_rq->getRoleId();
  122. // $_param['role_name'] = $role_rq->getRoleName();
  123. // $_param['server_id'] = $role_rq->getServerId();
  124. // $_param['server_name'] = $role_rq->getServerName();
  125. // $_param['order_id'] = $order_rq->getOrderId();
  126. // $_param['payway'] = $order_rq->getPayway();
  127. // $_param['amount'] = $order_rq->getProductPrice();
  128. // $_param['real_amount'] = $order_rq->getProductPrice();
  129. // $_param['status'] = $order_rq->getStatus();
  130. // if (empty($_param['status'])) {
  131. // $_param['status'] = 2;
  132. // }
  133. // $_param['from'] = \huolib\oa\Oa::osToFrom($device_rq->getOs());
  134. // $_p_re = $_oa_login->pay($_param);
  135. // if ($_p_re) {
  136. // }
  137. // /* 处理渠道信息显示 */
  138. // $_agent_param = array();
  139. // $_agent_param['agent_id'] = $_param['agent_id'];
  140. // $_agent_param['app_id'] = $_param['app_id'];
  141. // $_agent_param['now_time'] = $_param['create_time'];
  142. // $_agent_oa_class = new \huolib\oa\AgentOa($_agent_param['agent_id']);
  143. // $_a_re = $_agent_oa_class->baseUpdate($_agent_param);
  144. // if ($_a_re) {
  145. // }
  146. // }
  147. //
  148. // return $_day_logic->upDayGameAgent($_day_class->toArray());
  149. }
  150. }