作者 唐旭辉

bug 修复

... ... @@ -56,7 +56,7 @@ func (dao BusinessBonusDao) SearchBusinessBonus(partnerId int64, partnerNameMatc
if len(partnerCondition) > 0 {
sql += fmt.Sprintf(" AND (%s)", strings.Join(partnerCondition, " OR "))
}
sql += ` limit ? OFFSET ? `
sql += `ORDER BY business_bonus.id DESC limit ? OFFSET ? `
allParam = append(allParam, limit, offset)
tx := dao.transactionContext.PgTx
var (
... ...
... ... @@ -41,6 +41,7 @@ func (reponsitory AdminPermissionRepository) Find(queryOptions domain.Permission
if len(queryOptions.Ids) > 0 {
query = query.WhereIn("id in (?) ", queryOptions.Ids)
}
query = query.Order("admin_permission.sort AES")
if err := query.Select(); err != nil {
return nil, err
}
... ...
... ... @@ -130,7 +130,7 @@ func (repository *BusinessBonusRepository) Find(queryOptions domain.BusinessBonu
} else {
query = query.Limit(1000)
}
query = query.Order("business_bonus.id DESC")
if cnt, err = query.SelectAndCount(); err != nil {
return 0, businessBonuss, err
}
... ...
... ... @@ -133,9 +133,12 @@ func (repository OrderBaseRepository) FindOne(qureyOptions domain.OrderBaseFindO
tx = repository.transactionContext.PgDd
)
m := new(models.OrderBase)
err = tx.Model(m).
Where("id=?", qureyOptions.OrderId).
First()
query := tx.Model(m).
Where("id=?", qureyOptions.OrderId)
if qureyOptions.CompanyId > 0 {
query = query.Where("company_id=?", qureyOptions.CompanyId)
}
err = query.First()
if err != nil {
return nil, err
}
... ...
... ... @@ -201,6 +201,8 @@ func (controller *BaseController) setUserCompanyId(id int64) {
func (controller *BaseController) GetUserCompany() int64 {
idV := controller.Ctx.Input.GetData("token:company_id")
uid, err := strconv.ParseInt(fmt.Sprint(idV), 10, 64)
logs.Error(err)
if err != nil {
logs.Error(err)
}
return uid
}
... ...