// 获取库存充足商品
async getEnoughGoodsList({
page = 1,
pageSize = 20
}) {
const dbObj = uniCloud.databaseForJQL({
clientInfo: this.getClientInfo()
});
const uid = await checkLogin.call(this);
if (typeof uid === 'object') {
return uid;
}
try {
const condition = {
user_id: uid,
$or: [{
goods_threshold: null,
goods_num: {
$gt: 0
}
},
{
goods_threshold: '',
goods_num: {
$gt: 0
}
},
{
goods_num: null
},
{
goods_num: ''
},
{
$and: [{
goods_threshold: {
$exists: true,
$ne: null,
$ne: ''
}
},
{
goods_num: {
$exists: true,
$ne: null,
$ne: ''
}
},
{
$expr: {
$lt: ["$goods_threshold", "$goods_num"]
}
}
]
}
]
};
const goodsInfo = await dbObj.collection('goods-info')
.where(condition)
.skip((page - 1) * pageSize)
.limit(pageSize)
.orderBy('last_modify_date', 'desc')
.get();
return {
code: 0,
msg: '获取成功',
data: goodsInfo.data
};
} catch (error) {
console.error('获取商品列表失败:', error);
return {
code: -2,
msg: '获取商品列表失败',
error: error.message
};
}
},
2 个回复
风之源 - 我这么闲给你评论,是因为我的问题还没有人回答~
也许是数据库超时呢,你这没日志查不了的呀
2***@qq.com (作者) - zjx
我也是HttpClientRequestTimeoutError: Request timeout for 10000 ms