...
|
...
|
@@ -32,9 +32,24 @@ func (svr *PgLoginService) Init(phone string) (err error) { |
|
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
|
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
|
)
|
|
|
|
|
|
svr.Phone = phone
|
|
|
|
|
|
_, svr.PartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC"})
|
|
|
_, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true})
|
|
|
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (svr *PgLoginService) InitSenior(phone string) (err error) {
|
|
|
var (
|
|
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
|
)
|
|
|
|
|
|
svr.Phone = phone
|
|
|
|
|
|
_, svr.Users, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1})
|
|
|
|
|
|
return nil
|
|
|
}
|
|
|
|
...
|
...
|
@@ -73,10 +88,12 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
|
response := make(map[string]interface{})
|
|
|
response["id"] = protocolx.AdminTypePartner
|
|
|
response["name"] = protocolx.AdminTypePartnerName
|
|
|
|
|
|
if len(svr.PartnerInfo) == 0 {
|
|
|
response["companys"] = make([]struct{}, 0)
|
|
|
return response, nil
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
OrderDao, _ = dao.NewOrderBaseDao(svr.transactionContext)
|
|
|
BusinessBonusDao, _ = dao.NewBusinessBonusDao(svr.transactionContext)
|
...
|
...
|
@@ -87,6 +104,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
|
adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway()
|
|
|
)
|
|
|
|
|
|
doGetCompanyIds := func() []int64 {
|
|
|
var companies []int64
|
|
|
for i := range svr.PartnerInfo {
|
...
|
...
|
@@ -94,6 +112,7 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
|
}
|
|
|
return companies
|
|
|
}
|
|
|
|
|
|
doGetPartnerIds := func() []int64 {
|
|
|
var array []int64
|
|
|
for i := range svr.PartnerInfo {
|
...
|
...
|
@@ -101,17 +120,21 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
|
}
|
|
|
return array
|
|
|
}
|
|
|
|
|
|
companyList = svr.GetCompanyList(doGetCompanyIds)
|
|
|
if len(companyList) == 0 {
|
|
|
return response, nil
|
|
|
}
|
|
|
|
|
|
totalBonus, e := OrderDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), OrderTypes: domain.UserOrderTypes(domain.Career)})
|
|
|
if e != nil {
|
|
|
return response, e
|
|
|
}
|
|
|
|
|
|
if businessBonus, e := BusinessBonusDao.OrderBonusStatics(domain.OrderBonusQuery{InPartnerIds: doGetPartnerIds(), IsDisable: 1}); e == nil {
|
|
|
totalBonus.Bonus += businessBonus.Bonus
|
|
|
}
|
|
|
|
|
|
_, allPartnerCategory, e = PartnerCategoryInfoRepository.Find(map[string]interface{}{"sortById": domain.ASC})
|
|
|
var mapPartnerBussinessBonus = make(map[int64]*domain.BusinessBonus)
|
|
|
if _, bussinessBonus, e := BusinessBonusRepository.Find(map[string]interface{}{"inPartnerIds": doGetPartnerIds(), "isDisable": 1}); e == nil {
|
...
|
...
|
@@ -173,6 +196,8 @@ func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { |
|
|
response["companys"] = companys
|
|
|
return response, nil
|
|
|
}
|
|
|
|
|
|
// 高管统计信息
|
|
|
func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) {
|
|
|
response := make(map[string]interface{})
|
|
|
response["id"] = protocolx.AdminTypeManager
|
...
|
...
|
@@ -290,11 +315,14 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { |
|
|
PartnerInfoService, _ = repository.NewPartnerInfoRepository(svr.transactionContext)
|
|
|
UsersRepository, _ = repository.NewUsersRepository(svr.transactionContext)
|
|
|
)
|
|
|
|
|
|
partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone})
|
|
|
user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone})
|
|
|
|
|
|
if partnerInfo != nil || user != nil {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
if errUser != nil && errPartner != nil {
|
|
|
id := time.Now().Unix()
|
|
|
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
|
...
|
...
|
|