This commit is contained in:
2026-03-25 02:48:30 +08:00
parent 8704434c36
commit 66bcd8061a
23 changed files with 1204 additions and 208 deletions
+37 -25
View File
@@ -179,7 +179,7 @@ if (!function_exists('captcha_verfiy')) {
$list = cache($cache_key);
$list = $list ?: [];
if (!isset($list[$code])) {
abort(__('Captcha is incorrect').$cache_key.$code);
abort(__('Captcha is incorrect'));
}
if ($list[$code] + $expris < time()) {
unset($list[$code]);
@@ -456,50 +456,62 @@ if (!function_exists('msectime')) {
if (!function_exists('cache_add')) {
function cache_add($key, $value=1, $tag = null)
{
if (substr($key, 0, 20) == 'user_recharge_total_') {
if (str_starts_with($key, 'user_recharge_total_')) {
$tag = 'recharge_total';
}
if (substr($key, 0, 20) == 'user_recharge_total_') {
$tag = 'recharge_total';
}
if (substr($key, 0, 17) == 'user_power_total_') {
$tag = 'user_power_total';
}
if (substr($key, 0, 18) == 'user_income_total_') {
if (str_starts_with($key, 'user_income_total_')) {
$tag = 'income_total';
}
if (substr($key, 0, 16) == 'user_play_count_') {
$tag = 'play_count';
}
if (substr($key, 0, 19) == 'user_consume_total_') {
if (str_starts_with($key, 'user_consume_total_')) {
$tag = 'consume_total';
}
if (substr($key, 0, 18) == 'team_member_total_') {
$tag = 'team_member_total';
if (str_starts_with($key, 'team_user_total_')) {
$tag = 'team_user_total';
}
if (substr($key, 0, 18) == 'team_direct_total_') {
if (str_starts_with($key, 'team_direct_total_')) {
$tag = 'team_direct_total';
}
if (substr($key, 0, 20) == 'team_recharge_total_') {
if (str_starts_with($key, 'team_vip_total_')) {
$tag = 'team_vip_total';
}
if (str_starts_with($key, 'team_recharge_total_')) {
$tag = 'team_recharge_total';
}
if (substr($key, 0, 21) == 'team_withdrawl_total_') {
if (str_starts_with($key, 'team_withdrawl_total_')) {
$tag = 'team_withdrawl_total';
}
if (substr($key, 0, 18) == 'team_income_total_') {
if (str_starts_with($key, 'team_income_total_')) {
$tag = 'team_income_total';
}
if (substr($key, 0, 16) == 'team_play_count_') {
$tag = 'team_play_count';
}
if (substr($key, 0, 19) == 'team_consume_total_') {
if (str_starts_with($key, 'team_consume_total_')) {
$tag = 'team_consume_total';
}
cache($key, (cache($key) ?? 0) + $value, null, $tag);
$old_value = cache_get($key);
cache($key,$old_value + $value, null, $tag);
}
}
if(!function_exists('cache_get')){
function cache_get(string $key,bool $force=false):mixed{
$ret= cache($key) ?: 0;
if(!$ret || $force){
if (str_starts_with($key, 'team_user_total_')) {
$user_id = substr($key,strlen('team_user_total_'));
$ret = \support\think\Db::name('user_extend')->where('user_id',$user_id)->column('team_total');
}else if (str_starts_with($key, 'team_direct_total_')) {
$user_id = substr($key,strlen('team_direct_total_'));
$ret = \support\think\Db::name('user_extend')->where('user_id',$user_id)->column('direct_total');
}else if (str_starts_with($key, 'team_vip_total_')) {
$user_id = substr($key,strlen('team_vip_total_'));
$ret = \support\think\Db::name('user_extend')->where('user_id',$user_id)->column('vip_total');
}
cache($key,$ret);
}
return $ret;
}
}
if (!function_exists('build_invite_code')) {
function build_invite_code($id = '')
{
@@ -660,4 +672,4 @@ if(!function_exists('__my__template_inputs')){
return [$template, $vars, $app, $plugin];
}
}
}