Example #1
0
File: sale.go Project: honj51/go2o
func (this *Sale) CreateGoods(v *sale.ValueGoods) sale.IGoods {
	if v.CreateTime == 0 {
		v.CreateTime = time.Now().Unix()
	}

	if v.UpdateTime == 0 {
		v.UpdateTime = v.CreateTime
	}

	//todo: 判断category

	return newGoods(this, v, this.saleRep)
}
Example #2
0
File: goods.go Project: honj51/go2o
func (this *Goods) SetValue(v *sale.ValueGoods) error {
	if v.Id == this.value.Id {
		v.CreateTime = this.value.CreateTime
		this.value = v
	}
	this.value.UpdateTime = time.Now().Unix()
	return nil
}