作者 yangfu

机会模板示例增加视频

... ... @@ -95,10 +95,10 @@ func GetAuditTemplates(companyId int64, chanceTypeId int) (v []*AuditTemplate, e
}
//获取模板示例
func GetAuditTemplateExample(id int64) (v string, err error) {
func GetAuditTemplateExample(id int64) (v string, videos string, err error) {
o := orm.NewOrm()
sql := "select example from audit_template where id=?"
if err = o.Raw(sql, id).QueryRow(&v); err == nil {
sql := "select example,videos from audit_template where id=?"
if err = o.Raw(sql, id).QueryRow(&v, &videos); err == nil {
return
}
return
... ...
... ... @@ -112,6 +112,7 @@ type ChanceExampleRequest struct {
}
type ChanceExampleResponse struct {
Content string `json:"content"`
Videos []string `json:"videos"` //视频
}
/*提交机会*/
... ...
... ... @@ -337,13 +337,19 @@ func checkTemplateIsVisible(header *protocol.RequestHeader, template *models.Aud
func ChanceExample(header *protocol.RequestHeader, request *protocol.ChanceExampleRequest) (rsp *protocol.ChanceExampleResponse, err error) {
var (
example string
videosData string
)
if example, err = models.GetAuditTemplateExample(int64(request.TemplateId)); err != nil {
if example, videosData, err = models.GetAuditTemplateExample(int64(request.TemplateId)); err != nil {
log.Error(request.TemplateId, err)
err = protocol.NewErrWithMessage(5301) //模板不存在
return
}
rsp = &protocol.ChanceExampleResponse{example}
rsp = &protocol.ChanceExampleResponse{Content: example}
if len(videosData) == 0 {
rsp.Videos = make([]string, 0)
} else {
_ = json.Unmarshal([]byte(videosData), &rsp.Videos)
}
return
}
... ...