Browse Source

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

wangfei 6 years ago
parent
commit
d81c79dd0f

+ 1
- 1
controllers/cases/signin.go View File

38
 	if err != nil {
38
 	if err != nil {
39
 		c.ResponseError(err)
39
 		c.ResponseError(err)
40
 	}
40
 	}
41
-
41
+	
42
 	c.ResponseJSON(res)
42
 	c.ResponseJSON(res)
43
 }
43
 }
44
 
44
 

+ 13
- 5
models/cases/signin.go View File

66
 	var sql string
66
 	var sql string
67
 	switch selectType {
67
 	switch selectType {
68
 		case ALL:
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
 		case TODAY:
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
 		case THIS_WEEK:
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
 		case THIS_MONTH:
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
 		case THIS_YEAR:
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
 	err := m.db.Sql(sql).Find(&signin)
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
 	return signin,err
89
 	return signin,err
82
  }
90
  }
83
 
91
 

+ 2
- 1
models/model/ta_checkin_record.go View File

17
    ActivityId    string    `xorm:"VARCHAR(64)"`  
17
    ActivityId    string    `xorm:"VARCHAR(64)"`  
18
    ActivityName  string    `xorm:"VARCHAR(64)"`  
18
    ActivityName  string    `xorm:"VARCHAR(64)"`  
19
    CreateDate    time.Time `xorm:"DATETIME"`     
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 View File

38
 	 if len(info) >0 {
38
 	 if len(info) >0 {
39
 		total = len(info)
39
 		total = len(info)
40
 	 }
40
 	 }
41
-	
41
+
42
 	return map[string]interface{}{
42
 	return map[string]interface{}{
43
 		"list":     info,
43
 		"list":     info,
44
 		"pagesize": pageSize,
44
 		"pagesize": pageSize,