This commit is contained in:
2026-04-04 08:52:59 +08:00
parent 66bcd8061a
commit d98ac8f146
33 changed files with 2565 additions and 328 deletions
@@ -86,6 +86,7 @@ class AccountController extends Crud
$username = $request->post('username', '');
$this->removeLoginLimit($username);
$password = $request->post('password', '');
$code = $request->post('code', '');
if (!$username) {
return $this->fail('用户名不能为空');
}
@@ -94,26 +95,33 @@ class AccountController extends Crud
* @var Admin $admin
*/
$admin = Admin::where('username', $username)->find();
// if (!$admin || !Util::passwordVerify($password, $admin->password)) {
// return $this->fail('账户不存在或密码错误');
// }
//$secret = $admin['totp_secret'] ?:'EJGYB7OZR2W46XRX7VB3PXHSOY4LUAWCA5GTDAVTWKHXNDAAAIIP7AQ3JSO3XZJNX5J5OTIDEQVKLYFYIYNAXSCYF4GNZ2EMA4ORA3Y';
//\support\Log::alert($admin['totp_secret']);
$totp = \OTPHP\TOTP::create($admin->totp_secret);
//$secret = $totp->getSecret();
//$totp->setLabel('cansnow');
//$totp->setIssuer('DVPN');
//$qrCodeUri =$totp->getProvisioningUri();
//cp($secret);
//cp($qrCodeUri);
//cp('https://api.qrtool.cn/?text='.urlencode($qrCodeUri));
//cp($totp->at(time()));
if (!$totp->verify($request->post('code', ''))) {
return $this->fail('当前账户暂时无法登录1');
}
if ($admin->status != 1) {
return $this->fail('当前账户暂时无法登录');
}
if(!$code && !$password){
return $this->fail('请输入验证码或密码');
}
if($code){
//$secret = $admin['totp_secret'] ?:'EJGYB7OZR2W46XRX7VB3PXHSOY4LUAWCA5GTDAVTWKHXNDAAAIIP7AQ3JSO3XZJNX5J5OTIDEQVKLYFYIYNAXSCYF4GNZ2EMA4ORA3Y';
//\support\Log::alert($admin['totp_secret']);
$totp = \OTPHP\TOTP::create($admin->totp_secret);
//$secret = $totp->getSecret();
//$totp->setLabel('cansnow');
//$totp->setIssuer('DVPN');
//$qrCodeUri =$totp->getProvisioningUri();
//cp($secret);
//cp($qrCodeUri);
//cp('https://api.qrtool.cn/?text='.urlencode($qrCodeUri));
//cp($totp->at(time()));
if (!$totp->verify($code)) {
return $this->fail('动态密码错误');
}
}
if($password){
if (!$admin || !Util::passwordVerify($password, $admin->password)) {
return $this->fail('账户不存在或密码错误');
}
}
$admin->login_at = time();
$admin->save();
$this->removeLoginLimit($username);
+9 -16
View File
@@ -374,22 +374,15 @@ class Crud extends Base
}
}
}
$password_filed = 'password';
if (isset($data[$password_filed])) {
// 密码为空,则不更新密码
if ($data[$password_filed] === '') {
unset($data[$password_filed]);
} else {
$data[$password_filed] = Util::passwordHash(md5($data[$password_filed]));
}
}
$password_filed = 'trade_password';
if (isset($data[$password_filed])) {
// 密码为空,则不更新密码
if ($data[$password_filed] === '') {
unset($data[$password_filed]);
} else {
$data[$password_filed] = Util::passwordHash($data[$password_filed]);
$password_fileds = ['password','trade_password','empty_password'];
foreach($password_fileds as $password_filed){
if (isset($data[$password_filed])) {
// 密码为空,则不更新密码
if ($data[$password_filed] === '') {
unset($data[$password_filed]);
} else {
$data[$password_filed] = Util::passwordHash(md5($data[$password_filed]));
}
}
}
unset($data[$primary_key]);
+19 -32
View File
@@ -69,7 +69,6 @@ class IndexController extends Base
}
//$day7_user_recharge_sum = Recharge::where('status',2)->whereTime('created_at', '-7 days')->sum('amount');
// 总用户数
$user_count = \app\model\User::where('status',1)->count('id');
$recharge_total = 0;//\app\model\Recharge::where('status',\app\enum\RechargeStatus::COMPLETE->value)->sum('amount');
// mysql版本
$withdrawl_total = \app\model\Withdrawl::where('status',\app\enum\WithdrawlStatus::COMPLETE->value)->sum('recive_amount');
@@ -90,7 +89,6 @@ class IndexController extends Base
return view('index/dashboard', [
'today_user_recharge_sum' => formatAmount(cache('statistics_recharge_amount_'.date('Y-m-d')),0),
'day7_user_recharge_sum' => formatAmount($day7_user_recharge_sum,0),
'user_count' => $user_count,
//'recharge' => $recharge,
//'withdrawl' => $withdrawl,
'recharge_total' => formatAmount($recharge_total,0),
@@ -122,39 +120,28 @@ class IndexController extends Base
}
return $this->success('ok',$res);
}
function recharge_lines()
{
function lines_data(){
$days = Input('days',7);
$items = Input('items','');
$items = explode(',',$items);
$res = [];
for ($i=7; $i >= 0; $i--) {
for ($i=$days; $i >= 0; $i--) {
$date = date('Y-m-d',strtotime('-'.$i.' days'));
$res[$date] = [
'amount' => cache('statistics_recharge_amount_'.$date)?:0,
];
$item= [];
foreach($items as $k=>$v){
if($v == 'withdrawl'){
$item[$v] = cache('statistics_withdrawl_amount_'.$date)?:0;
}
if($v == 'recharge'){
$item[$v] = cache('statistics_recharge_amount_'.$date)?:0;
}
if($v == 'register'){
$item[$v] = cache('statistics_register_'.$date)?:0;
}
}
$res[$date] = $item;
}
return $this->success('ok',$res);
}
function withdrawl_lines()
{
$res = [];
for ($i=7; $i >= 0; $i--) {
$date = date('Y-m-d',strtotime('-'.$i.' days'));
$res[$date] = [
'amount' => cache('statistics_withdrawl_amount_'.$date)?:0,
];
}
return $this->success('ok',$res);
}
function money_lines()
{
$res = [];
for ($i=7; $i >= 0; $i--) {
$date = date('Y-m-d',strtotime('-'.$i.' days'));
$res[$date] = [
'withdrawl' => cache('statistics_withdrawl_amount_'.$date)?:0,
'recharge' => cache('statistics_recharge_amount_'.$date)?:0,
];
}
return $this->success('ok',$res);
return $this->success('ok'.$items,$res);
}
}
+1
View File
@@ -28,6 +28,7 @@ class Config implements MiddlewareInterface
$config['action'] = $request->action_name;
$config['moduleurl'] = admin_path();
$config['admin_path'] = admin_path();
$config['development'] = config('site.name') == '瞬聊Test';
$config['domain'] = env_get('server.domain','');
$request->_view_vars = array_merge((array) $request->_view_vars,[
'user' => session('admin'),
+17 -7
View File
@@ -54,18 +54,28 @@
<div class="login-header text-center">
<a href="javascript:;" style="font-size: 22px;display: flex;align-items: center;justify-content: center;"> <img alt="{$title}" src="{$logo}" width="32" class="m-r-5" />{$title}</a>
</div>
<ul class="nav nav-tabs nav-justified">
<li class="active"><a data-toggle="tab" href="#otop_login">OTOP登录</a></li>
<li class="nav-item"><a data-toggle="tab" href="#passowrd_login">密码登录</a></li>
</ul>
<form action="{:url('account/login')}" method="post" id="loginform" valid>
<div class="form-group has-feedback feedback-left">
<span class="mdi mdi-account form-control-feedback" aria-hidden="true"></span>
<input type="text" placeholder="请输入您的用户名" class="form-control" name="username" id="username" data-rule="required" data-msg="请输入您的用户名"/>
</div>
<!-- <div class="form-group has-feedback feedback-left">
<span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
<input type="password" placeholder="请输入密码" class="form-control" id="password" name="password" data-rule="required;password" />
</div> -->
<div class="form-group has-feedback feedback-left">
<span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
<input type="code" placeholder="请输入OTOP验证码" class="form-control" id="code" name="code" data-rule="required;length(4)" data-msg="请输入OTOP验证码" />
<div class="tab-content">
<div class="tab-pane fade active in" id="otop_login">
<div class="form-group has-feedback feedback-left">
<span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
<input type="code" placeholder="请输入OTOP验证码" class="form-control" id="code" name="code" data-rule="required(#otop_login.active);length(4)" data-msg="请输入OTOP验证码" />
</div>
</div>
<div class="tab-pane fade" id="passowrd_login">
<div class="form-group has-feedback feedback-left">
<span class="mdi mdi-lock form-control-feedback" aria-hidden="true"></span>
<input type="password" placeholder="请输入密码" class="form-control" id="password" name="password" data-rule="required(#passowrd_login.active);password" />
</div>
</div>
</div>
{if Config('site.admin_login_captcha')}
<div class="form-group has-feedback feedback-left row">
+26 -58
View File
@@ -19,8 +19,7 @@
<p class="h6 text-white m-t-0">7日内充值</p>
<p class="h3 text-white m-b-0 fa-1-5x"><?=$day7_user_recharge_sum?></p>
</div>
<div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i
class="mdi mdi-account fa-1-5x"></i></span> </div>
<div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-account fa-1-5x"></i></span> </div>
</div>
</div>
</div>
@@ -32,8 +31,7 @@
<p class="h6 text-white m-t-0">总充值</p>
<p class="h3 text-white m-b-0 fa-1-5x"><?=$recharge_total?></p>
</div>
<div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i
class="mdi mdi-arrow-down-bold fa-1-5x"></i></span> </div>
<div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-arrow-down-bold fa-1-5x"></i></span> </div>
</div>
</div>
</div>
@@ -45,8 +43,7 @@
<p class="h6 text-white m-t-0">总提现</p>
<p class="h3 text-white m-b-0 fa-1-5x"><?=$withdrawl_total?></p>
</div>
<div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i
class="mdi mdi-arrow-up-bold fa-1-5x"></i></span> </div>
<div class="pull-left"> <span class="img-avatar img-avatar-48 bg-translucent"><i class="mdi mdi-arrow-up-bold fa-1-5x"></i></span> </div>
</div>
</div>
</div>
@@ -90,28 +87,24 @@
</colgroup>
<tbody>
<tr>
<td>渠道商</td>
<td>
<?php
echo \app\model\User::where('group_id',1)->count('id');
?>
</td>
<td>用户总</td>
<td><?php echo \app\model\User::count('id');?></td>
</tr>
<tr>
<td>用户余额总和</td>
<td>{$user_money_total}</td>
<td>VIP用户数</td>
<td><?php echo \app\model\User::where('role_id',2)->count('id');?></td>
</tr>
<tr>
<td>SVIP1用户数</td>
<td><?php echo \app\model\User::where('role_id',3)->count('id');?></td>
</tr>
<tr>
<td>SVIP2用户数</td>
<td><?php echo \app\model\User::where('role_id',4)->count('id');?></td>
</tr>
<tr>
<td>用户积分总和</td>
<td>{$user_score_total}</td>
</tr>
<tr>
<td>调研币总和</td>
<td><?php echo \app\model\User::sum('currency1');?></td>
</tr>
<tr>
<td>待分配总和</td>
<td><?php echo \app\model\User::sum('currency7');?></td>
<td><?php echo \app\model\User::sum('score');?></td>
</tr>
</tbody>
</table>
@@ -132,49 +125,24 @@
</colgroup>
<tbody>
<tr>
<td>问卷成交个数</td>
<td>
<?php $system_question_total = cache('system_question_total');echo $system_question_total;?>
</td>
<td>操作系统</td>
<td>{$os}</td>
</tr>
<tr>
<td>预计支出泡沫</td>
<td>
<?php $system_question_cha_total = 0;echo $system_question_cha_total;?>
</td>
<td>workerman</td>
<td>{$workerman_version}</td>
</tr>
<tr>
<td>总沉淀金额</td>
<td>
<?php
$system_role_buy_amount_total = cache('system_role_buy_amount_total');
$system_role_buy_reward_total = cache('system_role_buy_reward_total');
$system_role_buy_residual_total = $system_role_buy_amount_total - $system_role_buy_reward_total;
echo $system_role_buy_residual_total;
?>
</td>
<td>webman</td>
<td>{$webman_version}</td>
</tr>
<tr>
<td>实际泡沫</td>
<td>
<?php
$cha = $system_question_cha_total - $system_role_buy_residual_total;
if($cha>0){
echo '<span class="text-danger">'.$cha.'</span>';
}else{
echo '<span class="text-success">'.$cha.'</span>';
}
?>
</td>
<td>php</td>
<td>{$php_version}</td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
</tr>
<tr>
<td>&nbsp;</td>
<td></td>
<td>MySQL</td>
<td>{$mysql_version}</td>
</tr>
</tbody>
</table>
+28 -68
View File
@@ -83,7 +83,11 @@ define(['lightyear','multitabs', '../libs/Chart','form','bootstrap'], function (
setTheme = function (input_name, data_name) {
$("input[name='" + input_name + "']").click(function () {
$('body').attr(data_name, $(this).val());
localStorage.setItem(data_name,$(this).val());
});
if(Config.development){
$('body').attr(data_name, localStorage.getItem(data_name) || 'color_8');
}
}
setTheme('logo_bg', 'data-logobg');
setTheme('header_bg', 'data-headerbg');
@@ -167,47 +171,7 @@ define(['lightyear','multitabs', '../libs/Chart','form','bootstrap'], function (
});
},
dashboard: function () {
// new Chart(
// document.getElementsByClassName('js-chartjs-bars'),
// {
// type: 'bar',
// data: {
// labels: recharge_labels,
// datasets: [
// {
// label: '充值统计',
// data: recharge_values,
// borderColor: '#358ed7',
// backgroundColor: 'rgba(53, 142, 215, 0.175)',
// borderWidth: 1,
// fill: false,
// lineTension: 0.5
// },
// ]
// }
// }
// );
// new Chart(
// document.getElementsByClassName('js-chartjs-lines'),
// {
// type: 'bar',//line
// data: {
// labels: withdrawl_labels,
// datasets: [
// {
// label: '提现统计',
// data: withdrawl_values,
// borderColor: '#358ed7',
// backgroundColor: 'rgba(53, 142, 215, 0.175)',
// borderWidth: 1,
// fill: false,
// lineTension: 0.5
// }
// ]
// }
// }
// );
$.getJSON('index/money_lines',function(res){
$.getJSON('index/lines_data?items=withdrawl,recharge&days=7',function(res){
res = res.data;
var labels=[];
var withdrawl_values=[];
@@ -248,17 +212,13 @@ define(['lightyear','multitabs', '../libs/Chart','form','bootstrap'], function (
}
);
});
$.getJSON('index/role_buy_lines',function(res){
$.getJSON('index/lines_data?items=register&days=7',function(res){
res = res.data;
var amount=[];
var reward=[];
var residual=[];
var register=[];
var labels=[];
for (let date in res) {
labels.push(date);
amount.push(res[date].amount);
reward.push(res[date].reward);
residual.push(res[date].residual);
register.push(res[date].register);
}
new Chart(document.getElementsByClassName('js-role_buy_lines'),{
type: 'line',
@@ -266,32 +226,32 @@ define(['lightyear','multitabs', '../libs/Chart','form','bootstrap'], function (
labels: labels,
datasets: [
{
label: '总购买金额',
data: amount,
label: '注册统计',
data: register,
borderColor: 'rgba(43, 191, 232, 0.7)',
backgroundColor: 'rgba(43, 191, 232, 0.7)',
borderWidth: 2,
fill: false,
lineTension: 0.5
},
{
label: '奖励统计',
data: reward,
borderColor: 'rgba(166, 53, 215, 0.7)',
backgroundColor: 'rgba(166, 53, 215, 0.7)',
borderWidth: 2,
fill: false,
lineTension: 0.5
},
{
label: '沉淀统计',
data: residual,
borderColor: 'rgba(59, 199, 8, 0.7)',
backgroundColor: 'rgba(59, 199, 8, 0.7)',
borderWidth: 2,
fill: false,
lineTension: 0.5
}
// {
// label: '奖励统计',
// data: reward,
// borderColor: 'rgba(166, 53, 215, 0.7)',
// backgroundColor: 'rgba(166, 53, 215, 0.7)',
// borderWidth: 2,
// fill: false,
// lineTension: 0.5
// },
// {
// label: '沉淀统计',
// data: residual,
// borderColor: 'rgba(59, 199, 8, 0.7)',
// backgroundColor: 'rgba(59, 199, 8, 0.7)',
// borderWidth: 2,
// fill: false,
// lineTension: 0.5
// }
]
}
});
+4 -2
View File
@@ -50,11 +50,13 @@ define(['table', 'upload','form','qrcode'], function (Table,Upload,Form) {
},
{
title: "用户名",
field: "username"
field: "username",
filter: "string"
},
{
title: "昵称",
field: "nickname"
field: "nickname",
filter: "string"
},
{
title: "头像",