mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-01 05:30:24 +08:00
对服务增加基础的数据统计/部分代码分Package
This commit is contained in:
18
internal/db/models/regions/region_country_model_ext.go
Normal file
18
internal/db/models/regions/region_country_model_ext.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package regions
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
)
|
||||
|
||||
func (this *RegionCountry) DecodeCodes() []string {
|
||||
if len(this.Codes) == 0 {
|
||||
return []string{}
|
||||
}
|
||||
result := []string{}
|
||||
err := json.Unmarshal([]byte(this.Codes), &result)
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user