正在显示
6 个修改的文件
包含
45 行增加
和
6 行删除
@@ -65,7 +65,7 @@ func (srv BusinessBonusService) ListBusinessBonus(queryOption query.ListBusiness | @@ -65,7 +65,7 @@ func (srv BusinessBonusService) ListBusinessBonus(queryOption query.ListBusiness | ||
65 | "updateTime": "", | 65 | "updateTime": "", |
66 | } | 66 | } |
67 | if !v.UpdateAt.IsZero() { | 67 | if !v.UpdateAt.IsZero() { |
68 | - m["updateTime"] = v.UpdateAt.Format("2006-01-02 15:04:05") | 68 | + m["updateTime"] = v.UpdateAt.Local().Format("2006-01-02 15:04:05") |
69 | } | 69 | } |
70 | returnData = append(returnData, m) | 70 | returnData = append(returnData, m) |
71 | } | 71 | } |
@@ -170,7 +170,7 @@ func (srv BusinessBonusService) GetBusinessBonus(queryOption query.GetBusinessBo | @@ -170,7 +170,7 @@ func (srv BusinessBonusService) GetBusinessBonus(queryOption query.GetBusinessBo | ||
170 | "id": bonusData.Id, | 170 | "id": bonusData.Id, |
171 | } | 171 | } |
172 | if !bonusData.UpdateAt.IsZero() { | 172 | if !bonusData.UpdateAt.IsZero() { |
173 | - returnData["updateTime"] = bonusData.UpdateAt.Format("2006-01-02 15:04:05") | 173 | + returnData["updateTime"] = bonusData.UpdateAt.Local().Format("2006-01-02 15:04:05") |
174 | } | 174 | } |
175 | 175 | ||
176 | return returnData, nil | 176 | return returnData, nil |
@@ -4,6 +4,8 @@ import ( | @@ -4,6 +4,8 @@ import ( | ||
4 | "fmt" | 4 | "fmt" |
5 | "time" | 5 | "time" |
6 | 6 | ||
7 | + "github.com/astaxie/beego/logs" | ||
8 | + | ||
7 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/factory" | 9 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/factory" |
8 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/command" | 10 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/command" |
9 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/query" | 11 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/orderinfo/query" |
@@ -66,15 +68,16 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder | @@ -66,15 +68,16 @@ func (service OrderInfoService) PageListOrderBase(listOrderQuery query.ListOrder | ||
66 | return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 68 | return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
67 | } | 69 | } |
68 | for i := range orders { | 70 | for i := range orders { |
69 | - var partnerData *domain.PartnerInfo | 71 | + partnerData := &domain.PartnerInfo{} |
70 | partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{ | 72 | partnerData, err = PartnerInfoRepository.FindOne(domain.PartnerFindOneQuery{ |
71 | UserId: orders[i].PartnerId, | 73 | UserId: orders[i].PartnerId, |
72 | }) | 74 | }) |
73 | if err != nil { | 75 | if err != nil { |
74 | - return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
75 | - } | 76 | + logs.Error("获取合伙(id=%d)失败%s", orders[i].PartnerId, err) |
77 | + } else { | ||
76 | orders[i].PartnerInfo = partnerData.Partner | 78 | orders[i].PartnerInfo = partnerData.Partner |
77 | } | 79 | } |
80 | + } | ||
78 | transactionContext.CommitTransaction() | 81 | transactionContext.CommitTransaction() |
79 | return orders, cnt, nil | 82 | return orders, cnt, nil |
80 | } | 83 | } |
@@ -86,6 +86,10 @@ var _ BusinessBonusBonusStatus = (*BusinessBonusHasPay)(nil) | @@ -86,6 +86,10 @@ var _ BusinessBonusBonusStatus = (*BusinessBonusHasPay)(nil) | ||
86 | //状态变更为空 | 86 | //状态变更为空 |
87 | func (pay BusinessBonusNullPay) NullPayPartnerBonus(bonus *BusinessBonus) error { | 87 | func (pay BusinessBonusNullPay) NullPayPartnerBonus(bonus *BusinessBonus) error { |
88 | bonus.BonusStatus = 0 | 88 | bonus.BonusStatus = 0 |
89 | + bonus.BonusExpense = 0 | ||
90 | + bonus.BonusHas = 0 | ||
91 | + bonus.BonusNot = 0 | ||
92 | + bonus.Bonus = 0 | ||
89 | return nil | 93 | return nil |
90 | } | 94 | } |
91 | 95 | ||
@@ -109,6 +113,10 @@ func (pay BusinessBonusNullPay) PayPartnerBonus(bonus *BusinessBonus) error { | @@ -109,6 +113,10 @@ func (pay BusinessBonusNullPay) PayPartnerBonus(bonus *BusinessBonus) error { | ||
109 | //状态变更为空 | 113 | //状态变更为空 |
110 | func (pay BusinessBonusWaitPay) NullPayPartnerBonus(bonus *BusinessBonus) error { | 114 | func (pay BusinessBonusWaitPay) NullPayPartnerBonus(bonus *BusinessBonus) error { |
111 | bonus.BonusStatus = 0 | 115 | bonus.BonusStatus = 0 |
116 | + bonus.BonusExpense = 0 | ||
117 | + bonus.BonusHas = 0 | ||
118 | + bonus.BonusNot = 0 | ||
119 | + bonus.Bonus = 0 | ||
112 | return nil | 120 | return nil |
113 | } | 121 | } |
114 | 122 | ||
@@ -132,6 +140,10 @@ func (pay BusinessBonusWaitPay) PayPartnerBonus(bonus *BusinessBonus) error { | @@ -132,6 +140,10 @@ func (pay BusinessBonusWaitPay) PayPartnerBonus(bonus *BusinessBonus) error { | ||
132 | //状态变更为空 | 140 | //状态变更为空 |
133 | func (pay BusinessBonusHasPay) NullPayPartnerBonus(bonus *BusinessBonus) error { | 141 | func (pay BusinessBonusHasPay) NullPayPartnerBonus(bonus *BusinessBonus) error { |
134 | bonus.BonusStatus = 0 | 142 | bonus.BonusStatus = 0 |
143 | + bonus.BonusExpense = 0 | ||
144 | + bonus.BonusHas = 0 | ||
145 | + bonus.BonusNot = 0 | ||
146 | + bonus.Bonus = 0 | ||
135 | return nil | 147 | return nil |
136 | } | 148 | } |
137 | 149 |
1 | package repository | 1 | package repository |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "errors" | ||
4 | "fmt" | 5 | "fmt" |
5 | 6 | ||
6 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" |
@@ -54,15 +55,21 @@ func (reponsitory AdminPermissionRepository) Find(queryOptions domain.Permission | @@ -54,15 +55,21 @@ func (reponsitory AdminPermissionRepository) Find(queryOptions domain.Permission | ||
54 | func (reponsitory AdminPermissionRepository) FindOne(queryOptions domain.PermissionFindOneOption) (domain.AdminPermission, error) { | 55 | func (reponsitory AdminPermissionRepository) FindOne(queryOptions domain.PermissionFindOneOption) (domain.AdminPermission, error) { |
55 | db := reponsitory.transactionContext.PgDd | 56 | db := reponsitory.transactionContext.PgDd |
56 | var permissionModels models.AdminPermission | 57 | var permissionModels models.AdminPermission |
58 | + var hasCondition bool | ||
57 | query := db.Model(&permissionModels) | 59 | query := db.Model(&permissionModels) |
58 | if len(queryOptions.Code) > 0 { | 60 | if len(queryOptions.Code) > 0 { |
61 | + hasCondition = true | ||
59 | query = query.Where("code=?", queryOptions.Code) | 62 | query = query.Where("code=?", queryOptions.Code) |
60 | } | 63 | } |
61 | if queryOptions.Id > 0 { | 64 | if queryOptions.Id > 0 { |
65 | + hasCondition = true | ||
62 | query = query.Where("id=?", queryOptions.Id) | 66 | query = query.Where("id=?", queryOptions.Id) |
63 | } | 67 | } |
64 | - | ||
65 | var result domain.AdminPermission | 68 | var result domain.AdminPermission |
69 | + if !hasCondition { | ||
70 | + return result, errors.New("FindOne 必须要有查询条件") | ||
71 | + } | ||
72 | + | ||
66 | err := query.First() | 73 | err := query.First() |
67 | if err != nil { | 74 | if err != nil { |
68 | return result, err | 75 | return result, err |
1 | package repository | 1 | package repository |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "errors" | ||
4 | "fmt" | 5 | "fmt" |
5 | 6 | ||
6 | "github.com/go-pg/pg/v10/orm" | 7 | "github.com/go-pg/pg/v10/orm" |
@@ -97,16 +98,23 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error { | @@ -97,16 +98,23 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) error { | ||
97 | func (repository *PartnerInfoRepository) FindOne(queryOptions domain.PartnerFindOneQuery) (*domain.PartnerInfo, error) { | 98 | func (repository *PartnerInfoRepository) FindOne(queryOptions domain.PartnerFindOneQuery) (*domain.PartnerInfo, error) { |
98 | tx := repository.transactionContext.PgTx | 99 | tx := repository.transactionContext.PgTx |
99 | PartnerInfoModel := new(models.PartnerInfo) | 100 | PartnerInfoModel := new(models.PartnerInfo) |
101 | + var hasCondition bool | ||
100 | query := tx.Model(PartnerInfoModel) | 102 | query := tx.Model(PartnerInfoModel) |
101 | if len(queryOptions.AccountEqual) > 0 { | 103 | if len(queryOptions.AccountEqual) > 0 { |
104 | + hasCondition = true | ||
102 | query = query.Where("account=?", queryOptions.AccountEqual) | 105 | query = query.Where("account=?", queryOptions.AccountEqual) |
103 | } | 106 | } |
104 | if queryOptions.UserId > 0 { | 107 | if queryOptions.UserId > 0 { |
108 | + hasCondition = true | ||
105 | query = query.Where("id=?", queryOptions.UserId) | 109 | query = query.Where("id=?", queryOptions.UserId) |
106 | } | 110 | } |
107 | if queryOptions.CompanyId > 0 { | 111 | if queryOptions.CompanyId > 0 { |
112 | + hasCondition = true | ||
108 | query = query.Where("company_id=?", queryOptions.CompanyId) | 113 | query = query.Where("company_id=?", queryOptions.CompanyId) |
109 | } | 114 | } |
115 | + if !hasCondition { | ||
116 | + return nil, errors.New("FindOne 必须要有查询条件") | ||
117 | + } | ||
110 | if err := query.First(); err != nil { | 118 | if err := query.First(); err != nil { |
111 | return nil, err | 119 | return nil, err |
112 | } | 120 | } |
1 | package repository | 1 | package repository |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | + "errors" | ||
4 | "fmt" | 5 | "fmt" |
5 | "time" | 6 | "time" |
6 | 7 | ||
@@ -119,21 +120,29 @@ func (reponsitory UsersRepository) FindOne(queryOptions domain.UsersFindOneQuery | @@ -119,21 +120,29 @@ func (reponsitory UsersRepository) FindOne(queryOptions domain.UsersFindOneQuery | ||
119 | err error | 120 | err error |
120 | tx = reponsitory.transactionContext.PgTx | 121 | tx = reponsitory.transactionContext.PgTx |
121 | m models.Users | 122 | m models.Users |
123 | + hasCondition bool | ||
122 | ) | 124 | ) |
123 | query := tx.Model(&m) | 125 | query := tx.Model(&m) |
124 | query.Where("delete_at ISNULL") | 126 | query.Where("delete_at ISNULL") |
125 | if queryOptions.Id > 0 { | 127 | if queryOptions.Id > 0 { |
128 | + hasCondition = true | ||
126 | query = query.Where("id=?", queryOptions.Id) | 129 | query = query.Where("id=?", queryOptions.Id) |
127 | } | 130 | } |
128 | if len(queryOptions.Phone) > 0 { | 131 | if len(queryOptions.Phone) > 0 { |
132 | + hasCondition = true | ||
129 | query = query.Where("phone=?", queryOptions.Phone) | 133 | query = query.Where("phone=?", queryOptions.Phone) |
130 | } | 134 | } |
131 | if queryOptions.CompanyId > 0 { | 135 | if queryOptions.CompanyId > 0 { |
136 | + hasCondition = true | ||
132 | query = query.Where("company_id=?", queryOptions.CompanyId) | 137 | query = query.Where("company_id=?", queryOptions.CompanyId) |
133 | } | 138 | } |
134 | if queryOptions.OpenId > 0 { | 139 | if queryOptions.OpenId > 0 { |
140 | + hasCondition = true | ||
135 | query = query.Where("open_id=?", queryOptions.OpenId) | 141 | query = query.Where("open_id=?", queryOptions.OpenId) |
136 | } | 142 | } |
143 | + if !hasCondition { | ||
144 | + return domain.Users{}, errors.New("FindOne 必须要有查询条件") | ||
145 | + } | ||
137 | err = query.First() | 146 | err = query.First() |
138 | if err != nil { | 147 | if err != nil { |
139 | return domain.Users{}, err | 148 | return domain.Users{}, err |
-
请 注册 或 登录 后发表评论