作者 唐旭辉

新增接口 机会详情

@@ -77,7 +77,7 @@ func (c *AuditController) AuditInfo() { @@ -77,7 +77,7 @@ func (c *AuditController) AuditInfo() {
77 msg = protocol.BadRequestParam("1") 77 msg = protocol.BadRequestParam("1")
78 return 78 return
79 } 79 }
80 - chanceid, _ := strconv.ParseInt(param.ChanceId, 10, 64) 80 + chanceid, err := strconv.ParseInt(param.ChanceId, 10, 64)
81 companyId := c.GetCompanyId() 81 companyId := c.GetCompanyId()
82 list, err := serveaudit.GetChanceDetail(chanceid, companyId) 82 list, err := serveaudit.GetChanceDetail(chanceid, companyId)
83 msg = protocol.NewReturnResponse(list, err) 83 msg = protocol.NewReturnResponse(list, err)
@@ -7,7 +7,7 @@ import ( @@ -7,7 +7,7 @@ import (
7 ) 7 )
8 8
9 type ChanceData struct { 9 type ChanceData struct {
10 - Id int `orm:"column(id);pk" description:"唯一编号"` 10 + Id int64 `orm:"column(id);pk" description:"唯一编号"`
11 ChanceId int64 `orm:"column(chance_id);null" description:"表chance.id 机会编号"` 11 ChanceId int64 `orm:"column(chance_id);null" description:"表chance.id 机会编号"`
12 Images string `orm:"column(images);null" description:"图片 json"` 12 Images string `orm:"column(images);null" description:"图片 json"`
13 Speechs string `orm:"column(speechs);null" description:"语音 json"` 13 Speechs string `orm:"column(speechs);null" description:"语音 json"`
@@ -40,3 +40,13 @@ type ChanceDataVideos struct { @@ -40,3 +40,13 @@ type ChanceDataVideos struct {
40 Cover ChanceDataImage `json:"cover"` 40 Cover ChanceDataImage `json:"cover"`
41 Duration int `json:"duration"` 41 Duration int `json:"duration"`
42 } 42 }
  43 +
  44 +func GetChanceDataByChanceId(chanceid int64) (v *ChanceData, err error) {
  45 + o := orm.NewOrm()
  46 + v = &ChanceData{}
  47 + err = o.QueryTable(v).Filter("chance_id", chanceid).One(v)
  48 + if err == nil {
  49 + return v, nil
  50 + }
  51 + return nil, err
  52 +}
@@ -150,7 +150,7 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 @@ -150,7 +150,7 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
150 } 150 }
151 151
152 type ResponseChanceInfo struct { 152 type ResponseChanceInfo struct {
153 - CreateTime int64 `json:"create_time"` 153 + CreateTime string `json:"create_time"`
154 UserName string `json:"user_name"` 154 UserName string `json:"user_name"`
155 ChanceTypeName string `json:"chance_type_name"` 155 ChanceTypeName string `json:"chance_type_name"`
156 TemplateName string `json:"template_name"` 156 TemplateName string `json:"template_name"`
@@ -170,10 +170,10 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error @@ -170,10 +170,10 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
170 returnData = ResponseChanceInfo{ 170 returnData = ResponseChanceInfo{
171 BaseContent: make([]protocol.InputElement, 0), 171 BaseContent: make([]protocol.InputElement, 0),
172 ExtraContent: make([]protocol.InputElement, 0), 172 ExtraContent: make([]protocol.InputElement, 0),
173 - ImageData: make([]models.ChanceDataImage, 0),  
174 - VideoData: make([]models.ChanceDataVideos, 0),  
175 - SpeechData: make([]models.ChanceDataSpeechs, 0),  
176 - FlowLog: make([]protocol.ChanceFlowLog, 0), 173 + // ImageData: make([]models.ChanceDataImage, 0),
  174 + // VideoData: make([]models.ChanceDataVideos, 0),
  175 + // SpeechData: make([]models.ChanceDataSpeechs, 0),
  176 + // FlowLog: make([]protocol.ChanceFlowLog, 0),
177 } 177 }
178 ) 178 )
179 chanceInfo, err = models.GetChanceById(chanceid) 179 chanceInfo, err = models.GetChanceById(chanceid)
@@ -185,7 +185,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error @@ -185,7 +185,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
185 log.Error("机会的公司不匹配") 185 log.Error("机会的公司不匹配")
186 return returnData, protocol.NewErrWithMessage("1") 186 return returnData, protocol.NewErrWithMessage("1")
187 } 187 }
188 - returnData.CreateTime = chanceInfo.CreateAt.Unix() 188 + returnData.CreateTime = chanceInfo.CreateAt.Format("2006-01-02 15:16:17")
189 189
190 var ( 190 var (
191 chanceContent []protocol.InputElement 191 chanceContent []protocol.InputElement
@@ -202,6 +202,20 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error @@ -202,6 +202,20 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
202 returnData.ExtraContent = append(returnData.ExtraContent, chanceContent[i]) 202 returnData.ExtraContent = append(returnData.ExtraContent, chanceContent[i])
203 } 203 }
204 } 204 }
  205 + var (
  206 + imgData = make([]models.ChanceDataImage, 0)
  207 + videosData = make([]models.ChanceDataVideos, 0)
  208 + speechsData = make([]models.ChanceDataSpeechs, 0)
  209 + )
  210 + chancedata, err := models.GetChanceDataByChanceId(chanceid)
  211 + if err == nil {
  212 + json.Unmarshal([]byte(chancedata.Images), &imgData)
  213 + json.Unmarshal([]byte(chancedata.Videos), &videosData)
  214 + json.Unmarshal([]byte(chancedata.Speechs), &speechsData)
  215 + }
  216 + returnData.ImageData = imgData
  217 + returnData.VideoData = videosData
  218 + returnData.SpeechData = speechsData
205 ucompany, err := models.GetUserCompanyById(chanceInfo.UserId) 219 ucompany, err := models.GetUserCompanyById(chanceInfo.UserId)
206 if err == nil { 220 if err == nil {
207 userinfo, err := models.GetUserById(ucompany.UserId) 221 userinfo, err := models.GetUserById(ucompany.UserId)
@@ -230,6 +244,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error @@ -230,6 +244,7 @@ func GetChanceDetail(chanceid int64, companyid int64) (ResponseChanceInfo, error
230 log.Warn("获取获取记录失败") 244 log.Warn("获取获取记录失败")
231 } 245 }
232 returnData.FlowLog = flowlogs 246 returnData.FlowLog = flowlogs
  247 +
233 return returnData, nil 248 return returnData, nil
234 } 249 }
235 250