// Package service /** * @ File: shop * @ Date: 2021/4/13 10:41 * @ Author: JYQ * @ Description: */ package service import ( pb "sportfitness/base/api/grpc/base" "sportfitness/base/assembly/base/repository/postgre" "sportfitness/base/errors" "sportfitness/base/repository/grpc/bsw/im" ) type Shop struct { base } func (s Shop) ShopGroupQuery(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopGroupQuery(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } func (s Shop) ManageableShopList(token string, r *pb.ShopListRequest) *pb.ShopListReply { // 获取商家可用商家列表shopId传入0,因为是通用接口 _ = s.checkPermission(token, 0) status := s.WebStatusToManageStatus(r.Status) rst := im.ShopListRequest(r.Name, status, r.SId) println(rst) var info []*pb.ShopInfo if len(rst.List) > 0 { l := &pb.ShopInfo{} for _, v := range rst.List { l.ShopId = v.ShopId l.Name = v.Name l.SId = v.SId l.Addr = v.Addr l.Phone = v.Phone l.Contacts = v.Contacts l.CreatedAt = v.CreatedAt l.UpdatedAt = v.UpdatedAt l.Status = s.ManageStatusToWebStatus(v.Status) info = append(info, l) } } return &pb.ShopListReply{List: info} } // GetShopNavi 获取商家导航 func (s Shop) GetShopNavi(token string, r *pb.GetShopNaviRequest) *pb.GetShopNaviReply { optId := s.checkPermission(token, r.GetShopId()) rst := im.GetShopNavi(int64(optId), r.GetShopId(), r.GetParentId()) var info []*pb.Column if len(rst.List) > 0 { l := &pb.Column{} for _, v := range rst.List { l.Name = v.Name l.Url = v.Url l.Code = v.Code l.Sn = v.Sn l.NavShow = v.NavShow l.Id = v.Id l.Status = s.ManageStatusToWebStatus(v.Status) info = append(info, l) } } return &pb.GetShopNaviReply{List: info} } func (s Shop) ShopGroupAdd(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopGroupAdd(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } func (s Shop) ShopGroupEdit(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopGroupEdit(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } func (s Shop) ShopGroupStatusEdit(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopGroupStatusEdit(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } func (s Shop) ShopGroupDetailsQuery(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopGroupDetailsQuery(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } func (s Shop) ShopVenueQuery(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueQuery(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopVenueAdd 商家区域添加 @token:token func (s Shop) ShopVenueAdd(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueAdd(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopVenueEdit 商家区域编辑 func (s Shop) ShopVenueEdit(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueEdit(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopVenueStatusEdit 商家区域状态修改 func (s Shop) ShopVenueStatusEdit(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueStatusEdit(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopVenueEquipQuery 商家设备查询 func (s Shop) ShopVenueEquipQuery(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueEquipQuery(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopVenueEquipAdd 商家设备添加 func (s Shop) ShopVenueEquipAdd(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueEquipQuery(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopVenueEquipEdit 商家设备编辑 func (s Shop) ShopVenueEquipEdit(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueEquipEdit(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopVenueEquipStatusEdit 商家设备状态修改 func (s Shop) ShopVenueEquipStatusEdit(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueEquipStatusEdit(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopVenueEquipStatusDel 商家设备删除 func (s Shop) ShopVenueEquipStatusDel(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopVenueEquipStatusDel(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopConfigQuery 商家配置查询 func (s Shop) ShopConfigQuery(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopConfigQuery(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst } // ShopConfigEdit 商家设备删除 func (s Shop) ShopConfigEdit(token string, objectShopId int64, jsonStr string, sign string) string { optId := s.checkPermission(token, objectShopId) rst, err := postgre.PGShop{}.ShopConfigEdit(optId, objectShopId, jsonStr, sign) if err != nil { panic(errors.PGError) } return rst }