|
@@ -456,10 +456,10 @@ type CustomerCourse struct {
|
456
|
456
|
}
|
457
|
457
|
|
458
|
458
|
// GetCustomerCourse 获取我的课程信息
|
459
|
|
-func (m *CourseDAO) GetCustomerCourse(custID string) ([]CustomerCourse, error) {
|
|
459
|
+func (m *CourseDAO) GetCustomerCourse(custID string, page, pageSize int) ([]CustomerCourse, error) {
|
460
|
460
|
var courses []CustomerCourse
|
461
|
461
|
sql := `select * from ta_customer_course where status>` + strconv.Itoa(models.STATUS_DEL) + ` and customer_id='` + custID + `'`
|
462
|
|
-
|
|
462
|
+ sql += ` order by create_date desc limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
|
463
|
463
|
err := m.db.Sql(sql).Find(&courses)
|
464
|
464
|
if err != nil {
|
465
|
465
|
return nil, err
|
|
@@ -474,6 +474,16 @@ func (m *CourseDAO) GetCustomerCourse(custID string) ([]CustomerCourse, error) {
|
474
|
474
|
return courses, nil
|
475
|
475
|
}
|
476
|
476
|
|
|
477
|
+// GetCustomerCourseCount 获取我的课程总数
|
|
478
|
+func (m *CourseDAO) GetCustomerCourseCount(custID string) (int, error) {
|
|
479
|
+ var courses []model.TaCustomerCourse
|
|
480
|
+ err := m.db.Where("status>"+strconv.Itoa(models.STATUS_DEL)).And("customer_id=?", custID).Find(&courses)
|
|
481
|
+ if err != nil {
|
|
482
|
+ return 0, err
|
|
483
|
+ }
|
|
484
|
+ return len(courses), nil
|
|
485
|
+}
|
|
486
|
+
|
477
|
487
|
// GetCustomerCourseDetail 获取我的课程明细
|
478
|
488
|
func (m *CourseDAO) GetCustomerCourseDetail(customerCourseID string) ([]model.TaCustomerCourseDetail, error) {
|
479
|
489
|
var details []model.TaCustomerCourseDetail
|