Пример #1
0
// 保存订单的促销绑定
func (this *orderRepImpl) SavePromotionBindForOrder(v *order.OrderPromotionBind) (int, error) {
	var err error
	var orm = this.Connector.GetOrm()
	if v.Id > 0 {
		_, _, err = orm.Save(v.Id, v)
	} else {
		var id64 int64
		_, id64, err = orm.Save(nil, v)
		v.Id = int(id64)
	}
	return v.Id, err
}
Пример #2
0
// 保存企业信息
func (this *profileManagerImpl) SaveEnterpriseInfo(v *merchant.EnterpriseInfo) (int, error) {
	e := this.GetReviewingEnterpriseInfo()
	if e == nil {
		e = &merchant.EnterpriseInfo{}
	}
	this.copy(v, e)
	dt := time.Now().Unix()
	e.Reviewed = 0
	e.IsHandled = 0
	e.ReviewTime = dt
	e.UpdateTime = dt
	this._list = nil //clean cache
	return orm.Save(tmp.Db().GetOrm(), e, e.Id)
}
Пример #3
0
// 保存子订单
func (o *orderRepImpl) SaveSubOrder(v *order.SubOrder) (int, error) {
	var err error
	var statusIsChanged bool //业务状态是否改变
	d := o.Connector

	if v.Id <= 0 {
		statusIsChanged = true
	} else {
		var oriStatus int
		d.ExecScalar("SELECT state FROM sale_sub_order WHERE id=?", &oriStatus, v.Id)
		statusIsChanged = oriStatus != v.State // 业务状态是否改变
	}
	v.Id, err = orm.Save(o.GetOrm(), v, v.Id)

	//如果业务状态已经发生改变,则提交到队列
	if statusIsChanged && v.Id > 0 {
		rc := core.GetRedisConn()
		rc.Do("RPUSH", variable.KvOrderBusinessQueue, v.Id)
		rc.Close()
		//log.Println("-----order ",v.Id,v.Status,statusIsChanged,err)
	}
	return v.Id, err
}
Пример #4
0
// 保存发货商品项
func (s *shipmentRep) SaveShipmentItem(v *shipment.Item) (int, error) {
	return orm.Save(s.GetOrm(), v, v.Id)
}
Пример #5
0
// 保存发货单
func (s *shipmentRep) SaveShipmentOrder(o *shipment.ShipmentOrder) (int, error) {
	return orm.Save(s.GetOrm(), o, o.Id)
}
Пример #6
0
// 保存模板的地区设置
func (this *expressRep) SaveExpressTemplateAreaSet(v *express.ExpressAreaTemplate) (int, error) {
	return orm.Save(this.GetOrm(), v, v.Id)
}
Пример #7
0
// 保存快递公司
func (this *expressRep) SaveExpressProvider(v *express.ExpressProvider) (int, error) {
	this.ProvidersCache = nil
	return orm.Save(this.GetOrm(), v, v.Id)
}
Пример #8
0
// 保存商品销售快照
func (this *goodsRep) SaveSaleSnapshot(v *goods.SalesSnapshot) (int, error) {
	return orm.Save(this.Connector.GetOrm(), v, v.Id)
}
Пример #9
0
// 保存子订单的商品项,并返回编号和错误
func (this *orderRepImpl) SaveOrderItem(subOrderId int, v *order.OrderItem) (int, error) {
	v.OrderId = subOrderId
	return orm.Save(this.GetOrm(), v, v.Id)
}
Пример #10
0
func (this *orderRepImpl) SaveOrder(v *order.Order) (int, error) {
	return orm.Save(this.GetOrm(), v, v.Id)
}
Пример #11
0
func (this *profileManagerImpl) save(e *merchant.EnterpriseInfo) error {
	_, err := orm.Save(tmp.Db().GetOrm(), e, e.Id)
	return err
}