Documentation ¶
Index ¶
- Constants
- Variables
- func Find(CN string, results interface{}, sort string, limit int, selectM bson.M, ...) error
- func FindOne(CN string, query, result interface{}) error
- func Insert(cn string, docs interface{}) error
- func One(CN string, id bson.ObjectId, result interface{}) error
- func Remove(cn string, selector bson.M) error
- func Update(cn string, selector bson.M, update bson.M) error
- type Address
- type Avatar
- type BankCard
- type Comment
- type Date
- type ExposureArticle
- func (ea ExposureArticle) Find(sort string, limit int, selectM bson.M, condition bson.M) ([]ExposureArticle, error)
- func (ea *ExposureArticle) Insert() error
- func (ea *ExposureArticle) Remove(condition bson.M) error
- func (ea *ExposureArticle) Update() error
- func (ea ExposureArticle) UpdateCond(cond bson.M) error
- type IDCard
- type Message
- type Recharge
- type Reply
- type Thumb
- type TipOff
- type User
- func (u *User) Create() error
- func (u User) FindAllByCondition(condition bson.M) ([]User, error)
- func (u *User) GetInfoByID() error
- func (u User) Update(selector, update bson.M) error
- func (u *User) UpdateByID() error
- func (u *User) UpdateIdCard() error
- func (u *User) VaildIDCard() error
- func (u *User) ValidUser() error
- type Wallet
Constants ¶
View Source
const ( DbName = "luobo" UserCollection = "user" )
View Source
const (
ArticleCN = "article"
)
Variables ¶
View Source
var DB *mgo.Database
Functions ¶
Types ¶
type Address ¶
type Address struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id,omitempty"` UserName string `json:"userName" form:"userName" query:"userName" bson:"userName" binding:"required"` Phone string `json:"phone" form:"phone" query:"phone" bson:"phone" binding:"required"` Province string `json:"province" form:"province" query:"province" bson:"province" binding:"required"` City string `json:"city" form:"city" query:"city" bson:"city" binding:"required"` County string `json:"county" form:"county" query:"county" bson:"county" binding:"required"` Street string `json:"street" form:"street" query:"street" bson:"street" binding:"required"` Default bool `json:"default" form:"default" query:"default" bson:"default" binding:"exists"` }
type Avatar ¶
type BankCard ¶
type BankCard struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id"` Code string `json:"code" form:"code" query:"code" bson:"code"` //名字 Name string `json:"name" form:"name" query:"name" bson:"name"` //名字 Number string `json:"number" form:"number" query:"number" bson:"number"` //卡号 }
银行卡
type Comment ¶
type Comment struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id"` Type string `json:"type" form:"type" query:"type" bson:"type" binding:"required"` ArticleID string `json:"articleID" form:"articleID" query:"articleID" bson:"articleID" binding:"required"` Anonymous bool `json:"anonymous" form:"anonymous" query:"anonymous" bson:"anonymous" binding:"exists"` Content string `json:"content" form:"content" query:"content" bson:"content" binding:"required"` IP string `json:"ip" form:"ip" query:"ip" bson:"ip" binding:"-"` CreateAt time.Time `json:"createAt" form:"createAt" query:"createAt" bson:"createAt" binding:"-"` By string `json:"by" form:"by" query:"by" bson:"by" binding:"-"` AnNickName string `json:"anNickName" form:"anNickName" query:"anNickName" bson:"anNickName" binding:"required"` ThumbsUps int `json:"thumbsUps" form:"thumbsUps" query:"thumbsUps" bson:"thumbsUps" binding:"-"` ReplyCommentID string `json:"replyCommentID" form:"replyCommentID" query:"replyCommentID" bson:"replyCommentID" binding:"-"` Reply Reply `json:"reply" form:"reply" query:"reply" bson:"-" binding:"-"` }
type ExposureArticle ¶
type ExposureArticle struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id" binding:"-"` Title string `json:"title" form:"title" query:"title" bson:"title" binding:"required"` //文章标题 Tags []string `json:"tags" form:"tags[]" query:"tags" bson:"tags" binding:"checkTags"` //标签 OccurrenceDate time.Time `` //发生时间 /* 145-byte string literal not displayed */ Location string `json:"location" form:"location" query:"location" bson:"location" binding:"required"` //发生地 Domain string `json:"domain" form:"domain" query:"domain" bson:"domain" binding:"required"` //涉事对象 Wastage string `json:"wastage" form:"wastage" query:"wastage" bson:"wastage" binding:"required"` //损失 Content string `json:"content" form:"content" query:"content" bson:"content" binding:"required"` //文章内容 State string `json:"state" form:"state" query:"state" bson:"state"` //文章状态 CreateAt time.Time `json:"createAt" form:"-" query:"createAt" bson:"createAt" binding:"-"` UpdateAt time.Time `json:"updateAt" form:"-" query:"updateAt" bson:"updateAt" binding:"-"` //创建时间 NickNamePublish bool `json:"nickNamePublish" form:"nickNamePublish" query:"nickNamePublish" bson:"nickNamePublish" binding:"exists"` //匿名/实名 CreateBy string `json:"createBy" form:"createBy" query:"createBy" bson:"createBy"` //创建人 NickName string `json:"nickName" form:"nickName" query:"nickName" bson:"nickName"` Auditor string `json:"auditor" form:"auditor" query:"auditor" bson:"auditor"` //审核人 AuditOpinion string `json:"auditOpinion" form:"auditOpinion" query:"auditOpinion" bson:"auditOpinion"` //审核意见 AuditTime time.Time `json:"auditTime" form:"-" query:"auditTime" bson:"auditTime" binding:"-"` //审核时间 Comments int `json:"comments" form:"-" query:"auditTime" bson:"comments" binding:"-"` Views int `json:"views" form:"-" query:"views" bson:"views" binding:"-"` ThumbsUps int `json:"thumbsUps" form:"-" query:"thumbsUps" bson:"thumbsUps" binding:"-"` ThumbsDowns int `json:"thumbsDowns" form:"-" query:"thumbsDowns" bson:"thumbsDowns" binding:"-"` }
type IDCard ¶
type IDCard struct { Name string `json:"name" form:"name" query:"name"` //名字 Gender string `json:"gender" form:"gender" query:"gender"` //性别 IdCardNumber string `json:"id_card_number" form:"id_card_number" query:"idCardNumber" bson:"idCardNumber"` //身份证号 Birthday string `json:"birthday" form:"birthday" query:"birthday"` //生日 Race string `json:"race" form:"race" query:"race"` //名族 Address string `json:"address" form:"address" query:"address"` //地址 // BeginDate time.Time `json:"beginDate" form:"beginDate" query:"beginDate"` // EndDate time.Time `json:"endDate" form:"endDate" query:"endDate"` //有效日期 ValidDate string `json:"valid_date" form:"valid_date" query:"validDate" bson:"validDate"` //有效日期 IssuedBy string `json:"issued_by" form:"issued_by" query:"issuedBy" bson:"issuedBy"` //签发机关 }
type Message ¶
type Message struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id" binding:"-"` From string `json:"from" form:"from" query:"from" bson:"from" binding:"required"` Type string `json:"type" form:"type" query:"type" bson:"type" binding:"required"` To string `json:"to" form:"to" query:"to" bson:"to" binding:"required"` Content string `json:"content" form:"content" query:"content" bson:"content" binding:"required"` CreateAt time.Time `json:"createAt" form:"createAt" query:"createAt" bson:"createAt" binding:"-"` State string `json:"state" form:"state" query:"state" bson:"state" binding:"-"` }
func (Message) GetNewMessageCount ¶
type Recharge ¶
type Recharge struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id"` TradeNumber string `json:"tradeNumber" form:"tradeNumber" query:"tradeNumber" bson:"tradeNumber"` //交易号 Type int `json:"type" form:"type" query:"type" bson:"type"` //转账类型 Amount float64 `json:"amount" form:"amount" query:"amount" bson:"amount"` //转账金额 UserID string `json:"userID" form:"userID" query:"userID" bson:"userID"` //用户号 Operator string `json:"operator" form:"operator" query:"operator" bson:"operator"` //操作人 OperatorAt time.Time `json:"operatorAt" form:"operatorAt" query:"operatorAt" bson:"operatorAt"` State string `json:"state" form:"state" query:"state" bson:"state"` //订单状态 CreateAt time.Time `json:"createAt" form:"createAt" query:"createAt" bson:"createAt"` }
func (*Recharge) FindAllByCondition ¶
type Reply ¶
type Reply struct { UserID string `json:"userID" form:"userID" query:"userID" bson:"userID" binding:"-"` Content string `json:"content" form:"content" query:"content" bson:"content" binding:"-"` AnNickName string `json:"anNickName" form:"anNickName" query:"anNickName" bson:"anNickName" binding:"-"` Anonymous bool `json:"anonymous" form:"anonymous" query:"anonymous" bson:"anonymous" binding:"-"` }
type Thumb ¶
type Thumb struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id" binding:"-"` Type string `json:"type" form:"type" query:"type" bson:"type" binding:"-"` //文章 评论 ArticleID string `json:"articleID" form:"articleID" query:"articleID" bson:"articleID" binding:"required"` CommentID string `json:"commentID" form:"commentID" query:"commentID" bson:"commentID" binding:"-"` By string `json:"by" form:"by" query:"by" bson:"by" binding:"-"` IP string `json:"ip" form:"ip" query:"ip" bson:"ip" binding:"-"` CreateAt time.Time `json:"createAt" form:"createAt" query:"createAt" bson:"createAt" binding:"-"` }
type TipOff ¶
type TipOff struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id" binding:"-"` ArticleID string `json:"articleID" form:"articleID" query:"articleID" bson:"articleID" binding:"required"` CommentID string `json:"commentID" form:"commentID" query:"commentID" bson:"commentID"` Category string `json:"category" form:"category" query:"category" bson:"category" binding:"required"` Content string `json:"content" form:"content" query:"content" bson:"content" binding:"required"` CreateAt time.Time `json:"createAt" form:"createAt" query:"createAt" bson:"createAt" binding:"-"` CreatBy string `json:"creatBy" form:"creatBy" query:"creatBy" bson:"creatBy" binding:"-"` Auditor string `json:"auditor" form:"auditor" query:"auditor" bson:"auditor" binding:"-"` AuditOpinion string `json:"auditOpinion" form:"auditOpinion" query:"auditOpinion" bson:"auditOpinion" binding:"-"` AuditAt time.Time `json:"auditAt" form:"auditAt" query:"auditAt" bson:"auditAt" binding:"-"` }
type User ¶
type User struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id"` UserName string `json:"userName" form:"userName" query:"userName"` AnNickName string `json:"anNickName" form:"anNickName" query:"anNickName"` NickName string `json:"nickName" form:"nickName" query:"nickName"` Email string `json:"email" form:"email" query:"email"` Passwd string `json:"-" form:"passwd" query:"passwd"` Phone string `json:"phone" form:"phone" query:"phone"` IDCard *IDCard `json:"idCard" form:"idCard" query:"idCard" bson:"idCard"` IDCardValid bool `json:"idCardValid" form:"idCardValid" query:"idCardValid"` BankCards []BankCard `json:"bankCards" form:"bankCards[]" query:"bankCards" bson:"bankCards"` Avatar string `json:"avatar" form:"avatar" query:"avatar" ` Address []Address `json:"address" form:"address[]" query:"address" bson:"address"` DefaultAddress string `json:"defaultAddress" form:"defaultAddress" query:"defaultAddress" bson:"defaultAddress"` State string `json:"state" form:"state" query:"state" ` //用户状态 Wallet Wallet `json:"wallet" form:"wallet" query:"wallet" bson:"wallet"` // ValidCode string `json:"validCode" form:"validCode" query:"validCode"` CreateAt time.Time `json:"createAt" form:"createAt" query:"createAt"` }
func (*User) GetInfoByID ¶
func (*User) UpdateIdCard ¶
func (*User) VaildIDCard ¶
type Wallet ¶
type Wallet struct { ID bson.ObjectId `json:"id" form:"id" query:"id" bson:"_id"` TotalAmount float64 `json:"totalAmount" form:"totalAmount" query:"totalAmount" bson:"totalAmount"` //总金额 AvailableAmount float64 `json:"availableAmount" form:"availableAmount" query:"availableAmount" bson:"availableAmount"` //保证金 FreezingAmount float64 `json:"freezingAmount" form:"freezingAmount" query:"freezingAmount" bson:"freezingAmount"` //可用保证金 }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.