作者 唐旭辉

bug 修复

@@ -56,7 +56,7 @@ func (dao BusinessBonusDao) SearchBusinessBonus(partnerId int64, partnerNameMatc @@ -56,7 +56,7 @@ func (dao BusinessBonusDao) SearchBusinessBonus(partnerId int64, partnerNameMatc
56 if len(partnerCondition) > 0 { 56 if len(partnerCondition) > 0 {
57 sql += fmt.Sprintf(" AND (%s)", strings.Join(partnerCondition, " OR ")) 57 sql += fmt.Sprintf(" AND (%s)", strings.Join(partnerCondition, " OR "))
58 } 58 }
59 - sql += ` limit ? OFFSET ? ` 59 + sql += `ORDER BY business_bonus.id DESC limit ? OFFSET ? `
60 allParam = append(allParam, limit, offset) 60 allParam = append(allParam, limit, offset)
61 tx := dao.transactionContext.PgTx 61 tx := dao.transactionContext.PgTx
62 var ( 62 var (
@@ -41,6 +41,7 @@ func (reponsitory AdminPermissionRepository) Find(queryOptions domain.Permission @@ -41,6 +41,7 @@ func (reponsitory AdminPermissionRepository) Find(queryOptions domain.Permission
41 if len(queryOptions.Ids) > 0 { 41 if len(queryOptions.Ids) > 0 {
42 query = query.WhereIn("id in (?) ", queryOptions.Ids) 42 query = query.WhereIn("id in (?) ", queryOptions.Ids)
43 } 43 }
  44 + query = query.Order("admin_permission.sort AES")
44 if err := query.Select(); err != nil { 45 if err := query.Select(); err != nil {
45 return nil, err 46 return nil, err
46 } 47 }
@@ -130,7 +130,7 @@ func (repository *BusinessBonusRepository) Find(queryOptions domain.BusinessBonu @@ -130,7 +130,7 @@ func (repository *BusinessBonusRepository) Find(queryOptions domain.BusinessBonu
130 } else { 130 } else {
131 query = query.Limit(1000) 131 query = query.Limit(1000)
132 } 132 }
133 - 133 + query = query.Order("business_bonus.id DESC")
134 if cnt, err = query.SelectAndCount(); err != nil { 134 if cnt, err = query.SelectAndCount(); err != nil {
135 return 0, businessBonuss, err 135 return 0, businessBonuss, err
136 } 136 }
@@ -133,9 +133,12 @@ func (repository OrderBaseRepository) FindOne(qureyOptions domain.OrderBaseFindO @@ -133,9 +133,12 @@ func (repository OrderBaseRepository) FindOne(qureyOptions domain.OrderBaseFindO
133 tx = repository.transactionContext.PgDd 133 tx = repository.transactionContext.PgDd
134 ) 134 )
135 m := new(models.OrderBase) 135 m := new(models.OrderBase)
136 - err = tx.Model(m).  
137 - Where("id=?", qureyOptions.OrderId).  
138 - First() 136 + query := tx.Model(m).
  137 + Where("id=?", qureyOptions.OrderId)
  138 + if qureyOptions.CompanyId > 0 {
  139 + query = query.Where("company_id=?", qureyOptions.CompanyId)
  140 + }
  141 + err = query.First()
139 if err != nil { 142 if err != nil {
140 return nil, err 143 return nil, err
141 } 144 }
@@ -201,6 +201,8 @@ func (controller *BaseController) setUserCompanyId(id int64) { @@ -201,6 +201,8 @@ func (controller *BaseController) setUserCompanyId(id int64) {
201 func (controller *BaseController) GetUserCompany() int64 { 201 func (controller *BaseController) GetUserCompany() int64 {
202 idV := controller.Ctx.Input.GetData("token:company_id") 202 idV := controller.Ctx.Input.GetData("token:company_id")
203 uid, err := strconv.ParseInt(fmt.Sprint(idV), 10, 64) 203 uid, err := strconv.ParseInt(fmt.Sprint(idV), 10, 64)
204 - logs.Error(err) 204 + if err != nil {
  205 + logs.Error(err)
  206 + }
205 return uid 207 return uid
206 } 208 }