Example #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
}
Example #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)
}
Example #3
0
func (this *ShopImpl) check(v *shop.Shop) error {
	v.Name = strings.TrimSpace(v.Name)
	return nil
}