添加后台启动脚本和修改域名
This commit is contained in:
@@ -10,24 +10,38 @@ class CattlePenController {
|
||||
*/
|
||||
async getPens(req, res) {
|
||||
try {
|
||||
const { page = 1, pageSize = 10, search, status, type } = req.query;
|
||||
const { page = 1, pageSize = 10, search, name, status, type } = req.query;
|
||||
const offset = (page - 1) * pageSize;
|
||||
|
||||
console.log('=== 获取栏舍列表 ===');
|
||||
console.log('请求时间:', new Date().toISOString());
|
||||
console.log('请求参数:', { page, pageSize, search, name, status, type });
|
||||
console.log('请求来源:', req.ip);
|
||||
|
||||
// 构建查询条件
|
||||
const where = {};
|
||||
if (search) {
|
||||
|
||||
// 支持 search 和 name 参数(兼容性处理)
|
||||
const searchKeyword = search || name;
|
||||
if (searchKeyword) {
|
||||
console.log('🔍 [后端-栏舍设置] 搜索关键词:', searchKeyword);
|
||||
where[Op.or] = [
|
||||
{ name: { [Op.like]: `%${search}%` } },
|
||||
{ code: { [Op.like]: `%${search}%` } }
|
||||
{ name: { [Op.like]: `%${searchKeyword}%` } },
|
||||
{ code: { [Op.like]: `%${searchKeyword}%` } }
|
||||
];
|
||||
console.log('🔍 [后端-栏舍设置] 搜索条件构建完成');
|
||||
}
|
||||
|
||||
if (status) {
|
||||
where.status = status;
|
||||
}
|
||||
if (type) {
|
||||
where.type = type;
|
||||
}
|
||||
|
||||
console.log('🔍 [后端-栏舍设置] 构建的查询条件:', JSON.stringify(where, null, 2));
|
||||
|
||||
console.log('🔍 [后端-栏舍设置] 开始执行查询...');
|
||||
const { count, rows } = await CattlePen.findAndCountAll({
|
||||
where,
|
||||
include: [
|
||||
@@ -42,6 +56,18 @@ class CattlePenController {
|
||||
order: [['created_at', 'DESC']]
|
||||
});
|
||||
|
||||
console.log('📊 [后端-栏舍设置] 查询结果:', {
|
||||
总数: count,
|
||||
当前页记录数: rows.length,
|
||||
记录列表: rows.map(item => ({
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
code: item.code,
|
||||
type: item.type,
|
||||
status: item.status
|
||||
}))
|
||||
});
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user