Merge branch 'dev/dev1.0' into feature/rzy/api_1.0
This commit is contained in:
		
						commit
						28bd78ab7f
					
				| 
						 | 
				
			
			@ -17,7 +17,7 @@ func NewOrderLogRepo(repo xorm.Interface) *OrderLogRepo {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *OrderLogRepo) MerchantList(conn builder.Cond, pageFilter entities.PageRequest, orderLogList *[]orderlogmodel.OrderLogModel) (int64, error) {
 | 
			
		||||
func (m *OrderLogRepo) OrderLogList(conn builder.Cond, pageFilter entities.PageRequest, orderLogList *[]orderlogmodel.OrderLog) (int64, error) {
 | 
			
		||||
	repo := m.repo.Where(conn)
 | 
			
		||||
	if pageFilter.Page > 0 {
 | 
			
		||||
		repo = repo.Limit(pageFilter.PageSize, pageFilter.PageSize*(pageFilter.Page-1))
 | 
			
		||||
| 
						 | 
				
			
			@ -25,15 +25,15 @@ func (m *OrderLogRepo) MerchantList(conn builder.Cond, pageFilter entities.PageR
 | 
			
		|||
	return repo.Desc("create_time").FindAndCount(orderLogList)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *OrderLogRepo) MerchantInsertOne(orderLog *orderlogmodel.OrderLogModel) (int64, error) {
 | 
			
		||||
func (m *OrderLogRepo) OrderLogInsertOne(orderLog *orderlogmodel.OrderLog) (int64, error) {
 | 
			
		||||
	return m.repo.InsertOne(orderLog)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *OrderLogRepo) MerchantDelete(orderLog *orderlogmodel.OrderLogModel, conn builder.Cond) (int64, error) {
 | 
			
		||||
func (m *OrderLogRepo) OrderLogDelete(orderLog *orderlogmodel.OrderLog, conn builder.Cond) (int64, error) {
 | 
			
		||||
	return m.repo.Where(conn).Delete(orderLog)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// columns 参数为要更新的字段
 | 
			
		||||
func (m *OrderLogRepo) MerchantUpdate(orderLog *orderlogmodel.OrderLogModel, conn builder.Cond, columns ...string) (int64, error) {
 | 
			
		||||
func (m *OrderLogRepo) OrderLogUpdate(orderLog *orderlogmodel.OrderLog, conn builder.Cond, columns ...string) (int64, error) {
 | 
			
		||||
	return m.repo.Where(conn).MustCols(columns...).Update(orderLog)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ func NewOrderRepo(repo xorm.Interface) *OrderRepo {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *OrderRepo) MerchantList(conn builder.Cond, pageFilter entities.PageRequest, orderList *[]ordersmodel.Orders) (int64, error) {
 | 
			
		||||
func (m *OrderRepo) OrderList(conn builder.Cond, pageFilter entities.PageRequest, orderList *[]ordersmodel.Orders) (int64, error) {
 | 
			
		||||
	repo := m.repo.Where(conn)
 | 
			
		||||
	if pageFilter.Page > 0 {
 | 
			
		||||
		repo = repo.Limit(pageFilter.PageSize, pageFilter.PageSize*(pageFilter.Page-1))
 | 
			
		||||
| 
						 | 
				
			
			@ -25,15 +25,27 @@ func (m *OrderRepo) MerchantList(conn builder.Cond, pageFilter entities.PageRequ
 | 
			
		|||
	return repo.Desc("create_time").FindAndCount(orderList)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *OrderRepo) MerchantInsertOne(order *ordersmodel.Orders) (int64, error) {
 | 
			
		||||
func (m *OrderRepo) OrderInsertOne(order *ordersmodel.Orders) (int64, error) {
 | 
			
		||||
	return m.repo.InsertOne(order)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *OrderRepo) MerchantDelete(order *ordersmodel.Orders, conn builder.Cond) (int64, error) {
 | 
			
		||||
func (m *OrderRepo) OrderDelete(order *ordersmodel.Orders, conn builder.Cond) (int64, error) {
 | 
			
		||||
	return m.repo.Where(conn).Delete(order)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// columns 参数为要更新的字段
 | 
			
		||||
func (m *OrderRepo) MerchantUpdate(order *ordersmodel.Orders, conn builder.Cond, columns ...string) (int64, error) {
 | 
			
		||||
func (m *OrderRepo) OrderUpdate(order *ordersmodel.Orders, conn builder.Cond, columns ...string) (int64, error) {
 | 
			
		||||
	return m.repo.Where(conn).MustCols(columns...).Update(order)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *OrderRepo) OrdersBackendList(conn builder.Cond, pageFilter entities.PageRequest, orderList *[]ordersmodel.OrdersBackendList) (int64, error) {
 | 
			
		||||
	repo := m.repo.Select(`orders.*, merchant.name as merchant_name, app.app_name, pay_channel.pay_name`).
 | 
			
		||||
		Where(conn)
 | 
			
		||||
	if pageFilter.Page > 0 {
 | 
			
		||||
		repo = repo.Limit(pageFilter.PageSize, pageFilter.PageSize*(pageFilter.Page-1))
 | 
			
		||||
	}
 | 
			
		||||
	repo = repo.Join("left", "app", "app.id = orders.app_id").
 | 
			
		||||
		Join("left", "merchant", "merchant.id = orders.merchant_id").
 | 
			
		||||
		Join("left", "pay_channel", "pay_channel.id = orders.pay_id")
 | 
			
		||||
	return repo.Desc("create_time").FindAndCount(orderList)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
package backend
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"PaymentCenter/app/constants/errorcode"
 | 
			
		||||
	"PaymentCenter/app/http/controllers"
 | 
			
		||||
	"PaymentCenter/app/http/entities"
 | 
			
		||||
	"PaymentCenter/app/http/entities/backend"
 | 
			
		||||
	"PaymentCenter/app/models/orderlogmodel"
 | 
			
		||||
	"PaymentCenter/app/models/ordersmodel"
 | 
			
		||||
	"PaymentCenter/app/services"
 | 
			
		||||
	"github.com/ahmetb/go-linq/v3"
 | 
			
		||||
	"github.com/gin-gonic/gin"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func OrderList(c *gin.Context) {
 | 
			
		||||
	req, _ := controllers.GetRequest(c).(*backend.OrderListRequest)
 | 
			
		||||
	filter, err := req.ValidateRequest()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		controllers.Error(c, errorcode.ParamError, err.Error())
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	orderList, total, code := services.OrderList(filter)
 | 
			
		||||
 | 
			
		||||
	result := make([]backend.OrdersResponse, 0, len(orderList))
 | 
			
		||||
	linq.From(orderList).SelectT(func(in ordersmodel.OrdersBackendList) (out backend.OrdersResponse) {
 | 
			
		||||
		out.ResponseFromDb(in)
 | 
			
		||||
		return
 | 
			
		||||
	}).ToSlice(&result)
 | 
			
		||||
	data := entities.PageRsp{
 | 
			
		||||
		Total: total,
 | 
			
		||||
		Data:  result,
 | 
			
		||||
	}
 | 
			
		||||
	controllers.HandCodeRes(c, data, code)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func OrderLogsList(c *gin.Context) {
 | 
			
		||||
	req, _ := controllers.GetRequest(c).(*backend.OrderLogsListRequest)
 | 
			
		||||
	req.SetDefault()
 | 
			
		||||
	orderLogList, total, code := services.OrderLogsList(*req)
 | 
			
		||||
 | 
			
		||||
	result := make([]backend.OrderLogResponse, 0, len(orderLogList))
 | 
			
		||||
	linq.From(orderLogList).SelectT(func(in orderlogmodel.OrderLog) (out backend.OrderLogResponse) {
 | 
			
		||||
		out.ResponseFromDb(in)
 | 
			
		||||
		return
 | 
			
		||||
	}).ToSlice(&result)
 | 
			
		||||
	data := entities.PageRsp{
 | 
			
		||||
		Total: total,
 | 
			
		||||
		Data:  result,
 | 
			
		||||
	}
 | 
			
		||||
	controllers.HandCodeRes(c, data, code)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,131 @@
 | 
			
		|||
package backend
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"PaymentCenter/app/http/entities"
 | 
			
		||||
	"PaymentCenter/app/models/orderlogmodel"
 | 
			
		||||
	"PaymentCenter/app/models/ordersmodel"
 | 
			
		||||
	"PaymentCenter/app/utils"
 | 
			
		||||
	"github.com/pkg/errors"
 | 
			
		||||
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type OrderListRequest struct {
 | 
			
		||||
	Id              int64  `json:"id" form:"id"`
 | 
			
		||||
	MerchantId      int64  `json:"merchant_id" form:"merchant_id"`
 | 
			
		||||
	PayId           int64  `json:"pay_id" form:"pay_id"`
 | 
			
		||||
	AppId           int64  `json:"app_id" form:"app_id"`
 | 
			
		||||
	MerchantOrderId string `json:"merchant_order_id" form:"merchant_order_id"`
 | 
			
		||||
	Status          int    `json:"status" form:"status"`
 | 
			
		||||
	OrderType       int    `json:"order_type" form:"order_type"`
 | 
			
		||||
	StartTime       string `json:"start_time" form:"start_time"`
 | 
			
		||||
	EndTime         string `json:"end_time" form:"end_time"`
 | 
			
		||||
	entities.PageRequest
 | 
			
		||||
}
 | 
			
		||||
type OrderList struct {
 | 
			
		||||
	Id              int64     `json:"id"`
 | 
			
		||||
	MerchantId      int64     `json:"merchant_id"`
 | 
			
		||||
	PayId           int64     `json:"pay_id"`
 | 
			
		||||
	AppId           int64     `json:"app_id"`
 | 
			
		||||
	MerchantOrderId string    `json:"merchant_order_id"`
 | 
			
		||||
	Status          int       `json:"status"`
 | 
			
		||||
	OrderType       int       `json:"order_type"`
 | 
			
		||||
	StartTime       time.Time `json:"start_time"`
 | 
			
		||||
	EndTime         time.Time `json:"end_time"`
 | 
			
		||||
	entities.PageRequest
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o *OrderListRequest) ValidateRequest() (r OrderList, err error) {
 | 
			
		||||
	if o.StartTime != "" {
 | 
			
		||||
		r.StartTime, err = utils.StrToTimeShanghai(o.StartTime)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			err = errors.Wrap(err, "时间格式错误")
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if o.EndTime != "" {
 | 
			
		||||
		r.EndTime, err = utils.StrToTimeShanghai(o.EndTime)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			err = errors.Wrap(err, "时间格式错误")
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	r.Id = o.Id
 | 
			
		||||
	r.MerchantId = o.MerchantId
 | 
			
		||||
	r.PayId = o.PayId
 | 
			
		||||
	r.AppId = o.AppId
 | 
			
		||||
	r.MerchantOrderId = o.MerchantOrderId
 | 
			
		||||
	r.Status = o.Status
 | 
			
		||||
	r.OrderType = o.OrderType
 | 
			
		||||
	r.PageRequest = o.PageRequest
 | 
			
		||||
	r.SetDefault()
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type OrdersResponse struct {
 | 
			
		||||
	Id               int64  `json:"id"`
 | 
			
		||||
	MerchantId       int64  `json:"merchant_id"`
 | 
			
		||||
	PayId            int64  `json:"pay_id"`
 | 
			
		||||
	AppId            int64  `json:"app_id"`
 | 
			
		||||
	MerchantOrderId  string `json:"merchant_order_id"`
 | 
			
		||||
	Status           int    `json:"status"`
 | 
			
		||||
	OrderType        int    `json:"order_type"`
 | 
			
		||||
	Amount           int    `json:"amount"`
 | 
			
		||||
	IpAddress        string `json:"ip_address"`
 | 
			
		||||
	MerchantRequest  string `json:"merchant_request"`
 | 
			
		||||
	MerchantResponse string `json:"merchant_response"`
 | 
			
		||||
	OrderResponse    string `json:"order_response"`
 | 
			
		||||
	ExtJson          string `json:"ext_json"`
 | 
			
		||||
	CreateTime       string `json:"create_time"`
 | 
			
		||||
	UpdateTime       string `json:"update_time"`
 | 
			
		||||
	MerchantName     string `json:"merchant_name"`
 | 
			
		||||
	PayName          string `json:"pay_name"`
 | 
			
		||||
	AppName          string `json:"app_name"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o *OrdersResponse) ResponseFromDb(db ordersmodel.OrdersBackendList) {
 | 
			
		||||
	o.Id = db.Id
 | 
			
		||||
	o.MerchantId = db.MerchantId
 | 
			
		||||
	o.PayId = db.PayId
 | 
			
		||||
	o.AppId = db.AppId
 | 
			
		||||
	o.MerchantOrderId = db.MerchantOrderId
 | 
			
		||||
	o.Status = db.Status
 | 
			
		||||
	o.OrderType = db.OrderType
 | 
			
		||||
	o.Amount = db.Amount
 | 
			
		||||
	o.IpAddress = db.IpAddress
 | 
			
		||||
	o.MerchantRequest = db.MerchantRequest
 | 
			
		||||
	o.MerchantResponse = db.MerchantResponse
 | 
			
		||||
	o.OrderResponse = db.OrderResponse
 | 
			
		||||
	o.ExtJson = db.ExtJson
 | 
			
		||||
	o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05")
 | 
			
		||||
	o.UpdateTime = db.UpdateTime.Format("2006-01-02 15:04:05")
 | 
			
		||||
	o.MerchantName = db.MerchantName
 | 
			
		||||
	o.PayName = db.PayName
 | 
			
		||||
	o.AppName = db.AppName
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type OrderLogsListRequest struct {
 | 
			
		||||
	OrderId int64 `json:"order_id" form:"order_id"`
 | 
			
		||||
	entities.PageRequest
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type OrderLogResponse struct {
 | 
			
		||||
	Id               int64  `json:"id"`
 | 
			
		||||
	OrderId          int64  `json:"order_id"`
 | 
			
		||||
	PayCallback      string `json:"pay_callback"`
 | 
			
		||||
	Status           int    `json:"status"`
 | 
			
		||||
	MerchantParam    string `json:"merchant_param"`
 | 
			
		||||
	MerchantCallback string `json:"merchant_callback"`
 | 
			
		||||
	CreateTime       string `json:"create_time"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o *OrderLogResponse) ResponseFromDb(db orderlogmodel.OrderLog) {
 | 
			
		||||
	o.Id = db.Id
 | 
			
		||||
	o.OrderId = db.OrderId
 | 
			
		||||
	o.PayCallback = db.PayCallback
 | 
			
		||||
	o.Status = db.Status
 | 
			
		||||
	o.MerchantParam = db.MerchantParam
 | 
			
		||||
	o.MerchantCallback = db.MerchantCallback
 | 
			
		||||
	o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -24,4 +24,7 @@ var BackendRequestMap = map[string]func() interface{}{
 | 
			
		|||
	common.ADMIN_V1 + "/app/list":    func() interface{} { return new(backend.AppListRequest) },
 | 
			
		||||
	common.ADMIN_V1 + "/app/delete":  func() interface{} { return new(entities.IdRequest) },
 | 
			
		||||
	common.ADMIN_V1 + "/app/decrypt": func() interface{} { return new(backend.GenerateDecryptKeyRequest) },
 | 
			
		||||
	// 订单
 | 
			
		||||
	common.ADMIN_V1 + "/order/list":     func() interface{} { return new(backend.OrderListRequest) },
 | 
			
		||||
	common.ADMIN_V1 + "/order/log/list": func() interface{} { return new(backend.OrderLogsListRequest) },
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,6 +46,11 @@ func RegisterAdminRoute(router *gin.Engine) {
 | 
			
		|||
		app.DELETE("/delete", backend.AppDelete)     // 应用删除
 | 
			
		||||
		app.GET("/decrypt", backend.GenerateDecrypt) // 生成密钥对
 | 
			
		||||
 | 
			
		||||
		// 订单
 | 
			
		||||
		order := v1.Group("/order")
 | 
			
		||||
		order.GET("/list", backend.OrderList)         // 订单列表
 | 
			
		||||
		order.GET("/log/list", backend.OrderLogsList) // 订单日志列表
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,7 @@ type Orders struct {
 | 
			
		|||
	MerchantId       int64     `xorm:"'merchant_id' bigint(20)"`
 | 
			
		||||
	PayId            int64     `xorm:"'pay_id' bigint(20)"`
 | 
			
		||||
	AppId            int64     `xorm:"'app_id' bigint(20)"`
 | 
			
		||||
	MerchantOrderId  string    `xorm:"'merchant_order_id' varchar(128)"`
 | 
			
		||||
	MerchantOrderId  string    `xorm:"'merchant_order_id' varchar(32)"`
 | 
			
		||||
	Status           int       `xorm:"'status' int(11)"`
 | 
			
		||||
	OrderType        int       `xorm:"'order_type' int(11)"`
 | 
			
		||||
	Amount           int       `xorm:"'amount' int(11)"`
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +30,12 @@ type Orders struct {
 | 
			
		|||
	UpdateTime       time.Time `xorm:"'update_time' timestamp updated"`
 | 
			
		||||
	DeleteTime       time.Time `xorm:"'delete_time' timestamp deleted"`
 | 
			
		||||
}
 | 
			
		||||
type OrdersBackendList struct {
 | 
			
		||||
	Orders       `xorm:"extends"`
 | 
			
		||||
	MerchantName string `xorm:"'merchant_name' varchar(128)"`
 | 
			
		||||
	PayName      string `xorm:"'pay_name' varchar(128)"`
 | 
			
		||||
	AppName      string `xorm:"'app_name' varchar(128)"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 表名
 | 
			
		||||
func (m *Orders) TableName() string {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,7 +17,6 @@ type PayChannel struct {
 | 
			
		|||
	PayName     string    `xorm:"'pay_name' varchar(128)"`
 | 
			
		||||
	MerchantId  int64     `xorm:"'merchant_id' bigint(20)"`
 | 
			
		||||
	ChannelType int       `xorm:"'channel_type' int(11)"`
 | 
			
		||||
 | 
			
		||||
	AppId       string    `xorm:"'app_id' varchar(255)"`
 | 
			
		||||
	ExtJson     string    `xorm:"'ext_json' JSON"`
 | 
			
		||||
	ExpireTime  time.Time `xorm:"'expire_time' datetime"`
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,64 @@
 | 
			
		|||
package services
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"PaymentCenter/app/data"
 | 
			
		||||
	"PaymentCenter/app/http/entities/backend"
 | 
			
		||||
	"PaymentCenter/app/models/orderlogmodel"
 | 
			
		||||
	"PaymentCenter/app/models/ordersmodel"
 | 
			
		||||
	"PaymentCenter/app/models/paychannelmodel"
 | 
			
		||||
	"xorm.io/builder"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// 订单列表,后台查询
 | 
			
		||||
func OrderList(req backend.OrderList) (result []ordersmodel.OrdersBackendList, total int64, code int) {
 | 
			
		||||
	repo := data.NewOrderRepo(paychannelmodel.GetInstance().GetDb())
 | 
			
		||||
	// 拼接查询条件
 | 
			
		||||
	conn := builder.NewCond()
 | 
			
		||||
	if req.Id > 0 {
 | 
			
		||||
		conn = conn.And(builder.Eq{"id": req.Id})
 | 
			
		||||
	}
 | 
			
		||||
	if req.MerchantId > 0 {
 | 
			
		||||
		conn = conn.And(builder.Eq{"merchant_id": req.MerchantId})
 | 
			
		||||
	}
 | 
			
		||||
	if req.PayId > 0 {
 | 
			
		||||
		conn = conn.And(builder.Eq{"pay_id": req.PayId})
 | 
			
		||||
	}
 | 
			
		||||
	if req.AppId > 0 {
 | 
			
		||||
		conn = conn.And(builder.Eq{"app_id": req.AppId})
 | 
			
		||||
	}
 | 
			
		||||
	if req.MerchantOrderId != "" {
 | 
			
		||||
		conn = conn.And(builder.Like{"merchant_order_id", req.MerchantOrderId})
 | 
			
		||||
	}
 | 
			
		||||
	if req.Status > 0 {
 | 
			
		||||
		conn = conn.And(builder.Eq{"status": req.Status})
 | 
			
		||||
	}
 | 
			
		||||
	if req.OrderType > 0 {
 | 
			
		||||
		conn = conn.And(builder.Eq{"order_type": req.OrderType})
 | 
			
		||||
	}
 | 
			
		||||
	if !req.StartTime.IsZero() {
 | 
			
		||||
		conn = conn.And(builder.Gte{"start_time": req.StartTime})
 | 
			
		||||
	}
 | 
			
		||||
	if !req.EndTime.IsZero() {
 | 
			
		||||
		conn = conn.And(builder.Lte{"end_time": req.EndTime})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 调用repo
 | 
			
		||||
	orderList := make([]ordersmodel.OrdersBackendList, 0)
 | 
			
		||||
	count, err := repo.OrdersBackendList(conn, req.PageRequest, &orderList)
 | 
			
		||||
	code = handErr(err)
 | 
			
		||||
	return orderList, count, code
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func OrderLogsList(req backend.OrderLogsListRequest) (result []orderlogmodel.OrderLog, total int64, code int) {
 | 
			
		||||
	repo := data.NewOrderLogRepo(paychannelmodel.GetInstance().GetDb())
 | 
			
		||||
	conn := builder.NewCond()
 | 
			
		||||
	if req.OrderId > 0 {
 | 
			
		||||
		conn = conn.And(builder.Eq{"order_id": req.OrderId})
 | 
			
		||||
	}
 | 
			
		||||
	// 调用repo
 | 
			
		||||
	orderLogList := make([]orderlogmodel.OrderLog, 0)
 | 
			
		||||
	count, err := repo.OrderLogList(conn, req.PageRequest, &orderLogList)
 | 
			
		||||
	code = handErr(err)
 | 
			
		||||
 | 
			
		||||
	return orderLogList, count, code
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue