作者 唐旭辉

更新

... ... @@ -27,7 +27,6 @@ func main() {
if err != nil {
fmt.Printf("启动kafka消息消费者失败 err%s \n", err)
logs.Error("启动kafka消息消费者失败:%s", err)
return
}
for {
select {
... ...
... ... @@ -793,7 +793,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
return orders, cnt, nil
}
//GetOrderBestshopInfo 获取来源于海鲜干货订单的详情以及分红数据
//GetOrderBestshopInfo 获取来源于xiangmi订单的详情以及分红数据
func (service OrderInfoService) GetOrderBestshopInfoWithBonus(orderBaseId int64, companyId int64) (interface{}, error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
... ... @@ -877,12 +877,12 @@ func (service OrderInfoService) GetOrderBestshopInfoWithBonus(orderBaseId int64,
orderData.PartnerInfo = partnerInfo.Partner
orderBestshopData, err = orderBestshopRepository.FindOne(domain.OrderBestshopFindOneQuery{OrderId: orderData.DataFrom.DataId})
if err != nil {
e := fmt.Sprintf("获取海鲜干货订单(order_bestshop)数据失败,id=%d,err=%s", orderData.DataFrom.DataId, err)
e := fmt.Sprintf("获取xiangmi订单(order_bestshop)数据失败,id=%d,err=%s", orderData.DataFrom.DataId, err)
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
}
orderGoodBestshop, err = orderGoodBestshopRepository.Find(domain.OrderGoodBestshopFindQuery{OrderId: orderBestshopData.Id})
if err != nil {
e := fmt.Sprintf("获取海鲜干货订单货品(order_good_bestshop)数据失败,order_id=%d,err=%s", orderBestshopData.Id, err)
e := fmt.Sprintf("获取xiangmi订单货品(order_good_bestshop)数据失败,order_id=%d,err=%s", orderBestshopData.Id, err)
return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
}
orderBestshopData.Goods = orderGoodBestshop
... ...
... ... @@ -27,7 +27,7 @@ func NewOrderInfoService(option map[string]interface{}) *SyncOrderService {
return newService
}
//SyncOrderFromBestshop 接收来源于海鲜干货小程序的订单数据
//SyncOrderFromBestshop 接收来源于xiangmi小程序的订单数据
func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBestshop) error {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
... ... @@ -186,7 +186,7 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
}
}
if !canCopyOrder {
logs.Warning("公司未设置海鲜干货的小程序原始id; order_bestshop.id=%d", orderBestshop.Id)
logs.Warning("公司未设置xiangmi小程序原始id; order_bestshop.id=%d", orderBestshop.Id)
return nil
}
var (
... ... @@ -213,13 +213,13 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord
for i := range ordergoods {
ordergoods[i].OrderId = orderbase.Id
}
//TODO 添加goods
// 添加goods
err = orderGoodRepository.Save(ordergoods)
if err != nil {
e := fmt.Sprintf("添加order_good数据失败%s", err)
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
}
//TODO 更新isCopy
// 更新isCopy
orderBestshop.IsCopy = true
err = orderBestshopRepository.Edit(orderBestshop)
if err != nil {
... ...
... ... @@ -28,7 +28,7 @@ func NewOrderBonusService(tcx *transaction.TransactionContext) *OrderBonusServic
}
//UpdateBounsWithGoodNumber 分红时,因修改订单中商品的数量发生分红变动
//目前只处理 海鲜干货的订单 即 order_type = OrderTypeBestShop (3)
//目前只处理 xiangmi的订单 即 order_type = OrderTypeBestShop (3)
func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId int64, goodId int64, goodWithNumber int, reason string) error {
var (
userRepository domain.UsersRepository
... ... @@ -129,7 +129,7 @@ func (serve *OrderBonusService) UpdateBounsByGoodNumber(orderId int64, adminId i
}
//UpdateBounsByPartnerBonusPercent 分红时,因修改订单中商品的合伙人分行比例发生分红变动
////目前只处理 海鲜干货的订单 即 order_type = OrderTypeBestShop (3)
////目前只处理 xiangmi的订单 即 order_type = OrderTypeBestShop (3)
func (serve *OrderBonusService) UpdateBounsByPartnerBonusPercent(orderId int64, adminId int64, goodId int64, partnerPercent float64, reason string) error {
var (
userRepository domain.UsersRepository
... ...
... ... @@ -82,7 +82,7 @@ func StartConsumer(ctx context.Context) (func(), error) {
config.Version = sarama.V0_11_0_2
consumerGroup, err := sarama.NewConsumerGroup(consumer.kafkaHosts, consumer.groupId, config)
if err != nil {
return nil, err
return func() {}, err
}
wg := &sync.WaitGroup{}
wg.Add(1)
... ...