_getMarketMysql()->execQueryOne( 'SELECT COUNT(1) AS times FROM t_withdrawal WHERE account=:account AND createtime>=:now_dayseconds AND createtime<=:now_dayseconds + 3600 * 24;', array( ':account' => $account, ':now_dayseconds' => myself()->_getNowDaySeconds() ) ); return $row ? $row['times'] : 0; } public static function add($account, $type, $netId, $amount) { SqlHelper::insert (myself()->_getMarketMysql(), 't_withdrawal', array( 'account' => $account, 'type' => $type, 'net_id' => $netId, 'amount' => $amount, 'createtime' => myself()->_getNowTime(), 'modifytime' => myself()->_getNowTime() ) ); $seqId = SqlHelper::getLastInsertId(myself()->_getMarketMysql()); return $seqId; } public static function find($seqId) { $row = SqlHelper::ormSelectOne( myself()->_getMarketMysql(), 't_withdrawal', array( 'idx' => $seqId, ) ); return $row; } public static function testOk($idx, $account, $type, $netId, $amount) { SqlHelper::update( myself()->_getMarketMysql(), '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() ) ); } }