|
@@ -1004,6 +1004,17 @@ class Pay extends Api
|
|
|
$this->success('查询完成');
|
|
$this->success('查询完成');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function withdrawal(){
|
|
|
|
|
+ $uid = input('uid');
|
|
|
|
|
+ $address = input('address');
|
|
|
|
|
+ $type = input('type');
|
|
|
|
|
+ $img = input('img');
|
|
|
|
|
+ if (empty($address)&&empty($img)){
|
|
|
|
|
+ $this->error(__('请上传地址或上传收款码'));
|
|
|
|
|
+ }
|
|
|
|
|
+ Db::name('user_txjl')->insert(['uid' => $uid, 'address' => $address, 'type' => $type, 'img' => $img, 'add_time' => time()]);
|
|
|
|
|
+ $this->success('提交成功');
|
|
|
|
|
+ }
|
|
|
public function test()
|
|
public function test()
|
|
|
{
|
|
{
|
|
|
$service = Web3Service::instance('bsc', 'usdt', '');
|
|
$service = Web3Service::instance('bsc', 'usdt', '');
|
|
@@ -1011,7 +1022,7 @@ class Pay extends Api
|
|
|
$user_info = Db::name('user')->where('id', 1571)->find();
|
|
$user_info = Db::name('user')->where('id', 1571)->find();
|
|
|
foreach ($info as $k2 => $v2) {
|
|
foreach ($info as $k2 => $v2) {
|
|
|
$value = $v2->params['value']->toString(); //金额
|
|
$value = $v2->params['value']->toString(); //金额
|
|
|
- $value2 = bcdiv($value, bcpow(10, get_token_info('bsc', 'USDT', 'decimal')), 12);
|
|
|
|
|
|
|
+ $value2 = bcdiv($value, bcpow(10, get_token_info('bsc', 'TUSD', 'decimal')), 12);
|
|
|
$transactionHash = $v2->transactionHash;
|
|
$transactionHash = $v2->transactionHash;
|
|
|
$be = DB::name('user_recharge')->where('hash', $transactionHash)->find();
|
|
$be = DB::name('user_recharge')->where('hash', $transactionHash)->find();
|
|
|
if ($be) { //hash重复
|
|
if ($be) { //hash重复
|
|
@@ -1081,65 +1092,5 @@ class Pay extends Api
|
|
|
// }
|
|
// }
|
|
|
// var_dump($info);die();
|
|
// var_dump($info);die();
|
|
|
}
|
|
}
|
|
|
-// function paginatedTransferQuery($service, $toAddress, $targetTimestamp) {
|
|
|
|
|
-// $BPS = 3; // BSC每秒区块数
|
|
|
|
|
-// $currentBlock = intval(time() * $BPS);
|
|
|
|
|
-// $startBlock = intval($targetTimestamp * $BPS);
|
|
|
|
|
-// $pageSize = 500;
|
|
|
|
|
-// $results = [];
|
|
|
|
|
-// $attempts = 0;
|
|
|
|
|
-//
|
|
|
|
|
-// while ($startBlock <= $currentBlock && $attempts < 50) {
|
|
|
|
|
-// $endBlock = min($startBlock + $pageSize - 1, $currentBlock);
|
|
|
|
|
-//
|
|
|
|
|
-// try {
|
|
|
|
|
-// $transfers = $service->getLastTransfer(
|
|
|
|
|
-// [],
|
|
|
|
|
-// [$toAddress],
|
|
|
|
|
-// 0,
|
|
|
|
|
-// $startBlock,
|
|
|
|
|
-// $endBlock
|
|
|
|
|
-// );
|
|
|
|
|
-//
|
|
|
|
|
-// // 只有当有结果时才处理
|
|
|
|
|
-// if (!empty($transfers)) {
|
|
|
|
|
-// $results = array_merge($results, $transfers);
|
|
|
|
|
-//
|
|
|
|
|
-// // 检查是否达到目标时间
|
|
|
|
|
-// $newest = end($transfers);
|
|
|
|
|
-// reset($transfers); // 重置数组指针
|
|
|
|
|
-//
|
|
|
|
|
-// // 确保有 timestamp 属性再检查
|
|
|
|
|
-// if (property_exists($newest, 'timestamp') && $newest->timestamp >= time() - 60) {
|
|
|
|
|
-// break; // 已查询到最新区块
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// // 成功时增加分页大小
|
|
|
|
|
-// $pageSize = min(5000, $pageSize * 2);
|
|
|
|
|
-// $startBlock = $endBlock + 1;
|
|
|
|
|
-//
|
|
|
|
|
-// } catch (RequestException $e) {
|
|
|
|
|
-// if (strpos($e->getMessage(), '413') !== false) {
|
|
|
|
|
-// $pageSize = max(100, $pageSize / 2);
|
|
|
|
|
-// $attempts++;
|
|
|
|
|
-// continue;
|
|
|
|
|
-// }
|
|
|
|
|
-// throw $e;
|
|
|
|
|
-// } catch (\Throwable $e) {
|
|
|
|
|
-// // 捕获所有类型错误
|
|
|
|
|
-// error_log("查询错误: " . $e->getMessage());
|
|
|
|
|
-// $pageSize = max(100, $pageSize / 2);
|
|
|
|
|
-// $attempts++;
|
|
|
|
|
-// continue;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// usleep(100000);
|
|
|
|
|
-// $attempts++;
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// return array_filter($results, function($t) use ($targetTimestamp) {
|
|
|
|
|
-// return property_exists($t, 'timestamp') && $t->timestamp >= $targetTimestamp;
|
|
|
|
|
-// });
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|