示例#1
0
文件: services.go 项目: honj51/go2o
func Init(ctx gof.App) {
	Context := ctx
	db := Context.Db()

	/** Repository **/
	userRep := repository.NewUserRep(db)
	memberRep := repository.NewMemberRep(db)
	partnerRep := repository.NewPartnerRep(db, userRep, memberRep)
	promRep := repository.NewPromotionRep(db, memberRep)
	saleRep := repository.NewSaleRep(db)
	deliveryRep := repository.NewDeliverRep(db)
	spRep := repository.NewShoppingRep(db, partnerRep, saleRep, promRep, memberRep, deliveryRep)

	/** Query **/
	mq := query.NewMemberQuery(db)
	pq := query.NewPartnerQuery(ctx)

	/** Service **/
	PromService = NewPromotionService(promRep)
	ShoppingService = NewShoppingService(spRep)
	MemberService = NewMemberService(memberRep, mq)
	PartnerService = NewPartnerService(partnerRep, pq)
	SaleService = NewSaleService(saleRep)
	DeliverService = NewDeliveryService(deliveryRep)
}
示例#2
0
文件: services.go 项目: sunxboy/go2o
func Init(ctx gof.App) {
	Context := ctx
	db := Context.Db()

	/** Repository **/
	userRep := repository.NewUserRep(db)
	memberRep := repository.NewMemberRep(db)
	goodsRep := repository.NewGoodsRep(db)
	tagSaleRep := repository.NewTagSaleRep(db)
	promRep := repository.NewPromotionRep(db, goodsRep, memberRep)
	saleRep := repository.NewSaleRep(db, tagSaleRep, goodsRep, promRep)
	partnerRep := repository.NewPartnerRep(db, userRep, memberRep)

	deliveryRep := repository.NewDeliverRep(db)
	contentRep := repository.NewContentRep(db)
	adRep := repository.NewAdvertisementRep(db)
	spRep := repository.NewShoppingRep(db, partnerRep, saleRep, goodsRep, promRep, memberRep, deliveryRep)

	/** Query **/
	memberQue := query.NewMemberQuery(db)
	partnerQue := query.NewPartnerQuery(ctx)
	contentQue := query.NewContentQuery(db)

	/** Service **/
	PromService = NewPromotionService(promRep)
	ShoppingService = NewShoppingService(spRep)
	MemberService = NewMemberService(memberRep, memberQue)
	PartnerService = NewPartnerService(partnerRep, partnerQue)
	SaleService = NewSaleService(saleRep, goodsRep)
	DeliverService = NewDeliveryService(deliveryRep)
	ContentService = NewContentService(contentRep, contentQue)
	AdvertisementService = NewAdvertisementService(adRep)
}