Exemplo n.º 1
0
func (this *Shopping) SmartConfirmOrder(order shopping.IOrder) error {
	var err error
	v := order.GetValue()
	log.Printf("[ AUTO][OrderSetup]:%s - Confirm \n", v.OrderNo)
	var shop partner.IShop

	if biShops == nil {
		biShops = this._partner.GetBusinessInShops()
	}

	if len(biShops) == 1 {
		shop = biShops[0]
	} else {
		shop, err = this.SmartChoiceShop(v.DeliverAddress)
		if err != nil {
			log.Println(err)
			order.Suspend("智能分配门店失败!原因:" + err.Error())
			return err
		}
	}

	if shop != nil {

		sv := shop.GetValue()
		order.SetShop(shop.GetDomainId())
		err = order.Confirm()
		//err = order.Process()

		order.AppendLog(enum.ORDER_LOG_SETUP, false, fmt.Sprintf(
			"自动分配门店:%s,电话:%s", sv.Name, sv.Phone))
	}
	return err
}
Exemplo n.º 2
0
// 更新账户
func updateAccountForOrder(m member.IMember, order shopping.IOrder) {
	acc := m.GetAccount()
	ov := order.GetValue()
	acc.TotalFee += ov.Fee
	acc.TotalPay += ov.PayFee
	acc.UpdateTime = time.Now().Unix()
	m.SaveAccount()
}