1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package handler
- import (
- "github.com/gin-gonic/gin"
- "github.com/sirupsen/logrus"
- "youngee_m_api/consts"
- "youngee_m_api/db"
- "youngee_m_api/model/http_model"
- "youngee_m_api/util"
- )
- func WrapEditJobHandler(ctx *gin.Context) {
- handler := newUpdateJobHandler(ctx)
- BaseRun(handler)
- }
- func newUpdateJobHandler(ctx *gin.Context) *UpdateJobInfoHandler {
- return &UpdateJobInfoHandler{
- req: http_model.NewUpdateJobInfoRequest(),
- resp: http_model.NewUpdateJobInfoResponse(),
- ctx: ctx,
- }
- }
- type UpdateJobInfoHandler struct {
- req *http_model.UpdateJobInfoRequest
- resp *http_model.CommonResponse
- ctx *gin.Context
- }
- func (u UpdateJobInfoHandler) getContext() *gin.Context { return u.ctx }
- func (u UpdateJobInfoHandler) getResponse() interface{} {
- return u.resp
- }
- func (u UpdateJobInfoHandler) getRequest() interface{} {
- return u.req
- }
- func (u UpdateJobInfoHandler) run() {
- data := http_model.UpdateJobInfoRequest{}
- data = *u.req
- res, err := db.UpdateJobInfo(u.ctx, &data)
- if err != nil {
- logrus.Errorf("[UpdateJobInfoHandler] call UpdateJobInfo err:%+v\n", err)
- util.HandlerPackErrorResp(u.resp, consts.ErrorInternal, "")
- logrus.Info("UpdateJobInfoHandler fail,req:%+v", u.req)
- return
- }
- u.resp.Message = "编辑创建岗位"
- u.resp.Data = res
- }
- func (u UpdateJobInfoHandler) checkParam() error {
- return nil
- }
|