@@ -0,0 +1,13 @@
|
||||
package item
|
||||
|
||||
import "fmt"
|
||||
|
||||
func ItemApi(action string) (res any, err error) {
|
||||
switch action {
|
||||
case "list":
|
||||
res, err = itemList()
|
||||
default:
|
||||
err = fmt.Errorf("unimplemented action: item: %s", action)
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package item
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
honokautils "honoka-chan/pkg/utils"
|
||||
)
|
||||
|
||||
func itemList() (res any, err error) {
|
||||
itemResp := honokautils.ReadAllText("assets/serverdata/item.json")
|
||||
err = json.Unmarshal([]byte(itemResp), &res)
|
||||
|
||||
return res, err
|
||||
}
|
||||
Reference in New Issue
Block a user