package router
|
|
import (
|
"net/http"
|
"outsourcing/conf"
|
"outsourcing/controllers"
|
_ "outsourcing/docs"
|
"outsourcing/middleware"
|
|
"github.com/gin-gonic/gin"
|
swaggerFiles "github.com/swaggo/files"
|
ginSwagger "github.com/swaggo/gin-swagger"
|
)
|
|
func NewRouter() *gin.Engine {
|
r := gin.Default()
|
r.Use(middleware.Cors())
|
|
r.StaticFS(conf.LocalConf.StorePath, http.Dir(conf.LocalConf.StorePath)) // 为用户头像和文件提供静态地址
|
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
|
urlPrefix := "/api-outsourcing/v1"
|
|
outsourcingApi := new(controllers.OrderController)
|
outsourcingGroup := r.Group(urlPrefix + "/order").Use(middleware.JWTAuth())
|
{
|
outsourcingGroup.GET("list", outsourcingApi.OutsourcingOrderList) // 委外订单列表
|
outsourcingGroup.GET("overview", outsourcingApi.OrderOverview) // 委外订单统计
|
outsourcingGroup.GET("productList", outsourcingApi.OutsourcingOrderProductList) // 委外订单产品列表
|
outsourcingGroup.POST("saveMaterialApply", outsourcingApi.SaveMaterialApply) // 保存物料申请单
|
outsourcingGroup.POST("getMaterialApplyList", outsourcingApi.GetMaterialApplyList) // 获取物料申请单
|
outsourcingGroup.POST("changeStatus", outsourcingApi.ChangeStatus) // 修改状态
|
outsourcingGroup.GET("deliveryPrepare", outsourcingApi.DeliveryPrepare) //发货准备信息
|
outsourcingGroup.POST("deliveryList", outsourcingApi.GetDeliveryList) // 发货历史
|
outsourcingGroup.POST("saveDelivery", outsourcingApi.SaveDelivery) // 保存发货信息
|
outsourcingGroup.POST("materialSearch", outsourcingApi.MaterialSearch) // 物料搜索
|
|
}
|
|
return r
|
}
|