返利优化

master
ELF 3 years ago
parent 0a3027796f
commit 82bc905b45

@ -12,6 +12,7 @@ use Base\Service\TestingResourceService;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use think\Db; use think\Db;
use Base\Tool\GameResource; use Base\Tool\GameResource;
use Base\Tool\GameResource\SbcqClient;
class GameApiController extends Think { class GameApiController extends Think {
@ -63,6 +64,23 @@ class GameApiController extends Think {
public function send() public function send()
{ {
$giftItem = [
'id' => 1782,
'num' => 1,
];
$order = [
'user_account' => '13110873520',
'server_id' => '1',
'role_name' => '十六',
];
$client = new SbcqClient();
/* $result = $client->sendEmail($giftItem, $order);
var_dump($result); */
$result = $client->sendGold(25000, $order);
var_dump($result);
return;
// 229 // 229
// 231 // 231
$game = M('game', 'tab_')->field(['id', 'sdk_version'])->where(['id' => 231])->find(); $game = M('game', 'tab_')->field(['id', 'sdk_version'])->where(['id' => 231])->find();

@ -10,7 +10,7 @@ class GameRebateService
{ {
public function sendByOrder($order) public function sendByOrder($order)
{ {
$gift = M('rebate_gifts', 'tab_')->where(['type' => $order['type'], 'gift_key' => $order['gift_key']])->find(); $gift = M('rebate_gifts', 'tab_')->where(['base_game_id' => $order['base_game_id'], 'type' => $order['type'], 'gift_key' => $order['gift_key']])->find();
$hasError = false; $hasError = false;
$sendResult = ''; $sendResult = '';
if ($gift['game_currency'] > 0) { if ($gift['game_currency'] > 0) {
@ -45,6 +45,9 @@ class GameRebateService
case 73: case 73:
$client = new SbcqClient(); $client = new SbcqClient();
break; break;
/* case 9:
$client = new SbcqClient();
break; */
default: default:
throw new \Exception('客户端未实现'); throw new \Exception('客户端未实现');
break; break;

@ -4,6 +4,7 @@ namespace Base\Tool\GameResource;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Think\Log;
/** /**
* 双倍传奇-测试资源接口 * 双倍传奇-测试资源接口
@ -18,14 +19,14 @@ class SbcqClient
protected $client; protected $client;
private $apis = [ private $apis = [
'send-gold' => ['uri' => '/sendgold', 'method' => 'get'], 'send-gold' => ['uri' => 'sendgold', 'method' => 'post'],
'send-email' => ['uri' => '/sendemail', 'method' => 'get'], 'send-email' => ['uri' => 'sendemail', 'method' => 'post'],
]; ];
public function __construct() public function __construct()
{ {
$this->client = new Client([ $this->client = new Client([
'base_uri' => 'http://api.tlcq.90wqiji.com/wan/game', 'base_uri' => 'http://api.tlcq.90wqiji.com/wan/game/',
'timeout' => 10.0, 'timeout' => 10.0,
]); ]);
} }
@ -61,6 +62,7 @@ class SbcqClient
'form_params' => $params, 'form_params' => $params,
]); ]);
$result = (string)$response->getBody(); $result = (string)$response->getBody();
Log::record('rebate:SBCQ ' . $uri . ' -- '. json_encode($params) . ' -- '. $result);
return json_decode($result, true); return json_decode($result, true);
} }
@ -71,6 +73,7 @@ class SbcqClient
'query' => $params, 'query' => $params,
]); ]);
$result = (string)$response->getBody(); $result = (string)$response->getBody();
Log::record('rebate:SBCQ ' . $uri . ' -- '. json_encode($params) . ' -- '. $result);
return json_decode($result, true); return json_decode($result, true);
} }
@ -87,7 +90,7 @@ class SbcqClient
'num' => $giftItem['num'], 'num' => $giftItem['num'],
'name' => $giftItem['id'], 'name' => $giftItem['id'],
'role' => $order['role_name'], 'role' => $order['role_name'],
'content' => '', 'content' => '您的福利已到账,请查收',
]; ];
$result = $this->api('send-email', $data); $result = $this->api('send-email', $data);

@ -4,6 +4,7 @@ namespace Base\Tool\GameResource;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Exception\RequestException;
use Think\Log;
/** /**
* 逍遥游之仙魔降世-测试资源接口 * 逍遥游之仙魔降世-测试资源接口
@ -18,9 +19,9 @@ class XyyClient
protected $client; protected $client;
private $apis = [ private $apis = [
'sendgold' => ['uri' => '', 'method' => 'get'], 'send-gold' => ['uri' => '', 'method' => 'get'],
'send_email' => ['uri' => '', 'method' => 'get'], 'send-email' => ['uri' => '', 'method' => 'get'],
'self_apply_foster' => ['uri' => '', 'method' => 'get'], 'self-apply-foster' => ['uri' => '', 'method' => 'get'],
]; ];
public function __construct() public function __construct()
@ -62,6 +63,7 @@ class XyyClient
'form_params' => $params, 'form_params' => $params,
]); ]);
$result = (string)$response->getBody(); $result = (string)$response->getBody();
Log::record('rebate:XYY ' . $uri . ' -- '. json_encode($params) . ' -- '. $result);
return json_decode($result, true); return json_decode($result, true);
} }
@ -72,6 +74,7 @@ class XyyClient
'query' => $params, 'query' => $params,
]); ]);
$result = (string)$response->getBody(); $result = (string)$response->getBody();
Log::record('rebate:XYY ' . $uri . ' -- '. json_encode($params) . ' -- '. $result);
return json_decode($result, true); return json_decode($result, true);
} }

Loading…
Cancel
Save