| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- // 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
- }
|