1
This commit is contained in:
parent
797c86c022
commit
848af5b3d4
@ -85,14 +85,15 @@ DROP TABLE IF EXISTS `t_user_wallet_record`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_user_wallet_record` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`trans_id` varchar(100) NOT NULL DEFAULT '' COMMENT 'trans_id',
|
||||
`txhash` varchar(100) NOT NULL DEFAULT '' COMMENT 'txhash',
|
||||
`dir` int(11) NOT NULL DEFAULT '0' COMMENT 'dir',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`gold` int(11) NOT NULL DEFAULT '0' COMMENT '金币',
|
||||
`diamond` int(11) NOT NULL DEFAULT '0' COMMENT '钻石',
|
||||
`type` int(11) NOT NULL DEFAULT '0' COMMENT 'type',
|
||||
`value` bigint NOT NULL DEFAULT '0' COMMENT 'value',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `trans_id` (`trans_id`),
|
||||
UNIQUE KEY `txhash` (`txhash`),
|
||||
KEY `account_id` (`account_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
39
webapp/controller/CallbackController.class.php
Normal file
39
webapp/controller/CallbackController.class.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
require_once('mt/Item.php');
|
||||
require_once('mt/Currency.php');
|
||||
require_once('mt/Hero.php');
|
||||
require_once('mt/Parameter.php');
|
||||
|
||||
require_once('models/Nft.php');
|
||||
require_once('models/Withdrawal.php');
|
||||
require_once('models/Transfer.php');
|
||||
|
||||
require_once('phpcommon/bchelper.php');
|
||||
|
||||
use phpcommon\SqlHelper;
|
||||
use models\Nft;
|
||||
use models\Withdrawal;
|
||||
use models\Transfer;
|
||||
|
||||
class Callback extends BaseController {
|
||||
|
||||
private function isTestMode()
|
||||
{
|
||||
return isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443 && SERVER_ENV == _TEST;
|
||||
}
|
||||
|
||||
public function transfer()
|
||||
{
|
||||
$dir = strtolower(getReqVal('dir', ''));
|
||||
$account = strtolower(getReqVal('account', ''));
|
||||
$txHash = getReqVal('txhash', '');
|
||||
$type = getReqVal('type', '');
|
||||
$value = getReqVal('value', '');
|
||||
if ($this->isTestMode()) {
|
||||
|
||||
}
|
||||
myself()->_rspOk();
|
||||
}
|
||||
|
||||
}
|
@ -40,7 +40,7 @@ class WalletController extends BaseController {
|
||||
'seq_id' => $seqId
|
||||
));
|
||||
if ($this->isTestMode()) {
|
||||
|
||||
Withdrawal::testOk($seqid, $account, $type, $netId, $amount);
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,4 +96,9 @@ class WalletController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
private function notifyGame($dir, $txhash, $account, $type, $value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,4 +52,35 @@ class Withdrawal extends BaseModel {
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function testOk($idx, $account, $type, $netId, $amount)
|
||||
{
|
||||
SqlHelper::update(
|
||||
myself()->_getSelfMysql(),
|
||||
't_withdrawal',
|
||||
array(
|
||||
'idx' => $idx,
|
||||
),
|
||||
array(
|
||||
'state' => 2,
|
||||
'bc_block_number' => 1,
|
||||
'bc_txhash' => $idx,
|
||||
'bc_time' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
SqlHelper::insert
|
||||
(myself()->_getMarketMysql(),
|
||||
't_transfer',
|
||||
array(
|
||||
'txhash' => $idx,
|
||||
'type' => $type,
|
||||
'_from' => $account,
|
||||
'_to' => $account,
|
||||
'value' => $amount,
|
||||
'state' => 1,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user