mirror of
https://github.com/trafficlunar/api.git
synced 2026-06-27 22:24:08 +00:00
refactor: rename visitor counter to hit counter
This commit is contained in:
parent
38b93391a1
commit
32aea2cbd5
4 changed files with 12 additions and 12 deletions
|
|
@ -10,10 +10,10 @@ import (
|
|||
"backend/internal/model"
|
||||
)
|
||||
|
||||
const path = "./data/visit.json"
|
||||
const path = "./data/hit.json"
|
||||
|
||||
func GetVisitCounter() model.VisitCounter {
|
||||
var data model.VisitCounter
|
||||
func GetHitCounter() model.HitCounter {
|
||||
var data model.HitCounter
|
||||
|
||||
jsonFile, err := os.Open(path)
|
||||
if err != nil {
|
||||
|
|
@ -37,8 +37,8 @@ func GetVisitCounter() model.VisitCounter {
|
|||
return data
|
||||
}
|
||||
|
||||
func IncrementVisitCounter() model.Success {
|
||||
data := GetVisitCounter()
|
||||
func IncrementHitCounter() model.Success {
|
||||
data := GetHitCounter()
|
||||
data.Counter++
|
||||
|
||||
err := os.MkdirAll(filepath.Dir(path), 0755)
|
||||
Loading…
Add table
Add a link
Reference in a new issue