新增统计,小游戏,系统设置
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
<?php
|
||||
namespace app\common\service;
|
||||
|
||||
use app\admin\model\Config as ConfigModel;
|
||||
use think\Exception;
|
||||
|
||||
class Jk8Services
|
||||
{
|
||||
private $config = [];
|
||||
private $domain = '';
|
||||
private $accessId = '';
|
||||
private $token = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->config = config('jk8');
|
||||
$this->domain = config('jk8.domain');
|
||||
$this->accessId = config('jk8.access_id');
|
||||
$this->token = config('jk8.token');
|
||||
$config = ConfigModel::where('group', 'jdk_api')->column('value', 'name');
|
||||
$this->domain = $config['api_url'];
|
||||
$this->accessId = $config['access_id'];
|
||||
$this->token = $config['token'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,96 +111,4 @@ class Jk8Services
|
||||
return $result['data']['transactionId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 存款
|
||||
* @param array $params 参数
|
||||
* @return array
|
||||
* @throws Exception
|
||||
* @throws GameException
|
||||
*/
|
||||
public function deposit(array $params): array
|
||||
{
|
||||
$auth = $this->auth($params);
|
||||
if (!$auth['status']) {
|
||||
throw new GameException($auth['message']);
|
||||
}
|
||||
$data = [
|
||||
'username' => $params['name'],
|
||||
'auth' => $auth['auth'],
|
||||
'amount' => $params['amount'],
|
||||
'currency' => 'MYR',
|
||||
'orderid' => $params['orderNo'],
|
||||
'redirect_url' => $this->returnUrl . '?orderNo='.$params['orderNo'],
|
||||
];
|
||||
return doFormCurl($this->domain . '/merchant/generate_orders',$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 代付
|
||||
* @param array $params 参数
|
||||
* @throws GameException|Exception
|
||||
*/
|
||||
public function payout(array $params): array
|
||||
{
|
||||
$params['type'] = 'online';
|
||||
$auth = $this->auth($params);
|
||||
if (!$auth['status']) {
|
||||
throw new GameException($auth['message']);
|
||||
}
|
||||
$data = [
|
||||
'auth' => $auth['auth'],
|
||||
'amount' => $params['amount'],
|
||||
'currency' => 'MYR',
|
||||
'orderid' => $params['orderNo'],
|
||||
'bank_id' => $params['bankCode'],
|
||||
'holder_name' => $params['bankAccountName'],
|
||||
'account_no' => $params['bankAccountNo'],
|
||||
];
|
||||
return doFormCurl($this->domain . '/merchant/withdraw_orders',$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证
|
||||
* @param array $params 参数
|
||||
* @throws Exception
|
||||
*/
|
||||
public function depositVerifySign(array $params)
|
||||
{
|
||||
$orderInfo = PlayerRechargeRecord::query()
|
||||
->where(['tradeno' => $params['order_id']])
|
||||
->first();
|
||||
if (empty($orderInfo)) {
|
||||
return false;
|
||||
}
|
||||
return MD5($this->config[$orderInfo['payment_method']]['secret_key'] . $params['order_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证
|
||||
* @param array $params 参数
|
||||
* @throws Exception
|
||||
*/
|
||||
public function withdrawalVerifySign(array $params)
|
||||
{
|
||||
return MD5($this->config['online']['secret_key'] . $params['order_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单查询
|
||||
* @param $orderNo
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function query($orderNo): array
|
||||
{
|
||||
$orderInfo = PlayerRechargeRecord::query()
|
||||
->where(['tradeno' => $orderNo])
|
||||
->first();
|
||||
$data = [
|
||||
'username' => $this->config[$orderInfo['payment_method']]['merchantId'],
|
||||
'id' => $orderNo,
|
||||
];
|
||||
return doFormCurl($this->domain . '/merchant/check_status',$data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user