master
ELF 4 years ago
parent dd71ccdf83
commit e1352fea1e

@ -52,8 +52,22 @@ class GameApiController extends Think {
public function send() public function send()
{ {
$game = M('game', 'tab_')->field(['id', 'sdk_version'])->where(['id' => 232])->find(); // 229
$role = [ // 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', 'role_id' => '6819493',
'user_account' => 'qh11102', 'user_account' => 'qh11102',
'sdk_version' => 1, 'sdk_version' => 1,
@ -63,9 +77,31 @@ class GameApiController extends Think {
'ref_id' => '8', 'ref_id' => '8',
'remark' => '测试', 'remark' => '测试',
'order_no' => date('YmdHis') . rand(1000, 9999) . '_1', '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); $gameResource = new GameResource($game);
$result = $gameResource->getResources(); // $result = $gameResource->getResources();
$result = $gameResource->apply($order, $role);
var_dump($result); var_dump($result);
} }
} }

@ -92,7 +92,7 @@ class TestingResourceService
throw new \Exception('该游戏不支持发放测试资源'); throw new \Exception('该游戏不支持发放测试资源');
} }
$role = M('user_play_info', 'tab_') $role = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id', 'promote_id', 'user_account', 'sdk_version']) ->field(['id', 'role_id', 'user_id', 'promote_id', 'user_account', 'sdk_version', 'server_id'])
->where(['game_id' => $batch['game_id'], 'role_id' => $batch['role_id']]) ->where(['game_id' => $batch['game_id'], 'role_id' => $batch['role_id']])
->find(); ->find();
$orders = M('testing_resource_order', 'tab_') $orders = M('testing_resource_order', 'tab_')

@ -17,8 +17,9 @@ class JtxcClient
protected $client; protected $client;
// http://chat.leniu.com/api/game/sendGold/zhuimeng/jxlm/57972
private $apis = [ private $apis = [
'provide' => ['uri' => '/api/game/sendGold/zhuimeng/jxlm/53334', 'method' => 'post'], 'provide' => ['uri' => '/api/game/sendGold/zhuimeng/jxlm/57972', 'method' => 'post'],
]; ];
public function __construct() public function __construct()
@ -40,7 +41,7 @@ class JtxcClient
return $this->request($api, $params); return $this->request($api, $params);
} catch (\Exception $e) { } catch (\Exception $e) {
$env = C('APP_ENV', null, 'prod'); $env = C('APP_ENV', null, 'prod');
return ['code' => 1000, 'state' => 1000, 'message' => '接口请求错误。' . ($env == 'prod' ? '' : $e->getMessage()) , 'data' => []]; return $e->getMessage();
} }
} }
@ -59,8 +60,7 @@ class JtxcClient
'verify' => false, 'verify' => false,
'form_params' => $params, 'form_params' => $params,
]); ]);
$result = (string)$response->getBody(); return (string)$response->getBody();
return json_decode($result, true);
} }
protected function get($uri, array $params = []) protected function get($uri, array $params = [])
@ -69,8 +69,7 @@ class JtxcClient
'verify' => false, 'verify' => false,
'query' => $params, 'query' => $params,
]); ]);
$result = (string)$response->getBody(); return (string)$response->getBody();
return json_decode($result, true);
} }
protected function sign($params) protected function sign($params)
@ -88,22 +87,22 @@ class JtxcClient
{ {
$result = $this->api('provide', [ $result = $this->api('provide', [
'role_id' => $role['role_id'], 'role_id' => $role['role_id'],
'money' => intval($order['ref_amount']), 'money' => intval($order['ref_amount']) * 10,
'type' => 2, 'type' => 2,
// 'goods_id' => 0, // 'goods_id' => 0,
'server_no' => $role['user_account'], 'server_no' => $role['server_id'],
]); ]);
if ($result['state'] == 1 && $result['data']) { if ($result == 'SUCCESS') {
return [ return [
'status' => true, 'status' => true,
'message' => $result['msg'], 'message' => $result,
'result' => $result 'result' => ['result' => $result]
]; ];
} else { } else {
return [ return [
'status' => false, 'status' => false,
'message' => $result['msg'], 'message' => $result,
'result' => $result ?? [] 'result' => ['result' => $result]
]; ];
} }
} }

@ -39,7 +39,7 @@ class LsxxClient
return $this->request($api, $params); return $this->request($api, $params);
} catch (\Exception $e) { } catch (\Exception $e) {
$env = C('APP_ENV', null, 'prod'); $env = C('APP_ENV', null, 'prod');
return ['code' => 1000, 'state' => 1000, 'message' => '接口请求错误。' . ($env == 'prod' ? '' : $e->getMessage()) , 'data' => []]; return ['status' => 0, 'msg' => '接口请求错误。' . ($env == 'prod' ? '' : $e->getMessage()) , 'data' => []];
} }
} }
@ -87,9 +87,8 @@ class LsxxClient
{ {
$result = $this->api('provide', [ $result = $this->api('provide', [
'role_id' => $role['role_id'], 'role_id' => $role['role_id'],
'money' => intval($order['ref_amount']),
'goods_id' => $order['ref_id'], 'goods_id' => $order['ref_id'],
'server_no' => $role['user_account'], 'server_no' => $role['server_id'],
'send_time' => time() 'send_time' => time()
]); ]);
if ($result['status'] == 1) { if ($result['status'] == 1) {

Loading…
Cancel
Save