コード例 #1
0
ファイル: goods_rep.go プロジェクト: yonglehou/go2o
// 保存会员价
func (this *goodsRep) SaveGoodsLevelPrice(v *goods.MemberPrice) (id int, err error) {
	//if v.Id <= 0 {
	//	this.Connector.ExecScalar(`SELECT MAX(id) FROM gs_member_price where goods_id=? and level=?`,
	//		&v.Id, v.GoodsId, v.Level)
	//}
	if v.Id > 0 {
		_, _, err = this.Connector.GetOrm().Save(v.Id, v)
		id = v.Id
	} else {
		var id64 int64
		_, id64, err = this.Connector.GetOrm().Save(nil, v)
		v.Id = int(id64)
	}
	return id, err
}