Blame view

src/models/team.go 315 Bytes
3592dfd3   zhangqijia   重构models, 索引唯一索引
1
2
3
  package models
  
  import (
3592dfd3   zhangqijia   重构models, 索引唯一索引
4
  	"pro2d/protos/pb"
cad2b7f3   zhangqijia   reactor: 重构目录, 重构...
5
  	"pro2d/src/components/db"
1584eb4b   zhangqijia   修复创建唯一索引的bug
6
  	"strconv"
3592dfd3   zhangqijia   重构models, 索引唯一索引
7
8
9
10
11
12
13
  )
  
  type TeamModel struct {
  	*db.MgoColl
  	Team *pb.Team
  }
  
cad2b7f3   zhangqijia   reactor: 重构目录, 重构...
14
  func NewTeam(id int64) *TeamModel {
3592dfd3   zhangqijia   重构models, 索引唯一索引
15
16
17
18
  	data := &pb.Team{
  		Id: id,
  	}
  	m := &TeamModel{
1584eb4b   zhangqijia   修复创建唯一索引的bug
19
  		MgoColl: db.NewMongoColl(strconv.Itoa(int(id)), data),
cad2b7f3   zhangqijia   reactor: 重构目录, 重构...
20
  		Team:    data,
3592dfd3   zhangqijia   重构models, 索引唯一索引
21
22
23
24
  	}
  
  	return m
  }