package v1 import ( "git.getensh.com/common/gopkgs/logger" "git.getensh.com/common/gopkgs/tasker/httptasker" "git.getensh.com/common/gopkgs/util" "github.com/gin-gonic/gin" "go.uber.org/zap" "net/http" "property-applete-gateway/errors" param_v1 "property-applete-gateway/param/v1" "property-applete-gateway/pb" "property-applete-gateway/pb/v1" "property-applete-gateway/utils" ) // // @Summary 添加分类 // @Description 添加分类 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param body body v1.RepairClassAddBody true "信息" // @Success 200 {object} v1.RepairClassAddResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/class [post] func (c *Controller) RepairClassAdd(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairClassAddRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.RepairClassAddBody) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairClassAddResponse{} rpcReq := &v1.RepairClassAddRequest{ GardenId:tokenInfo.GardenId, Name:req.Name, Enable:req.Enable, Area:req.Area, } rpcRsp, err := pb.Garden.RepairClassAdd(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairClassAdd"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } resp.Data = *rpcRsp ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairClassAdd, Origin:nil, Target:req.RepairClassAddBody, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 修改分类 // @Description 修改分类 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param body body v1.RepairClassUpdateBody true "信息" // @Success 200 {object} v1.RepairClassUpdateResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/class [put] func (c *Controller) RepairClassUpdate(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairClassUpdateRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.RepairClassUpdateBody) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairClassUpdateResponse{} rpcReq := &v1.RepairClassUpdateRequest{ GardenId:tokenInfo.GardenId, Name:req.Name, Enable:req.Enable, Id:req.Id, Area:req.Area, } rpcRsp, err := pb.Garden.RepairClassUpdate(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairClassUpdate"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairClassUpdate, Origin:rpcRsp.Origin, Target:req.RepairClassUpdateBody, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 删除分类 // @Description 删除分类 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param id query int true " " // @Success 200 {object} v1.RepairClassDelResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/class [delete] func (c *Controller) RepairClassDel(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairClassDelRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, &req.RepairClassDelQuery, nil) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairClassDelResponse{} rpcReq := &v1.RepairClassDelRequest{ GardenId:tokenInfo.GardenId, Id:req.Id, } rpcRsp, err := pb.Garden.RepairClassDel(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairClassDel"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairClassDel, Origin:rpcRsp.Origin, Target:nil, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 分类列表 // @Description 分类列表 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param page query int false " " // @Param page_size query int false " " // @Param area query int false "1公区 2室内 " // @Success 200 {object} v1.RepairClassListResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/class [get] func (c *Controller) RepairClassList(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairClassListRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, &req.RepairClassListQuery, nil) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairClassListResponse{} rpcReq := &v1.RepairClassListRequest{ GardenId:tokenInfo.GardenId, PageSize:req.PageSize, Page:req.Page, Area:req.Area, } rpcRsp, err := pb.Garden.RepairClassList(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairClassList"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } if rpcRsp.List == nil { rpcRsp.List = make([]*v1.RepairClassItem, 0) } resp.Data = *rpcRsp ctx.JSON(http.StatusOK, resp) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 新增工单 // @Description 新增工单 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param body body v1.RepairOrderAddBody true "信息" // @Success 200 {object} v1.RepairOrderAddResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order [post] func (c *Controller) RepairOrderAdd(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderAddRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.RepairOrderAddBody) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderAddResponse{} rpcReq := &v1.RepairOrderAddRequest{ GardenId:tokenInfo.GardenId, // 分类id ClassId:req.ClassId, // 报修人 ApplyPeople:req.ApplyPeople, // 报修人电话 ApplyPeoplePhone:req.ApplyPeoplePhone, // 预约时间 Appointment:req.Appointment, // 房屋id HouseId:req.HouseId, // 上级处理人 LastUid:tokenInfo.Uid, // 报修内容 ApplyContent:req.ApplyContent, // 报修图片 ApplyPic:req.ApplyPic, ByCompany:tokenInfo.ByCompany, HouseholdUid:0, } rpcRsp, err := pb.Garden.RepairOrderAdd(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderAdd"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } resp.Data = *rpcRsp ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairOrderAdd, Origin:nil, Target:req.RepairOrderAddBody, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 修改工单 // @Description 修改工单 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param body body v1.RepairOrderUpdateBody true "信息" // @Success 200 {object} v1.RepairOrderUpdateResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order [put] func (c *Controller) RepairOrderUpdate(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderUpdateRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.RepairOrderUpdateBody) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderUpdateResponse{} rpcReq := &v1.RepairOrderUpdateRequest{ GardenId:tokenInfo.GardenId, Id:req.Id, // 分类id ClassId:req.ClassId, // 报修人 ApplyPeople:req.ApplyPeople, // 报修人电话 ApplyPeoplePhone:req.ApplyPeoplePhone, // 预约时间 Appointment:req.Appointment, // 房屋id HouseId:req.HouseId, // 报修内容 ApplyContent:req.ApplyContent, // 报修图片 ApplyPic:req.ApplyPic, HouseholdUid:0, } rpcRsp, err := pb.Garden.RepairOrderUpdate(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderUpdate"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairOrderUpdate, Origin:rpcRsp.Origin, Target:req.RepairOrderUpdateBody, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 删除工单 // @Description 删除工单 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param id query int true " " // @Success 200 {object} v1.RepairOrderDelResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order [delete] func (c *Controller) RepairOrderDel(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderDelRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, &req.RepairOrderDelQuery, nil) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderDelResponse{} rpcReq := &v1.RepairOrderDelRequest{ GardenId:tokenInfo.GardenId, Id:req.Id, HouseholdUid:0, } rpcRsp, err := pb.Garden.RepairOrderDel(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderDel"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairOrderDel, Origin:rpcRsp.Origin, Target:nil, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 工单列表 // @Description 工单列表 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param page query int false " " // @Param page_size query int false " " // @Param status query int false " 1未派单 2 已派单 3 已完结 " // @Param apply_people query string false "报修人" // @Param apply_people_phone query string false "报修人电话" // @Param is_me query bool false " true: 指派给我的" // @Param class_id query int false "分类id" // @Success 200 {object} v1.RepairOrderListResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order [get] func (c *Controller) RepairOrderList(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderListRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, &req.RepairOrderListQuery, nil) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderListResponse{} rpcReq := &v1.RepairOrderListRequest{ GardenId:tokenInfo.GardenId, PageSize:req.PageSize, Page:req.Page, ClassId:req.ClassId, ApplyPeoplePhone:req.ApplyPeoplePhone, ApplyPeople:req.ApplyPeople, Status:req.Status, } if req.IsMe { rpcReq.CurrentUid = tokenInfo.Uid } rpcRsp, err := pb.Garden.RepairOrderList(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderList"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } if rpcRsp.List == nil { rpcRsp.List = make([]*v1.RepairOrderItem, 0) } resp.Data = *rpcRsp ctx.JSON(http.StatusOK, resp) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 工单详情 // @Description 工单详情 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param id query int true " " // @Success 200 {object} v1.RepairOrderInfoResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order/info [get] func (c *Controller) RepairOrderInfo(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderInfoRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, &req.RepairOrderInfoQuery, nil) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderInfoResponse{} rpcReq := &v1.RepairOrderInfoRequest{ GardenId:tokenInfo.GardenId, Id:req.Id, } rpcRsp, err := pb.Garden.RepairOrderInfo(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderInfo"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } if rpcRsp.List == nil { rpcRsp.List = make([]*v1.RepairOrderPipelineData, 0) } resp.Data = *rpcRsp ctx.JSON(http.StatusOK, resp) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 派单 // @Description 派单 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param body body v1.RepairOrderSendBody true "信息" // @Success 200 {object} v1.RepairOrderSendResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order/send [put] func (c *Controller) RepairOrderSend(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderSendRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.RepairOrderSendBody) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderSendResponse{} rpcReq := &v1.RepairOrderSendRequest{ GardenId:tokenInfo.GardenId, Id:req.Id, CurrentUid:req.CurrentUid, Feedback:req.Feedback, LastUid:tokenInfo.Uid, ByCompany:tokenInfo.ByCompany, } _, err = pb.Garden.RepairOrderSend(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderSend"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairOrderSend, Origin:nil, Target:req.RepairOrderSendBody, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 结单 // @Description 结单 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param body body v1.RepairOrderFinishBody true "信息" // @Success 200 {object} v1.RepairOrderFinishResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order/finish [put] func (c *Controller) RepairOrderFinish(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderFinishRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.RepairOrderFinishBody) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderFinishResponse{} rpcReq := &v1.RepairOrderFinishRequest{ GardenId:tokenInfo.GardenId, Id:req.Id, Feedback:req.Feedback, LastUid:tokenInfo.Uid, ByCompany:tokenInfo.ByCompany, RepairPic:req.RepairPic, } _, err = pb.Garden.RepairOrderFinish(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderFinish"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairOrderFinish, Origin:nil, Target:req.RepairOrderFinishBody, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 退单 // @Description 退单 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param body body v1.RepairOrderBackBody true "信息" // @Success 200 {object} v1.RepairOrderBackResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order/back [put] func (c *Controller) RepairOrderBack(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderBackRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.RepairOrderBackBody) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderBackResponse{} rpcReq := &v1.RepairOrderBackRequest{ GardenId:tokenInfo.GardenId, Id:req.Id, Feedback:req.Feedback, LastUid:tokenInfo.Uid, ByCompany:tokenInfo.ByCompany, } _, err = pb.Garden.RepairOrderBack(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderBack"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairOrderBack, Origin:nil, Target:req.RepairOrderBackBody, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) } // // @Summary 回访 // @Description 回访 // @Tags 报事报修 // @Accept json // @Produce json // @Param token header string true "token" // @Param body body v1.RepairOrderReturnVisitBody true "信息" // @Success 200 {object} v1.RepairOrderReturnVisitResponse // @Failure 500 {object} base.HTTPError // @Router /api/v1/repair/order/return_visit [put] func (c *Controller) RepairOrderReturnVisit(ctx *gin.Context) { // 解析参数 req := ¶m_v1.RepairOrderReturnVisitRequest{} parseParamTask := func() error { err := util.ShouldBind(ctx, &req.Header, nil, nil, &req.RepairOrderReturnVisitBody) if err != nil { logger.Error("func", zap.String("call", "util.ShouldBind"), zap.String("error", err.Error())) return errors.ParamsError } return nil } // 业务处理 handleServiceTask := func() error { tokenInfo, err := utils.GetSubjectValue(ctx) if err != nil { return err } // 响应数据 resp := param_v1.RepairOrderReturnVisitResponse{} rpcReq := &v1.RepairOrderReturnVisitRequest{ GardenId:tokenInfo.GardenId, Id:req.Id, ReturnVisitLevel:req.ReturnVisitLevel, ReturnVisitContent:req.ReturnVisitContent, } _, err = pb.Garden.RepairOrderReturnVisit(ctx, rpcReq) if err != nil { s, _ := json.MarshalToString(req) logger.Error("func", zap.String("call", "pb.Garden.RepairOrderReturnVisit"), zap.String("params", s), zap.String("error", err.Error())) return errors.ErrorTransForm(err) } ctx.JSON(http.StatusOK, resp) logReq := OperationLogRequest{ Module:ModuleRepair, Action:ActionRepairOrderReturnVisit, Origin:nil, Target:req.RepairOrderReturnVisitBody, UserName:tokenInfo.UserName, Uid:tokenInfo.Uid, Cid:tokenInfo.Cid, GardenId:tokenInfo.GardenId, } go OperationLogAdd(&logReq) return nil } // 执行任务 httptasker.Exec(ctx, parseParamTask, handleServiceTask) }