注意事项            
【!注意!】技术指导专用文章,实在不会搭建再点击此处 【!注意!】
EPUSDT插件支付收款教程

EPUSDT插件支付收款教程

注意事项
🔥 最新推出:一天会员!
专为下载资源打造,超值体验,立即加入!
了解详情
✨ 新推出:兑换码!

进入小程序,获得大额兑换码!最高减100%

小程序二维码

扫码进入小程序

p准备工作

1.Telegram机器人x1 (用于操作您的钱包和接收交易通知)

2.Epusdt开源程序

3.服务器x1 (用于部署Epusdt程序,配置≥2g2h)

4.域名x1 (用于支付请求发起和扫码页面,支持二级域名)

开始教程

准备工作完成后就让我们开始正式教程吧

创建Telegram机器人

打开Telegram,在顶部搜索栏中搜索BotFather机器人,注意甄别ID为@BotFather

图片[1]-子比主题接入EPUSDT插件支付收款教程-初一小盏

打开与BotFather的对话框,点击开始,您会收到BotFather回复的一些代码命令,我们点击第一个命令 /newbot创建机器人

图片[2]-EPUSDT插件支付收款教程-允梦网络
图片[3]-EPUSDT插件支付收款教程-允梦网络

机器人Token

接下来BotFather会依次提示您您输入机器人的昵称@ID_BOT,创建成功后,会得到机器人Token

  • 昵称自定义填写 (可以中文)
  • @ID_BOT 为唯一标识,如果取名重复则会提示重新输入,不能中文(输入格式为:xxx_bot)

接着,在顶部搜索栏中用@ID_bot搜索刚才创建成功的机器人,并任意发送一条消息,激活机器人(此时机器人不会做任何回复)

图片[4]-EPUSDT插件支付收款教程-允梦网络

管理员ID

激活后,在顶部搜索框输入getmyidbot,打开对话框,点击开始,机器人会自动回复您Telegram账号的ID,(也就是管理员ID),现在搜索不到了,得仔细找找

图片[5]-EPUSDT插件支付收款教程-允梦网络

搭建EPusdt程序

服务器安装宝塔面板,不会安装请点击前往宝塔官网查看详细安装教程

图片[6]-EPUSDT插件支付收款教程-允梦网络

Epusdt安装环境

登录宝塔 侧边栏点击-软件商店 安装 MySQL 、phpMyAdmin 、Redis进程守护管理器(只需安装这几个即可)

图片[7]-EPUSDT插件支付收款教程-允梦网络

安装完成后,侧边栏点击-网站-添加站点,填写您准备的域名、创建数据库、PHP选择伪静态,最后点击提交

创建数据库

添加完站点,侧边栏点击-数据库,找到刚才创建的数据库,点击管理-登录到该数据库

图片[8]-EPUSDT插件支付收款教程-允梦网络

复制下面的代码,粘贴至phpmyadmin的SQL面板,然后执行

-- auto-generated definition
create table orders
(
id int auto_increment
primary key,
trade_id varchar(32) not null comment 'epusdt订单号',
order_id varchar(32) not null comment '客户交易id',
block_transaction_id varchar(128) null comment '区块唯一编号',
actual_amount decimal(19, 4) not null comment '订单实际需要支付的金额,保留4位小数',
amount decimal(19, 4) not null comment '订单金额,保留4位小数',
token varchar(50) not null comment '所属钱包地址',
status int default 1 not null comment '1:等待支付,2:支付成功,3:已过期',
notify_url varchar(128) not null comment '异步回调地址',
redirect_url varchar(128) null comment '同步回调地址',
callback_num int default 0 null comment '回调次数',
callback_confirm int default 2 null comment '回调是否已确认? 1是 2否',
created_at timestamp null,
updated_at timestamp null,
deleted_at timestamp null,
constraint orders_order_id_uindex
unique (order_id),
constraint orders_trade_id_uindex
unique (trade_id)
);


create index orders_block_transaction_id_index
on orders (block_transaction_id);


-- auto-generated definition
create table wallet_address
(
id int auto_increment
primary key,
token varchar(50) not null comment '钱包token',
status int default 1 not null comment '1:启用 2:禁用',
created_at timestamp null,
updated_at timestamp null,
deleted_at timestamp null
)
comment '钱包表';


create index wallet_address_token_index
on wallet_address (token);

接下来点击下载Epusdt已编译程序 (注意下载图中版本,否则无法运行)

图片[11]-子比主题接入EPUSDT插件支付收款教程-初一小盏

上传至刚才新增站点的网站目录下,并将 .env.example 重命名为 .env

图片[10]-EPUSDT插件支付收款教程-允梦网络

配置.env文件

图片[11]-EPUSDT插件支付收款教程-允梦网络

