重构动物模型和路由系统,优化查询逻辑并新增商户和促销活动功能

This commit is contained in:
ylweng
2025-09-22 02:04:07 +08:00
parent 5fc1a4fcb9
commit 47c816270d
54 changed files with 5384 additions and 4639 deletions

View File

@@ -161,11 +161,11 @@ X-Version: 1.0.0
"openid": "wx_openid_123",
"unionid": "wx_unionid_456",
"nickname": "微信用户",
"avatar_url": "https://wx.qlogo.cn/avatar.jpg",
"gender": 1,
"city": "北京",
"province": "北京",
"country": "中国",
"real_name": "",
"avatar": "https://wx.qlogo.cn/avatar.jpg",
"user_type": "regular",
"balance": 0.00,
"status": "active",
"is_new_user": false,
"profile_completed": true
}
@@ -216,18 +216,12 @@ X-Version: 1.0.0
"id": 1,
"uuid": "user_123456",
"nickname": "旅行达人",
"real_name": "张三",
"avatar_url": "https://example.com/avatar.jpg",
"gender": 1,
"birthday": "1990-01-01",
"location": "北京市",
"bio": "热爱旅行和小动物",
"phone": "13800138000",
"email": "user@example.com",
"user_type": "normal",
"balance": 1500.00,
"status": 1,
"profile_completed": true,
"real_name_verified": true,
"phone_verified": true,
"email_verified": false,
"created_at": "2024-01-01T10:00:00Z",
"statistics": {
"travel_count": 5,
@@ -269,7 +263,7 @@ X-Version: 1.0.0
"data": {
"id": 1,
"nickname": "新昵称",
"avatar_url": "https://example.com/new_avatar.jpg",
"avatar": "https://example.com/new_avatar.jpg",
"updated_at": "2024-01-15T10:30:00Z"
}
}
@@ -318,18 +312,19 @@ X-Version: 1.0.0
"duration_days": 5,
"max_participants": 8,
"current_participants": 3,
"budget_min": 2000.00,
"budget_max": 3000.00,
"price_per_person": 2500.00,
"includes": "住宿、早餐、门票、导游",
"excludes": "午餐、晚餐、个人消费",
"travel_type": "cultural",
"status": 1,
"is_featured": 1,
"status": "recruiting",
"is_featured": true,
"view_count": 156,
"like_count": 23,
"comment_count": 8,
"creator": {
"id": 1,
"nickname": "旅行达人",
"avatar_url": "https://example.com/avatar.jpg"
"avatar": "https://example.com/avatar.jpg"
},
"cover_image": "https://example.com/cover.jpg",
"images": [
@@ -383,28 +378,20 @@ X-Version: 1.0.0
"duration_days": 5,
"max_participants": 8,
"current_participants": 3,
"min_age": 18,
"max_age": 60,
"gender_limit": 0,
"budget_min": 2000.00,
"budget_max": 3000.00,
"price_per_person": 2500.00,
"includes": "住宿、早餐、门票、导游",
"excludes": "午餐、晚餐、个人消费",
"travel_type": "cultural",
"transportation": "高铁+包车",
"accommodation": "客栈",
"itinerary": [
{
"day": 1,
"title": "抵达大理",
"activities": ["接机", "入住客栈", "古城夜游"],
"meals": ["晚餐"],
"accommodation": "大理古城客栈"
"activities": ["接机", "入住客栈", "古城夜游"]
},
{
"day": 2,
"title": "大理古城游览",
"activities": ["洱海骑行", "三塔寺参观", "古城购物"],
"meals": ["早餐", "午餐", "晚餐"],
"accommodation": "大理古城客栈"
"activities": ["洱海骑行", "三塔寺参观", "古城购物"]
}
],
"requirements": "身体健康,有一定体力,热爱文化旅行",
@@ -419,8 +406,8 @@ X-Version: 1.0.0
"https://example.com/image2.jpg"
],
"tags": ["文化", "古城", "摄影"],
"status": 1,
"is_featured": 1,
"status": "recruiting",
"is_featured": true,
"view_count": 156,
"like_count": 23,
"comment_count": 8,
@@ -428,7 +415,7 @@ X-Version: 1.0.0
"creator": {
"id": 1,
"nickname": "旅行达人",
"avatar_url": "https://example.com/avatar.jpg",
"avatar": "https://example.com/avatar.jpg",
"travel_count": 15,
"rating": 4.8,
"verified": true
@@ -439,11 +426,11 @@ X-Version: 1.0.0
"user": {
"id": 2,
"nickname": "小明",
"avatar_url": "https://example.com/avatar2.jpg",
"avatar": "https://example.com/avatar2.jpg",
"age": 28,
"gender": 1
},
"status": 1,
"status": "confirmed",
"applied_at": "2024-01-10T15:30:00Z"
}
],
@@ -468,35 +455,21 @@ X-Version: 1.0.0
"title": "西藏拉萨朝圣之旅",
"description": "深度体验西藏文化,朝圣布达拉宫...",
"destination": "西藏拉萨",
"destination_detail": {
"province": "西藏自治区",
"city": "拉萨市",
"address": "布达拉宫广场",
"latitude": 29.6544,
"longitude": 91.1175
},
"start_date": "2024-04-01",
"end_date": "2024-04-07",
"max_participants": 6,
"min_age": 20,
"max_age": 50,
"gender_limit": 0,
"budget_min": 5000.00,
"budget_max": 8000.00,
"price_per_person": 6500.00,
"includes": "住宿、早餐、景点门票",
"excludes": "往返机票、午晚餐",
"travel_type": "cultural",
"transportation": "飞机+包车",
"accommodation": "酒店",
"itinerary": [
{
"day": 1,
"title": "抵达拉萨",
"activities": ["接机", "入住酒店", "适应高原"],
"meals": ["晚餐"]
"activities": ["接机", "入住酒店", "适应高原"]
}
],
"requirements": "身体健康,无高原反应病史",
"included_services": ["住宿", "早餐", "景点门票"],
"excluded_services": ["往返机票", "午晚餐"],
"contact_info": {
"wechat": "tibet_lover",
"phone": "13900139000"
@@ -626,13 +599,13 @@ X-Version: 1.0.0
| size | integer | 否 | 每页数量默认10 |
| sort | string | 否 | 排序默认created_at:desc |
| keyword | string | 否 | 搜索关键词(动物名称) |
| species | string | 否 | 物种cat,dog,rabbit,other |
| type | string | 否 | 动物类型cat,dog,rabbit,other |
| breed | string | 否 | 品种 |
| gender | integer | 否 | 性别:1-雄性2-雌性 |
| gender | string | 否 | 性别:male,female |
| age_min | integer | 否 | 年龄下限(月) |
| age_max | integer | 否 | 年龄上限(月) |
| location | string | 否 | 所在地 |
| status | integer | 否 | 状态:1-可认领2-已认领 |
| status | string | 否 | 状态:available,claimed,unavailable |
| is_featured | integer | 否 | 是否精选1-是 |
#### 响应示例
@@ -646,35 +619,34 @@ X-Version: 1.0.0
"id": 1,
"uuid": "animal_123456",
"name": "小花",
"species": "cat",
"type": "",
"breed": "英国短毛猫",
"gender": 2,
"gender": "female",
"age": 24,
"weight": 4.5,
"color": "银渐层",
"description": "性格温顺,喜欢晒太阳",
"personality": "温顺、亲人、活泼",
"health_status": "健康",
"price": 500.00,
"daily_cost": 15.00,
"location": "北京市朝阳区",
"adoption_fee": 500.00,
"monthly_cost": 200.00,
"status": 1,
"is_featured": 1,
"view_count": 89,
"like_count": 15,
"adoption_count": 0,
"cover_image": "https://example.com/cat_cover.jpg",
"status": "available",
"health_status": "健康",
"description": "性格温顺,喜欢晒太阳",
"images": [
"https://example.com/cat1.jpg",
"https://example.com/cat2.jpg"
],
"farm": {
"vaccination_records": [
{
"vaccine": "狂犬疫苗",
"date": "2024-01-01",
"next_date": "2025-01-01"
}
],
"farmer": {
"id": 1,
"name": "爱心动物农场",
"location": "北京市朝阳区",
"rating": 4.8
"location": "北京市朝阳区"
},
"tags": ["温顺", "亲人", "已绝育"],
"view_count": 89,
"like_count": 15,
"created_at": "2024-01-10T10:00:00Z"
}
],
@@ -704,78 +676,35 @@ X-Version: 1.0.0
"id": 1,
"uuid": "animal_123456",
"name": "小花",
"species": "cat",
"type": "",
"breed": "英国短毛猫",
"gender": 2,
"gender": "female",
"age": 24,
"weight": 4.5,
"color": "银渐层",
"description": "小花是一只非常温顺的英国短毛猫,喜欢晒太阳和玩毛线球...",
"personality": "温顺、亲人、活泼",
"health_status": "健康",
"vaccination_status": {
"rabies": {
"vaccinated": true,
"date": "2023-12-01",
"next_due": "2024-12-01"
},
"feline_distemper": {
"vaccinated": true,
"date": "2023-12-01",
"next_due": "2024-12-01"
}
},
"medical_history": "2023年11月进行了绝育手术恢复良好",
"price": 500.00,
"daily_cost": 15.00,
"location": "北京市朝阳区",
"adoption_fee": 500.00,
"monthly_cost": 200.00,
"status": 1,
"is_featured": 1,
"view_count": 89,
"like_count": 15,
"adoption_count": 0,
"status": "available",
"health_status": "健康",
"description": "小花是一只非常温顺的英国短毛猫,喜欢晒太阳和玩毛线球...",
"images": [
"https://example.com/cat1.jpg",
"https://example.com/cat2.jpg"
],
"videos": [
"https://example.com/cat_video1.mp4"
"vaccination_records": [
{
"vaccine": "狂犬疫苗",
"date": "2024-01-01",
"next_date": "2025-01-01"
}
],
"farm": {
"farmer": {
"id": 1,
"name": "爱心动物农场",
"location": "北京市朝阳区",
"contact_phone": "13800138000",
"description": "专业的动物救助机构",
"rating": 4.8,
"images": [
"https://example.com/farm1.jpg"
]
"contact_phone": "13800138000"
},
"caretaker": {
"id": 1,
"name": "张三",
"avatar_url": "https://example.com/caretaker.jpg",
"experience": "5年动物护理经验",
"introduction": "热爱动物,专业护理"
},
"adoption_types": [
{
"type": 1,
"name": "长期认领",
"description": "12个月以上的长期认领",
"min_duration": 12,
"monthly_fee": 200.00
},
{
"type": 2,
"name": "短期认领",
"description": "1-6个月的短期认领",
"min_duration": 1,
"monthly_fee": 250.00
}
],
"tags": ["温顺", "亲人", "已绝育"],
"view_count": 89,
"like_count": 15,
"is_liked": false,
"can_adopt": true,
"created_at": "2024-01-10T10:00:00Z"