1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace huo\controller\pay;
- use huo\controller\common\Base;
- use huolib\constant\OrderConst;
- use huolib\constant\PaywayConst;
- use huolib\status\OrderStatus;
- use huolib\status\SettleStatus;
- class GamePay extends Base {
-
- public function GameSdkPay($order_id) {
- $_soc_class = SdkOrderCache::ins();
- $_order_data = $_soc_class->getInfoByOrderId($order_id);
- if (empty($_order_data)) {
- $_code = OrderStatus::ORDER_NOT_EXISTS;
- return $this->huoError($_code, OrderStatus::getMsg($_code));
- }
- $_order_data['payway'] = PaywayConst::PAYWAY_GAMEPAY;
-
- $_order_data['gm_amount'] = $_order_data['real_amount'];
- $_order_data['real_amount'] = 0;
- $_soc_class->updateOrder($order_id, $_order_data);
-
-
- $_ltv_class = new \ltv\Ltv();
- $_mem_data = (new \huo\model\member\MemberModel())->getInfoById(
- $_order_data['mem_id']
- );
- $_ltv_class->charge(
- $_mem_data['app_id'],
- $_mem_data['agent_id'],
- $_order_data['app_id'],
- $_order_data['amount'],
- $_order_data['update_time'],
- $_mem_data['create_time']
- );
-
- $_rs = (new Notify())->doAfterPayNotify($order_id);
- $_cp_status = OrderConst::CP_STATUS_SUC;
- if (OrderStatus::NOTIFY_FAIL == $_rs['code']) {
- $_cp_status = OrderConst::CP_STATUS_NOT;
- } else {
- if (SettleStatus::NO_ERROR != $_rs['code']) {
- return $this->huoReturn($_rs);
- }
- }
- $_rdata = $this->clientAjax($_order_data['payway'], $order_id, 2, 2, $_cp_status);
- $_code = OrderStatus::NO_ERROR;
- return $this->huoSuccess($_code, OrderStatus::getMsg($_code), $_rdata);
- }
-
- public function clientAjax($payway, $order_id, $status = 1, $is_native = 2, $cp_status = 2) {
- $_rdata['pay_type'] = $payway;
- $_rdata['order_id'] = $order_id;
- $_rdata['real_amount'] = 0;
- $_rdata['token'] = $order_id;
- $_rdata['is_native'] = $is_native;
- $_rdata['status'] = $status;
- $_rdata['cp_status'] = $cp_status;
- return $_rdata;
- }
- }
|