refactor: reorganize modules and add Linux build tooling
This commit is contained in:
37
module/ec/order/internal/logic/summary/check.go
Normal file
37
module/ec/order/internal/logic/summary/check.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package summary
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"bsm/full/module/ec/order/internal/models"
|
||||
pb "bsm/full/module/ec/order/pb"
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/printer"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
)
|
||||
|
||||
// 检测是否有未确认及付款的订单
|
||||
func Check(ctx context.Context, in *pb.Empty) (reply *pb.StatusReply, err error) {
|
||||
// parse authorization meta.
|
||||
auth, err := service.ParseMetaCtx(ctx, &service.ParseOptions{RoleValue: "Mall_Admin"})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var (
|
||||
summary = new(models.OrderSummary)
|
||||
)
|
||||
err = models.DBService.Where("passport_id = ?", auth.ID).First(&summary).Error
|
||||
if err != nil {
|
||||
printer.Error(err.Error())
|
||||
return nil, errcode.ErrDB
|
||||
}
|
||||
|
||||
return &pb.StatusReply{
|
||||
Code: 0,
|
||||
Identity: summary.OrderNo,
|
||||
Message: "OK",
|
||||
Timeseq: time.Now().UnixNano(),
|
||||
}, nil
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user