Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
024fcade01
@ -128,3 +128,21 @@ class AALogin(object):
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
self.internalApis = [
|
||||||
|
{
|
||||||
|
'method': 'POST',
|
||||||
|
'name': 'verifyJwt',
|
||||||
|
'desc': 'jwt验证',
|
||||||
|
'group': '!AALogin',
|
||||||
|
'url': 'https://login-test.kingsome.cn/webapp/index.php?c=Login&a=verifyJwt',
|
||||||
|
'is_json_params': True,
|
||||||
|
'params': [
|
||||||
|
['jwt', '', 'jwt'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['account_id', '', 'account_id'],
|
||||||
|
['address', '', 'address'],
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
57
doc/AANft.py
Normal file
57
doc/AANft.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import _common
|
||||||
|
|
||||||
|
class AANft(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.apis = [
|
||||||
|
{
|
||||||
|
'name': '/hero/home_meta/:net_id',
|
||||||
|
'desc': '获取英雄nft元信息主页',
|
||||||
|
'group': '!AANft',
|
||||||
|
'url': 'https://nft-test.kingsome.cn/hero/home_meta/:net_id',
|
||||||
|
'params': [
|
||||||
|
[':net_id', '', '链id'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.NftHomeMeta(),
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': '/gold_bullion/home_meta/:net_id',
|
||||||
|
'desc': '获取金砖nft元信息主页',
|
||||||
|
'group': '!AANft',
|
||||||
|
'url': 'https://nft-test.kingsome.cn/gold_bullion/home_meta/:net_id',
|
||||||
|
'params': [
|
||||||
|
[':net_id', '', '链id'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.NftHomeMeta(),
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': '/hero/meta/:net_id/:token_id',
|
||||||
|
'desc': '获取英雄nft元信息',
|
||||||
|
'group': '!AANft',
|
||||||
|
'url': 'https://nft-test.kingsome.cn/hero/meta/:net_id/:token_id',
|
||||||
|
'params': [
|
||||||
|
[':net_id', '', '链id'],
|
||||||
|
[':token_id', '', 'tokenId'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.NftHeroMeta(),
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': '/gold_bullion/meta/:net_id/:token_id',
|
||||||
|
'desc': '获取金砖nft元信息',
|
||||||
|
'group': '!AANft',
|
||||||
|
'url': 'https://nft-test.kingsome.cn/gold_bullion/meta/:net_id/:token_id',
|
||||||
|
'params': [
|
||||||
|
[':net_id', '', '链id'],
|
||||||
|
[':token_id', '', 'tokenId'],
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.NftHeroMeta(),
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
@ -152,12 +152,16 @@ class User(object):
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
'method': 'POST',
|
||||||
'name': 'updateAddressBind',
|
'name': 'updateAddressBind',
|
||||||
'desc': '更新钱包绑定信息',
|
'desc': '更新钱包绑定信息',
|
||||||
'group': 'User',
|
'group': 'User',
|
||||||
'url': 'webapp/index.php?c=User&a=updateAddressBind',
|
'url': 'webapp/index.php?c=User&a=updateAddressBind',
|
||||||
'params': [
|
'is_json_params': True,
|
||||||
|
'request_params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
|
],
|
||||||
|
'params': [
|
||||||
['jwt', '', 'jwt数据'],
|
['jwt', '', 'jwt数据'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
|
@ -1669,3 +1669,42 @@ class MFTransactionRequest(object):
|
|||||||
['to', '', '调用的目标合约地址'],
|
['to', '', '调用的目标合约地址'],
|
||||||
['data', '', '包含报文相关的字节字符串'],
|
['data', '', '包含报文相关的字节字符串'],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
class NftHomeMeta(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['name', '', 'nft名字'],
|
||||||
|
['symbol', '', 'symbol'],
|
||||||
|
['description', '', 'nft描述'],
|
||||||
|
['image', '', 'nft图片地址'],
|
||||||
|
['external_link', '', 'nft链接'],
|
||||||
|
]
|
||||||
|
|
||||||
|
class NftAttribute(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['trait_type', '', '属性名'],
|
||||||
|
['value', '', '属性值'],
|
||||||
|
]
|
||||||
|
|
||||||
|
class NftHeroMeta(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['name', '', 'nft名字'],
|
||||||
|
['description', '', 'nft描述'],
|
||||||
|
['image', '', 'nft图片地址'],
|
||||||
|
['!attrigutes', [NftAttribute()], 'nft属性'],
|
||||||
|
]
|
||||||
|
|
||||||
|
class NftGoldBullionMeta(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.fields = [
|
||||||
|
['name', '', 'nft名字'],
|
||||||
|
['description', '', 'nft描述'],
|
||||||
|
['image', '', 'nft图片地址'],
|
||||||
|
['!attrigutes', [NftAttribute()], 'nft属性'],
|
||||||
|
]
|
||||||
|
2
third_party/phpcommon
vendored
2
third_party/phpcommon
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 11fd016051f98589781dc1f0c2375ffd0c1a8814
|
Subproject commit c9c3eb2baac856f0b8a4d31cbd9806dc146d433d
|
@ -171,13 +171,14 @@ class BaseAuthedController extends BaseController {
|
|||||||
$userDb = $this->_getOrmUserInfo();
|
$userDb = $this->_getOrmUserInfo();
|
||||||
$this->address = $userDb['address'];
|
$this->address = $userDb['address'];
|
||||||
$this->addressActived = true;
|
$this->addressActived = true;
|
||||||
|
/*
|
||||||
if (SERVER_ENV != _ONLINE && empty($this->address)) {
|
if (SERVER_ENV != _ONLINE && empty($this->address)) {
|
||||||
$this->address = strtolower('0xa9ecB9F3A0b54d31ce4a035C89EC7Da4110beB59');
|
$this->address = strtolower('0xa9ecB9F3A0b54d31ce4a035C89EC7Da4110beB59');
|
||||||
if (myself()->_getAccountId() == '6513_2006_3WOWIsmpcihK1KTnNP1Ky5MBOh7rt6Rl') {
|
if (myself()->_getAccountId() == '6513_2006_3WOWIsmpcihK1KTnNP1Ky5MBOh7rt6Rl') {
|
||||||
///$this->address = strtolower('0x0bb52209756e8d157f2e551a9adb8d9019b688b1');
|
///$this->address = strtolower('0x0bb52209756e8d157f2e551a9adb8d9019b688b1');
|
||||||
$this->address = strtolower('0xbd2d6de4b70d370954b187c95dddfbd00f4129ff');
|
$this->address = strtolower('0xbd2d6de4b70d370954b187c95dddfbd00f4129ff');
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
return $this->address;
|
return $this->address;
|
||||||
}
|
}
|
||||||
|
@ -17,57 +17,45 @@ class MailController extends BaseAuthedController {
|
|||||||
$this->awardService = new services\AwardService();
|
$this->awardService = new services\AwardService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAttachment()
|
public function getAttachmentCb()
|
||||||
{
|
{
|
||||||
$mailIds = getReqVal('mail_ids', '');
|
$timestamp = getReqVal('timestamp', '');
|
||||||
|
$signStr = getReqVal('sign', '');
|
||||||
|
$data = file_get_contents('php://input');
|
||||||
|
$dataJson = json_decode($data, true);
|
||||||
|
|
||||||
$response = '';
|
$localSignStr = md5($data . MAIL_KEY . $timestamp);
|
||||||
{
|
if ($localSignStr != $signStr) {
|
||||||
$params = array(
|
myself()->_rspErr(500, 'server internal error 3, url:');
|
||||||
'c' => 'Mail',
|
return;
|
||||||
'a' => 'getAttachment',
|
}
|
||||||
'account_id' => myself()->_getAccountId(),
|
if (empty($dataJson)) {
|
||||||
'session_id' => myself()->_getSessionId(),
|
myself()->_rspErr(500, 'server internal error 4, url:');
|
||||||
'mail_ids' => $mailIds
|
return;
|
||||||
);
|
}
|
||||||
|
if ($dataJson['account_id'] != myself()->_getAccountId()) {
|
||||||
|
myself()->_rspErr(500, 'server internal error 2, url:');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (abs($timestamp - myself()->_getNowTime()) > 60) {
|
||||||
|
myself()->_rspErr(500, 'server internal error 5, url:');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$url = self::getMailServerUrl();
|
$this->procAttachments($dataJson);
|
||||||
if (!phpcommon\HttpClient::get
|
myself()->_rspData(array(
|
||||||
($url,
|
'award' => $this->awardService->toDto(),
|
||||||
$params,
|
'property_chg' => $this->propertyChgService->toDto()
|
||||||
$response)) {
|
));
|
||||||
myself()->_rspErr(500, 'server internal error 3, url:' . $url);
|
|
||||||
die();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
error_log($mailIds);
|
|
||||||
error_log($response);
|
|
||||||
error_log($url);
|
|
||||||
$rspObj = json_decode($response, true);
|
|
||||||
if ($rspObj && $rspObj['errcode'] == 0) {
|
|
||||||
$this->procAttachments($rspObj['attachments']);
|
|
||||||
$rspObj['award'] = $this->awardService->toDto();
|
|
||||||
$rspObj['property_chg'] = $this->propertyChgService->toDto();
|
|
||||||
}
|
|
||||||
echo json_encode($rspObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function procAttachments($attachments)
|
private function procAttachments($dataJson)
|
||||||
{
|
{
|
||||||
$mailHash = array();
|
$mailHash = $dataJson['mails'];
|
||||||
{
|
foreach ($mailHash as $val) {
|
||||||
foreach ($attachments as $item) {
|
$mailId = $val['mailid'];
|
||||||
if (!array_key_exists($item['mailid'], $mailHash)) {
|
|
||||||
$mailHash[$item['mailid']] = array();
|
|
||||||
}
|
|
||||||
array_push($mailHash[$item['mailid']], $item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach ($mailHash as $key => $val) {
|
|
||||||
$mailId = $key;
|
|
||||||
$items = array();
|
$items = array();
|
||||||
foreach ($val as $item) {
|
foreach ($val['attachments'] as $item) {
|
||||||
array_push($items, array(
|
array_push($items, array(
|
||||||
'item_id' => $item['itemid'],
|
'item_id' => $item['itemid'],
|
||||||
'item_num' => $item['itemnum'],
|
'item_num' => $item['itemnum'],
|
||||||
@ -116,9 +104,4 @@ class MailController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function getMailServerUrl()
|
|
||||||
{
|
|
||||||
return MAIL_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
require_once('models/Nft.php');
|
require_once('models/Nft.php');
|
||||||
require_once('models/User.php');
|
require_once('models/User.php');
|
||||||
|
require_once('models/Hero.php');
|
||||||
|
|
||||||
use models\Nft;
|
use models\Nft;
|
||||||
use models\User;
|
use models\User;
|
||||||
|
use models\Hero;
|
||||||
class OutAppNftController extends BaseController {
|
class OutAppNftController extends BaseController {
|
||||||
|
|
||||||
public function getNftList(){
|
public function getNftList(){
|
||||||
@ -189,6 +191,7 @@ class OutAppNftController extends BaseController {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
error_log(json_encode($info));
|
||||||
myself()->_rspData($info);
|
myself()->_rspData($info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,74 +906,68 @@ class UserController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function updateAddressBind()
|
public function updateAddressBind()
|
||||||
{
|
{
|
||||||
if (myself()->_getChannel() != BC_POLY_CHANNEL) {
|
if (myself()->_getChannel() != IMTBL_CHANNEL) {
|
||||||
phpcommon\sendError(1, 'token error');
|
phpcommon\sendError(1, 'token error');
|
||||||
die();
|
die();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error_log(json_encode($_REQUEST));
|
$data = json_decode(file_get_contents('php://input'), true);
|
||||||
$jwt = getReqVal('jwt', '');
|
if (empty($data)) {
|
||||||
|
phpcommon\rspErr(100, 'data error');
|
||||||
$arr = explode('.', $jwt);
|
|
||||||
if (count($arr) < 3) {
|
|
||||||
phpcommon\sendError(1, 'token error');
|
|
||||||
die();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$header = base64_decode($arr[0]);
|
|
||||||
$payload = base64_decode($arr[1]);
|
|
||||||
$sign = base64_decode($arr[2]);
|
|
||||||
$data = json_decode($payload, true);
|
|
||||||
|
|
||||||
$subIdxPre = '';
|
|
||||||
$subIdx = getXVal($data, 'version', '');
|
|
||||||
if (!empty($subIdx)) {
|
|
||||||
$subIdxPre = 's' . $subIdx . '_';
|
|
||||||
}
|
|
||||||
{
|
|
||||||
$jwtAccountId = BC_POLY_CHANNEL . '_' . myself()->_getGameId() . '_' .
|
|
||||||
$subIdxPre . $data['plat'] . '_' . $data['openid'];
|
|
||||||
if ($jwtAccountId != myself()->_getAccountId()) {
|
|
||||||
myself()->_rspErr(1, 'token error3');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//$url = 'https://pay.cebggame.com/wallet/info?';
|
|
||||||
$url = 'https://oauth-svr.cebggame.com/test/wallet/info?';
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'token' => $jwt
|
'jwt' => $data['jwt']
|
||||||
);
|
);
|
||||||
|
$url = LOGIN_URL . '?c=Login&a=verifyJwt';
|
||||||
$response = '';
|
$response = '';
|
||||||
if (!phpcommon\HttpClient::get
|
if (!phpcommon\HttpClient::postContent
|
||||||
($url,
|
($url,
|
||||||
$params,
|
json_encode($params),
|
||||||
$response)) {
|
$response)) {
|
||||||
myself()->_rspErr(500, 'server internal error');
|
echo json_encode(array(
|
||||||
die();
|
'errcode' => 500,
|
||||||
|
'errmsg' => "server internal error",
|
||||||
|
'is_retry' => 1,
|
||||||
|
'retry_time' => 15
|
||||||
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
error_log($response);
|
error_log($response);
|
||||||
|
if (empty($response)) {
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 500,
|
||||||
|
'errmsg' => "server internal error",
|
||||||
|
'is_retry' => 1,
|
||||||
|
'retry_time' => 20
|
||||||
|
));
|
||||||
|
return;
|
||||||
|
}
|
||||||
$rspObj = json_decode($response, true);
|
$rspObj = json_decode($response, true);
|
||||||
if (empty($rspObj['data']['address'])) {
|
if ($rspObj['errcode'] != 0) {
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 500,
|
||||||
|
'errmsg' => "server internal error",
|
||||||
|
'is_retry' => 1,
|
||||||
|
'retry_time' => 30
|
||||||
|
));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($rspObj['account_id'] != myself()->_getAccountId()) {
|
||||||
|
myself()->_rspErr(500, 'server internal error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (empty($rspObj['address'])) {
|
||||||
User::Update(array(
|
User::Update(array(
|
||||||
'address' => null
|
'address' => null
|
||||||
));
|
));
|
||||||
myself()->_rspOk();
|
myself()->_rspOk();
|
||||||
die();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$address = strtolower($rspObj['data']['address']);
|
$address = strtolower($rspObj['address']);
|
||||||
$oldUser = User::findByAddress($address);
|
$oldUser = User::findByAddress($address);
|
||||||
if ($oldUser) {
|
if ($oldUser) {
|
||||||
if ($oldUser['account_id'] != myself()->_getAccountId()) {
|
if ($oldUser['account_id'] != myself()->_getAccountId()) {
|
||||||
if (!phpcommon\isSameSeriesAccount(
|
|
||||||
$oldUser['account_id'],
|
|
||||||
myself()->_getAccountId()
|
|
||||||
)) {
|
|
||||||
myself()->_rspErr(1, 'is not SameSeriesAccount');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
User::updateOther(
|
User::updateOther(
|
||||||
$oldUser['account_id'],
|
$oldUser['account_id'],
|
||||||
array(
|
array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user