操作日志记录增加门店相关

This commit is contained in:
苏尹岚
2020-01-17 16:16:56 +08:00
parent 05ebeeb77c
commit 3aec482720
7 changed files with 33 additions and 23 deletions

View File

@@ -40,7 +40,7 @@ func DeleteOperateEvent(db *DaoDB, deleteTime time.Time) (err error) {
return err
}
func GetOperateEvents(db *DaoDB, apiFunction, name string, operateType int, skuIDs, storeIDs []int, fromTime, toTime time.Time, offset, pageSize int) (operateEventExt []*OperateEventExt, totalCount int, err error) {
func GetOperateEvents(db *DaoDB, name string, apiFunctions []string, operateTypes, skuIDs, storeIDs []int, fromTime, toTime time.Time, offset, pageSize int) (operateEventExt []*OperateEventExt, totalCount int, err error) {
sql := `
SELECT SQL_CALC_FOUND_ROWS DISTINCT a.*, c.name
FROM operate_event a
@@ -61,13 +61,13 @@ func GetOperateEvents(db *DaoDB, apiFunction, name string, operateType int, skuI
sql += " AND a.created_at <= ?"
sqlParams = append(sqlParams, toTime)
}
if apiFunction != "" {
sql += " AND a.api_function = ?"
sqlParams = append(sqlParams, apiFunction)
if len(apiFunctions) > 0 {
sql += " AND a.api_function IN (" + GenQuestionMarks(len(apiFunctions)) + ")"
sqlParams = append(sqlParams, apiFunctions)
}
if operateType != 0 {
sql += " AND b.operate_type = ?"
sqlParams = append(sqlParams, operateType)
if len(operateTypes) > 0 {
sql += " AND b.operate_type IN (" + GenQuestionMarks(len(operateTypes)) + ")"
sqlParams = append(sqlParams, operateTypes)
}
if len(skuIDs) > 0 {
sql += " AND b.thing_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"