作者 yangfu

修改 草稿箱列表(自查内容,表单)

@@ -70,6 +70,21 @@ func UpdateChanceDraftById(m *ChanceDraft) (err error) { @@ -70,6 +70,21 @@ func UpdateChanceDraftById(m *ChanceDraft) (err error) {
70 return 70 return
71 } 71 }
72 72
  73 +// DeleteChanceDraft deletes ChanceDraft by Id and returns error if
  74 +// the record to be deleted doesn't exist
  75 +func DeleteChanceDraftById(id int64) (err error) {
  76 + o := orm.NewOrm()
  77 + v := ChanceDraft{Id: id}
  78 + // ascertain id exists in the database
  79 + if err = o.Read(&v); err == nil {
  80 + var num int64
  81 + if num, err = o.Delete(&ChanceDraft{Id: id}); err == nil {
  82 + fmt.Println("Number of records deleted in database:", num)
  83 + }
  84 + }
  85 + return
  86 +}
  87 +
73 //草稿项机会列表 88 //草稿项机会列表
74 func GetDraftByChance(uid int64, offset int, pageSize int, v interface{}) (total int, err error) { 89 func GetDraftByChance(uid int64, offset int, pageSize int, v interface{}) (total int, err error) {
75 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos 90 sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos
@@ -532,7 +532,11 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit @@ -532,7 +532,11 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit
532 } 532 }
533 go agg.BulkInsertSelfChecks(header, chance.Id, chance.Id, request.SelfChecks, false, protocol.TypeSubmit) 533 go agg.BulkInsertSelfChecks(header, chance.Id, chance.Id, request.SelfChecks, false, protocol.TypeSubmit)
534 orm.Commit() 534 orm.Commit()
535 - 535 + if request.Id > 0 {
  536 + if e := utils.ExecuteSQLWithOrmer(orm, models.DeleteChanceDraft, header.UserId, request.Id); e != nil {
  537 + log.Error("删除草稿箱异常:", e)
  538 + }
  539 + }
536 rsp = &protocol.ChanceSubmitResponse{} 540 rsp = &protocol.ChanceSubmitResponse{}
537 return 541 return
538 } 542 }