// 获取会员汇总信息 func (this *memberService) GetMemberSummary(memberId int) *dto.MemberSummary { var m member.IMember = this._rep.GetMember(memberId) if m != nil { mv := m.GetValue() acv := m.GetAccount().GetValue() lv := m.GetLevel() pro := m.Profile().GetProfile() return &dto.MemberSummary{ Id: m.GetAggregateRootId(), Usr: mv.Usr, Name: pro.Name, Avatar: format.GetResUrl(pro.Avatar), Exp: mv.Exp, Level: mv.Level, LevelName: lv.Name, Integral: acv.Integral, Balance: acv.Balance, PresentBalance: acv.PresentBalance, GrowBalance: acv.GrowBalance, GrowAmount: acv.GrowAmount, GrowEarnings: acv.GrowEarnings, GrowTotalEarnings: acv.GrowTotalEarnings, UpdateTime: mv.UpdateTime, } } return nil }
func (this *memberService) GetMemberList(ids []int) []*dto.MemberSummary { list := this._query.GetMemberList(ids) for _, v := range list { v.Avatar = format.GetResUrl(v.Avatar) } return list }
func (this *saleService) setChild(list []sale.ICategory, dst *sale.Category) { for _, v := range list { if vv := v.GetValue(); vv.ParentId == dst.Id && vv.Enabled == 1 { if dst.Child == nil { dst.Child = []*sale.Category{} } vv.Icon = format.GetResUrl(vv.Icon) dst.Child = append(dst.Child, vv) } } }
func (this *saleService) GetBigCategories(mchId int) []*sale.Category { cats := this.getCategoryManager(mchId).GetCategories() list := []*sale.Category{} for _, v := range cats { if v2 := v.GetValue(); v2.ParentId == 0 && v2.Enabled == 1 { v2.Icon = format.GetResUrl(v2.Icon) list = append(list, v2) } } return list }
func (this *saleService) GetCategories(merchantId int) []*sale.Category { sl := this._rep.GetSale(merchantId) cats := sl.CategoryManager().GetCategories() var list []*sale.Category = make([]*sale.Category, len(cats)) for i, v := range cats { vv := v.GetValue() vv.Icon = format.GetResUrl(vv.Icon) list[i] = vv } return list }
// 获取广告及广告数据, 用于展示关高 func (this *adService) GetAdAndDataByKey(adUserId int, key string) *ad.AdDto { if adv := this.getUserAd(adUserId).GetByPositionKey(key); adv != nil { switch adv.Type() { case ad.TypeGallery: dto := adv.Dto() gallary := dto.Data.(ad.ValueGallery) for _, v := range gallary { v.ImageUrl = format.GetResUrl(v.ImageUrl) } dto.Data = gallary return dto case ad.TypeImage: dto := adv.Dto() img := dto.Data.(*ad.Image) img.ImageUrl = format.GetResUrl(img.ImageUrl) return dto } return adv.Dto() } return nil }
func (this *saleService) GetChildCategories(mchId, parentId int) []*sale.Category { cats := this.getCategoryManager(mchId).GetCategories() list := []*sale.Category{} for _, v := range cats { if vv := v.GetValue(); vv.ParentId == parentId && vv.Enabled == 1 { v2 := *vv v2.Icon = format.GetResUrl(v2.Icon) list = append(list, &v2) this.setChild(cats, &v2) } } return list }
// 获取我邀请的会员及会员邀请的人数 func (this *memberService) GetMyPagedInvitationMembers(memberId int, begin, end int) (total int, rows []*dto.InvitationMember) { iv := this._rep.CreateMember(&member.Member{Id: memberId}).Invitation() total, rows = iv.GetInvitationMembers(begin, end) if l := len(rows); l > 0 { arr := make([]int, l) for i := 0; i < l; i++ { arr[i] = rows[i].MemberId } num := iv.GetSubInvitationNum(arr) for i := 0; i < l; i++ { rows[i].InvitationNum = num[rows[i].MemberId] rows[i].Avatar = format.GetResUrl(rows[i].Avatar) } } return total, rows }
// 获取商城的数据 func GetOnlineShopData(shopId int) *shop.ShopDto { var v shop.ShopDto sto := GetKVS() key := GetShopDataKey(shopId) if sto.Get(key, &v) != nil { mchId := GetMchIdByShopId(shopId) if v2 := dps.ShopService.GetShopData(mchId, shopId); v2 != nil { v3 := v2.Data.(shop.OnlineShop) v3.Logo = format.GetResUrl(v3.Logo) v2.Data = &v3 if v2 != nil { sto.SetExpire(key, *v2, DefaultMaxSeconds) } return v2 } } return &v }