소스 검색

增加订单编号

wangfei 6 년 전
부모
커밋
75f7d4bfd8
1개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  1. 8
    3
      models/course/course.go

+ 8
- 3
models/course/course.go 파일 보기

@@ -453,14 +453,17 @@ func (m *CourseDAO) SaveCourseOfCustomer(course *model.TaCustomerCourse, details
453 453
 type CustomerCourse struct {
454 454
 	model.TaCustomerCourse `xorm:"extends"`
455 455
 	QrCodeString           string
456
+	OrdersNo               string
456 457
 	Details                []model.TaCustomerCourseDetail
457 458
 }
458 459
 
459 460
 // GetCustomerCourse 获取我的课程信息
460 461
 func (m *CourseDAO) GetCustomerCourse(custID string, page, pageSize int) ([]CustomerCourse, error) {
461 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 467
 	err := m.db.Sql(sql).Find(&courses)
465 468
 	if err != nil {
466 469
 		return nil, err
@@ -495,7 +498,9 @@ func (m *CourseDAO) GetCustomerCourseDetail(customerCourseID string) ([]model.Ta
495 498
 // GetCustomerCourseByID 获取我的课程信息明细
496 499
 func (m *CourseDAO) GetCustomerCourseByID(id string) (*CustomerCourse, error) {
497 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 505
 	err := m.db.Sql(sql).Find(&courses)
501 506
 	if err != nil {