47 lines
974 B
Go
47 lines
974 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"lone-services/pkg/modelbase"
|
|
"lone-services/pkg/utils"
|
|
"lone-services/services/express/internal/dao"
|
|
"lone-services/services/express/internal/model"
|
|
|
|
"lone-services/rpc/express/pb"
|
|
"lone-services/services/express/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type HistoryLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
BaseLogic
|
|
}
|
|
|
|
func NewHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *HistoryLogic {
|
|
return &HistoryLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *HistoryLogic) History(in *express.HistoryRequest) (*express.Response, error) {
|
|
modelObj := model.DeliveryHistoryModel{}.Init()
|
|
w := modelbase.Params{
|
|
Size: int(in.Size),
|
|
Page: int(in.Page),
|
|
Order: "id desc",
|
|
}
|
|
|
|
var data []dao.DeliveryHistoryCreate
|
|
err := modelObj.Items(w, &data)
|
|
if err != nil {
|
|
return l.fail(utils.Fail)
|
|
}
|
|
|
|
return l.ok(data)
|
|
}
|