作者 yangfu

Merge branch 'test' of http://gitlab.fjmaimaimai.com/mmm-go/oppmg into test

... ... @@ -150,12 +150,16 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
}
type ResponseChanceInfo struct {
BaseContent []protocol.InputElement `json:"base_content"`
ExtraContent []protocol.InputElement `json:"extra_content"`
ImageData []models.ChanceDataImage `json:"image_data"`
VideoData []models.ChanceDataVideos `json:"video_data"`
SpeechData []models.ChanceDataSpeechs `json:"speech_data"`
FlowLog []protocol.ChanceFlowLog `json:"flow_log"`
CreateTime int64 `json:"create_time"`
UserName string `json:"user_name"`
ChanceTypeName string `json:"chance_type_name"`
TemplateName string `json:"template_name"`
BaseContent []protocol.InputElement `json:"base_content"`
ExtraContent []protocol.InputElement `json:"extra_content"`
ImageData []models.ChanceDataImage `json:"image_data"`
VideoData []models.ChanceDataVideos `json:"video_data"`
SpeechData []models.ChanceDataSpeechs `json:"speech_data"`
FlowLog []protocol.ChanceFlowLog `json:"flow_log"`
}
//机会详情
... ... @@ -181,10 +185,15 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
log.Error("机会的公司不匹配")
return returnData, protocol.NewErrWithMessage("1")
}
returnData.CreateTime = chanceInfo.CreateAt.Unix()
var (
chanceContent []protocol.InputElement
)
json.Unmarshal([]byte(chanceInfo.Content), &chanceContent)
err = json.Unmarshal([]byte(chanceInfo.Content), &chanceContent)
if err != nil {
log.Error("解析机会内容失败:%s", err)
}
for i := range chanceContent {
if chanceContent[i].SectionType == 1 {
returnData.BaseContent = append(returnData.BaseContent, chanceContent[i])
... ... @@ -193,6 +202,29 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
returnData.ExtraContent = append(returnData.ExtraContent, chanceContent[i])
}
}
ucompany, err := models.GetUserCompanyById(chanceInfo.UserId)
if err == nil {
userinfo, err := models.GetUserById(ucompany.UserId)
if err == nil {
returnData.UserName = userinfo.NickName
} else {
log.Error("GetUserById(%d) err:%s", ucompany.UserId, err)
}
} else {
log.Error("GetUserCompanyById(%d) err:%s", chanceInfo.UserId, err)
}
templateinfo, err := models.GetAuditTemplateById(chanceInfo.AuditTemplateId)
if err == nil {
returnData.TemplateName = templateinfo.Name
} else {
log.Error("GetAuditTemplateById(%d)err:%s", chanceInfo.AuditTemplateId, err)
}
chanceTypeInfo, err := models.GetChanceTypeById(chanceInfo.ChanceTypeId)
if err == nil {
returnData.ChanceTypeName = chanceTypeInfo.Name
} else {
log.Error("GetChanceTypeById(%d) err:%s", chanceInfo.ChanceTypeId, err)
}
return returnData, nil
}
... ...
... ... @@ -366,7 +366,7 @@ func GetUserHasMenu(userid, companyid int64) ([]protocol.ResponseUserHasMenu, er
JOIN role AS c ON a.role_id = c.id
WHERE b.user_company_id=? AND c.delete_at =0 `
var menuids []int64
err = utils.ExecuteQueryAll(&menuids, datasql, ucompany.Id)
err = utils.ExecuteQueryAll(&menuids, datasql2, ucompany.Id)
if err != nil {
log.Error("EXECUTE SQL err:%s", err)
return nil, protocol.NewErrWithMessage("1")
... ...