// v34 兜底函数补齐 function day_stamp($ts = null) { if ($ts === null) $ts = time(); return (int)date('Ymd', (int)$ts); } function normalize_avatar($url) { if (!$url) return ''; // 微信头像:https://thirdwx.qlogo.cn/... → 保留 // wxfile:// / tmp/ 本地路径 → 拒绝 if (!preg_match('#^https?://[^\s]+\.(jpg|jpeg|png|gif|webp)(\?.*)?$#i', $url)) return ''; return $url; } function gen_invite_code() { $chars = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'; $code = ''; for ($i = 0; $i < 6; $i++) { $code .= $chars[random_int(0, strlen($chars) - 1)]; } return $code; }