修改功能依赖

This commit is contained in:
root
2025-05-18 12:21:07 +00:00
parent 4a90c41da2
commit 2f1dd89060
7 changed files with 121 additions and 752 deletions
+10
View File
File diff suppressed because one or more lines are too long
+14 -585
View File
File diff suppressed because one or more lines are too long
+34 -152
View File
@@ -7,6 +7,7 @@ use think\facade\Cache;
use think\facade\Log;
use app\service\Telegram;
use app\model\Member;
use app\service\Customer;
class Premium
@@ -18,6 +19,8 @@ class Premium
private $token;
private $Member;
private $userinfo;
private $Customer;
public function __construct($data, $botid)
@@ -25,6 +28,7 @@ class Premium
$botinfo = Db::name("admin_bot")->where("botid", $botid)->find();
$this->data = $data;
$this->bots = $botinfo;
$this->Customer=new Customer();
$this->times = date('Y-m-d H:i:s');
$this->token = base64_encode($botinfo['botkey']);
$this->telegram = new Telegram($botinfo['botkey']);
@@ -467,10 +471,13 @@ TG ID <code>{$from['id']}</code>
//价格
if ($message == "价格") {
$array = explode(",", $this->bots['pricelist']);
$array = explode(",", $this->bots['pricexiao']);
if (count($array) != 3) {
$this->telegram->sendMessage($from['id'], "管理员价格配置错误了");
} else {
$t1 = $array[0];
$t2 = $array[1];
$t3 = $array[2];
@@ -537,7 +544,7 @@ TG ID <code>{$from['id']}</code>
//正常购买
//如果有设定价格 则 使用设定价格
$array = explode(",", $this->bots['pricelist']);
$array = explode(",", $this->bots['pricexiao']);
if (count($array) != 3) {
$this->telegram->sendMessage($from['id'], "管理员价格配置错误了");
} else {
@@ -631,7 +638,7 @@ TG ID <code>{$from['id']}</code>
//如果有设定价格 则 使用设定价格
$array = explode(",", $this->bots['pricelist']);
$array = explode(",", $this->bots['pricexiao']);
$t1 = $array[0];
$t2 = $array[1];
$t3 = $array[2];
@@ -911,7 +918,7 @@ TG ID <code>{$from['id']}</code>
// $this->telegram->answerCallback($callback_id, $type, true);
if ($type == "price") {
$array = explode(",", $this->bots['pricelist']);
$array = explode(",", $this->bots['pricexiao']);
$t1 = isset($array[0]) ? $array[0] : "15";
$t2 = isset($array[1]) ? $array[1] : "20";
$t3 = isset($array[2]) ? $array[2] : "35";
@@ -1158,7 +1165,7 @@ TG ID <code>{$from['id']}</code>
}
if ($type == "paymoney") {
$systemadd = Db::name("conf")->where("key", 'system')->value('value');
$res = CreateQRcode($systemadd, "大于5u"); //$trxadd,$money
$res = $this->Customer->CreateQRcode($systemadd, "大于5u"); //$trxadd,$money
//var_dump($res);
// $this->telegram->sendMessage($chat['id'], json_encode($res));
$isid = $this->telegram->sendDocumentphoto($chat['id'], $res, "地址:<code>{$systemadd}</code>" . "\r\n" . "系统地址大于5u 转账多少 上分多少");
@@ -1280,7 +1287,7 @@ TG ID <code>{$from['id']}</code>
//订单成功处理
if ($orderinfo['moth'] == 'yuepay') {
//余额充值 调用增加余额
$req = ChangeMoney($orderinfo['userid'], 'member', "+", $orderinfo['money'], $orderinfo['botid'], "充值");
$req = $this->Customer->ChangeMoney($orderinfo['userid'], 'member', "+", $orderinfo['money'], $orderinfo['botid'], "充值");
}
@@ -1326,7 +1333,7 @@ TG ID <code>{$from['id']}</code>
if ($tou == "adminprice") {
$type = $callbackExplode['1'];
$money = isset($callbackExplode['2']) ? (float)$callbackExplode['2'] : 0;
$array = explode(",", $this->bots['pricelist']);
$array = explode(",", $this->bots['pricexiao']);
if ($type == 3) {
$n = 0;
}
@@ -1419,7 +1426,7 @@ TG ID <code>{$from['id']}</code>
//更新到配置 更具n 生成数据
$array[$n] = $newprice;
$str = implode(',', $array);
Db::name("admin_bot")->where("botid", $this->bots['botid'])->update(['pricelist' => $str]);
Db::name("admin_bot")->where("botid", $this->bots['botid'])->update(['pricexiao' => $str]);
$this->telegram->editMessage($chat['id'], $message_id, $msg, $button);
}
}
@@ -1722,22 +1729,10 @@ TG ID <code>{$from['id']}</code>
} else {
//查询订单 并要支付 更新统一的支付方式
$array = explode(",", $this->bots['pricelist']);
if ($yue == 3) {
$n = 0;
}
if ($yue == 6) {
$n = 1;
}
if ($yue == 12) {
$n = 2;
}
$t1 = $array[$n];
$lirun = number_format($money - $t1, 2);
Db::name('order')->insert(['userid' => $callback_from['id'], 'money' => $money, 'paymoney' => $paymoney, 'username' => $usernamr, 'create_time' => time(), "trxadd" => $this->bots['trxadd'], "botid" => $this->bots['botid'], "nichen" => $nichengyi, "name" => "会员购买" . $usernamr, 'tancan' => $yue, 'start' => 0, 'order_no' => $order_no, 'end_time' => $jzsh, 'smessage_id' => $message_id, "mode" => "Daikaihuiyuan", "moth" => "huiyuangoumaai", 'lirun' => $lirun]);
$pricelist= $this->Customer->Get_shoujia($this->bots,$yue);
$lirun = $pricelist['botlirun'];
Db::name('order')->insert(['userid' => $callback_from['id'], 'money' => $money, 'paymoney' => $paymoney, 'username' => $usernamr, 'create_time' => time(), "trxadd" => $this->bots['trxadd'], "botid" => $this->bots['botid'], "nichen" => $nichengyi, "name" => "会员购买" . $usernamr, 'tancan' => $yue, 'start' => 0, 'order_no' => $order_no, 'end_time' => $jzsh, 'smessage_id' => $message_id, "mode" => "Daikaihuiyuan", "moth" => "huiyuangoumaai", 'lirun' => $lirun, 'slirun' => $pricelist['ptlirun']]);
$user = Db::name('order')->where("order_no", $order_no)->find();
$xzssss = date("m-d H:i:s");
@@ -1871,15 +1866,17 @@ TG ID <code>{$from['id']}</code>
$cycleMap = ['3' => '0', '6' => '1', '12' => '2'];
$mappedValue = $cycleMap[$odder['tancan']] ?? '3';
$req = ChangeMoney($odder['userid'], 'member', "-", $odder['money'], $odder['botid'], "消费" . $odder['username']);
$req = $this->Customer->ChangeMoney($odder['userid'], 'member', "-", $odder['money'], $odder['botid'], "消费" . $odder['username']);
if ($req['code'] == true) {
$reqx = submitkt($tmuid, $tmkey,$this->bots['botid'],$odder['money'], $odder['username'], $mappedValue, $this->bots['apiurl']);
$reqx = $this->Customer->submitkt($tmuid, $tmkey,$this->bots['botid'],$odder['money'], $odder['username'], $mappedValue, $this->bots['apiurl']);
//var_dump($reqx);
if ($reqx['code'] == 0) {
Db::name('order')->where("order_no", $order_no)->update(['start' => 1]);
$this->telegram->sendMessage($this->bots['botad'], $reqx['msg'] . "\r\n" . "单号:<code>" . $order_no . "</code>" . "\r\n" . "用户名:<code>" . $odder['username'] . "</code>" . "\r\n" . "开通时间:<code>" . $odder['tancan'] . "</code>" . "\r\n" . "消费金额:<code>" . $odder['money'] . "</code>" . "\r\n" . "处理方法:充值余额后手动提交给机器人代替客户开通");
//return true;
$this->telegram->sendMessage($odder['userid'], "订单提交成功!请联系客服,尽快处理!单号:<code>" . $order_no . "</code>");
@@ -1899,13 +1896,13 @@ TG ID <code>{$from['id']}</code>
$tmkey = Db::name("conf")->where("key", 'tmkey')->value('value');
$cycleMap = ['3' => '0', '6' => '1', '12' => '2'];
$mappedValue = $cycleMap[$odder['tancan']] ?? '3';
$req = ChangeMoney($odder['userid'], 'member', "-", $odder['money'], $odder['botid'], "消费" . $odder['username']);
$req = $this->Customer->ChangeMoney($odder['userid'], 'member', "-", $odder['money'], $odder['botid'], "消费" . $odder['username']);
cache::set($odder['moth'].$order_no,$odder['userid'],5);
if ($req['code'] == true) {
$dakai = json_decode($odder['username'], true);
foreach ($dakai as $key => $value) {
$reqx = submitkt($tmuid, $tmkey,$this->bots['botid'],$odder['danprice'], "@" . $value, $mappedValue, $this->bots['apiurl']);
$reqx = $this->Customer->submitkt($tmuid, $tmkey,$this->bots['botid'],$odder['danprice'], "@" . $value, $mappedValue, $this->bots['apiurl']);
if ($reqx['code'] == 0) {
$this->telegram->sendMessage($this->bots['botad'], $reqx['msg'] . "\r\n" . "单号:<code>" . $order_no . "</code>" . "\r\n" . "用户名:<code>" . $odder['username'] . "</code>" . "\r\n" . "开通时间:<code>" . $odder['tancan'] . "</code>" . "\r\n" . "消费金额:<code>" . $odder['money'] . "</code>" . "\r\n" . "处理方法:充值余额后手动提交给机器人代替客户开通");
//return true;
@@ -2049,7 +2046,7 @@ TG ID <code>{$from['id']}</code>
$this->telegram->editMessageCaption($chat['id'], $message_id, null, $msg);
$this->telegram->editMessageReplyMarkup($chat['id'], $message_id, null, $button);
//创建支付图片
$res = CreateQRcode($odder['trxadd'], $odder['paymoney']); //$trxadd,$money
$res = $this->Customer->CreateQRcode($odder['trxadd'], $odder['paymoney']); //$trxadd,$money
//var_dump($res);
// $this->telegram->sendMessage($chat['id'], json_encode($res));
$isid = $this->telegram->sendDocumentphoto($chat['id'], $res, "订单号:{$order_no}
@@ -2098,127 +2095,7 @@ TG ID <code>{$from['id']}</code>
}
$this->telegram->answerCallback($callback_id, "订单支付超时!", true);
}
} elseif ($moth == "admin") {
//$user= $this->db->select ('order',"*",['order_no' => $order_no]);
$odder = Db::name('order')->where("order_no", $order_no)->find();
// var_dump($odder);
if ($this->bots['botad'] == $callback_from['id']) {
Db::name('order')->where(['order_no' => $order_no])->update(['start' => 1, "remakess" => "管理员手动"]);
if ($odder['moth'] == "huiyuangoumaai") {
$this->userpay($odder['userid'], $odder['tancan'], 0, $odder['username'], $order_no);
}
if ($odder['moth'] == 'pkaihuiy') {
$dakai = json_decode($odder['username'], true);
foreach ($dakai as $key => $value) {
// code...
$this->userpay($odder['userid'], $odder['tancan'], $odder['danprice'], "@" . $value, $order_no . "_" . $key);
}
}
if ($odder['moth'] == "PurchaseEnergy") {
$url = "https://open.et15.com/api/telegram/submit";
$orderid = $odder['order_no'];
$timee = time();
$umoney = (int) $odder['bishu'] * 5 / 10;
$submit = ['uid' => $this->bots['chuhaid'], 'name' => "购买笔数" . $odder['bishu'], "bishu" => $odder['bishu'], "orderid" => $orderid, "umoney" => $umoney, "time" => $timee]; //name,orderid,umoney
//签名uid,name,orderid,umoney,time,bishu
$sign = md5($submit['uid'] . $submit['name'] . $submit['orderid'] . $submit['umoney'] . $submit['time'] . $submit['bishu'] . $this->bots['chuhaikey']);
$submit['sign'] = $sign;
$hui = $this->Custom->posturl($url, $submit);
if ($hui['code'] == 1) {
Db::name('daikaihuiyuan_user_money')->where(['userid' => $odder['userid'], "botid" => $odder['botid']])->inc('bishu', $odder['bishu'])->update();
$this->telegram->sendMessage($odder['userid'], "收到您的" . $odder['paymoney'] . "能量【" . $odder['bishu'] . "】已经到账");
} else {
$this->telegram->sendMessage($this->bots['botad'], "有新的订单 需要你 处理哟!由于提交平台出错[" . $hui['msg'] . "] 需要您手动处理");
}
}
if ($odder['moth'] == "xinixingoumaai") { //星星购买 余额支付
$url = "https://open.et15.com/api/daikai/submitstart";
$orderid = $odder['order_no'];
$timee = time();
$submit = ['uid' => $this->bots['chuhaid'], 'username' => $odder['username'], "number" => $odder['tancan'], "orderid" => $orderid]; //name,orderid,umoney
//签名uid,name,orderid,umoney,time,bishu
$sign = md5($submit['uid'] . $odder['username'] . $submit['orderid'] . $submit['number'] . $this->bots['chuhaikey']);
$submit['sign'] = $sign;
$hui = $this->Custom->posturl($url, $submit);
// var_dump($hui);
if ($hui['code'] == 1) {
$this->Custom->Amountlog($odder['userid'], $this->bots['botid'], "-", $odder['money'], "星星消费[余额]" . "" . $odder['money'] . "", 1);
$this->telegram->sendMessage($odder['userid'], "您的" . $odder['username'] . "购买的【" . $odder['tancan'] . "】已经到账 正在处理请 请稍后。。。");
// 开始处理 分账 问题
if (!empty($this->bots["yqoqingxiadanfeli"])) {
/* if ($this->bots["yqoqingxiadanfeli"] == 1) {
$chenben = $this->Custom->GetCost("PurchaseEnergy");
if (!empty($chenben)) {
$felimoney = $odder['money'] - $chenben[$odder['bishu']];
if ($felimoney > 0) {
// $this->telegram->sendMessage($odder['userid'], "运行到这里了".$felimoney."===".$uid);
$this->Custom->Settlementrebate($odder['userid'], $this->bots['botid'], $felimoney, $this->telegram, "能量分成[" . $orderid . "]");
}
}
} */
}
} else {
$this->telegram->sendMessage($this->bots['botad'], "有新的订单 需要你 处理哟!由于提交平台出错[" . $hui['msg'] . "] 需要您手动处理" . $odder['username'] . " 购买星星" . $odder['tancan']);
}
}
if ($odder['moth'] == "nengliangpay") {
//提交上端
$orderid = $odder['order_no'];
$url = "https://open.et15.com/api/telegram/energytuoguanzhouqi";
$timee = time();
//$address="TSCBYxKnLbLGPkcjZddWB4b64ymTdpcyY3";
$lirun = (100 - $this->bots['tuoguanenergylirun']) / 100;
$money = number_format($odder['paymoney'] * $lirun, 2);;
//uid,address,time,orderid,money
$sign = md5($this->bots['chuhaid'] . $odder['useradd'] . $timee . $orderid . $money . $this->bots['chuhaikey']);
// = "uid=" . "63" . "&address=" . $address . "&time=" . $timee . "&orderid=" . $orderid . "&money=" . $money . "&sign=" . $sign . "&utype=u";
$submit = ['uid' => $this->bots['chuhaid'], 'money' => $money, 'address' => $odder['useradd'], "time" => $timee, "orderid" => $orderid, "sign" => $sign, 'utype' => 'u']; //name,orderid,umoney
// $this->telegram->sendMessage($odder['userid'], http_build_query($submit));
$hui = $this->Custom->posturl($url, $submit);
// $this->telegram->sendMessage($odder['userid'], json_encode($hui));
if ($hui['code'] == 1) {
$bendimoney = $hui['data']['price'] * (100 + $this->bots['tuoguanenergylirun']) / 100;
Db::name('daikaihuiyuan_user_address')->where(['userid' => $odder['userid'], "botid" => $odder['botid']])->inc('money', $bendimoney)->update();
$this->telegram->sendMessage($odder['userid'], "收到您的" . $odder['paymoney'] . "能量余额【" . $bendimoney . "】已经到账");
} else {
$this->telegram->sendMessage($this->bots['botad'], "有新的订单 需要你 处理哟!由于提交平台出错[" . $hui['msg'] . "] 需要您手动处理");
}
}
$this->telegram->deleteMessage($chat['id'], $message_id);
$this->telegram->answerCallback($callback_id, "已经提交了", true);
} else {
$this->telegram->answerCallback($callback_id, "没你啥事儿啊", true);
// return true;
}
//如果余额 够 直接
// $user= $this->db->select('user_money',"*",['userid' =>$odder['userid']]);
return true;
} elseif ($moth == "payue") {
} elseif ($moth == "payue") {
// $user= $this->db->select ('order',"*",['order_no' => $order_no]);
@@ -2303,7 +2180,7 @@ TG ID <code>{$from['id']}</code>
//$this->telegram->editMessageCaption($chat['id'],$callback_id,null,$msg);
$this->telegram->editMessage($chat['id'], $message_id, $msg, $button, 'HTML', true);
$res = CreateQRcode($odder['trxadd'], $odder['paymoney']);
$res = $this->Customer->CreateQRcode($odder['trxadd'], $odder['paymoney']);
$isid = $this->telegram->sendDocumentphoto($chat['id'], $res, "订单号:{$order_no}
商品名称:<strong>{$odder['name']}</strong>
支付方式:USDT-TRC20
@@ -2599,7 +2476,12 @@ TG ID <code>{$from['id']}</code>
$this->telegram->editMessageMedia($chat['id'], $message_id, NULL, json_encode($media), $button);
} else {
Db::name('order')->insert(['userid' => $callback_from['id'], 'money' => $zmoney, 'paymoney' => $paymoney, 'username' => json_encode($usernames), 'create_time' => time(), "trxadd" => $this->bots['trxadd'], "botid" => $this->bots['botid'], "nichen" => "批量开通" . count($usernames) . "个会员", "name" => "批量购买会员" . count($usernames) . "个会员", 'tancan' => $yue, 'start' => 0, 'order_no' => $order_no, 'end_time' => $jzsh, 'smessage_id' => $message_id, "mode" => "Daikaihuiyuan", "moth" => "pkaihuiy", 'danprice' => $money]);
$pricelist= $this->Customer->Get_shoujia($this->bots,$yue);
$lirun = $pricelist['botlirun']*count($usernames);
$slirun= $pricelist['ptlirun']*count($usernames);
Db::name('order')->insert(['userid' => $callback_from['id'], 'money' => $zmoney, 'paymoney' => $paymoney, 'username' => json_encode($usernames), 'create_time' => time(), "trxadd" => $this->bots['trxadd'], "botid" => $this->bots['botid'], "nichen" => "批量开通" . count($usernames) . "个会员", "name" => "批量购买会员" . count($usernames) . "个会员", 'tancan' => $yue, 'start' => 0, 'order_no' => $order_no, 'end_time' => $jzsh, 'smessage_id' => $message_id, "mode" => "Daikaihuiyuan", "moth" => "pkaihuiy", 'danprice' => $money, 'lirun' => $lirun, 'slirun' => $slirun]);
if ($lsdingdan > 1) {
//不在监听 减少资源浪费
} else {