浏览代码

增加订单编号

wangfei 6 年前
父节点
当前提交
75f7d4bfd8
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8
    3
      models/course/course.go

+ 8
- 3
models/course/course.go 查看文件

453
 type CustomerCourse struct {
453
 type CustomerCourse struct {
454
 	model.TaCustomerCourse `xorm:"extends"`
454
 	model.TaCustomerCourse `xorm:"extends"`
455
 	QrCodeString           string
455
 	QrCodeString           string
456
+	OrdersNo               string
456
 	Details                []model.TaCustomerCourseDetail
457
 	Details                []model.TaCustomerCourseDetail
457
 }
458
 }
458
 
459
 
459
 // GetCustomerCourse 获取我的课程信息
460
 // GetCustomerCourse 获取我的课程信息
460
 func (m *CourseDAO) GetCustomerCourse(custID string, page, pageSize int) ([]CustomerCourse, error) {
461
 func (m *CourseDAO) GetCustomerCourse(custID string, page, pageSize int) ([]CustomerCourse, error) {
461
 	var courses []CustomerCourse
462
 	var courses []CustomerCourse
462
-	sql := `select *,customer_course_id as qr_code_string from ta_customer_course where status>` + strconv.Itoa(models.STATUS_DEL) + ` and customer_id='` + custID + `'`
463
-	sql += ` order by create_date desc limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
463
+	sql := `select a.*,a.customer_course_id as qr_code_string,b.orders_no from ta_customer_course a 
464
+	left join ta_course_orders b on a.source_id=b.orders_id
465
+	 where a.status>` + strconv.Itoa(models.STATUS_DEL) + ` and a.customer_id='` + custID + `'`
466
+	sql += ` order by a.create_date desc limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
464
 	err := m.db.Sql(sql).Find(&courses)
467
 	err := m.db.Sql(sql).Find(&courses)
465
 	if err != nil {
468
 	if err != nil {
466
 		return nil, err
469
 		return nil, err
495
 // GetCustomerCourseByID 获取我的课程信息明细
498
 // GetCustomerCourseByID 获取我的课程信息明细
496
 func (m *CourseDAO) GetCustomerCourseByID(id string) (*CustomerCourse, error) {
499
 func (m *CourseDAO) GetCustomerCourseByID(id string) (*CustomerCourse, error) {
497
 	var courses []CustomerCourse
500
 	var courses []CustomerCourse
498
-	sql := `select *,customer_course_id as qr_code_string from ta_customer_course where status>` + strconv.Itoa(models.STATUS_DEL) + ` and customer_course_id='` + id + `'`
501
+	sql := `select a.*,a.customer_course_id as qr_code_string,b.orders_no from ta_customer_course a 
502
+	left join ta_course_orders b on a.source_id=b.orders_id
503
+	 where a.status>` + strconv.Itoa(models.STATUS_DEL) + ` and a.customer_course_id='` + id + `'`
499
 
504
 
500
 	err := m.db.Sql(sql).Find(&courses)
505
 	err := m.db.Sql(sql).Find(&courses)
501
 	if err != nil {
506
 	if err != nil {