This commit is contained in:
commie
2026-02-24 21:02:17 +08:00
parent 6586f27c9e
commit c9c8a120ab
12 changed files with 345 additions and 103 deletions
+2 -13
View File
@@ -720,27 +720,16 @@ if(!function_exists('generateShortUniqueID')){
}
if(!function_exists('get_user_rights')){
function get_user_rights($user_id):array{
// return [
// 'name' => 'VIP',
// 'max_send_msg_count' => 999999999999,
// 'max_friend_count' => 999999999999,
// 'max_group_join_count' => 999999999999,
// 'max_gourp_create_count' => 999999999999
// ];
$user_id = idDecode($user_id);
$key = 'user_rights_'.$user_id;
$result = cache($key);
if(!$result){
// log_alert(\think\facade\Db::name('user_role')->alias('ur')
// ->join('user u','ur.id = u.role_id')
// ->where('u.id',$user_id)
// ->field('ur.name,ur.max_send_msg_count,ur.max_friend_count,ur.max_group_join_count,ur.max_gourp_create_count')
// ->buildSql());
$result = \think\facade\Db::name('user_role')->alias('ur')
->join('user u','ur.id = u.role_id')
->where('u.id',$user_id)
->field('ur.name,ur.max_send_msg_count,ur.max_friend_count,ur.max_group_join_count,ur.max_gourp_create_count')
->field('ur.name,ur.right')
->find();
$result['right'] = json_decode($result['right'],true);
cache($key,$result,86400);
}
return $result;