|
@@ -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
|