作者 唐旭辉

bug 修复

@@ -150,12 +150,16 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 @@ -150,12 +150,16 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
150 } 150 }
151 151
152 type ResponseChanceInfo struct { 152 type ResponseChanceInfo struct {
153 - BaseContent []protocol.InputElement `json:"base_content"`  
154 - ExtraContent []protocol.InputElement `json:"extra_content"`  
155 - ImageData []models.ChanceDataImage `json:"image_data"`  
156 - VideoData []models.ChanceDataVideos `json:"video_data"`  
157 - SpeechData []models.ChanceDataSpeechs `json:"speech_data"`  
158 - FlowLog []protocol.ChanceFlowLog `json:"flow_log"` 153 + CreateTime int64 `json:"create_time"`
  154 + UserName string `json:"user_name"`
  155 + ChanceTypeName string `json:"chance_type_name"`
  156 + TemplateName string `json:"template_name"`
  157 + BaseContent []protocol.InputElement `json:"base_content"`
  158 + ExtraContent []protocol.InputElement `json:"extra_content"`
  159 + ImageData []models.ChanceDataImage `json:"image_data"`
  160 + VideoData []models.ChanceDataVideos `json:"video_data"`
  161 + SpeechData []models.ChanceDataSpeechs `json:"speech_data"`
  162 + FlowLog []protocol.ChanceFlowLog `json:"flow_log"`
159 } 163 }
160 164
161 //机会详情 165 //机会详情
@@ -181,10 +185,15 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error @@ -181,10 +185,15 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
181 log.Error("机会的公司不匹配") 185 log.Error("机会的公司不匹配")
182 return returnData, protocol.NewErrWithMessage("1") 186 return returnData, protocol.NewErrWithMessage("1")
183 } 187 }
  188 + returnData.CreateTime = chanceInfo.CreateAt.Unix()
  189 +
184 var ( 190 var (
185 chanceContent []protocol.InputElement 191 chanceContent []protocol.InputElement
186 ) 192 )
187 - json.Unmarshal([]byte(chanceInfo.Content), &chanceContent) 193 + err = json.Unmarshal([]byte(chanceInfo.Content), &chanceContent)
  194 + if err != nil {
  195 + log.Error("解析机会内容失败:%s", err)
  196 + }
188 for i := range chanceContent { 197 for i := range chanceContent {
189 if chanceContent[i].SectionType == 1 { 198 if chanceContent[i].SectionType == 1 {
190 returnData.BaseContent = append(returnData.BaseContent, chanceContent[i]) 199 returnData.BaseContent = append(returnData.BaseContent, chanceContent[i])
@@ -193,6 +202,29 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error @@ -193,6 +202,29 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
193 returnData.ExtraContent = append(returnData.ExtraContent, chanceContent[i]) 202 returnData.ExtraContent = append(returnData.ExtraContent, chanceContent[i])
194 } 203 }
195 } 204 }
  205 + ucompany, err := models.GetUserCompanyById(chanceInfo.UserId)
  206 + if err == nil {
  207 + userinfo, err := models.GetUserById(ucompany.UserId)
  208 + if err == nil {
  209 + returnData.UserName = userinfo.NickName
  210 + } else {
  211 + log.Error("GetUserById(%d) err:%s", ucompany.UserId, err)
  212 + }
  213 + } else {
  214 + log.Error("GetUserCompanyById(%d) err:%s", chanceInfo.UserId, err)
  215 + }
  216 + templateinfo, err := models.GetAuditTemplateById(chanceInfo.AuditTemplateId)
  217 + if err == nil {
  218 + returnData.TemplateName = templateinfo.Name
  219 + } else {
  220 + log.Error("GetAuditTemplateById(%d)err:%s", chanceInfo.AuditTemplateId, err)
  221 + }
  222 + chanceTypeInfo, err := models.GetChanceTypeById(chanceInfo.ChanceTypeId)
  223 + if err == nil {
  224 + returnData.ChanceTypeName = chanceTypeInfo.Name
  225 + } else {
  226 + log.Error("GetChanceTypeById(%d) err:%s", chanceInfo.ChanceTypeId, err)
  227 + }
196 228
197 return returnData, nil 229 return returnData, nil
198 } 230 }
@@ -366,7 +366,7 @@ func GetUserHasMenu(userid, companyid int64) ([]protocol.ResponseUserHasMenu, er @@ -366,7 +366,7 @@ func GetUserHasMenu(userid, companyid int64) ([]protocol.ResponseUserHasMenu, er
366 JOIN role AS c ON a.role_id = c.id 366 JOIN role AS c ON a.role_id = c.id
367 WHERE b.user_company_id=? AND c.delete_at =0 ` 367 WHERE b.user_company_id=? AND c.delete_at =0 `
368 var menuids []int64 368 var menuids []int64
369 - err = utils.ExecuteQueryAll(&menuids, datasql, ucompany.Id) 369 + err = utils.ExecuteQueryAll(&menuids, datasql2, ucompany.Id)
370 if err != nil { 370 if err != nil {
371 log.Error("EXECUTE SQL err:%s", err) 371 log.Error("EXECUTE SQL err:%s", err)
372 return nil, protocol.NewErrWithMessage("1") 372 return nil, protocol.NewErrWithMessage("1")