合并 internal → main: 退款/提现/激活/CI 全面优化 #4
@@ -2,6 +2,7 @@ package invite
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"slices"
|
||||||
|
|
||||||
modellog "github.com/perfect-panel/server/internal/model/log"
|
modellog "github.com/perfect-panel/server/internal/model/log"
|
||||||
"github.com/perfect-panel/server/pkg/xerr"
|
"github.com/perfect-panel/server/pkg/xerr"
|
||||||
@@ -113,6 +114,7 @@ func QueryBenefits(ctx context.Context, db *gorm.DB, relations []InviteRelation)
|
|||||||
for userId := range inviteeAndInviterSet {
|
for userId := range inviteeAndInviterSet {
|
||||||
inviteeAndInviterIds = append(inviteeAndInviterIds, userId)
|
inviteeAndInviterIds = append(inviteeAndInviterIds, userId)
|
||||||
}
|
}
|
||||||
|
slices.Sort(inviteeAndInviterIds)
|
||||||
|
|
||||||
if err := fillCommissionBenefits(ctx, db, result, orderToInvitee, inviteeToInviter, orderNos, inviterIds); err != nil {
|
if err := fillCommissionBenefits(ctx, db, result, orderToInvitee, inviteeToInviter, orderNos, inviterIds); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ func TestQueryBenefitsCountsFamilyOwnerGiftAsInviteeGift(t *testing.T) {
|
|||||||
WithArgs(33, int64(100), "family-order", 331, 332).
|
WithArgs(33, int64(100), "family-order", 331, 332).
|
||||||
WillReturnRows(sqlmock.NewRows([]string{"object_id", "content"}))
|
WillReturnRows(sqlmock.NewRows([]string{"object_id", "content"}))
|
||||||
mock.ExpectQuery("object_id IN").
|
mock.ExpectQuery("object_id IN").
|
||||||
WithArgs(34, int64(900), int64(200), int64(100), "family-order").
|
WithArgs(34, int64(100), int64(200), int64(900), "family-order").
|
||||||
WillReturnRows(sqlmock.NewRows([]string{"object_id", "content"}).
|
WillReturnRows(sqlmock.NewRows([]string{"object_id", "content"}).
|
||||||
AddRow(900, `{"type":341,"order_no":"family-order","amount":7,"balance":7,"remark":"邀请赠送"}`))
|
AddRow(900, `{"type":341,"order_no":"family-order","amount":7,"balance":7,"remark":"邀请赠送"}`))
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ func TestQueryBenefitsKeepsDirectInviteeGift(t *testing.T) {
|
|||||||
WithArgs(33, int64(100), "direct-order", 331, 332).
|
WithArgs(33, int64(100), "direct-order", 331, 332).
|
||||||
WillReturnRows(sqlmock.NewRows([]string{"object_id", "content"}))
|
WillReturnRows(sqlmock.NewRows([]string{"object_id", "content"}))
|
||||||
mock.ExpectQuery("object_id IN").
|
mock.ExpectQuery("object_id IN").
|
||||||
WithArgs(34, int64(200), int64(100), "direct-order").
|
WithArgs(34, int64(100), int64(200), "direct-order").
|
||||||
WillReturnRows(sqlmock.NewRows([]string{"object_id", "content"}).
|
WillReturnRows(sqlmock.NewRows([]string{"object_id", "content"}).
|
||||||
AddRow(200, `{"type":341,"order_no":"direct-order","amount":5,"balance":5,"remark":"邀请赠送"}`))
|
AddRow(200, `{"type":341,"order_no":"direct-order","amount":5,"balance":5,"remark":"邀请赠送"}`))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user