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.

118 lines
3.4 KiB
PHTML

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