發(fā)布房源
城區(qū)信息接口設計和定義
緩存區(qū)域數(shù)據(jù)
區(qū)域數(shù)據(jù)是我們動態(tài)查詢的結果策彤。
但是區(qū)域數(shù)據(jù)不是頻繁變化的數(shù)據(jù)稚矿,所以沒有必要每次都重新查詢嬉愧。
所以我們可以選擇對區(qū)域數(shù)據(jù)進行緩存處理。
緩存工具
Redis
緩存邏輯
前端模板
JS模板-ART-TEMPLATE
http://aui.github.io/art-template/
newhouse.html
1 <scripttype="text/html"id="areas-tmpl">
2? ? ?{{ each areas as area }}
3? ? ?<option value={{ area.aid }}>{{ area.aname }}</option>
4? ? ?{{ /each }}
5 </script>
newhouse.js
1 // 使用js模板
2 varhtml=template("areas-tmpl", {areas:areas})
3 $("#area-id").html(html);
保存房屋的基本信息
接收參數(shù)
1 title=house_data.get("title")# 房屋名稱標題
2 price=house_data.get("price")# 房屋單價
3 area_id=house_data.get("area_id")# 房屋所屬城區(qū)的編號
4 address=house_data.get("address")# 房屋地址
5 room_count=house_data.get("room_count")# 房屋包含的房間數(shù)目
6 acreage=house_data.get("acreage")# 房屋面積
7 unit=house_data.get("unit")# 房屋布局(幾室?guī)讖d)
8 capacity=house_data.get("capacity")# 房屋容納人數(shù)
9 beds=house_data.get("beds")# 房屋臥床數(shù)目
10 deposit=house_data.get("deposit")# 押金
11 min_days=house_data.get("min_days")# 最小入住天數(shù)
12 max_days=house_data.get("max_days")# 最大入住天數(shù)
保存數(shù)據(jù)到House中
1 house = House(
2? ? ? ? user_id=user_id,
3? ? ? ???area_id=area_id,
4? ? ? ? title=title,
5? ? ? ? price=price,
6? ? ? ? address=address,
7? ? ? ? room_count=room_count,
8? ? ? ? acreage=acreage,
9? ? ? ? unit=unit,
10? ? ? ?capacity=capacity,
11? ? ? ? beds=beds,
12? ? ? ? deposit=deposit,
13? ? ? ? min_days=min_days,
14? ? ? ? max_days=max_days
15 )
保存房屋的圖片
房屋管理&房屋列表
獲取房東發(fā)布的房源信息條目
房東發(fā)布房源接口設計
獲取主頁展示的房屋基本信息
主頁房源接口設計
獲取房屋詳情
獲取房源詳情接口設計
房屋列表頁面