作者 唐旭辉

bug 修复

... ... @@ -65,7 +65,7 @@ func (srv BusinessBonusService) ListBusinessBonus(queryOption query.ListBusiness
"updateTime": "",
}
if !v.UpdateAt.IsZero() {
m["updateTime"] = v.UpdateAt.Format("2006-01-02 15:04:05")
m["updateTime"] = v.UpdateAt.Local().Format("2006-01-02 15:04:05")
}
returnData = append(returnData, m)
}
... ... @@ -170,7 +170,7 @@ func (srv BusinessBonusService) GetBusinessBonus(queryOption query.GetBusinessBo
"id": bonusData.Id,
}
if !bonusData.UpdateAt.IsZero() {
returnData["updateTime"] = bonusData.UpdateAt.Format("2006-01-02 15:04:05")
returnData["updateTime"] = bonusData.UpdateAt.Local().Format("2006-01-02 15:04:05")
}
return returnData, nil
... ...
... ... @@ -4,6 +4,8 @@ import (
"fmt"
"time"
"github.com/astaxie/beego/logs"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/command"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/query"
... ... @@ -66,14 +68,15 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
}
for i := range orders {
var partnerData *domain.PartnerInfo
partnerData := &domain.PartnerInfo{}
partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{
UserId: orders[i].PartnerId,
})
if err != nil {
return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
logs.Error("获取合伙(id=%d)失败%s", orders[i].PartnerId, err)
} else {
orders[i].PartnerInfo = partnerData.Partner
}
orders[i].PartnerInfo = partnerData.Partner
}
transactionContext.CommitTransaction()
return orders, cnt, nil
... ...
... ... @@ -86,6 +86,10 @@ var _ BusinessBonusBonusStatus = (*BusinessBonusHasPay)(nil)
//状态变更为空
func (pay BusinessBonusNullPay) NullPayPartnerBonus(bonus *BusinessBonus) error {
bonus.BonusStatus = 0
bonus.BonusExpense = 0
bonus.BonusHas = 0
bonus.BonusNot = 0
bonus.Bonus = 0
return nil
}
... ... @@ -109,6 +113,10 @@ func (pay BusinessBonusNullPay) PayPartnerBonus(bonus *BusinessBonus) error {
//状态变更为空
func (pay BusinessBonusWaitPay) NullPayPartnerBonus(bonus *BusinessBonus) error {
bonus.BonusStatus = 0
bonus.BonusExpense = 0
bonus.BonusHas = 0
bonus.BonusNot = 0
bonus.Bonus = 0
return nil
}
... ... @@ -132,6 +140,10 @@ func (pay BusinessBonusWaitPay) PayPartnerBonus(bonus *BusinessBonus) error {
//状态变更为空
func (pay BusinessBonusHasPay) NullPayPartnerBonus(bonus *BusinessBonus) error {
bonus.BonusStatus = 0
bonus.BonusExpense = 0
bonus.BonusHas = 0
bonus.BonusNot = 0
bonus.Bonus = 0
return nil
}
... ...
package repository
import (
"errors"
"fmt"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
... ... @@ -54,15 +55,21 @@ func (reponsitory AdminPermissionRepository) Find(queryOptions domain.Permission
func (reponsitory AdminPermissionRepository) FindOne(queryOptions domain.PermissionFindOneOption) (domain.AdminPermission, error) {
db := reponsitory.transactionContext.PgDd
var permissionModels models.AdminPermission
var hasCondition bool
query := db.Model(&permissionModels)
if len(queryOptions.Code) > 0 {
hasCondition = true
query = query.Where("code=?", queryOptions.Code)
}
if queryOptions.Id > 0 {
hasCondition = true
query = query.Where("id=?", queryOptions.Id)
}
var result domain.AdminPermission
if !hasCondition {
return result, errors.New("FindOne 必须要有查询条件")
}
err := query.First()
if err != nil {
return result, err
... ...
package repository
import (
"errors"
"fmt"
"github.com/go-pg/pg/v10/orm"
... ... @@ -97,16 +98,23 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error {
func (repository *PartnerInfoRepository) FindOne(queryOptions domain.PartnerFindOneQuery) (*domain.PartnerInfo, error) {
tx := repository.transactionContext.PgTx
PartnerInfoModel := new(models.PartnerInfo)
var hasCondition bool
query := tx.Model(PartnerInfoModel)
if len(queryOptions.AccountEqual) > 0 {
hasCondition = true
query = query.Where("account=?", queryOptions.AccountEqual)
}
if queryOptions.UserId > 0 {
hasCondition = true
query = query.Where("id=?", queryOptions.UserId)
}
if queryOptions.CompanyId > 0 {
hasCondition = true
query = query.Where("company_id=?", queryOptions.CompanyId)
}
if !hasCondition {
return nil, errors.New("FindOne 必须要有查询条件")
}
if err := query.First(); err != nil {
return nil, err
}
... ...
package repository
import (
"errors"
"fmt"
"time"
... ... @@ -116,24 +117,32 @@ func (reponsitory UsersRepository) Edit(u *domain.Users) error {
func (reponsitory UsersRepository) FindOne(queryOptions domain.UsersFindOneQuery) (domain.Users, error) {
var (
err error
tx = reponsitory.transactionContext.PgTx
m models.Users
err error
tx = reponsitory.transactionContext.PgTx
m models.Users
hasCondition bool
)
query := tx.Model(&m)
query.Where("delete_at ISNULL")
if queryOptions.Id > 0 {
hasCondition = true
query = query.Where("id=?", queryOptions.Id)
}
if len(queryOptions.Phone) > 0 {
hasCondition = true
query = query.Where("phone=?", queryOptions.Phone)
}
if queryOptions.CompanyId > 0 {
hasCondition = true
query = query.Where("company_id=?", queryOptions.CompanyId)
}
if queryOptions.OpenId > 0 {
hasCondition = true
query = query.Where("open_id=?", queryOptions.OpenId)
}
if !hasCondition {
return domain.Users{}, errors.New("FindOne 必须要有查询条件")
}
err = query.First()
if err != nil {
return domain.Users{}, err
... ...