修复日志查看与项目不匹配问题
This commit is contained in:
parent
7d98cb19ae
commit
07d8e6c489
|
|
@ -95,6 +95,11 @@ func FindRunLogByID(auth_id, cid_id int) CIDRunLog {
|
||||||
DB.Debug().Where("cid_id = ? and auth_id = ?", cid_id, auth_id).First(&cidRunLog)
|
DB.Debug().Where("cid_id = ? and auth_id = ?", cid_id, auth_id).First(&cidRunLog)
|
||||||
return cidRunLog
|
return cidRunLog
|
||||||
}
|
}
|
||||||
|
func FindRunLogByCIDLogID(id, auth_id int) []CIDRunLog {
|
||||||
|
var cidRunLogs []CIDRunLog
|
||||||
|
DB.Debug().Where("id = ? and auth_id = ?", id, auth_id).Order("created_at desc").Find(&cidRunLogs)
|
||||||
|
return cidRunLogs
|
||||||
|
}
|
||||||
|
|
||||||
func FindCIDByIDAndToken(id int, token string) CID {
|
func FindCIDByIDAndToken(id int, token string) CID {
|
||||||
var cid CID
|
var cid CID
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,10 @@ type CIDRunReq struct {
|
||||||
ID int `json:"id" form:"id"`
|
ID int `json:"id" form:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CIDLogReq struct {
|
||||||
|
ID int `json:"id" form:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
type CIDUpdateReq struct {
|
type CIDUpdateReq struct {
|
||||||
ID int `json:"id" form:"id"`
|
ID int `json:"id" form:"id"`
|
||||||
Name string `json:"name" form:"name"`
|
Name string `json:"name" form:"name"`
|
||||||
|
|
@ -163,7 +167,7 @@ func GetCIDLog(c *gin.Context) {
|
||||||
// 获取用户ID
|
// 获取用户ID
|
||||||
id, _ := c.Get("id")
|
id, _ := c.Get("id")
|
||||||
authID := int(id.(float64))
|
authID := int(id.(float64))
|
||||||
cidLogs := dao.FindRunLogByID(req.ID, authID)
|
cidLogs := dao.FindRunLogByCIDLogID(req.ID, authID)
|
||||||
c.JSON(200, gin.H{"code": proto.SuccessCode, "message": "success", "data": cidLogs})
|
c.JSON(200, gin.H{"code": proto.SuccessCode, "message": "success", "data": cidLogs})
|
||||||
} else {
|
} else {
|
||||||
c.JSON(200, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "failed"})
|
c.JSON(200, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "failed"})
|
||||||
|
|
@ -174,8 +178,13 @@ func GetCIDLogList(c *gin.Context) {
|
||||||
// 获取用户ID
|
// 获取用户ID
|
||||||
id, _ := c.Get("id")
|
id, _ := c.Get("id")
|
||||||
authID := int(id.(float64))
|
authID := int(id.(float64))
|
||||||
cidLogs := dao.FindRunLogByAuthID(authID)
|
var req CIDLogReq
|
||||||
c.JSON(200, gin.H{"code": proto.SuccessCode, "message": "success", "data": cidLogs})
|
if err := c.ShouldBind(&req); err == nil {
|
||||||
|
cidLogs := dao.FindRunLogByID(authID, req.ID)
|
||||||
|
c.JSON(200, gin.H{"code": proto.SuccessCode, "message": "success", "data": cidLogs})
|
||||||
|
} else {
|
||||||
|
c.JSON(200, gin.H{"error": err.Error(), "code": proto.ParameterError, "message": "failed"})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CIDCallback(c *gin.Context) {
|
func CIDCallback(c *gin.Context) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue