From 848af5b3d46b67f131c548ab08ff4fec4cd6560d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 28 Mar 2022 15:44:23 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 9 +++-- .../controller/CallbackController.class.php | 39 +++++++++++++++++++ webapp/controller/WalletController.class.php | 7 +++- webapp/models/Withdrawal.php | 31 +++++++++++++++ 4 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 webapp/controller/CallbackController.class.php diff --git a/sql/gamedb.sql b/sql/gamedb.sql index cddbc817..c05f3e63 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -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 */; diff --git a/webapp/controller/CallbackController.class.php b/webapp/controller/CallbackController.class.php new file mode 100644 index 00000000..fe5bcce2 --- /dev/null +++ b/webapp/controller/CallbackController.class.php @@ -0,0 +1,39 @@ +isTestMode()) { + + } + myself()->_rspOk(); + } + +} diff --git a/webapp/controller/WalletController.class.php b/webapp/controller/WalletController.class.php index 5304de67..f5ae19b2 100644 --- a/webapp/controller/WalletController.class.php +++ b/webapp/controller/WalletController.class.php @@ -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) + { + + } + } diff --git a/webapp/models/Withdrawal.php b/webapp/models/Withdrawal.php index 5bb6316b..61d0431e 100644 --- a/webapp/models/Withdrawal.php +++ b/webapp/models/Withdrawal.php @@ -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() + ) + ); + } + }