Browse Source

Update nickName to name fields in frontend code

pull/1/head
Default User 3 months ago
parent
commit
6e89b2ef98
  1. 480
      page.html
  2. 16
      pages/buyer/index.js
  3. 2
      pages/buyer/index.wxml
  4. 4
      pages/create-supply/index.js
  5. 16
      pages/index/index.js
  6. 2
      pages/index/index.wxml
  7. 16
      pages/profile/index.js
  8. 2
      pages/publish/index.js
  9. 10
      pages/seller/index.js
  10. 2
      pages/seller/index.wxml
  11. 4
      pages/settlement/index.js
  12. 43
      server-example/server-mysql.js

480
page.html

File diff suppressed because one or more lines are too long

16
pages/buyer/index.js

@ -640,7 +640,7 @@ Page({
region: product.region || '', // 【新增】添加地区字段 region: product.region || '', // 【新增】添加地区字段
grossWeight: grossWeightValue, // 确保不为null grossWeight: grossWeightValue, // 确保不为null
displayGrossWeight: formatGrossWeight(grossWeightValue, product.weight), displayGrossWeight: formatGrossWeight(grossWeightValue, product.weight),
seller: product.seller && product.seller.nickName ? product.seller.nickName : '未知卖家', seller: product.seller && (product.seller.name || product.seller.nickName) ? (product.seller.name || product.seller.nickName) : '未知卖家',
status: product.status || 'published', status: product.status || 'published',
imageUrls: product.imageUrls || [], imageUrls: product.imageUrls || [],
reservedCount: reservedCount, reservedCount: reservedCount,
@ -838,7 +838,7 @@ Page({
region: product.region || '', // 【新增】添加地区字段 region: product.region || '', // 【新增】添加地区字段
grossWeight: grossWeightValue, grossWeight: grossWeightValue,
displayGrossWeight: formatGrossWeight(grossWeightValue, product.weight), displayGrossWeight: formatGrossWeight(grossWeightValue, product.weight),
seller: product.seller && product.seller.nickName ? product.seller.nickName : '未知卖家', seller: product.seller && (product.seller.name || product.seller.nickName) ? (product.seller.name || product.seller.nickName) : '未知卖家',
status: product.status || 'published', status: product.status || 'published',
imageUrls: product.imageUrls || [], imageUrls: product.imageUrls || [],
createdAt: product.created_at || product.createTime || null, createdAt: product.created_at || product.createTime || null,
@ -1517,7 +1517,7 @@ Page({
const userInfo = { const userInfo = {
userId: res.data.id, userId: res.data.id,
openid: openid, openid: openid,
nickname: res.data.nickname || '', name: res.data.name || res.data.nickname || '',
avatarUrl: res.data.avatar || '', avatarUrl: res.data.avatar || '',
type: res.data.type type: res.data.type
}; };
@ -1618,9 +1618,9 @@ Page({
// 获取用户名 // 获取用户名
getUserName: function (e) { getUserName: function (e) {
console.log('获取用户名:', e); console.log('获取用户名:', e);
const { nickname } = e.detail.value; const { name } = e.detail.value;
if (!nickname || nickname.trim() === '') { if (!name || name.trim() === '') {
wx.showToast({ wx.showToast({
title: '昵称不能为空', title: '昵称不能为空',
icon: 'none' icon: 'none'
@ -1629,7 +1629,7 @@ Page({
} }
const userInfo = { const userInfo = {
nickname: nickname.trim(), name: name.trim(),
avatarUrl: this.data.avatarUrl avatarUrl: this.data.avatarUrl
}; };
@ -1727,7 +1727,7 @@ Page({
const userInfo = { const userInfo = {
openid: res.data.openid, openid: res.data.openid,
userId: res.data.userId, userId: res.data.userId,
nickname: userProfile.userInfo.nickName, name: userProfile.userInfo.name || userProfile.userInfo.nickName,
avatarUrl: userProfile.userInfo.avatarUrl, avatarUrl: userProfile.userInfo.avatarUrl,
type: this.data.pendingUserType type: this.data.pendingUserType
}; };
@ -1767,7 +1767,7 @@ Page({
const userInfo = { const userInfo = {
openid: res.data.openid, openid: res.data.openid,
userId: res.data.userId, userId: res.data.userId,
nickname: '微信用户', name: '微信用户',
avatarUrl: '/images/default-avatar.png', avatarUrl: '/images/default-avatar.png',
type: this.data.pendingUserType type: this.data.pendingUserType
}; };

2
pages/buyer/index.wxml

@ -173,7 +173,7 @@
<!-- 昵称输入 --> <!-- 昵称输入 -->
<form bindsubmit="getUserName"> <form bindsubmit="getUserName">
<view class="form-group" style="margin-bottom: 30rpx;"> <view class="form-group" style="margin-bottom: 30rpx;">
<input placeholder="请输入昵称" type="nickname" name="nickname" maxlength="32" class="form-input" style="width: 100%; padding: 20rpx; border: 1rpx solid #ddd; border-radius: 8rpx; box-sizing: border-box;" /> <input placeholder="请输入昵称" type="nickname" name="name" maxlength="32" class="form-input" style="width: 100%; padding: 20rpx; border: 1rpx solid #ddd; border-radius: 8rpx; box-sizing: border-box;" />
</view> </view>
<!-- 提交按钮 --> <!-- 提交按钮 -->

4
pages/create-supply/index.js

@ -240,8 +240,8 @@ Page({
// 获取卖家信息 // 获取卖家信息
const users = wx.getStorageSync('users') || {}; const users = wx.getStorageSync('users') || {};
const sellerName = users[userId] && users[userId].info && users[userId].info.nickName const sellerName = users[userId] && users[userId].info && (users[userId].info.name || users[userId].info.nickName)
? users[userId].info.nickName ? (users[userId].info.name || users[userId].info.nickName)
: '未知卖家'; : '未知卖家';
// 获取当前已有的货源列表 // 获取当前已有的货源列表

16
pages/index/index.js

@ -5,7 +5,7 @@ Page({
currentUserType: null, currentUserType: null,
showUserInfoForm: false, showUserInfoForm: false,
avatarUrl: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0', avatarUrl: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0',
nickname: '', name: '',
showAuthModal: false, showAuthModal: false,
showOneKeyLoginModal: false, showOneKeyLoginModal: false,
// 测试模式开关,用于在未完成微信认证时进行测试 // 测试模式开关,用于在未完成微信认证时进行测试
@ -295,7 +295,7 @@ Page({
// 6. 创建用户信息 // 6. 创建用户信息
const tempUserInfo = { const tempUserInfo = {
nickName: userProfile ? userProfile.userInfo.nickName : '微信用户', name: userProfile ? (userProfile.userInfo.name || userProfile.userInfo.nickName) : '微信用户',
// 获取微信头像失败时使用微信默认头像,而不是本地头像 // 获取微信头像失败时使用微信默认头像,而不是本地头像
avatarUrl: userProfile ? userProfile.userInfo.avatarUrl : 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0', avatarUrl: userProfile ? userProfile.userInfo.avatarUrl : 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0',
gender: userProfile ? userProfile.userInfo.gender : 0, gender: userProfile ? userProfile.userInfo.gender : 0,
@ -425,7 +425,7 @@ Page({
// 5. 创建模拟用户信息 // 5. 创建模拟用户信息
const mockUserInfo = { const mockUserInfo = {
nickName: '测试用户', name: '测试用户',
avatarUrl: this.data.avatarUrl, avatarUrl: this.data.avatarUrl,
gender: 0, gender: 0,
country: '测试国家', country: '测试国家',
@ -659,7 +659,7 @@ Page({
// 创建临时用户信息 // 创建临时用户信息
const tempUserInfo = { const tempUserInfo = {
nickName: '微信用户', name: '微信用户',
avatarUrl: this.data.avatarUrl, avatarUrl: this.data.avatarUrl,
gender: 0, gender: 0,
country: '', country: '',
@ -739,7 +739,7 @@ Page({
const completeUserInfo = { const completeUserInfo = {
...userInfo, ...userInfo,
// 确保包含服务器需要的必要字段 // 确保包含服务器需要的必要字段
nickName: userInfo.nickName || '测试用户' name: userInfo.name || '测试用户'
} }
try { try {
@ -772,10 +772,10 @@ Page({
// 处理昵称提交 // 处理昵称提交
getUserName(e) { getUserName(e) {
const { nickname } = e.detail.value const { name } = e.detail.value
const type = this.data.currentUserType const type = this.data.currentUserType
if (!nickname) { if (!name) {
wx.showToast({ wx.showToast({
title: '请输入昵称', title: '请输入昵称',
icon: 'none', icon: 'none',
@ -786,7 +786,7 @@ Page({
// 创建用户信息对象 // 创建用户信息对象
const userInfo = { const userInfo = {
nickName: nickname, name: name,
avatarUrl: this.data.avatarUrl, avatarUrl: this.data.avatarUrl,
// 其他可能需要的字段 // 其他可能需要的字段
gender: 0, gender: 0,

2
pages/index/index.wxml

@ -60,7 +60,7 @@
<form bindsubmit="getUserName"> <form bindsubmit="getUserName">
<view class="form-group"> <view class="form-group">
<view class="form-label">昵称</view> <view class="form-label">昵称</view>
<input placeholder="请输入昵称" type="nickname" name="nickname" maxlength="32" class="form-input"></input> <input placeholder="请输入昵称" type="nickname" name="name" maxlength="32" class="form-input"></input>
</view> </view>
<!-- 提交按钮 --> <!-- 提交按钮 -->

16
pages/profile/index.js

@ -147,7 +147,7 @@ Page({
this.syncUserTypeFromServer(userId, serverUserInfo.type) this.syncUserTypeFromServer(userId, serverUserInfo.type)
} }
console.log('用户信息已更新,昵称:', updatedUserInfo.nickName, '手机号:', updatedUserInfo.phoneNumber, '身份:', serverUserInfo.type) console.log('用户信息已更新,昵称:', updatedUserInfo.name, '手机号:', updatedUserInfo.phoneNumber, '身份:', serverUserInfo.type)
} }
}).catch(err => { }).catch(err => {
console.error('从服务器获取用户信息失败:', err) console.error('从服务器获取用户信息失败:', err)
@ -450,7 +450,7 @@ Page({
const existingUserInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {} const existingUserInfo = app.globalData.userInfo || wx.getStorageSync('userInfo') || {}
const userInfo = { const userInfo = {
// 优先使用最新获取的微信头像和昵称,如果没有获取到则使用本地存储的 // 优先使用最新获取的微信头像和昵称,如果没有获取到则使用本地存储的
nickName: (userProfile ? userProfile.userInfo.nickName : existingUserInfo.nickName) || '微信用户', name: (userProfile ? (userProfile.userInfo.name || userProfile.userInfo.nickName) : existingUserInfo.name) || '微信用户',
avatarUrl: (userProfile ? userProfile.userInfo.avatarUrl : existingUserInfo.avatarUrl) || 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0', avatarUrl: (userProfile ? userProfile.userInfo.avatarUrl : existingUserInfo.avatarUrl) || 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0',
gender: (userProfile ? userProfile.userInfo.gender : existingUserInfo.gender) || 0, gender: (userProfile ? userProfile.userInfo.gender : existingUserInfo.gender) || 0,
country: (userProfile ? userProfile.userInfo.country : existingUserInfo.country) || '', country: (userProfile ? userProfile.userInfo.country : existingUserInfo.country) || '',
@ -560,7 +560,7 @@ Page({
const uploadData = { const uploadData = {
userId: userId, userId: userId,
openid: openid, openid: openid,
nickName: userInfo.nickName, name: userInfo.name,
avatarUrl: userInfo.avatarUrl, // 添加头像URL字段 avatarUrl: userInfo.avatarUrl, // 添加头像URL字段
phoneNumber: userInfo.phoneNumber, // 添加phoneNumber字段,满足服务器要求 phoneNumber: userInfo.phoneNumber, // 添加phoneNumber字段,满足服务器要求
type: type, type: type,
@ -583,8 +583,8 @@ Page({
}, },
// 修改用户名称 // 修改用户名称
onEditNickName() { onEditName() {
const currentName = this.data.userInfo.nickName || '未登录'; const currentName = this.data.userInfo.name || '未登录';
wx.showModal({ wx.showModal({
title: '修改用户名称', title: '修改用户名称',
@ -635,7 +635,7 @@ Page({
}); });
// 更新用户信息 // 更新用户信息
this.updateNickName(newName).finally(() => { this.updateName(newName).finally(() => {
// 无论成功失败,都隐藏加载提示 // 无论成功失败,都隐藏加载提示
wx.hideLoading(); wx.hideLoading();
}); });
@ -645,14 +645,14 @@ Page({
}, },
// 更新用户名称 // 更新用户名称
updateNickName(newName) { updateName(newName) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
// 更新本地和全局用户信息 // 更新本地和全局用户信息
const app = getApp(); const app = getApp();
const updatedUserInfo = { const updatedUserInfo = {
...this.data.userInfo, ...this.data.userInfo,
nickName: newName name: newName
}; };
// 保存到本地存储和全局状态 // 保存到本地存储和全局状态

2
pages/publish/index.js

@ -397,7 +397,7 @@ Page({
// 获取卖家信息 // 获取卖家信息
const users = wx.getStorageSync('users') || {}; const users = wx.getStorageSync('users') || {};
const sellerName = users[userId] && users[userId].info && users[userId].info.nickName ? users[userId].info.nickName : '未知卖家'; const sellerName = users[userId] && users[userId].info && (users[userId].info.name || users[userId].info.nickName) ? (users[userId].info.name || users[userId].info.nickName) : '未知卖家';
// 保存到本地存储 // 保存到本地存储
setTimeout(() => { setTimeout(() => {

10
pages/seller/index.js

@ -2189,10 +2189,10 @@ Page({
// 处理昵称提交 // 处理昵称提交
getUserName(e) { getUserName(e) {
const { nickname } = e.detail.value const { name } = e.detail.value
const type = 'seller' // 卖家页面固定为卖家类型 const type = 'seller' // 卖家页面固定为卖家类型
if (!nickname) { if (!name) {
wx.showToast({ wx.showToast({
title: '请输入昵称', title: '请输入昵称',
icon: 'none', icon: 'none',
@ -2203,7 +2203,7 @@ Page({
// 创建用户信息对象 // 创建用户信息对象
const userInfo = { const userInfo = {
nickName: nickname, name: name,
avatarUrl: this.data.avatarUrl, avatarUrl: this.data.avatarUrl,
gender: 0, gender: 0,
country: '', country: '',
@ -2376,7 +2376,7 @@ Page({
// 5. 获取用户微信头像和昵称 // 5. 获取用户微信头像和昵称
let userProfile = null; let userProfile = null;
let tempUserInfo = { let tempUserInfo = {
nickName: '微信用户', name: '微信用户',
avatarUrl: this.data.avatarUrl, avatarUrl: this.data.avatarUrl,
gender: 0, gender: 0,
country: '', country: '',
@ -2398,7 +2398,7 @@ Page({
// 更新临时用户信息 // 更新临时用户信息
tempUserInfo = { tempUserInfo = {
nickName: userProfile.userInfo.nickName, name: userProfile.userInfo.name || userProfile.userInfo.nickName,
avatarUrl: userProfile.userInfo.avatarUrl, avatarUrl: userProfile.userInfo.avatarUrl,
gender: userProfile.userInfo.gender, gender: userProfile.userInfo.gender,
country: userProfile.userInfo.country, country: userProfile.userInfo.country,

2
pages/seller/index.wxml

@ -827,7 +827,7 @@
<form bindsubmit="getUserName"> <form bindsubmit="getUserName">
<view class="auth-form-group"> <view class="auth-form-group">
<view class="auth-form-label">昵称</view> <view class="auth-form-label">昵称</view>
<input placeholder="请输入昵称" type="nickname" name="nickname" maxlength="32" class="auth-form-input"></input> <input placeholder="请输入昵称" type="nickname" name="name" maxlength="32" class="auth-form-input"></input>
</view> </view>
<!-- 提交按钮 --> <!-- 提交按钮 -->

4
pages/settlement/index.js

@ -979,7 +979,7 @@ Page({
if (result && result.success) { if (result && result.success) {
// 保存用户信息到全局和本地存储 // 保存用户信息到全局和本地存储
const userInfo = { const userInfo = {
nickName: '微信用户', name: '微信用户',
avatarUrl: '/images/default-avatar.png', avatarUrl: '/images/default-avatar.png',
phoneNumber: result.phoneNumber || '未绑定', phoneNumber: result.phoneNumber || '未绑定',
gender: 0, gender: 0,
@ -1052,7 +1052,7 @@ Page({
// 保存用户信息到全局和本地存储 // 保存用户信息到全局和本地存储
const userInfo = { const userInfo = {
nickName: '微信用户', name: '微信用户',
avatarUrl: '/images/default-avatar.png', avatarUrl: '/images/default-avatar.png',
phoneNumber: '未绑定', phoneNumber: '未绑定',
gender: 0, gender: 0,

43
server-example/server-mysql.js

@ -310,9 +310,10 @@ User.init({
allowNull: false, allowNull: false,
unique: true unique: true
}, },
nickName: { name: {
type: DataTypes.STRING(100), type: DataTypes.STRING(255),
allowNull: false // 微信名,必填 allowNull: true, // 昵称,可选
comment: '昵称'
}, },
avatarUrl: { avatarUrl: {
type: DataTypes.TEXT type: DataTypes.TEXT
@ -593,9 +594,10 @@ Contact.init({
allowNull: false, allowNull: false,
unique: true unique: true
}, },
nickName: { name: {
type: DataTypes.STRING(100), type: DataTypes.STRING(100),
allowNull: false // 联系人 allowNull: false, // 联系人
comment: '联系人'
}, },
phoneNumber: { phoneNumber: {
type: DataTypes.STRING(20), type: DataTypes.STRING(20),
@ -839,14 +841,14 @@ async function createUserAssociations(user) {
await sequelize.transaction(async (transaction) => { await sequelize.transaction(async (transaction) => {
// 1. 处理联系人记录 - 使用INSERT ... ON DUPLICATE KEY UPDATE确保无论如何都只保留一条记录 // 1. 处理联系人记录 - 使用INSERT ... ON DUPLICATE KEY UPDATE确保无论如何都只保留一条记录
await sequelize.query( await sequelize.query(
`INSERT INTO contacts (userId, nickName, phoneNumber, created_at, updated_at) `INSERT INTO contacts (userId, name, phoneNumber, created_at, updated_at)
VALUES (?, ?, ?, NOW(), NOW()) VALUES (?, ?, ?, NOW(), NOW())
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
nickName = VALUES(nickName), name = VALUES(name),
phoneNumber = VALUES(phoneNumber), phoneNumber = VALUES(phoneNumber),
updated_at = NOW()`, updated_at = NOW()`,
{ {
replacements: [user.userId, user.nickName || '默认联系人', user.phoneNumber || ''], replacements: [user.userId, user.name || '默认联系人', user.phoneNumber || ''],
transaction: transaction transaction: transaction
} }
); );
@ -1098,7 +1100,7 @@ app.post('/api/wechat/getOpenid', async (req, res) => {
openid, openid,
userId, userId,
session_key, session_key,
nickName: '微信用户', // 临时占位,等待用户授权 name: '微信用户', // 临时占位,等待用户授权
phoneNumber: '', // 使用空字符串代替临时手机号,后续由微信小程序拉取的真实手机号更新 phoneNumber: '', // 使用空字符串代替临时手机号,后续由微信小程序拉取的真实手机号更新
type: userType, // 使用客户端传入的类型或默认买家身份 type: userType, // 使用客户端传入的类型或默认买家身份
province: '', // 默认空字符串 province: '', // 默认空字符串
@ -1114,7 +1116,7 @@ app.post('/api/wechat/getOpenid', async (req, res) => {
}); });
// 为新创建的用户创建关联记录 // 为新创建的用户创建关联记录
const newUser = { userId, openid, nickName: '微信用户', phoneNumber: '' }; const newUser = { userId, openid, name: '微信用户', phoneNumber: '' };
await createUserAssociations(newUser); await createUserAssociations(newUser);
} }
@ -1159,7 +1161,7 @@ app.post('/api/user/validate', async (req, res) => {
// 查找用户 // 查找用户
const user = await User.findOne({ const user = await User.findOne({
where: { openid }, where: { openid },
attributes: ['openid', 'userId', 'nickName', 'avatarUrl', 'phoneNumber', 'type'] attributes: ['openid', 'userId', 'name', 'avatarUrl', 'phoneNumber', 'type']
}); });
if (!user) { if (!user) {
@ -1204,10 +1206,9 @@ 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', 'nickName', 'phoneNumber', 'wechat', 'account', 'accountNumber', 'bank', 'address'] attributes: ['id', 'name', 'phoneNumber', 'wechat', 'account', 'accountNumber', 'bank', 'address']
}, },
{ {
model: UserManagement, model: UserManagement,
@ -1410,7 +1411,7 @@ app.post('/api/product/list', async (req, res) => {
{ {
model: User, model: User,
as: 'seller', as: 'seller',
attributes: ['userId', 'nickName', 'avatarUrl'] attributes: ['userId', 'name', 'avatarUrl']
} }
], ],
attributes: { attributes: {
@ -2713,7 +2714,7 @@ try {
{ {
model: User, model: User,
as: 'seller', as: 'seller',
attributes: ['userId', 'nickName', 'avatarUrl'] attributes: ['userId', 'name', 'avatarUrl']
} }
] ]
}); });
@ -3060,7 +3061,7 @@ app.post('/api/products/detail', async (req, res) => {
{ {
model: User, model: User,
as: 'seller', as: 'seller',
attributes: ['userId', 'nickName', 'avatarUrl'] attributes: ['userId', 'name', 'avatarUrl']
} }
] ]
}); });
@ -4195,7 +4196,7 @@ app.post('/api/user/debug', async (req, res) => {
// 查询用户信息 // 查询用户信息
const user = await User.findOne({ const user = await User.findOne({
where: { openid }, where: { openid },
attributes: ['openid', 'userId', 'nickName', 'phoneNumber', 'type'] attributes: ['openid', 'userId', 'name', 'phoneNumber', 'type']
}); });
if (!user) { if (!user) {
@ -4320,7 +4321,7 @@ app.post('/api/product/hide', async (req, res) => {
}); });
} }
console.log('找到用户信息:', { userId: user.userId, nickName: user.nickName }); console.log('找到用户信息:', { userId: user.userId, name: user.name });
// 查找商品并验证所有权 - 直接使用userId,因为商品创建时使用的就是userId // 查找商品并验证所有权 - 直接使用userId,因为商品创建时使用的就是userId
const product = await Product.findOne({ const product = await Product.findOne({
@ -4561,7 +4562,7 @@ app.post('/api/product/publish', async (req, res) => {
}); });
} }
console.log('找到用户:', { userId: user.userId, nickName: user.nickName, type: user.type }); console.log('找到用户:', { userId: user.userId, name: user.name, type: user.type });
// 验证用户类型 // 验证用户类型
console.log(`验证用户类型: 用户ID=${user.userId}, 类型=${user.type}`); console.log(`验证用户类型: 用户ID=${user.userId}, 类型=${user.type}`);
@ -4625,7 +4626,7 @@ app.post('/api/product/publish', async (req, res) => {
{ {
model: User, model: User,
as: 'seller', as: 'seller',
attributes: ['userId', 'nickName', 'avatarUrl'] attributes: ['userId', 'name', 'avatarUrl']
} }
] ]
}); });

Loading…
Cancel
Save