order apis
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package dao
|
||||
|
||||
type Express struct {
|
||||
Id int64 `json:"id" gorm:"id"` // ID
|
||||
Name string `json:"name" gorm:"name"` // 名称
|
||||
TransitId uint8 `json:"transit_id" gorm:"transit_id"` // 快递公司,1为顺丰,2为京东,3为。。。
|
||||
AppCode string `json:"app_code" gorm:"app_code"` // app 代码
|
||||
AppSecretKey string `json:"app_secret_key" gorm:"app_secret_key"` // app 密钥
|
||||
AppUrl string `json:"app_url" gorm:"app_url"` // 接口地址
|
||||
CardNumber string `json:"card_number" gorm:"card_number"` // 月结卡号
|
||||
PdfCode string `json:"pdf_code" gorm:"pdf_code"` // pdf文件编码
|
||||
Province string `json:"province" gorm:"province"` // 省
|
||||
City string `json:"city" gorm:"city"` // 市
|
||||
County string `json:"county" gorm:"county"` // 县/区
|
||||
Address string `json:"address" gorm:"address"` // 地址
|
||||
CompanyName string `json:"company_name" gorm:"company_name"` // 公司名
|
||||
Contact string `json:"contact" gorm:"contact"` // 联系人
|
||||
Mobile string `json:"mobile" gorm:"mobile"` // 联系人手机号
|
||||
Other string `json:"other" gorm:"other"` // 基它数据
|
||||
Status uint8 `json:"status" gorm:"status"` // 状态,1为正常,2为禁用
|
||||
Reason string `json:"reason" gorm:"reason"` // 原因
|
||||
AdminId int64 `json:"admin_id" gorm:"admin_id"` // 操作人ID
|
||||
AdminName string `json:"admin_name" gorm:"admin_name"` // 操作人姓名
|
||||
}
|
||||
type ExpressInfo struct {
|
||||
Id int64 `json:"id" gorm:"id"` // ID
|
||||
Name string `json:"name" gorm:"name"` // 名称
|
||||
TransitId uint8 `json:"transit_id" gorm:"transit_id"` // 快递公司,1为顺丰,2为京东,3为。。。
|
||||
AppCode string `json:"app_code" gorm:"app_code"` // app 代码
|
||||
AppSecretKey string `json:"app_secret_key" gorm:"app_secret_key"` // app 密钥
|
||||
AppUrl string `json:"app_url" gorm:"app_url"` // 接口地址
|
||||
CardNumber string `json:"card_number" gorm:"card_number"` // 月结卡号
|
||||
PdfCode string `json:"pdf_code" gorm:"pdf_code"` // pdf文件编码
|
||||
Province string `json:"province" gorm:"province"` // 省
|
||||
City string `json:"city" gorm:"city"` // 市
|
||||
County string `json:"county" gorm:"county"` // 县/区
|
||||
Address string `json:"address" gorm:"address"` // 地址
|
||||
CompanyName string `json:"company_name" gorm:"company_name"` // 公司名
|
||||
Contact string `json:"contact" gorm:"contact"` // 联系人
|
||||
Mobile string `json:"mobile" gorm:"mobile"` // 联系人手机号
|
||||
Other string `json:"other" gorm:"other"` // 基它数据
|
||||
Status uint8 `json:"status" gorm:"status"` // 状态,1为正常,2为禁用
|
||||
Reason string `json:"reason" gorm:"reason"` // 原因
|
||||
}
|
||||
|
||||
type ExpressNames struct {
|
||||
Id int64 `json:"id" gorm:"id"` // ID
|
||||
Name string `json:"name" gorm:"name"` // 名称
|
||||
}
|
||||
|
||||
type ExpressStatus struct {
|
||||
Id int64 `json:"id" gorm:"id"` // ID
|
||||
Status uint8 `json:"status" gorm:"status"` // 状态,1为正常,2为禁用
|
||||
Reason string `json:"reason" gorm:"reason"` // 原因
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"lone-services/rpc/express/pb"
|
||||
"lone-services/services/express/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type CreateLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
BaseLogic
|
||||
}
|
||||
|
||||
func NewCreateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLogic {
|
||||
return &CreateLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *CreateLogic) Create(in *express.CreateRequest) (*express.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &express.Response{}, nil
|
||||
}
|
||||
+6
-6
@@ -2,30 +2,30 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
express "lone-services/rpc/express/pb"
|
||||
|
||||
"lone-services/rpc/express/pb"
|
||||
"lone-services/services/express/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type PingLogic struct {
|
||||
type EditLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
BaseLogic
|
||||
}
|
||||
|
||||
func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
|
||||
return &PingLogic{
|
||||
func NewEditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditLogic {
|
||||
return &EditLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *PingLogic) Ping(in *express.Request) (*express.Response, error) {
|
||||
func (l *EditLogic) Edit(in *express.CreateRequest) (*express.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return l.ok("this is a test")
|
||||
return &express.Response{}, nil
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"lone-services/rpc/express/pb"
|
||||
"lone-services/services/express/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type InfoLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
BaseLogic
|
||||
}
|
||||
|
||||
func NewInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InfoLogic {
|
||||
return &InfoLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *InfoLogic) Info(in *express.IdRequest) (*express.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &express.Response{}, nil
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"lone-services/pkg/modelbase"
|
||||
"lone-services/rpc/express/pb"
|
||||
"lone-services/services/express/internal/dao"
|
||||
"lone-services/services/express/internal/model"
|
||||
"lone-services/services/express/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
@@ -13,6 +15,7 @@ type ItemsLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
BaseLogic
|
||||
}
|
||||
|
||||
func NewItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemsLogic {
|
||||
@@ -24,7 +27,12 @@ func NewItemsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemsLogic
|
||||
}
|
||||
|
||||
func (l *ItemsLogic) Items(in *express.EmtpyRequest) (*express.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
modelObj := model.ExpressModel{}.Init()
|
||||
w := modelbase.Params{}
|
||||
|
||||
var data []dao.ExpressInfo
|
||||
items, _ := modelObj.Page(w, &data)
|
||||
|
||||
return l.ok(items)
|
||||
|
||||
return &express.Response{}, nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"lone-services/rpc/express/pb"
|
||||
"lone-services/services/express/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type NamesLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
BaseLogic
|
||||
}
|
||||
|
||||
func NewNamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NamesLogic {
|
||||
return &NamesLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *NamesLogic) Names(in *express.EmtpyRequest) (*express.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &express.Response{}, nil
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"lone-services/rpc/express/pb"
|
||||
"lone-services/services/express/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type StatusLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
BaseLogic
|
||||
}
|
||||
|
||||
func NewStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StatusLogic {
|
||||
return &StatusLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *StatusLogic) Status(in *express.StatusRequest) (*express.Response, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &express.Response{}, nil
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"lone-services/pkg/modelbase"
|
||||
"lone-services/services/express/internal/dao"
|
||||
)
|
||||
|
||||
type ExpressModel struct {
|
||||
modelbase.Base
|
||||
}
|
||||
|
||||
func (m ExpressModel) TableName() string {
|
||||
return modelbase.Prefix() + "express"
|
||||
}
|
||||
|
||||
func (m ExpressModel) Init() ExpressModel {
|
||||
m.Table = m.TableName()
|
||||
return m
|
||||
}
|
||||
|
||||
func (m ExpressModel) Create(data *dao.Express) error {
|
||||
return m.Base.Create(data)
|
||||
}
|
||||
@@ -23,12 +23,32 @@ func NewExpressServer(svcCtx *svc.ServiceContext) *ExpressServer {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ExpressServer) Ping(ctx context.Context, in *express.Request) (*express.Response, error) {
|
||||
l := logic.NewPingLogic(ctx, s.svcCtx)
|
||||
return l.Ping(in)
|
||||
}
|
||||
|
||||
func (s *ExpressServer) Items(ctx context.Context, in *express.EmtpyRequest) (*express.Response, error) {
|
||||
l := logic.NewItemsLogic(ctx, s.svcCtx)
|
||||
return l.Items(in)
|
||||
}
|
||||
|
||||
func (s *ExpressServer) Create(ctx context.Context, in *express.CreateRequest) (*express.Response, error) {
|
||||
l := logic.NewCreateLogic(ctx, s.svcCtx)
|
||||
return l.Create(in)
|
||||
}
|
||||
|
||||
func (s *ExpressServer) Edit(ctx context.Context, in *express.CreateRequest) (*express.Response, error) {
|
||||
l := logic.NewEditLogic(ctx, s.svcCtx)
|
||||
return l.Edit(in)
|
||||
}
|
||||
|
||||
func (s *ExpressServer) Info(ctx context.Context, in *express.IdRequest) (*express.Response, error) {
|
||||
l := logic.NewInfoLogic(ctx, s.svcCtx)
|
||||
return l.Info(in)
|
||||
}
|
||||
|
||||
func (s *ExpressServer) Names(ctx context.Context, in *express.EmtpyRequest) (*express.Response, error) {
|
||||
l := logic.NewNamesLogic(ctx, s.svcCtx)
|
||||
return l.Names(in)
|
||||
}
|
||||
|
||||
func (s *ExpressServer) Status(ctx context.Context, in *express.StatusRequest) (*express.Response, error) {
|
||||
l := logic.NewStatusLogic(ctx, s.svcCtx)
|
||||
return l.Status(in)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user