正在显示
1 个修改的文件
包含
28 行增加
和
27 行删除
| @@ -2,6 +2,7 @@ package domain_service | @@ -2,6 +2,7 @@ package domain_service | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "github.com/tiptok/gocomm/xa/eda" | 4 | "github.com/tiptok/gocomm/xa/eda" |
| 5 | + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" | ||
| 5 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" | 6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" |
| 6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/dao" | 7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/dao" |
| 7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction" | 8 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction" |
| @@ -65,8 +66,11 @@ func (svr *PgLoginService) ManagerLogin(phone string, password string) (err erro | @@ -65,8 +66,11 @@ func (svr *PgLoginService) ManagerLogin(phone string, password string) (err erro | ||
| 65 | 66 | ||
| 66 | //合伙人统计信息 | 67 | //合伙人统计信息 |
| 67 | func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | 68 | func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
| 69 | + response := make(map[string]interface{}) | ||
| 70 | + response["id"] = protocolx.AdminTypePartner | ||
| 71 | + response["name"] = protocolx.AdminTypePartnerName | ||
| 68 | if len(svr.PartnerInfo) == 0 { | 72 | if len(svr.PartnerInfo) == 0 { |
| 69 | - return nil, nil | 73 | + return response, nil |
| 70 | } | 74 | } |
| 71 | var ( | 75 | var ( |
| 72 | OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext) | 76 | OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext) |
| @@ -96,7 +100,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -96,7 +100,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
| 96 | } | 100 | } |
| 97 | totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderType: domain.OrderReal}) | 101 | totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderType: domain.OrderReal}) |
| 98 | if e != nil { | 102 | if e != nil { |
| 99 | - return nil, e | 103 | + return response, e |
| 100 | } | 104 | } |
| 101 | if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil { | 105 | if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil { |
| 102 | totalBonus.Bonus += businessBonus.Bonus | 106 | totalBonus.Bonus += businessBonus.Bonus |
| @@ -110,7 +114,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -110,7 +114,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
| 110 | } | 114 | } |
| 111 | if e != nil { | 115 | if e != nil { |
| 112 | log.Error(e) | 116 | log.Error(e) |
| 113 | - return nil, e | 117 | + return response, e |
| 114 | } | 118 | } |
| 115 | var companys = make([]*Company, 0) | 119 | var companys = make([]*Company, 0) |
| 116 | for i := range companyList { | 120 | for i := range companyList { |
| @@ -138,19 +142,19 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | @@ -138,19 +142,19 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { | ||
| 138 | companys = append(companys, item) | 142 | companys = append(companys, item) |
| 139 | } | 143 | } |
| 140 | 144 | ||
| 141 | - response := make(map[string]interface{}) | ||
| 142 | - response["id"] = protocolx.AdminTypePartner | ||
| 143 | - response["name"] = protocolx.AdminTypePartnerName | ||
| 144 | response["companys"] = companys | 145 | response["companys"] = companys |
| 145 | return response, nil | 146 | return response, nil |
| 146 | } | 147 | } |
| 147 | func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | 148 | func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { |
| 149 | + response := make(map[string]interface{}) | ||
| 150 | + response["id"] = protocolx.AdminTypeManager | ||
| 151 | + response["name"] = protocolx.AdminTypeManagerName | ||
| 148 | if len(svr.Users) == 0 { | 152 | if len(svr.Users) == 0 { |
| 149 | - return nil, nil | 153 | + return response, nil |
| 150 | } | 154 | } |
| 151 | var ( | 155 | var ( |
| 152 | - companyList []*domain.Company | ||
| 153 | - //adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway() | 156 | + companyList []*domain.Company |
| 157 | + adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway() | ||
| 154 | ) | 158 | ) |
| 155 | doGetCompanyIds := func() []int64 { | 159 | doGetCompanyIds := func() []int64 { |
| 156 | var companies []int64 | 160 | var companies []int64 |
| @@ -165,28 +169,25 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | @@ -165,28 +169,25 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | ||
| 165 | c := companyList[i] | 169 | c := companyList[i] |
| 166 | 170 | ||
| 167 | //通过企业平台 校验模块权限 | 171 | //通过企业平台 校验模块权限 |
| 168 | - //var user *domain.Users | ||
| 169 | - //for j := range svr.Users { | ||
| 170 | - // if svr.Users[j].CompanyId == c.Id { | ||
| 171 | - // user = svr.Users[j] | ||
| 172 | - // break | ||
| 173 | - // } | ||
| 174 | - //} | ||
| 175 | - //if user != nil { | ||
| 176 | - // if code, e := adminApiGateway.UserAuth(user.Id, constant.BUSINESS_ADMIN_PLATFORM_ID); e != nil || code != 0 { | ||
| 177 | - // log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e.Error()) | ||
| 178 | - // continue | ||
| 179 | - // } else { | ||
| 180 | - // log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e) | ||
| 181 | - // } | ||
| 182 | - //} | 172 | + var user *domain.Users |
| 173 | + for j := range svr.Users { | ||
| 174 | + if svr.Users[j].CompanyId == c.Id { | ||
| 175 | + user = svr.Users[j] | ||
| 176 | + break | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + if user != nil { | ||
| 180 | + if code, e := adminApiGateway.UserAuth(user.Id, constant.BUSINESS_ADMIN_PLATFORM_ID); e != nil || code != 0 { | ||
| 181 | + log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e.Error()) | ||
| 182 | + continue | ||
| 183 | + } else { | ||
| 184 | + log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e) | ||
| 185 | + } | ||
| 186 | + } | ||
| 183 | item := newCompanyBase(c) | 187 | item := newCompanyBase(c) |
| 184 | companys = append(companys, item) | 188 | companys = append(companys, item) |
| 185 | } | 189 | } |
| 186 | 190 | ||
| 187 | - response := make(map[string]interface{}) | ||
| 188 | - response["id"] = protocolx.AdminTypeManager | ||
| 189 | - response["name"] = protocolx.AdminTypeManagerName | ||
| 190 | response["companys"] = companys | 191 | response["companys"] = companys |
| 191 | return response, nil | 192 | return response, nil |
| 192 | } | 193 | } |
-
请 注册 或 登录 后发表评论