You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.2 KiB
PHP

<?php
/**
* 定时自动完成
*/
namespace Admin\Controller;
use Admin\Model\SpendModel;
use Base\Service\GameRebateService;
use Think\Think;
use Base\Tool\Printer;
use Base\Tool\TaskClient;
use Base\Service\TestingResourceService;
use GuzzleHttp\Client;
use think\Db;
use Base\Tool\GameResource;
use Base\Tool\GameResource\SbcqClient;
class GameApiController extends Think {
protected function _initialize()
{
C(api('Config/lists'));
}
public function verify()
{
$service = new TestingResourceService();
$gameIds = $service->getHasItfGameIds();
$map = ['verify_status' => 0, 'auto_verify' => 1];
if (count($gameIds) > 0) {
$map['game_id'] = ['in', $gameIds];
}
$batches = M('testing_resource_batch', 'tab_')->where($map)->select();
foreach ($batches as $batch) {
try {
$service->verify($batch);
echo 'SUCCESS [' . $batch['id'] . ']审核成功' . PHP_EOL;
} catch (\Exception $e) {
echo 'ERROR [' . $batch['id'] . ']审核异常' . PHP_EOL;
}
}
}
public function provide()
{
$service = new TestingResourceService();
$gameIds = $service->getHasItfGameIds();
$map = ['verify_status' => 1, 'provide_status' => 0];
if (count($gameIds) > 0) {
$map['game_id'] = ['in', $gameIds];
}
$batches = M('testing_resource_batch', 'tab_')->where($map)->select();
foreach ($batches as $batch) {
try {
$service->provide($batch);
echo 'SUCCESS [' . $batch['id'] . ']发放成功' . PHP_EOL;
} catch (\Exception $e) {
echo 'ERROR [' . $batch['id'] . ']发放异常' . PHP_EOL;
}
}
}
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
// 231
$game = M('game', 'tab_')->field(['id', 'sdk_version'])->where(['id' => 231])->find();
// $gameResource1 = new GameResource($game);
/* $resources = $gameResource1->getResources(1);
return; */
/* $successCount = 0;
for ($i = 0; $i < 10; $i ++) {
$resources = $gameResource1->getResources(1);
if (count($resources) > 0) {
$successCount ++;
}
}
var_dump($successCount);
return; */
/* $role = [
'role_id' => '6819493',
'user_account' => 'qh11102',
'sdk_version' => 1,
];
$order = [
'ref_amount' => '10.00',
'ref_id' => '8',
'remark' => '测试',
'order_no' => date('YmdHis') . rand(1000, 9999) . '_1',
]; */
$role = [
'role_id' => '9571794000008',
'server_id' => '8',
'sdk_version' => 1,
];
$order = [
'ref_id' => '9000',
'remark' => '测试',
'order_no' => date('YmdHis') . rand(1000, 9999) . '_1',
];
/* $role = [
'role_id' => '466500506',
'server_id' => '49000152',
'sdk_version' => 2,
];
$order = [
// 'ref_id' => '9000',
'ref_amount' => 6,
'order_no' => date('YmdHis') . rand(1000, 9999) . '_1',
]; */
$gameResource = new GameResource($game);
// $result = $gameResource->getResources();
$result = $gameResource->apply($order, $role);
var_dump($result);
}
public function rebateSend()
{
$service = new GameRebateService();
$service->sendAll('A');
$service->sendAll('B');
$service->sendAll('C');
}
public function rebateSendDaily()
{
$service = new GameRebateService();
$service->sendDaily(date('Y-m-d'));
}
}