Initial commit

This commit is contained in:
net909
2023-09-28 16:21:06 +08:00
parent 498772eb04
commit ba7be004c0
640 changed files with 87745 additions and 0 deletions
+94
View File
@@ -0,0 +1,94 @@
<?php
/**
* QQ等级查询
*/
namespace plugin\wqq\qqlevel;
use app\Plugin;
use Exception;
class App extends Plugin
{
public function index()
{
return $this->view();
}
public function query(){
$uin = input('post.uin', null, 'trim');
if(!$uin) return msg('error','no uin');
if(!is_numeric($uin) || strlen($uin)>11){
return msg('error', 'QQ号码格式不正确!');
}
$captcha_result = verify_captcha4();
if($captcha_result !== true){
return msg('error', '验证失败,请重新验证');
}
try{
$result = $this->queryapi($uin);
}catch(Exception $e){
return msg('error', $e->getMessage());
}
$msg['QQ号码'] = $uin;
$msg['QQ昵称'] = $result['sNickName'];
$msg['QQ等级'] = $result['iQQLevel'].'级';
$msg['等级图标'] = $this->Level($result['iQQLevel']);
$msg['注册时长'] = $result['iTotalActiveDay'].'天';
$msg['下次升级天数'] = $result['iNextLevelDay'].'天';
$msg['今日成长天数'] = $result['iRealDays'].'天';
$Time = @round((($result['iNoHideOnlineTime'] + $result['iPCQQOnlineTime']) / 60 / 60) , 2);
$msg['今日在线时长'] = $Time.'小时';
return msg('ok','success',$msg);
}
private function queryapi($uin){
//此处需填写QQAPI的接口地址(https://github.com/netcccyun/qqapi
$url = 'http://qqapiurl/api.php?act=getqqlevel';
$post = 'key=查询密钥&uin='.$uin;
$data = get_curl($url, $post);
$arr = json_decode($data, true);
if(isset($arr['code']) && $arr['code']==0){
return $arr['data'];
}elseif(isset($arr['msg'])){
throw new Exception($arr['msg']);
}else{
throw new Exception('接口请求失败');
}
}
private function Level($Level){
if($Level == 0){
return '☆';
}
$String = '';
$h = Intval($Level / 64);
$Level_h = Intval($Level - ($h * 64));
$t = Intval($Level_h / 16);
$Level_t = Intval($Level_h - ($t * 16));
$y = Intval($Level_t / 4);
$Level_y = Intval($Level_t - ($y * 4));
$x = Intval($Level_y);
$Level_t = Intval($Level_h - $x);
for($i = 0 ; $i < $h ; $i++){
$String .= '👑';
}
for($i = 0 ; $i < $t ; $i++){
$String .= '☀️';
}
for($i = 0 ; $i < $y ; $i++){
$String .= '🌙';
}
for($i = 0 ; $i < $x ; $i++){
$String .= '⭐';
}
return $String;
}
}
+117
View File
@@ -0,0 +1,117 @@
{extend name="common/plugin_layout" /}
{block name="title"}{$plugin.title} - {:config_get('title')}{/block}
{block name="main"}
<style>
td{text-align: center;}
</style>
<div class="container-xl" id="app">
<div class="col-sm-12 col-md-10 col-xl-8 center-block">
<div class="card card-preview">
<div class="card-inner mt-3">
<div class="nya-title nk-ibx-action-item progress-rating">
<span class="nk-menu-text font-weight-bold">QQ等级查询</span>
</div>
<div class="form-group">
<label class="form-label">QQ号码:</label>
<div class="form-control-wrap">
<input type="text" v-model="input" placeholder="请输入QQ号码" class="form-control form-control-lg" @keyup.enter="query" ref="input" autocomplete="off">
</div>
</div>
<button class="btn btn-dim btn-outline-primary btn-block card-link mb-3" @click="query" :disabled="query_disabled">
查询
</button>
</div>
</div>
<div class="card card-preview" v-show="showresult" style="display:none">
<div class="card-inner mt-3">
<div class="nya-title nk-ibx-action-item progress-rating">
<span class="nk-menu-text font-weight-bold">查询结果</span>
</div>
<div class="col-sm-12 col-md-10 col-xl-8 center-block">
<div class="table-responsive">
<table class="table table-hover table-bordered">
<tbody>
<tr v-for="(item,index) in result_info"><td class="query-title">{{index}}</td><td>{{item}}</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="script"}
<script src="{$cdn_cdnjs}vue/2.6.14/vue.min.js"></script>
<script src="https://static.geetest.com/v4/gt4.js"></script>
<script>
new Vue({
el: '#app',
data: {
query_disabled: true,
input: '',
result_input: '',
showresult: false,
result_info: [],
captcha: null
},
mounted() {
this.$refs.input.focus();
var that=this;
initGeetest4({
captchaId: "99b142aaece96330d0f3ffb565ffb3ef",
product: 'bind',
protocol: 'https://',
riskType: 'ai',
},function (captcha) {
captcha.onReady(function(){
that.query_disabled=false;
that.captcha = captcha;
}).onSuccess(function(){
var result = captcha.getValidate();
if (!result) {
layer.closeAll();
return alert('请先完成验证');
}
var data = { uin: that.input};
$.ajax({
url: '/api/{$plugin.alias}/query',
type: 'post',
dataType: 'json',
data: Object.assign(data, result),
cache: false,
success: function (data) {
layer.closeAll();
if(data.status=='ok'){
that.result_input = that.input;
that.showresult = true;
that.result_info = data.data;
captcha.reset();
}else{
layer.alert(data.message, {icon: 5});
captcha.reset();
}
},
error: function () {
layer.closeAll();
layer.msg('服务器错误', {icon: 5});
captcha.reset();
}
});
}).onError(function(){
alert('验证码加载失败,请刷新页面重试');
})
});
},
methods: {
query() {
if(this.input.trim() == ''){
alert('查询内容不能为空');return;
}
layer.load(0, {shade:0.1});
this.captcha.showCaptcha();
}
},
})
</script>
{/block}