作者 yangfu

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

... ... @@ -70,6 +70,21 @@ func UpdateChanceDraftById(m *ChanceDraft) (err error) {
return
}
// DeleteChanceDraft deletes ChanceDraft by Id and returns error if
// the record to be deleted doesn't exist
func DeleteChanceDraftById(id int64) (err error) {
o := orm.NewOrm()
v := ChanceDraft{Id: id}
// ascertain id exists in the database
if err = o.Read(&v); err == nil {
var num int64
if num, err = o.Delete(&ChanceDraft{Id: id}); err == nil {
fmt.Println("Number of records deleted in database:", num)
}
}
return
}
//草稿项机会列表
func GetDraftByChance(uid int64, offset int, pageSize int, v interface{}) (total int, err error) {
sql := fmt.Sprintf(`select a.*,b.images,b.speechs,b.videos
... ...
... ... @@ -532,7 +532,11 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit
}
go agg.BulkInsertSelfChecks(header, chance.Id, chance.Id, request.SelfChecks, false, protocol.TypeSubmit)
orm.Commit()
if request.Id > 0 {
if e := utils.ExecuteSQLWithOrmer(orm, models.DeleteChanceDraft, header.UserId, request.Id); e != nil {
log.Error("删除草稿箱异常:", e)
}
}
rsp = &protocol.ChanceSubmitResponse{}
return
}
... ...