作者 yangfu

自查模板修改

@@ -60,8 +60,9 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons @@ -60,8 +60,9 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons
60 //获取图片上传地址和凭证,并创建视频信息 60 //获取图片上传地址和凭证,并创建视频信息
61 func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (response *CreateUploadImageResponse, err error) { 61 func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (response *CreateUploadImageResponse, err error) {
62 request := vod.CreateCreateUploadImageRequest() 62 request := vod.CreateCreateUploadImageRequest()
63 - request.ImageType = "default" 63 + request.ImageType = "cover"
64 request.AcceptFormat = "JSON" 64 request.AcceptFormat = "JSON"
  65 + request.ImageExt = "jpg"
65 rsp, err := client.CreateUploadImage(request) 66 rsp, err := client.CreateUploadImage(request)
66 if err != nil { 67 if err != nil {
67 return 68 return
@@ -16,6 +16,7 @@ const ( @@ -16,6 +16,7 @@ const (
16 16
17 /*机会-自查内容*/ 17 /*机会-自查内容*/
18 var CheckOptionsCommit = []CheckOption{{Item: "是", NeedOther: false}, {Item: "否", NeedOther: false}, {Item: "不清楚", NeedOther: false}} 18 var CheckOptionsCommit = []CheckOption{{Item: "是", NeedOther: false}, {Item: "否", NeedOther: false}, {Item: "不清楚", NeedOther: false}}
  19 +var CheckOptionsApprove = []CheckOption{{Item: "是", NeedOther: false}, {Item: "否", NeedOther: true}, {Item: "不清楚", NeedOther: false}}
19 20
20 //自查结果列表 21 //自查结果列表
21 type SelfCheckResults []selfCheckResult 22 type SelfCheckResults []selfCheckResult
@@ -158,7 +159,7 @@ type CheckQuestion struct { @@ -158,7 +159,7 @@ type CheckQuestion struct {
158 } 159 }
159 type CheckOption struct { 160 type CheckOption struct {
160 Item string `json:"item"` 161 Item string `json:"item"`
161 - NeedOther bool `json:"-"` //是否需填写其他的内容【1:需要】【2:不需要】 162 + NeedOther bool `json:"needOther"` //是否需填写其他的内容【1:需要】【2:不需要】
162 } 163 }
163 164
164 /*CheckQuestions 自查问题列表*/ 165 /*CheckQuestions 自查问题列表*/
@@ -303,9 +303,12 @@ func GetCheckQuestionsByChanceId(header *protocol.RequestHeader, id int64) (rsp @@ -303,9 +303,12 @@ func GetCheckQuestionsByChanceId(header *protocol.RequestHeader, id int64) (rsp
303 groupIdx++ 303 groupIdx++
304 idx = 0 304 idx = 0
305 } 305 }
306 - item := protocol.NewCheckQuestion(c.CheckItem, getQuestionTitle(groupIdx, idx, c.CheckItem), c.GroupId, protocol.CheckOptionsCommit)  
307 - if header.UserId == chance.UserId && chance.ReviewStatus != protocol.ReviewStatusPass {  
308 - item.Answer = c.Answer 306 + item := protocol.NewCheckQuestion(c.CheckItem, getQuestionTitle(groupIdx, idx, c.CheckItem), c.GroupId, protocol.CheckOptionsApprove)
  307 + if header.UserId == chance.UserId {
  308 + item.CheckOptions = protocol.CheckOptionsCommit
  309 + if chance.ReviewStatus != protocol.ReviewStatusPass {
  310 + item.Answer = c.Answer
  311 + }
309 } 312 }
310 rsp = append(rsp, item) 313 rsp = append(rsp, item)
311 idx++ 314 idx++
@@ -296,9 +296,16 @@ func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest) @@ -296,9 +296,16 @@ func Template(header *protocol.RequestHeader, request *protocol.TemplateRequest)
296 if len(item.Example) > 0 || len(item.Videos) > 2 { 296 if len(item.Example) > 0 || len(item.Videos) > 2 {
297 template.Link = fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id) 297 template.Link = fmt.Sprintf("%v/#/ability/opportunity?id=%v", beego.AppConfig.String("h5_host"), item.Id)
298 } 298 }
299 - if template.Questions, err = agg.GetCheckQuestionsByTemplateId(templates.Id); err != nil {  
300 - log.Error(err)  
301 - return 299 + if request.ChanceId > 0 {
  300 + if template.Questions, err = agg.GetCheckQuestionsByChanceId(header, request.ChanceId); err != nil {
  301 + log.Error(err)
  302 + return
  303 + }
  304 + } else {
  305 + if template.Questions, err = agg.GetCheckQuestionsByTemplateId(templates.Id); err != nil {
  306 + log.Error(err)
  307 + return
  308 + }
302 } 309 }
303 for j := range forms { 310 for j := range forms {
304 form := forms[j] 311 form := forms[j]