编辑 .env 文件,只需修改或填写:您的收款域名数据库机器人Token管理员IDapi接口认证

app_name=epusdt
#下面配置你的域名,收银台会需要
app_uri=您的收款域名
#是否开启debug,默认false
app_debug=false
#http服务监听端口
http_listen=:8000


#静态资源文件目录
static_path=/static
#缓存路径
runtime_root_path=/runtime


#日志配置
log_save_path=/logs
log_max_size=32
log_max_age=7
max_backups=3


# mysql配置
mysql_host=127.0.0.1
mysql_port=3306
mysql_user=mysql账号
mysql_passwd=mysql密码
mysql_database=数据库
mysql_table_prefix=
mysql_max_idle_conns=10
mysql_max_open_conns=100
mysql_max_life_time=6


# redis配置
redis_host=127.0.0.1
redis_port=6379
redis_passwd=
redis_db=5
redis_pool_size=5
redis_max_retries=3
redis_idle_timeout=1000


# 消息队列配置
queue_concurrency=10
queue_level_critical=6
queue_level_default=3
queue_level_low=1


#机器人Apitoken
tg_bot_token= 机器人Token
#telegram代理url(大陆地区服务器可使用一台国外服务器做反代tg的url),如果运行的本来就是境外服务器,则无需填写
tg_proxy=
#管理员userid
tg_manage= 管理员ID


#api接口认证token(用于发起交易的签名认证,请勿外泄)
api_auth_token= 自定义(格式:数字+字母)


#订单过期时间(单位分钟)
order_expiration_time=10


#强制汇率(设置此参数后每笔交易将按照此汇率计算,例如:6.4)
forced_usdt_rate=

添加反向代理

编辑并保存后,侧边栏点击-网站-设置-添加反向代理,如图填写并提交

图片[12]-EPUSDT插件支付收款教程-允梦网络

可执行文件赋权

完成后,返回到网站目录下,找到Epusdt文件,修改权限为777

图片[13]-EPUSDT插件支付收款教程-允梦网络

添加进程守护

在 软件商店中 打开进程守护管理器 添加守护进程

  • 运行目录 选择新增站点根目录下
  • 启动命令 = 运行目录+/epusdt-dev/epusdt http start (列如:/www/wwwroot/usdt/epusdt-dev/epusdt http start)
图片[14]-EPUSDT插件支付收款教程-允梦网络

添加钱包地址

到这里程序就安装好了,之后打开自己机器人的对话框,输入/start 按照提示绑定自己的钱包地址即可

图片[15]-EPUSDT插件支付收款教程-允梦网络

扩展

下面是为大家准备的扩展内容

Telegram BOT API 自建反代

如果您的Epusdt程序是用的国内服务器搭建,那么则需要自建反代API

 
 
 
#telegram代理url(大陆地区服务器可使用一台国外服务器做反代tg的url),如果运行的本来就是境外服务器,则无需填写
tg_proxy=

这需要准备一台国外的服务器,安装宝塔 环境安装 Nginx 和PHP7.4 (只安装这两个即可)

图片[16]-EPUSDT插件支付收款教程-允梦网络

新建一个站点,在网站根目录下创建index.php以及tgproxy.php,复制对应文件代码粘贴并保存

index.php

<!DOCTYPE html>
<html>
<head>
<!-- UI from here: https://codepen.io/FlorinPop17/pen/dyPvNKK -->
<title>Telegram Bot API Proxy</title>
<link rel="icon" href="https://cdn.staticaly.com/gh/xiaowansm5/img@master/logo/telegram.3b3qa2l7qwg0.webp">
<style type="text/css">
@import url('https://fonts.googleapis.com/css?family=Muli&display=swap');


* {
box-sizing: border-box;
}


body {
background-image: linear-gradient(45deg, #7175da, #9790F2);
font-family: 'Muli', sans-serif;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
min-height: 100vh;
margin: 0;
}


.courses-container {


}


.course {
background-color: #fff;
border-radius: 10px;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.2);
display: flex;
max-width: 100%;
margin: 20px;
overflow: hidden;
width: 700px;
}


.course h6 {
opacity: 0.6;
margin: 0;
letter-spacing: 1px;
text-transform: uppercase;
}


.course h2 {
letter-spacing: 1px;
margin: 10px 0;
}


.course-preview {
background-color: #2A265F;
color: #fff;
padding: 30px;
max-width: 250px;
}


.course-preview a {
color: #fff;
display: inline-block;
font-size: 12px;
opacity: 0.6;
margin-top: 30px;
text-decoration: none;
}


.course-info {
padding: 30px;
position: relative;
width: 100%;
}


.progress-container {
position: absolute;
top: 30px;
right: 30px;
text-align: right;
width: 150px;
}


.progress {
background-color: #ddd;
border-radius: 3px;
height: 5px;
width: 100%;
}


