Documentation ¶
Index ¶
Constants ¶
View Source
const ( ORDER_STATUS_WAIT_ACCEPT = "WAIT_ACCEPT" //待接单 ORDER_STATUS_WAIT_PAYMENT = "WAIT_PAYMENT" //待支付 ORDER_STATUS_PAID = "PAID" //已支付 ORDER_STATUS_WAIT_COMMENT = "WAIT_COMMENT" //待评价 ORDER_STATUS_COMPLETE = "COMPLETE" //已完成 ORDER_STATUS_CANCELED = "CONCELED" //已取消 ORDER_STATUS_REJECTED = "REJECTED" //已拒单 )
Variables ¶
View Source
var HOME_PAGE_MAX_HOUSES int = 5
首页最多展示的房屋数量
View Source
var HOUSE_LIST_PAGE_CAPACITY int = 2
房屋列表页面每页显示条目数
Functions ¶
This section is empty.
Types ¶
type Area ¶
type Area struct { // 区域编号 1 2 Id int `json:"aid"` // 区域名字 昌平 海淀 Name string `orm:"size(32)" json:"aname"` // 区域所有的房屋 与 房屋表进行关联 Houses []*House `orm:"reverse(many)" json:"houses"` }
区域信息 table_name = area
TODO - 区域信息是需要我们手动添加到数据库中的
type Facility ¶
type Facility struct { // 设施编号 Id int `json:"fid"` // 设施名字 Name string `orm:"size(32)"` // 都有哪些房屋有此设施 与 房屋表进行关联 Houses []*House `orm:"rel(m2m)"` }
设施信息 table_name = "facility"
TODO - 设施信息 需要我们提前手动添加的
type House ¶
type House struct { // 房屋编号 Id int `json:"house_id"` // 房屋主人的用户编号 与用户进行关联 User *User `orm:"rel(fk)" json:"user_id"` // 归属地的区域编号 和 地区表进行关联 Area *Area `orm:"rel(fk)" json:"area_id"` // 房屋标题 Title string `orm:"size(64)" json:"title"` // 单价,单位:分 每次的价格要乘以100 // TODO - 金融一般分为单位,元为单位 浮点数 数值转换丢失精度 Price int `orm:"default(0)" json:"price"` // 地址 Address string `orm:"size(512)" orm:"default("")" json:"address"` // 房间数目 Room_count int `orm:"default(1)" json:"room_count"` // 房屋总面积 Acreage int `orm:"default(0)" json:"acreage"` // 房屋单元,如 几室几厅 Unit string `orm:"size(32)" orm:"default("")" json:"unit"` // 房屋容纳的总人数 Capacity int `orm:"default(1)" json:"capacity"` // 房屋床铺的配置 Beds string `orm:"size(64)" orm:"default("")" json:"beds"` // 押金 Deposit int `orm:"default(0)" json:"deposit"` // 最少入住的天数 Min_days int `orm:"default(1)" json:"min_days"` // 最多入住的天数 0表示不限制 Max_days int `orm:"default(0)" json:"max_days"` // 预定完成的该房屋的订单数 Order_count int `orm:"default(0)" json:"order_count"` // 房屋主图片路径 Index_image_url string `orm:"size(256)" orm:"default("")" json:"index_image_url"` // 1:N 房屋设施 与 设施表进行关联 Facilities []*Facility `orm:"reverse(many)" json:"facilities"` // 1:N 房屋的图片 除主要图片之外的其他图片地址 Images []*HouseImage `orm:"reverse(many)" json:"img_urls"` // 1:N 房屋的订单 与 房订单表进行管理 历史订单记录 Orders []*OrderHouse `orm:"reverse(many)" json:"orders"` Ctime time.Time `orm:"auto_now_add;type(datetime)" json:"ctime"` }
房屋信息 table_name = house
type HouseImage ¶
type HouseImage struct { // 图片id Id int `json:"house_image_id"` // 图片url 存放我们房屋的图片 Url string `orm:"size(256)" json:"url"` // 图片所属房屋编号 House *House `orm:"rel(fk)" json:"house_id"` }
房屋图片 table_name = "house_image"
type OrderHouse ¶
type OrderHouse struct { // 订单编号 Id int `json:"order_id"` // 下单的用户编号 与 用户表进行关联 User *User `orm:"rel(fk)" json:"user_id"` // 预定的房间编号 与 房屋信息进行关联 House *House `orm:"rel(fk)" json:"house_id"` // 预定的起始时间 Begin_date time.Time `orm:"type(datetime)"` // 预定的结束时间 End_date time.Time `orm:"type(datetime)"` // 预定总天数 Days int // 房屋的单价 House_price int // 订单总金额 Amount int // 订单状态 Status string `orm:"default(WAIT_ACCEPT)"` // 订单评论 Comment string `orm:"size(512)"` // TODO - 每次更新此表都会更新这个字段 Ctime time.Time `orm:"auto_now;type(datetime)" json:"ctime"` // 表示个人征信情况 true表示良好 Credit bool }
订单 table_name = order
type User ¶
type User struct { Id int `json:"user_id"` // 用户昵称 Name string `orm:"size(32)" json:"name"` // 用户密码加密 Password_hash string `orm:"size(128)" json:"password"` // 手机号做登录 Mobile string `orm:"size(11);unique" json:"mobile"` // 真实姓名 实名认证 Real_name string `orm:"size(32)" json:"real_name"` // 身份证号 实名认证 Id_card string `orm:"size(20)" json:"id_card"` // 用户头像路径 通过fastdfs进行图片存储 Avatar_url string `orm:"size(256)" json:"avatar_url"` // 1:N 用户发布的房屋信息 一个人多套房 Houses []*House `orm:"reverse(many)" json:"houses"` // 1:N 用户下的订单 一个人多次订单 Orders []*OrderHouse `orm:"reverse(many)" json:"orders"` }
用户 table_name = user
Click to show internal directories.
Click to hide internal directories.