's'
This commit is contained in:
@@ -37,7 +37,7 @@ export async function POST(request: NextRequest) {
|
||||
const xiaohongshuUrl = String(formData.xiaohongshu_url || "").trim();
|
||||
const xiaohongshuAvatarUrl = String(formData.xiaohongshu_avatar_url || formData.media || "").trim();
|
||||
const gender = String(formData.gender || "").trim() || "\u65e0";
|
||||
let intro = String(formData.intro || "").trim();
|
||||
let intro = String(formData.intro || formData.reason || "").trim();
|
||||
const firstTime = String(formData.first_time || "").trim();
|
||||
const agreeRules = !!formData.agree_rules;
|
||||
const status = String(formData.status || "").trim();
|
||||
@@ -61,6 +61,24 @@ export async function POST(request: NextRequest) {
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
if (!xiaohongshuUrl) {
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "请填写小红书主页链接或笔记链接" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
if (!intro) {
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "请填写自我介绍" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
if (intro.length < 20) {
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "自我介绍不少于20字" },
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
const userId = getUserIdFromCookie(request) || generateAnonId();
|
||||
|
||||
@@ -68,6 +86,7 @@ export async function POST(request: NextRequest) {
|
||||
/** occupation: 职业/城市,reason: 仅自我介绍 */
|
||||
const occupationValue = profession || city;
|
||||
|
||||
const userInfo = String(formData.userInfo || "").trim();
|
||||
const record: Record<string, unknown> = {
|
||||
user_id: userId,
|
||||
nickname,
|
||||
@@ -87,6 +106,7 @@ export async function POST(request: NextRequest) {
|
||||
first_time: firstTime,
|
||||
is_volunteer: isVolunteer,
|
||||
qualify,
|
||||
userInfo: userInfo || "",
|
||||
};
|
||||
if (phone.trim()) {
|
||||
record.phone = phone.trim();
|
||||
@@ -177,6 +197,7 @@ async function tryPocketBaseDirect(
|
||||
is_approved: qualify,
|
||||
age_range: record.age_range ?? "",
|
||||
first_time: record.first_time ?? "",
|
||||
userInfo: record.userInfo ?? "",
|
||||
};
|
||||
if (record.phone != null && String(record.phone).trim()) {
|
||||
body.phone = record.phone;
|
||||
|
||||
Reference in New Issue
Block a user