|
@@ -0,0 +1,60 @@
|
|
|
+package handler
|
|
|
+
|
|
|
+import (
|
|
|
+ "github.com/gin-gonic/gin"
|
|
|
+ "github.com/sirupsen/logrus"
|
|
|
+ "youngee_m_api/consts"
|
|
|
+ "youngee_m_api/model/http_model"
|
|
|
+ "youngee_m_api/service"
|
|
|
+ "youngee_m_api/util"
|
|
|
+)
|
|
|
+
|
|
|
+func WrapEndSelectionHandler(ctx *gin.Context) {
|
|
|
+ handler := newEndSelectionHandler(ctx)
|
|
|
+ BaseRun(handler)
|
|
|
+}
|
|
|
+
|
|
|
+type EndSelection struct {
|
|
|
+ ctx *gin.Context
|
|
|
+ req *http_model.EndSelectionRequest
|
|
|
+ resp *http_model.CommonResponse
|
|
|
+}
|
|
|
+
|
|
|
+func (g EndSelection) getContext() *gin.Context {
|
|
|
+ return g.ctx
|
|
|
+}
|
|
|
+
|
|
|
+func (g EndSelection) getResponse() interface{} {
|
|
|
+ return g.resp
|
|
|
+}
|
|
|
+
|
|
|
+func (g EndSelection) getRequest() interface{} {
|
|
|
+ return g.req
|
|
|
+}
|
|
|
+
|
|
|
+func (g EndSelection) run() {
|
|
|
+ data := http_model.EndSelectionRequest{}
|
|
|
+ data = *g.req
|
|
|
+ res, err := service.Selection.End(g.ctx, data)
|
|
|
+ if err != nil {
|
|
|
+ logrus.Errorf("[EndSelection] call EndSelection err:%+v\n", err)
|
|
|
+ util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, "")
|
|
|
+ logrus.Info("EndSelection fail,req:%+v", g.req)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ g.resp.Message = "结束带货任务成功"
|
|
|
+ g.resp.Data = res
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+func (g EndSelection) checkParam() error {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func newEndSelectionHandler(ctx *gin.Context) *EndSelection {
|
|
|
+ return &EndSelection{
|
|
|
+ ctx: ctx,
|
|
|
+ req: http_model.NewEndSelectionRequest(),
|
|
|
+ resp: http_model.NewEndSelectionResponse(),
|
|
|
+ }
|
|
|
+}
|