70 lines
2.4 KiB
PHP
Executable File
70 lines
2.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace app\controller;
|
|
use think\facade\Db;
|
|
use laytp\BaseController;
|
|
use think\facade\Cache;
|
|
|
|
class Index extends BaseController
|
|
{
|
|
public function index()
|
|
{
|
|
|
|
return redirect("/admin/index.html");
|
|
}
|
|
public function getnumber()
|
|
{
|
|
$uplist=Cache::get("getnumber");
|
|
if(empty($uplist)){
|
|
$url="http://git.zf789.life/kaifa/premium/graph";
|
|
$html= file_get_contents($url);
|
|
preg_match_all('/<span class="message tw-inline-block gt-ellipsis tw-mr-2">\s*<span>(.*?)<\/span>\s*<\/span>/', $html, $matches);
|
|
$uplist=array();
|
|
if ($matches[1]) {
|
|
$messages = $matches[1]; // Array of all matched messages
|
|
foreach ($messages as $message) {
|
|
$uplist[]=$message;
|
|
// var_dump($message);
|
|
// Process each message
|
|
}
|
|
}
|
|
|
|
Cache::set("getnumber",$uplist,1024);
|
|
}
|
|
|
|
//平台总用户
|
|
$ptzuser=Db::name("member")->count();
|
|
//平台托管机器人
|
|
$ptzbot=Db::name("admin_bot")->count();
|
|
//平台机器人总余额
|
|
$ptzbotmoney=Db::name("admin_bot")->sum('money');
|
|
//平台总利润
|
|
$ptlirun=Db::name("order")->sum('slirun');
|
|
//查询代充余额
|
|
$getbalance=$this->getbalance();
|
|
|
|
|
|
return $this->success('返回成功', ['uplist'=>$uplist,'ptzuser'=>$ptzuser,'ptzbot'=>$ptzbot,'ptzbotmoney'=>$ptzbotmoney,'ptlirun'=>$ptlirun,'getbalance'=>$getbalance]);
|
|
}
|
|
public function getbalance(){
|
|
$tmuid = Db::name("conf")->where("key", 'tmuid')->value('value');
|
|
$tmkey = Db::name("conf")->where("key", 'tmkey')->value('value');
|
|
$apiurl = "https://open.wfa.pw/api/sms/balance";
|
|
$sign = md5($tmuid .$tmkey);
|
|
$submit = array("uid" =>$tmuid, "sign" => $sign);
|
|
$hui =posturl($apiurl, $submit);
|
|
|
|
if ($hui['code'] == 1) {
|
|
// 提交出海平台成功
|
|
// $this->telegram->sendMessage($this->bots['botad'], "您的余额 还剩:" . $hui['data']['umoney'] . "U");
|
|
$umoney=isset($hui['data']['umoney'])?$hui['data']['umoney']:0;
|
|
|
|
return $umoney;
|
|
} else {
|
|
return 0;
|
|
}
|
|
|
|
|
|
}
|
|
}
|