作者 yangfu

机会模板示例增加视频

@@ -95,10 +95,10 @@ func GetAuditTemplates(companyId int64, chanceTypeId int) (v []*AuditTemplate, e @@ -95,10 +95,10 @@ func GetAuditTemplates(companyId int64, chanceTypeId int) (v []*AuditTemplate, e
95 } 95 }
96 96
97 //获取模板示例 97 //获取模板示例
98 -func GetAuditTemplateExample(id int64) (v string, err error) { 98 +func GetAuditTemplateExample(id int64) (v string, videos string, err error) {
99 o := orm.NewOrm() 99 o := orm.NewOrm()
100 - sql := "select example from audit_template where id=?"  
101 - if err = o.Raw(sql, id).QueryRow(&v); err == nil { 100 + sql := "select example,videos from audit_template where id=?"
  101 + if err = o.Raw(sql, id).QueryRow(&v, &videos); err == nil {
102 return 102 return
103 } 103 }
104 return 104 return
@@ -112,6 +112,7 @@ type ChanceExampleRequest struct { @@ -112,6 +112,7 @@ type ChanceExampleRequest struct {
112 } 112 }
113 type ChanceExampleResponse struct { 113 type ChanceExampleResponse struct {
114 Content string `json:"content"` 114 Content string `json:"content"`
  115 + Videos []string `json:"videos"` //视频
115 } 116 }
116 117
117 /*提交机会*/ 118 /*提交机会*/
@@ -337,13 +337,19 @@ func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.Aud @@ -337,13 +337,19 @@ func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.Aud
337 func ChanceExample(header *protocol.RequestHeader, request *protocol.ChanceExampleRequest) (rsp *protocol.ChanceExampleResponse, err error) { 337 func ChanceExample(header *protocol.RequestHeader, request *protocol.ChanceExampleRequest) (rsp *protocol.ChanceExampleResponse, err error) {
338 var ( 338 var (
339 example string 339 example string
  340 + videosData string
340 ) 341 )
341 - if example, err = models.GetAuditTemplateExample(int64(request.TemplateId)); err != nil { 342 + if example, videosData, err = models.GetAuditTemplateExample(int64(request.TemplateId)); err != nil {
342 log.Error(request.TemplateId, err) 343 log.Error(request.TemplateId, err)
343 err = protocol.NewErrWithMessage(5301) //模板不存在 344 err = protocol.NewErrWithMessage(5301) //模板不存在
344 return 345 return
345 } 346 }
346 - rsp = &protocol.ChanceExampleResponse{example} 347 + rsp = &protocol.ChanceExampleResponse{Content: example}
  348 + if len(videosData) == 0 {
  349 + rsp.Videos = make([]string, 0)
  350 + } else {
  351 + _ = json.Unmarshal([]byte(videosData), &rsp.Videos)
  352 + }
347 return 353 return
348 } 354 }
349 355