作者 yangfu
... ... @@ -7,19 +7,16 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
//取消申请
type CancelCooperationApplicationCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 共创申请ID
CooperationApplicationId []int `json:"cooperationApplicationId,string" valid:"Required"`
// 共创申请审核状态,1待审核,2已同意,3已拒绝
CooperationApplicationStatus int `json:"cooperationApplicationStatus" valid:"Required"`
// 共创申请审核描述
CooperationApplicationVerifyDescription string `json:"cooperationApplicationVerifyDescription" valid:"Required"`
CooperationApplicationId int `json:"cooperationApplicationId" valid:"Required"`
}
func (auditCooperationApplicationCommand *CancelCooperationApplicationCommand) Valid(validation *validation.Validation) {
validation.SetError("CustomValid", "未实现的自定义认证")
}
func (auditCooperationApplicationCommand *CancelCooperationApplicationCommand) ValidateCommand() error {
... ...
... ... @@ -123,8 +123,16 @@ func (srv CooperationApplicationsService) PersonGetCooperationApplications(appli
}
// PersonCancelCooperationApplications 共创用户取消共创申请
func (srv CooperationApplicationsService) PersonCancelCooperationApplications(userMenusCommand *command.CancelCooperationApplicationCommand) (interface{}, error) {
return nil, nil
func (srv CooperationApplicationsService) PersonCancelCooperationApplications(cancelCommand *command.CancelCooperationApplicationCommand) (interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
cancelCommand.Operator)
_, err := creationCooperationGateway.CooperationApplicationCancel(allied_creation_cooperation.ReqCooperationApplicationCancel{
ApplicationId: cancelCommand.CooperationApplicationId,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return cancelCommand, nil
}
// PersonSearchCooperationApplications 共创用户获取共创申请列表
... ...
... ... @@ -107,12 +107,9 @@ func (controller *CooperationController) PersonGetCooperationApplication() {
func (controller *CooperationController) PersonCancelCooperationApplication() {
svr := service.CooperationApplicationsService{}
cmd := &command.CancelCooperationApplicationCommand{}
err := controller.Unmarshal(cmd)
if err != nil {
controller.Response(nil, err)
return
}
applicationId, _ := controller.GetInt(":applicationId")
cmd.Operator = controller.GetOperator()
cmd.CooperationApplicationId = applicationId
data, err := svr.PersonCancelCooperationApplications(cmd)
controller.Response(data, err)
}
... ...