.progress::after {
border-radius: 3px;
background-color: #2A265F;
content: '';
position: absolute;
top: 0;
left: 0;
height: 5px;
width: 66%;
}


.progress-text {
font-size: 10px;
opacity: 0.6;
letter-spacing: 1px;
}


.btn {
background-color: #2A265F;
border: 0;
border-radius: 50px;
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.2);
color: #fff;
font-size: 16px;
padding: 12px 25px;
position: absolute;
bottom: 15px;
right: 15px;
letter-spacing: 1px;
text-decoration: none;
}


#domain {
cursor: pointer;
}
</style>
</head>
<body>
<div class="courses-container">
<div class="course">
<div class="course-preview">
<h2>TelegramRC Bot</h2>
</div>
<div class="course-info">
<h2>Proxy for Telegram Bot API</h2>
<p>URI for using this proxy: <b id="domain" onclick="selectText(this)">https://<?php echo $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?></b></p>
<a class="btn" href="https://anlenotes.com" target="_blank">ANLENOTES</a>
</div>
</div>
</div>


<script type="text/javascript">
function selectText(node) {
if (document.body.createTextRange) {
const range = document.body.createTextRange();
range.moveToElementText(node);
range.select();
} else if (window.getSelection) {
const selection = window.getSelection();
const range = document.createRange();
range.selectNodeContents(node);
selection.removeAllRanges();
selection.addRange(range);
} else {
console.warn("Could not select text in node: Unsupported browser.");
}
}
</script>
</body>
</html>

tgproxy.php







<?php
/**
* Script retranslates queries to telegram bot API
*/
class TelegramApiProxy {
private $url;
private $ch;
private $log = false;


public function __construct(){
$this->getUrl();
$this->initCurl();
}


public function setLog(bool $log){
$this->log = $log;
}


private function log(string $m){
if(!$this->log) return;
file_put_contents('proxy.log', $m . PHP_EOL, FILE_APPEND);
}


public function start(){
$this->log('[' . date('Y-m-d H:i:s') . '] Query init. URL: ' . $this->url);
$this->sendRequest();


$response = curl_exec($this->ch);
$debug = curl_getinfo($this->ch);
$this->log('Response headers: code=' . $debug['http_code'] . '; content_type=' . $debug['content_type'] . '; size_upload=' . $debug['size_upload'] . '; size_download=' . $debug['size_upload'] . ';');
$this->log('Response body: ' . $response);
$this->log(' ');


$this->sendResponse($response, $debug['content_type'], $debug['http_code']);
}


private function sendResponse(string $response, string $type, int $code){
header('Content-type: ' . $type, $code);
die($response);
}


public function getUrl(){
$dir = dirname($_SERVER['SCRIPT_NAME']); // detect path to dir
if(strpos($_SERVER['REQUEST_URI'], $dir) === 0){
$uri = substr($_SERVER['REQUEST_URI'], strlen($dir));
} else {
$uri = $_SERVER['REQUEST_URI'];
}


if(substr($uri, 0, 1) != '/'){
$uri = '/' . $uri;
}


return $this->url = "https://api.telegram.org" . $uri;
}


private function initCurl(){
$this->ch = curl_init($this->url);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
return $this->ch;
}


private function sendRequest(){
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$this->log('HTTP Request: ' . $method);


if($method == 'POST'){
curl_setopt($this->ch, CURLOPT_POST, true);


if(sizeof($_FILES) > 0){
$post = [];
foreach ($_FILES as $name => $file) {
$post[$name] = new CURLFile($file['tmp_name'], $file['type'], $file['name']);
}


foreach ($_POST as $name => $value) {
$post[$name] = $value;
}


} else {
$post = file_get_contents('php://input');
$ct = $_SERVER['HTTP_CONTENT_TYPE'] ?? $_SERVER['CONTENT_TYPE'];
curl_setopt($this->ch, CURLOPT_HTTPHEADER, ['Content-type: ' . $ct]);
}


curl_setopt($this->ch, CURLOPT_POSTFIELDS, $post);
$this->log('Send data: ' . var_export($post, true));


} else {
curl_setopt($this->ch, CURLOPT_CUSTOMREQUEST, $method);
}
}
}


$proxy = new TelegramApiProxy;
$proxy->setLog(false); // use logs only for debug
$proxy->start();
?>

设置站点ssl,并开启强制https,设置伪静态

rewrite ^/bot.*$ /tgproxy.php last;

然后在这里填写您的站点域名即可 列如:

#telegram代理url(大陆地区服务器可使用一台国外服务器做反代tg的url),如果运行的本来就是境外服务器,则无需填写
tg_proxy=https://tgapi.mengdo.cn
© 版权声明
THE END
喜欢就支持一下吧
点赞24 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容