12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- require_once dirname(__FILE__) . '/../../config_360.php';
- /**
- * Description of PayApp_ylsj
- * @version
- * 1.0.0 Created at 2018-3-3. by --gwang
- * @author gwang (mail@wanggangzero.cn)
- * @copyright ? 2018-3-3, SJZ LoyalSoft Corporation & gwang. All rights reserved.
- */
- class PayApp_ylsj implements PayApp_Interface
- {
- //需要修改为应用自身的app_key
- private $_appKey;
- //需要修改为应用自身的app_secret(服务器之间通讯使用)
- private $_appSecret;
- //人民币-游戏货币的兑换比例
- private $_cashRate = 10;
- public function __construct($appKey, $appSecret)
- {
- $this->_appKey = $appKey;
- $this->_appSecret = $appSecret;
- }
- public function getAppKey()
- {
- return $this->_appKey;
- }
- public function getAppSecret()
- {
- return $this->_appSecret;
- }
- public function isValidOrder(array $orderParams)
- {
- $order = $this->_getOrder($orderParams);
- if (empty($order)) {
- return false;
- }
- return $order->Check();
- }
- private function _getOrder($orderParams)
- {
- return \loyalsoft\pay\OrderNotice::Parse_360Order($orderParams);
- //应该根据360支付返回的订单号或者应用自身的订单号($order['app_order_id'])查询应用订单数据表
- }
- public function processOrder(array $orderParams)
- {
- $order = $this->_getOrder($orderParams);
- if (empty($order)) {
- return false;
- }
- return $order->UpdateOrderStatus();
- //更新订单,标识为已经处理,避免重复处理
- //如果更新订单状态失败,记录异常,以便再次处理。再次处理的逻辑需应用自己处理
- }
- }
|