作者 唐旭辉

更新

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