示例#1
0
func (this *shopRep) SaveShop(v *shop.Shop) (int, error) {
	orm := this.Connector.GetOrm()
	var err error
	if v.Id > 0 {
		_, _, err = orm.Save(v.Id, v)
	} else {
		var id int64
		_, id, err = orm.Save(nil, v)
		v.Id = int(id)
	}
	return v.Id, err
}
示例#2
0
// 新建商店
func (this *shopManagerImpl) CreateShop(v *shop.Shop) shop.IShop {
	v.CreateTime = time.Now().Unix()
	v.MerchantId = this._merchant.GetAggregateRootId()
	return newShop(this, v, this._rep)
}
示例#3
0
文件: shop.go 项目: yonglehou/go2o
func (this *ShopImpl) check(v *shop.Shop) error {
	v.Name = strings.TrimSpace(v.Name)
	return nil
}