|
@@ -114,6 +114,29 @@ func (m *CourseDAO) GetCourseByID(courseid string) (*model.TaCourse, error) {
|
114
|
114
|
return nil, nil
|
115
|
115
|
}
|
116
|
116
|
|
|
117
|
+// CheckCourseInCardOrCoupon 判断课程是否存在于卡券种
|
|
118
|
+func (m *CourseDAO) CheckCourseInCardOrCoupon(courseid string) (bool, error) {
|
|
119
|
+ sql := `select a.* from ta_coupon_card_target a inner join ta_coupon_card b on a.card_id=b.card_id where b.status>? and a.target_id=?`
|
|
120
|
+ var cardtarget []model.TaCouponCardTarget
|
|
121
|
+ err := m.db.Sql(sql, models.STATUS_DEL, courseid).Find(&cardtarget)
|
|
122
|
+ if err != nil {
|
|
123
|
+ return false, err
|
|
124
|
+ }
|
|
125
|
+ if len(cardtarget) > 0 {
|
|
126
|
+ return false, nil
|
|
127
|
+ }
|
|
128
|
+ sql = `select a.* from ta_coupon_target a inner join ta_coupon b on a.coupon_id=b.coupon_id where b.status>? and a.target_id=?`
|
|
129
|
+ var coupontarget []model.TaCouponCardTarget
|
|
130
|
+ err = m.db.Sql(sql, models.STATUS_DEL, courseid).Find(&coupontarget)
|
|
131
|
+ if err != nil {
|
|
132
|
+ return false, err
|
|
133
|
+ }
|
|
134
|
+ if len(coupontarget) > 0 {
|
|
135
|
+ return false, nil
|
|
136
|
+ }
|
|
137
|
+ return true, nil
|
|
138
|
+}
|
|
139
|
+
|
117
|
140
|
// AddCourse 新增课程信息
|
118
|
141
|
func (m *CourseDAO) AddCourse(course model.TaCourse) (*model.TaCourse, error) {
|
119
|
142
|
course.CourseId = utils.GetGUID()
|
|
@@ -509,6 +532,9 @@ type CustomerCourse struct {
|
509
|
532
|
OrdersNo string
|
510
|
533
|
CaseName string
|
511
|
534
|
CaseAddress string
|
|
535
|
+ BeginDate time.Time
|
|
536
|
+ EndDate time.Time
|
|
537
|
+ Remark string
|
512
|
538
|
Details []model.TaCustomerCourseDetail
|
513
|
539
|
}
|
514
|
540
|
|
|
@@ -516,7 +542,7 @@ type CustomerCourse struct {
|
516
|
542
|
func (m *CourseDAO) GetCustomerCourse(custID string, page, pageSize int) ([]CustomerCourse, error) {
|
517
|
543
|
var courses []CustomerCourse
|
518
|
544
|
sql := `select a.*,a.customer_course_id as qr_code_string,b.orders_no,c.course_img,d.case_address,
|
519
|
|
- d.case_name from ta_customer_course a
|
|
545
|
+ d.case_name,c.begin_date,c.end_date,c.remark from ta_customer_course a
|
520
|
546
|
inner join ta_course c on a.course_id=c.course_id
|
521
|
547
|
INNER JOIN sys_case d on a.case_id = d.case_id
|
522
|
548
|
left join ta_course_orders b on a.source_id=b.orders_id
|
|
@@ -561,7 +587,10 @@ func (m *CourseDAO) GetCustomerCourseByID(id string) (*CustomerCourse, error) {
|
561
|
587
|
b.orders_no,
|
562
|
588
|
c.course_img,
|
563
|
589
|
d.case_address,
|
564
|
|
- d.case_name
|
|
590
|
+ d.case_name,
|
|
591
|
+ c.begin_date,
|
|
592
|
+ c.end_date,
|
|
593
|
+ c.remark
|
565
|
594
|
FROM
|
566
|
595
|
ta_customer_course a
|
567
|
596
|
INNER JOIN ta_course c ON a.course_id = c.course_id
|