...
|
...
|
@@ -2,6 +2,7 @@ package domain_service |
|
|
|
|
|
import (
|
|
|
"github.com/tiptok/gocomm/xa/eda"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/dao"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction"
|
...
|
...
|
@@ -65,8 +66,11 @@ func (svr *PgLoginService) ManagerLogin(phone string, password string) (err erro |
|
|
|
|
|
//合伙人统计信息
|
|
|
func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) {
|
|
|
response := make(map[string]interface{})
|
|
|
response["id"] = protocolx.AdminTypePartner
|
|
|
response["name"] = protocolx.AdminTypePartnerName
|
|
|
if len(svr.PartnerInfo) == 0 {
|
|
|
return nil, nil
|
|
|
return response, nil
|
|
|
}
|
|
|
var (
|
|
|
OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext)
|
...
|
...
|
@@ -96,7 +100,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
|
}
|
|
|
totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderType: domain.OrderReal})
|
|
|
if e != nil {
|
|
|
return nil, e
|
|
|
return response, e
|
|
|
}
|
|
|
if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil {
|
|
|
totalBonus.Bonus += businessBonus.Bonus
|
...
|
...
|
@@ -110,7 +114,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
|
}
|
|
|
if e != nil {
|
|
|
log.Error(e)
|
|
|
return nil, e
|
|
|
return response, e
|
|
|
}
|
|
|
var companys = make([]*Company, 0)
|
|
|
for i := range companyList {
|
...
|
...
|
@@ -138,19 +142,19 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
|
companys = append(companys, item)
|
|
|
}
|
|
|
|
|
|
response := make(map[string]interface{})
|
|
|
response["id"] = protocolx.AdminTypePartner
|
|
|
response["name"] = protocolx.AdminTypePartnerName
|
|
|
response["companys"] = companys
|
|
|
return response, nil
|
|
|
}
|
|
|
func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) {
|
|
|
response := make(map[string]interface{})
|
|
|
response["id"] = protocolx.AdminTypeManager
|
|
|
response["name"] = protocolx.AdminTypeManagerName
|
|
|
if len(svr.Users) == 0 {
|
|
|
return nil, nil
|
|
|
return response, nil
|
|
|
}
|
|
|
var (
|
|
|
companyList []*domain.Company
|
|
|
//adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway()
|
|
|
companyList []*domain.Company
|
|
|
adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway()
|
|
|
)
|
|
|
doGetCompanyIds := func() []int64 {
|
|
|
var companies []int64
|
...
|
...
|
@@ -165,28 +169,25 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { |
|
|
c := companyList[i]
|
|
|
|
|
|
//通过企业平台 校验模块权限
|
|
|
//var user *domain.Users
|
|
|
//for j := range svr.Users {
|
|
|
// if svr.Users[j].CompanyId == c.Id {
|
|
|
// user = svr.Users[j]
|
|
|
// break
|
|
|
// }
|
|
|
//}
|
|
|
//if user != nil {
|
|
|
// if code, e := adminApiGateway.UserAuth(user.Id, constant.BUSINESS_ADMIN_PLATFORM_ID); e != nil || code != 0 {
|
|
|
// log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e.Error())
|
|
|
// continue
|
|
|
// } else {
|
|
|
// log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e)
|
|
|
// }
|
|
|
//}
|
|
|
var user *domain.Users
|
|
|
for j := range svr.Users {
|
|
|
if svr.Users[j].CompanyId == c.Id {
|
|
|
user = svr.Users[j]
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if user != nil {
|
|
|
if code, e := adminApiGateway.UserAuth(user.Id, constant.BUSINESS_ADMIN_PLATFORM_ID); e != nil || code != 0 {
|
|
|
log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e.Error())
|
|
|
continue
|
|
|
} else {
|
|
|
log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e)
|
|
|
}
|
|
|
}
|
|
|
item := newCompanyBase(c)
|
|
|
companys = append(companys, item)
|
|
|
}
|
|
|
|
|
|
response := make(map[string]interface{})
|
|
|
response["id"] = protocolx.AdminTypeManager
|
|
|
response["name"] = protocolx.AdminTypeManagerName
|
|
|
response["companys"] = companys
|
|
|
return response, nil
|
|
|
}
|
...
|
...
|
|