|
|
@ -644,6 +644,10 @@ User.init({ |
|
|
partnerstatus: { |
|
|
partnerstatus: { |
|
|
type: DataTypes.STRING(255) // 合作商状态
|
|
|
type: DataTypes.STRING(255) // 合作商状态
|
|
|
}, |
|
|
}, |
|
|
|
|
|
// 授权区域字段 - 用于存储用户位置信息
|
|
|
|
|
|
authorized_region: { |
|
|
|
|
|
type: DataTypes.TEXT // 存储用户位置信息的JSON字符串
|
|
|
|
|
|
}, |
|
|
reasonforfailure: { |
|
|
reasonforfailure: { |
|
|
type: DataTypes.TEXT // 审核失败原因
|
|
|
type: DataTypes.TEXT // 审核失败原因
|
|
|
}, |
|
|
}, |
|
|
@ -1188,12 +1192,17 @@ app.post('/api/user/upload', async (req, res) => { |
|
|
console.log('收到用户信息上传请求:', userData); |
|
|
console.log('收到用户信息上传请求:', userData); |
|
|
|
|
|
|
|
|
// 使用微信小程序拉取唯一电话号码的插件,不再需要检查手机号冲突
|
|
|
// 使用微信小程序拉取唯一电话号码的插件,不再需要检查手机号冲突
|
|
|
// 确保用户数据中包含手机号
|
|
|
// 检查用户是否已存在,如果是更新操作,不需要强制要求手机号
|
|
|
if (!userData.phoneNumber) { |
|
|
let existingUser = await User.findOne({ |
|
|
|
|
|
where: { openid: userData.openid } |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 只有在创建新用户时才强制要求手机号
|
|
|
|
|
|
if (!existingUser && !userData.phoneNumber) { |
|
|
return res.json({ |
|
|
return res.json({ |
|
|
success: false, |
|
|
success: false, |
|
|
code: 400, |
|
|
code: 400, |
|
|
message: '缺少手机号信息', |
|
|
message: '创建新用户时必须提供手机号信息', |
|
|
data: {} |
|
|
data: {} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
@ -1509,7 +1518,8 @@ app.post('/api/user/get', async (req, res) => { |
|
|
const user = await User.findOne({ |
|
|
const user = await User.findOne({ |
|
|
where: { openid }, |
|
|
where: { openid }, |
|
|
include: [ |
|
|
include: [ |
|
|
{ model: Contact, |
|
|
{ |
|
|
|
|
|
model: Contact, |
|
|
as: 'contacts', |
|
|
as: 'contacts', |
|
|
attributes: ['id', 'name', 'phoneNumber', 'wechat', 'account', 'accountNumber', 'bank', 'address'] |
|
|
attributes: ['id', 'name', 'phoneNumber', 'wechat', 'account', 'accountNumber', 'bank', 'address'] |
|
|
}, |
|
|
}, |
|
|
|