refactor: reorganize modules and add Linux build tooling
This commit is contained in:
40
module/finance/wallet/internal/logic/payment/callback.go
Normal file
40
module/finance/wallet/internal/logic/payment/callback.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package payment
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"bsm/full/module/finance/wallet/internal/models"
|
||||
pb "bsm/full/module/finance/wallet/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
"git.apinb.com/bsm-sdk/core/vars"
|
||||
)
|
||||
|
||||
// 回调更新支付的结果和状态
|
||||
func Callback(ctx context.Context, in *pb.CallbackRequest) (reply *pb.StatusReply, err error) {
|
||||
auth, ok := service.ParseMetaCtx(ctx, nil)
|
||||
if ok != nil {
|
||||
return nil, ok
|
||||
}
|
||||
|
||||
if in.Identity == "" {
|
||||
return nil, errcode.ErrInvalidArgument
|
||||
}
|
||||
|
||||
var status int8 = 0
|
||||
if in.CallbackStatus {
|
||||
status = 2
|
||||
} else {
|
||||
status = -1
|
||||
}
|
||||
err = models.UpsetWalletPaymentByIdentity(auth.Identity, in.Identity, status, in.CallbackMsg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pb.StatusReply{
|
||||
Message: vars.OK,
|
||||
Timeseq: time.Now().UnixMilli(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user