|
|
package audit
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"oppmg/common/log"
|
|
|
"oppmg/models"
|
...
|
...
|
@@ -115,7 +116,7 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 |
|
|
for _, v := range data {
|
|
|
t := v.CreateAt.Unix()
|
|
|
item := protocol.RspAuditList{
|
|
|
Id: v.Id,
|
|
|
Id: fmt.Sprint(v.Id),
|
|
|
EnableStatus: v.EnableStatus,
|
|
|
EnableStatusName: models.ChanceEnableStatusMap[v.EnableStatus],
|
|
|
PublishStatus: v.PublishStatus,
|
...
|
...
|
@@ -148,4 +149,50 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 |
|
|
return returnData, nil
|
|
|
}
|
|
|
|
|
|
// 机会管理的列表搜索项数据 |
|
|
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"`
|
|
|
}
|
|
|
|
|
|
//机会详情
|
|
|
func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error) {
|
|
|
var (
|
|
|
chanceInfo *models.Chance
|
|
|
err error
|
|
|
returnData = ResponseChanceInfo{
|
|
|
BaseContent: make([]protocol.InputElement, 0),
|
|
|
ExtraContent: make([]protocol.InputElement, 0),
|
|
|
ImageData: make([]models.ChanceDataImage, 0),
|
|
|
VideoData: make([]models.ChanceDataVideos, 0),
|
|
|
SpeechData: make([]models.ChanceDataSpeechs, 0),
|
|
|
FlowLog: make([]protocol.ChanceFlowLog, 0),
|
|
|
}
|
|
|
)
|
|
|
chanceInfo, err = models.GetChanceById(chanceid)
|
|
|
if err != nil {
|
|
|
log.Error("获取机会详情失败:%s", err)
|
|
|
return returnData, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
if chanceInfo.CompanyId != companyid {
|
|
|
log.Error("机会的公司不匹配")
|
|
|
return returnData, protocol.NewErrWithMessage("1")
|
|
|
}
|
|
|
var (
|
|
|
chanceContent []protocol.InputElement
|
|
|
)
|
|
|
json.Unmarshal([]byte(chanceInfo.Content), &chanceContent)
|
|
|
for i := range chanceContent {
|
|
|
if chanceContent[i].SectionType == 1 {
|
|
|
returnData.BaseContent = append(returnData.BaseContent, chanceContent[i])
|
|
|
}
|
|
|
if chanceContent[i].SectionType == 2 {
|
|
|
returnData.ExtraContent = append(returnData.ExtraContent, chanceContent[i])
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return returnData, nil
|
|
|
} |
...
|
...
|
|