作者 唐旭辉

更新

@@ -2,10 +2,10 @@ package domain @@ -2,10 +2,10 @@ package domain
2 2
3 import "time" 3 import "time"
4 4
5 -// 业务分红信息 是否关闭【0;否】【1:是 5 +// 业务分红信息 是否有效【0;无效】【1:有效
6 const ( 6 const (
7 - BUSINESS_BONUS_ENABLE int8 = 0  
8 - BUSINESS_BONUS_DISABLE int8 = 1 7 + BUSINESS_BONUS_ENABLE int8 = 1
  8 + BUSINESS_BONUS_DISABLE int8 = 0
9 ) 9 )
10 10
11 // 分红状态 1:待支付分红 2:已支付分红 11 // 分红状态 1:待支付分红 2:已支付分红
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 "strings" 5 "strings"
6 "time" 6 "time"
7 7
  8 + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
8 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction" 9 "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
9 ) 10 )
10 11
@@ -40,9 +41,9 @@ func (dao BusinessBonusDao) SearchBusinessBonus(partnerId int64, partnerNameMatc @@ -40,9 +41,9 @@ func (dao BusinessBonusDao) SearchBusinessBonus(partnerId int64, partnerNameMatc
40 ,partner_info.partner_name,business_bonus.bonus_has 41 ,partner_info.partner_name,business_bonus.bonus_has
41 FROM business_bonus 42 FROM business_bonus
42 JOIN partner_info ON business_bonus.partner_info_id=partner_info.id 43 JOIN partner_info ON business_bonus.partner_info_id=partner_info.id
43 - WHERE business_bonus.is_disable=0 AND business_bonus.company_id = ? ` 44 + WHERE business_bonus.is_disable=? AND business_bonus.company_id = ? `
44 partnerCondition := []string{} 45 partnerCondition := []string{}
45 - allParam := []interface{}{companyId} 46 + allParam := []interface{}{domain.BUSINESS_BONUS_ENABLE, companyId}
46 if partnerId > 0 { 47 if partnerId > 0 {
47 partnerCondition = append(partnerCondition, ` business_bonus.partner_info_id=? `) 48 partnerCondition = append(partnerCondition, ` business_bonus.partner_info_id=? `)
48 allParam = append(allParam, partnerId) 49 allParam = append(allParam, partnerId)
@@ -70,9 +71,9 @@ func (dao BusinessBonusDao) CountBusinessBonus(partnerId int64, partnerNameMatch @@ -70,9 +71,9 @@ func (dao BusinessBonusDao) CountBusinessBonus(partnerId int64, partnerNameMatch
70 sql := `SELECT count(*) 71 sql := `SELECT count(*)
71 FROM business_bonus 72 FROM business_bonus
72 JOIN partner_info ON business_bonus.partner_info_id=partner_info.id 73 JOIN partner_info ON business_bonus.partner_info_id=partner_info.id
73 - WHERE business_bonus.is_disable=0 AND business_bonus.company_id = ? ` 74 + WHERE business_bonus.is_disable=? AND business_bonus.company_id = ? `
74 partnerCondition := []string{} 75 partnerCondition := []string{}
75 - allParam := []interface{}{companyId} 76 + allParam := []interface{}{domain.BUSINESS_BONUS_ENABLE, companyId}
76 if partnerId > 0 { 77 if partnerId > 0 {
77 partnerCondition = append(partnerCondition, ` business_bonus.partner_info_id=? `) 78 partnerCondition = append(partnerCondition, ` business_bonus.partner_info_id=? `)
78 allParam = append(allParam, partnerId) 79 allParam = append(allParam, partnerId)
@@ -40,10 +40,18 @@ func (c *BusinessBonusController) ListBusinessBonus() { @@ -40,10 +40,18 @@ func (c *BusinessBonusController) ListBusinessBonus() {
40 c.ResponseError(errors.New("json数据解析失败")) 40 c.ResponseError(errors.New("json数据解析失败"))
41 return 41 return
42 } 42 }
  43 + if param.PageSize == 0 {
  44 + param.PageSize = 20
  45 + }
  46 + if param.PageNumber == 0 {
  47 + param.PageNumber = 1
  48 + }
43 companyId := c.GetUserCompany() 49 companyId := c.GetUserCompany()
44 srv := businessService.NewBusinessBonusService(nil) 50 srv := businessService.NewBusinessBonusService(nil)
45 cnt, result, err := srv.ListBusinessBonus(businessQuery.ListBusinessBonusQuery{ 51 cnt, result, err := srv.ListBusinessBonus(businessQuery.ListBusinessBonusQuery{
46 CompanyId: companyId, 52 CompanyId: companyId,
  53 + Limit: param.PageSize,
  54 + Offset: param.PageSize * (param.PageNumber - 1),
47 }) 55 })
48 if err != nil { 56 if err != nil {
49 c.ResponseError(err) 57 c.ResponseError(err)