修复多个问题 + 更新部署配置
## 修复 1. 我的页面:简化头像/昵称UI布局 2. 提现API:增加容错处理,自动创建表 3. 找伙伴:放宽匹配条件,匹配所有注册用户 ## 部署 1. 更新.cursorrules为小型宝塔配置 2. 服务器IP: 42.194.232.22
This commit is contained in:
@@ -19,24 +19,21 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
// 从数据库查询其他用户(排除自己)
|
||||
// 筛选条件:有头像、有昵称、有微信号或手机号
|
||||
// 宽松条件:只要是注册用户就可以匹配
|
||||
const users = await query(`
|
||||
SELECT
|
||||
id,
|
||||
nickname,
|
||||
avatar,
|
||||
wechat as wechatId,
|
||||
wechat_id,
|
||||
phone,
|
||||
introduction,
|
||||
created_at
|
||||
FROM users
|
||||
WHERE id != ?
|
||||
AND nickname IS NOT NULL
|
||||
AND nickname != ''
|
||||
AND (wechat IS NOT NULL OR phone IS NOT NULL)
|
||||
AND (avatar IS NOT NULL AND avatar != '')
|
||||
ORDER BY RAND()
|
||||
LIMIT 10
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 20
|
||||
`, [userId]) as any[]
|
||||
|
||||
if (!users || users.length === 0) {
|
||||
@@ -51,14 +48,15 @@ export async function POST(request: NextRequest) {
|
||||
const randomUser = users[Math.floor(Math.random() * users.length)]
|
||||
|
||||
// 构建匹配结果
|
||||
const wechat = randomUser.wechatId || randomUser.wechat_id || ''
|
||||
const matchResult = {
|
||||
id: randomUser.id,
|
||||
nickname: randomUser.nickname || '创业者',
|
||||
avatar: randomUser.avatar || 'https://picsum.photos/200/200?random=' + Date.now(),
|
||||
wechat: randomUser.wechatId || '',
|
||||
nickname: randomUser.nickname || '微信用户',
|
||||
avatar: randomUser.avatar || '',
|
||||
wechat: wechat,
|
||||
phone: randomUser.phone ? randomUser.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : '',
|
||||
introduction: randomUser.introduction || '来自Soul创业派对的伙伴',
|
||||
tags: ['创业者', '私域运营', matchType === 'partner' ? '创业合伙' :
|
||||
tags: ['创业者', matchType === 'partner' ? '找伙伴' :
|
||||
matchType === 'investor' ? '资源对接' :
|
||||
matchType === 'mentor' ? '导师顾问' : '团队招募'],
|
||||
matchScore: Math.floor(Math.random() * 20) + 80,
|
||||
|
||||
Reference in New Issue
Block a user