package controllers import ( "hongze/hz_crm_api/models" "hongze/hz_crm_api/models/company" ) // 流程管理 type CompanyProcessController struct { BaseAuthController } // @Title 客户流程列表 // @Description 客户流程列表接口 // @Param CompanyId query int true "客户id" // @Success 200 {object} company.CompanyOperationRecordListResp // @router /process/list [get] func (this *CompanyProcessController) ProcessList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() sysUser := this.SysUser if sysUser == nil { br.Msg = "请登录" br.ErrMsg = "请登录,SysUser Is Empty" br.Ret = 408 return } companyId, _ := this.GetInt("CompanyId") if companyId <= 0 { br.Msg = "参数错误" br.ErrMsg = "客户参数小于等于0" return } list, err := company.GetCompanyOperationRecordList(companyId) if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取数据失败,Err:" + err.Error() return } showButton := true if len(list) > 0 { for key, item := range list { if item.Operation == "approve" { list[key].Remark = item.ApproveContent } else if item.Operation == "edit_renewal_reason" || item.Operation == "add_try_out_reason" || item.Operation == "add_renewal_reason" { showButton = false } } } resp := new(company.CompanyOperationRecordListResp) resp.List = list resp.ShowButton = showButton br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp }