db.go 4.24 KB
package DB

import (
	"gopkg.in/mgo.v2"
	"gopkg.in/mgo.v2/bson"
)

var DBSession *mgo.Session
var CItem *mgo.Collection          //所有游玩项目内容
var CComplaint *mgo.Collection     //投诉
var CInvestigation *mgo.Collection //调查
var CMember *mgo.Collection        //会员
var CCommodity *mgo.Collection     //商城
var CTags *mgo.Collection          //标签
var CScenic *mgo.Collection        //景区
var CLine *mgo.Collection          //推荐线路
var DB *mgo.Database

type SItem struct {
	Id                 *bson.ObjectId `bson:"_id" json:"Id" valid:"required"`
	Name               string         `bson:"Name" json:"Name"`
	SubName            string         `bson:"SubName" json:"SubName"`
	Location           SLocation      `bson:"Location" json:"Location"`
	Tags               []STag         `bson:"Tags" json:"Tags"`
	Icon               string         `bson:"Icon" json:"Icon"`
	LimitHeight        string         `bson:"LimitHeight" json:"LimitHeight"`
	PlayDuration       string         `bson:"PlayDuration" json:"PlayDuration"`
	SceneTime          string         `bson:"SceneTime" json:"SceneTime"`
	Picture            []string       `bson:"Picture" json:"Picture"`
	Voice              string         `bson:"Voice" json:"Voice"`
	Tel                string         `bson:"Tel" json:"Tel"`
	AverageConsumption string         `bson:"AverageConsumption" json:"AverageConsumption"`
	Menu               string         `bson:"Menu" json:"Menu"`
	Time               string         `bson:"Time" json:"Time"`
}
type SLocation struct {
	Latitude  float64 `bson:"Latitude" json:"Latitude"`
	Longitude float64 `bson:"Longitude" json:"Longitude"`
}
type SCommodity struct {
	Id       *bson.ObjectId `bson:"_id" json:"Id" valid:"required"`
	Name     string         `bson:"Name" json:"Name"`
	Price    string         `bson:"Price" json:"Price"`
	ShopName string         `bson:"ShopName" json:"ShopName"`
	Location SLocation      `bson:"Location" json:"Location"`
	KvPhoto  string         `bson:"KvPhoto" json:"KvPhoto"`
	TopPhoto []string       `bson:"TopPhoto" json:"TopPhoto"`
	Images   []string       `bson:"Images" json:"Images"`
}
type SLine struct {
	Id           *bson.ObjectId `bson:"_id" json:"Id" valid:"required"`
	Name         string         `bson:"Name" json:"Name"`
	SubName      string         `bson:"SubName" json:"SubName"`
	Location     []SLocation    `bson:"Location" json:"Location"`
	PlayDuration string         `bson:"PlayDuration" json:"PlayDuration"`
	Suitable     string         `bson:"Suitable" json:"Suitable"`
	Content      string         `bson:"Content" json:"Content"`
	Annotations  []string       `bson:"Annotations" json:"Annotations"`
}

type SComplaint struct {
	Type    string   `bson:"Type" json:"Type"`
	Mobile  string   `bson:"Mobile" json:"Mobile"`
	Content string   `bson:"Content" json:"Content"`
	Image   []string `bson:"Image" json:"Image"`
}

type SInvestigation struct {
}
type SMember struct {
	Id       *bson.ObjectId `bson:"_id" json:"Id" valid:"required"`
	Password string         `bson:"Password" json:"Password"`
	Birthday string         `bson:"Birthday" json:"Birthday"`
	FullName string         `bson:"FullName" json:"FullName"`
	Mobile   string         `bson:"Mobile" json:"Mobile"`
	Openid   string         `bson:"Openid" json:"Openid"`
	Token    string         `bson:"Token" json:"Token"`
}

type STag struct {
	Type string `bson:"Type" json:"Type"`
	Name string `bson:"Name" json:"Name"`
}
type SScenic struct {
	Id                *bson.ObjectId `bson:"_id" json:"Id" valid:"required"`
	Name              string         `bson:"Name" json:"Name"`
	Describe          string         `bson:"Describe" json:"Describe"`
	OpenHours         string         `bson:"OpenHours" json:"OpenHours"`
	Mobile            string         `bson:"Mobile" json:"Mobile"`
	Address           string         `bson:"Address" json:"Address"`
	Location          SLocation      `bson:"Location" json:"Location"`
	Picture           []string       `bson:"Picture" json:"Picture"`
	ShopAdPicture     []string       `bson:"ShopAdPicture" json:"ShopAdPicture"`
	ItemScenicPicture []string       `bson:"ItemScenicPicture" json:"ItemScenicPicture"`
	ActivityPicture   []string       `bson:"ActivityPicture" json:"ActivityPicture"`
	VideoList         []string       `bson:"VideoList" json:"VideoList"`
}