소스 검색

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/services into dev

wangfei 6 년 전
부모
커밋
d81c79dd0f
4개의 변경된 파일17개의 추가작업 그리고 8개의 파일을 삭제
  1. 1
    1
      controllers/cases/signin.go
  2. 13
    5
      models/cases/signin.go
  3. 2
    1
      models/model/ta_checkin_record.go
  4. 1
    1
      service/cases/signin.go

+ 1
- 1
controllers/cases/signin.go 파일 보기

@@ -38,7 +38,7 @@ func (c *SigninController) GetSigninWhere() {
38 38
 	if err != nil {
39 39
 		c.ResponseError(err)
40 40
 	}
41
-
41
+	
42 42
 	c.ResponseJSON(res)
43 43
 }
44 44
 

+ 13
- 5
models/cases/signin.go 파일 보기

@@ -66,18 +66,26 @@ type SigninInfo struct {
66 66
 	var sql string
67 67
 	switch selectType {
68 68
 		case ALL:
69
-			sql = `select * from ta_checkin_record ORDER BY create_date DESC limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
69
+			sql = `select tcr.*,user_id from ta_checkin_record tcr LEFT JOIN ta_customer tc on tcr.customer_id = tc.customer_id where to_days(tcr.create_date) = to_days(now()) ORDER BY tcr.create_date DESC limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
70 70
 		case TODAY:
71
-			sql = `select * from ta_checkin_record where to_days(create_date) = to_days(now()) ORDER BY create_date DESC limit` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
71
+			sql = `select tcr.*,user_id from ta_checkin_record tcr LEFT JOIN ta_customer tc on tcr.customer_id = tc.customer_id where to_days(tcr.create_date) = to_days(now()) and tcr.case_id='` + caseid + `' ORDER BY tcr.create_date DESC limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
72 72
 		case THIS_WEEK:
73
-			sql = `SELECT * FROM ta_checkin_record WHERE YEARWEEK(date_format(create_date,'%Y-%m-%d')) = YEARWEEK(now()) ORDER BY create_date DESC limit` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
73
+			sql = `select tcr.*,user_id from ta_checkin_record tcr LEFT JOIN ta_customer tc on tcr.customer_id = tc.customer_id WHERE YEARWEEK(date_format(tcr.create_date,'%Y-%m-%d')) = YEARWEEK(now())  and tcr.case_id='` + caseid + `' ORDER BY tcr.create_date DESC limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
74 74
 		case THIS_MONTH:
75
-			sql = `SELECT * FROM ta_checkin_record WHERE DATE_FORMAT(create_date,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') ORDER BY create_date DESC limit` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
75
+			sql = `select tcr.*,user_id from ta_checkin_record tcr LEFT JOIN ta_customer tc on tcr.customer_id = tc.customer_id WHERE DATE_FORMAT(tcr.create_date,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') and tcr.case_id='` + caseid + `' ORDER BY tcr.create_date DESC limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
76 76
 		case THIS_YEAR:
77
-			sql = `select * from ta_checkin_record where YEAR(create_date)=YEAR(NOW()) ORDER BY create_date DESC limit` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
77
+			sql = `select tcr.*,user_id from ta_checkin_record tcr LEFT JOIN ta_customer tc on tcr.customer_id = tc.customer_id where YEAR(tcr.create_date)=YEAR(NOW()) and tcr.case_id='` + caseid + `' ORDER BY tcr.create_date DESC limit ` + strconv.Itoa((page-1)*pageSize) + `, ` + strconv.Itoa(pageSize)
78 78
 	}
79 79
 	
80 80
 	err := m.db.Sql(sql).Find(&signin)
81
+	// for index := 0; 0 < len(signin); index++ {
82
+	// 	println("用户编号:"+signin[index].UserId+"-")
83
+	// 	if signin[index].UserId == "" {
84
+	// 		signin[index].UserId = "前台用户"
85
+	// 	} else {
86
+	// 		signin[index].UserId = "后台用户"	
87
+	// 	}
88
+	// }
81 89
 	return signin,err
82 90
  }
83 91
 

+ 2
- 1
models/model/ta_checkin_record.go 파일 보기

@@ -17,6 +17,7 @@ type TaCheckinRecord struct {
17 17
    ActivityId    string    `xorm:"VARCHAR(64)"`  
18 18
    ActivityName  string    `xorm:"VARCHAR(64)"`  
19 19
    CreateDate    time.Time `xorm:"DATETIME"`     
20
-   Status        int       `xorm:"SMALLINT(6)"` 
20
+   Status        int       `xorm:"SMALLINT(6)"`
21
+   UserId        string    `xorm:"VARCHAR(64)"`
21 22
    
22 23
 }

+ 1
- 1
service/cases/signin.go 파일 보기

@@ -38,7 +38,7 @@ func (s *SigninServ) GetSigninWhere(selectType int,caseid string,page, pageSize
38 38
 	 if len(info) >0 {
39 39
 		total = len(info)
40 40
 	 }
41
-	
41
+
42 42
 	return map[string]interface{}{
43 43
 		"list":     info,
44 44
 		"pagesize": pageSize,