+5
-5
@@ -18,7 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func AlbumSeriesAllHandler(ctx *gin.Context) {
|
||||
db, err := sql.Open("sqlite3", "assets/unit.db")
|
||||
db, err := sql.Open("sqlite3", "assets/main.db")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func AlbumSeriesAllHandler(ctx *gin.Context) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
albumSeriesAllResp := []model.AlbumResponseData{}
|
||||
albumSeriesAllResp := []model.AlbumSeriesResp{}
|
||||
for seriesRows.Next() {
|
||||
var series int
|
||||
err = seriesRows.Scan(&series)
|
||||
@@ -69,7 +69,7 @@ func AlbumSeriesAllHandler(ctx *gin.Context) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
albumSeriesAll := []model.AlbumUnitList{}
|
||||
albumSeriesAll := []model.AlbumResult{}
|
||||
stmt, err := db.Prepare("SELECT unit_id,rarity FROM unit_m WHERE album_series_id = ?")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -87,7 +87,7 @@ func AlbumSeriesAllHandler(ctx *gin.Context) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
albumSeries := model.AlbumUnitList{
|
||||
albumSeries := model.AlbumResult{
|
||||
UnitID: unitId,
|
||||
RankMaxFlag: true,
|
||||
LoveMaxFlag: true,
|
||||
@@ -142,7 +142,7 @@ func AlbumSeriesAllHandler(ctx *gin.Context) {
|
||||
|
||||
albumSeriesAll = append(albumSeriesAll, albumSeries)
|
||||
}
|
||||
albumSeriesAllResp = append(albumSeriesAllResp, model.AlbumResponseData{
|
||||
albumSeriesAllResp = append(albumSeriesAllResp, model.AlbumSeriesResp{
|
||||
SeriesID: series,
|
||||
UnitList: albumSeriesAll,
|
||||
})
|
||||
|
||||
+25
-3
@@ -2,11 +2,11 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
"honoka-chan/encrypt"
|
||||
"honoka-chan/resp"
|
||||
"honoka-chan/utils"
|
||||
"html/template"
|
||||
"net/http"
|
||||
@@ -15,6 +15,16 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type AnnounceResp struct {
|
||||
ResponseData AnnounceData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
type AnnounceData struct {
|
||||
HasUnreadAnnounce bool `json:"has_unread_announce"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
func AnnounceIndexHandler(ctx *gin.Context) {
|
||||
ctx.HTML(http.StatusOK, "announce.tmpl", gin.H{
|
||||
"title": "Love Live! 学园偶像祭 非官方服务器",
|
||||
@@ -54,12 +64,24 @@ func AnnounceCheckStateHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp.AnnounceState), "privatekey.pem")
|
||||
announceResp := AnnounceResp{
|
||||
ResponseData: AnnounceData{
|
||||
HasUnreadAnnounce: false,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(announceResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp.AnnounceState)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
+29
-6
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/database"
|
||||
"honoka-chan/encrypt"
|
||||
@@ -12,6 +13,12 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type DownloadResp struct {
|
||||
ResponseData []interface{} `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
func DownloadBatchHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -44,14 +51,22 @@ func DownloadBatchHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/batch.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
batchResp := DownloadResp{
|
||||
ResponseData: []interface{}{},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(batchResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
func DownloadEventHandler(ctx *gin.Context) {
|
||||
@@ -86,12 +101,20 @@ func DownloadEventHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/event.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
eventResp := DownloadResp{
|
||||
ResponseData: []interface{}{},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(eventResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
+38
-3
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
@@ -13,6 +14,22 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type EventsResp struct {
|
||||
ResponseData EventsData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
type TargetList struct {
|
||||
Position int `json:"position"`
|
||||
IsDisplayable bool `json:"is_displayable"`
|
||||
}
|
||||
|
||||
type EventsData struct {
|
||||
TargetList []TargetList `json:"target_list"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
func EventListHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -45,13 +62,31 @@ func EventListHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/eventlist.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
targets := []TargetList{}
|
||||
for i := 0; i < 6; i++ {
|
||||
targets = append(targets, TargetList{
|
||||
Position: i + 1,
|
||||
IsDisplayable: false,
|
||||
})
|
||||
}
|
||||
eventsResp := EventsResp{
|
||||
ResponseData: EventsData{
|
||||
TargetList: targets,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(eventsResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
+28
-3
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
@@ -13,6 +14,18 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type GdprResp struct {
|
||||
ResponseData GdprData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
type GdprData struct {
|
||||
EnableGdpr bool `json:"enable_gdpr"`
|
||||
IsEea bool `json:"is_eea"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
func GdprHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -45,13 +58,25 @@ func GdprHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/gdpr.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
gdprResp := GdprResp{
|
||||
ResponseData: GdprData{
|
||||
EnableGdpr: true,
|
||||
IsEea: false,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(gdprResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
+20
-9
@@ -18,6 +18,12 @@ import (
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
type GameOverResp struct {
|
||||
ResponseData []interface{} `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
func PartyListHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -99,8 +105,7 @@ func PlayLiveHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
// resp := utils.ReadAllText("assets/playsong.json")
|
||||
db, err := sql.Open("sqlite3", "assets/live.db")
|
||||
db, err := sql.Open("sqlite3", "assets/main.db")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -263,15 +268,23 @@ func GameOverHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/gameover.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
overResp := GameOverResp{
|
||||
ResponseData: []interface{}{},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(overResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
func PlayScoreHandler(ctx *gin.Context) {
|
||||
@@ -312,8 +325,7 @@ func PlayScoreHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
// resp := utils.ReadAllText("assets/playsong.json")
|
||||
db, err := sql.Open("sqlite3", "assets/live.db")
|
||||
db, err := sql.Open("sqlite3", "assets/main.db")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -466,8 +478,7 @@ func PlayRewardHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
// resp := utils.ReadAllText("assets/playsong.json")
|
||||
db, err := sql.Open("sqlite3", "assets/live.db")
|
||||
db, err := sql.Open("sqlite3", "assets/main.db")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
+51
-3
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
@@ -13,6 +14,30 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ProductResp struct {
|
||||
ResponseData ProductData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
type RestrictionInfo struct {
|
||||
Restricted bool `json:"restricted"`
|
||||
}
|
||||
type UnderAgeInfo struct {
|
||||
BirthSet bool `json:"birth_set"`
|
||||
HasLimit bool `json:"has_limit"`
|
||||
LimitAmount interface{} `json:"limit_amount"`
|
||||
MonthUsed int `json:"month_used"`
|
||||
}
|
||||
type ProductData struct {
|
||||
RestrictionInfo RestrictionInfo `json:"restriction_info"`
|
||||
UnderAgeInfo UnderAgeInfo `json:"under_age_info"`
|
||||
SnsProductList []interface{} `json:"sns_product_list"`
|
||||
ProductList []interface{} `json:"product_list"`
|
||||
SubscriptionList []interface{} `json:"subscription_list"`
|
||||
ShowPointShop bool `json:"show_point_shop"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
func ProductListHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -45,13 +70,36 @@ func ProductListHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/products.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
prodReesp := ProductResp{
|
||||
ResponseData: ProductData{
|
||||
RestrictionInfo: RestrictionInfo{
|
||||
Restricted: false,
|
||||
},
|
||||
UnderAgeInfo: UnderAgeInfo{
|
||||
BirthSet: true,
|
||||
HasLimit: false,
|
||||
LimitAmount: nil,
|
||||
MonthUsed: 0,
|
||||
},
|
||||
SnsProductList: []interface{}{},
|
||||
ProductList: []interface{}{},
|
||||
SubscriptionList: []interface{}{},
|
||||
ShowPointShop: true,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(prodReesp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
@@ -13,6 +14,21 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type PersonalNoticeResp struct {
|
||||
ResponseData PersonalNoticeData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
type PersonalNoticeData struct {
|
||||
HasNotice bool `json:"has_notice"`
|
||||
NoticeID int `json:"notice_id"`
|
||||
Type int `json:"type"`
|
||||
Title string `json:"title"`
|
||||
Contents string `json:"contents"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
func PersonalNoticeHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -45,13 +61,28 @@ func PersonalNoticeHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/personalnotice.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
noticeResp := PersonalNoticeResp{
|
||||
ResponseData: PersonalNoticeData{
|
||||
HasNotice: false,
|
||||
NoticeID: 0,
|
||||
Type: 0,
|
||||
Title: "",
|
||||
Contents: "",
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(noticeResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
+43
-3
@@ -2,11 +2,11 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
"honoka-chan/encrypt"
|
||||
"honoka-chan/resp"
|
||||
"honoka-chan/utils"
|
||||
"net/http"
|
||||
"time"
|
||||
@@ -14,9 +14,36 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ScenarioResp struct {
|
||||
ResponseData ScenarioData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
type ScenarioData struct {
|
||||
ScenarioID int `json:"scenario_id"`
|
||||
ScenarioAdjustment int `json:"scenario_adjustment"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
type ScenarioReq struct {
|
||||
Module string `json:"module"`
|
||||
Action string `json:"action"`
|
||||
TimeStamp int `json:"timeStamp"`
|
||||
Mgd int `json:"mgd"`
|
||||
CommandNum string `json:"commandNum"`
|
||||
ScenarioID int `json:"scenario_id"`
|
||||
}
|
||||
|
||||
func ScenarioStartupHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
startReq := ScenarioReq{}
|
||||
err := json.Unmarshal([]byte(ctx.PostForm("request_data")), &startReq)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
authorizeStr := ctx.Request.Header["Authorize"]
|
||||
authToken, err := utils.GetAuthorizeToken(authorizeStr)
|
||||
if err != nil {
|
||||
@@ -46,7 +73,20 @@ func ScenarioStartupHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp.ScenarioStartup), "privatekey.pem")
|
||||
startResp := ScenarioResp{
|
||||
ResponseData: ScenarioData{
|
||||
ScenarioID: startReq.ScenarioID,
|
||||
ScenarioAdjustment: 50,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(startResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
@@ -54,7 +94,7 @@ func ScenarioStartupHandler(ctx *gin.Context) {
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
|
||||
ctx.String(http.StatusOK, resp.ScenarioStartup)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
func ScenarioRewardHandler(ctx *gin.Context) {
|
||||
|
||||
+43
-3
@@ -2,11 +2,11 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
"honoka-chan/encrypt"
|
||||
"honoka-chan/resp"
|
||||
"honoka-chan/utils"
|
||||
"net/http"
|
||||
"time"
|
||||
@@ -14,9 +14,36 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type SubScenarioResp struct {
|
||||
ResponseData SubScenarioData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
type SubScenarioData struct {
|
||||
SubscenarioID int `json:"subscenario_id"`
|
||||
ScenarioAdjustment int `json:"scenario_adjustment"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
type SubScenarioReq struct {
|
||||
Module string `json:"module"`
|
||||
Action string `json:"action"`
|
||||
TimeStamp int `json:"timeStamp"`
|
||||
SubscenarioID int `json:"subscenario_id"`
|
||||
Mgd int `json:"mgd"`
|
||||
CommandNum string `json:"commandNum"`
|
||||
}
|
||||
|
||||
func SubScenarioStartupHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
startReq := SubScenarioReq{}
|
||||
err := json.Unmarshal([]byte(ctx.PostForm("request_data")), &startReq)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
authorizeStr := ctx.Request.Header["Authorize"]
|
||||
authToken, err := utils.GetAuthorizeToken(authorizeStr)
|
||||
if err != nil {
|
||||
@@ -46,7 +73,20 @@ func SubScenarioStartupHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp.ScenarioStartup), "privatekey.pem")
|
||||
startResp := SubScenarioResp{
|
||||
ResponseData: SubScenarioData{
|
||||
SubscenarioID: startReq.SubscenarioID,
|
||||
ScenarioAdjustment: 50,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(startResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
@@ -54,7 +94,7 @@ func SubScenarioStartupHandler(ctx *gin.Context) {
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
|
||||
ctx.String(http.StatusOK, resp.SubScenarioStartup)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
func SubScenarioRewardHandler(ctx *gin.Context) {
|
||||
|
||||
+30
-3
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/database"
|
||||
"honoka-chan/encrypt"
|
||||
@@ -12,6 +13,19 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type TosResp struct {
|
||||
ResponseData TosData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
type TosData struct {
|
||||
TosID int `json:"tos_id"`
|
||||
TosType int `json:"tos_type"`
|
||||
IsAgreed bool `json:"is_agreed"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
func TosCheckHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -44,12 +58,25 @@ func TosCheckHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/toscheck.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
tosResp := TosResp{
|
||||
ResponseData: TosData{
|
||||
TosID: 1,
|
||||
TosType: 1,
|
||||
IsAgreed: true,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(tosResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
+18
-4
@@ -2,11 +2,11 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
"honoka-chan/encrypt"
|
||||
"honoka-chan/resp"
|
||||
"honoka-chan/utils"
|
||||
"net/http"
|
||||
"time"
|
||||
@@ -14,6 +14,12 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type SetDisplayRankResp struct {
|
||||
ResponseData []interface{} `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
func SetDisplayRankHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -46,13 +52,21 @@ func SetDisplayRankHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := resp.NotificationToken
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
dispResp := SetDisplayRankResp{
|
||||
ResponseData: []interface{}{},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(dispResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
+29
-5
@@ -2,11 +2,11 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
"honoka-chan/encrypt"
|
||||
"honoka-chan/resp"
|
||||
"honoka-chan/utils"
|
||||
"net/http"
|
||||
"time"
|
||||
@@ -14,6 +14,12 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type NotificationResp struct {
|
||||
ResponseData []interface{} `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
func SetNotificationTokenHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -46,14 +52,23 @@ func SetNotificationTokenHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp.NotificationToken), "privatekey.pem")
|
||||
notifResp := NotificationResp{
|
||||
ResponseData: []interface{}{},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(notifResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp.NotificationToken)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
func ChangeNaviHandler(ctx *gin.Context) {
|
||||
@@ -88,12 +103,21 @@ func ChangeNaviHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp.NotificationToken), "privatekey.pem")
|
||||
notifResp := NotificationResp{
|
||||
ResponseData: []interface{}{},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(notifResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp.NotificationToken)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
+101
-3
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"honoka-chan/config"
|
||||
"honoka-chan/database"
|
||||
@@ -13,6 +14,59 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type UserInfoResp struct {
|
||||
ResponseData UserInfoData `json:"response_data"`
|
||||
ReleaseInfo []interface{} `json:"release_info"`
|
||||
StatusCode int `json:"status_code"`
|
||||
}
|
||||
|
||||
type LpRecoveryItem struct {
|
||||
ItemID int `json:"item_id"`
|
||||
Amount int `json:"amount"`
|
||||
}
|
||||
|
||||
type User struct {
|
||||
UserID int `json:"user_id"`
|
||||
Name string `json:"name"`
|
||||
Level int `json:"level"`
|
||||
Exp int `json:"exp"`
|
||||
PreviousExp int `json:"previous_exp"`
|
||||
NextExp int `json:"next_exp"`
|
||||
GameCoin int `json:"game_coin"`
|
||||
SnsCoin int `json:"sns_coin"`
|
||||
FreeSnsCoin int `json:"free_sns_coin"`
|
||||
PaidSnsCoin int `json:"paid_sns_coin"`
|
||||
SocialPoint int `json:"social_point"`
|
||||
UnitMax int `json:"unit_max"`
|
||||
WaitingUnitMax int `json:"waiting_unit_max"`
|
||||
EnergyMax int `json:"energy_max"`
|
||||
EnergyFullTime string `json:"energy_full_time"`
|
||||
LicenseLiveEnergyRecoverlyTime int `json:"license_live_energy_recoverly_time"`
|
||||
EnergyFullNeedTime int `json:"energy_full_need_time"`
|
||||
OverMaxEnergy int `json:"over_max_energy"`
|
||||
TrainingEnergy int `json:"training_energy"`
|
||||
TrainingEnergyMax int `json:"training_energy_max"`
|
||||
FriendMax int `json:"friend_max"`
|
||||
InviteCode string `json:"invite_code"`
|
||||
InsertDate string `json:"insert_date"`
|
||||
UpdateDate string `json:"update_date"`
|
||||
TutorialState int `json:"tutorial_state"`
|
||||
DiamondCoin int `json:"diamond_coin"`
|
||||
CrystalCoin int `json:"crystal_coin"`
|
||||
LpRecoveryItem []LpRecoveryItem `json:"lp_recovery_item"`
|
||||
}
|
||||
|
||||
type Birth struct {
|
||||
BirthMonth int `json:"birth_month"`
|
||||
BirthDay int `json:"birth_day"`
|
||||
}
|
||||
|
||||
type UserInfoData struct {
|
||||
User User `json:"user"`
|
||||
Birth Birth `json:"birth"`
|
||||
ServerTimestamp int64 `json:"server_timestamp"`
|
||||
}
|
||||
|
||||
func UserInfoHandler(ctx *gin.Context) {
|
||||
reqTime := time.Now().Unix()
|
||||
|
||||
@@ -45,13 +99,57 @@ func UserInfoHandler(ctx *gin.Context) {
|
||||
newAuthorizeStr := fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", respTime, authToken, nonce, userId[0], reqTime)
|
||||
// fmt.Println(newAuthorizeStr)
|
||||
|
||||
resp := utils.ReadAllText("assets/userinfo.json")
|
||||
xms := encrypt.RSA_Sign_SHA1([]byte(resp), "privatekey.pem")
|
||||
userResp := UserInfoResp{
|
||||
ResponseData: UserInfoData{
|
||||
User: User{
|
||||
UserID: 9999999,
|
||||
Name: "\u68a6\u8def @\u65c5\u7acb\u3061\u306e\u65e5\u306b",
|
||||
Level: 1028,
|
||||
Exp: 28824396,
|
||||
PreviousExp: 27734700,
|
||||
NextExp: 28941885,
|
||||
GameCoin: 112124104,
|
||||
SnsCoin: 0,
|
||||
FreeSnsCoin: 0,
|
||||
PaidSnsCoin: 0,
|
||||
SocialPoint: 1438395,
|
||||
UnitMax: 5000,
|
||||
WaitingUnitMax: 1000,
|
||||
EnergyMax: 417,
|
||||
EnergyFullTime: "2023-03-20 03:58:55",
|
||||
LicenseLiveEnergyRecoverlyTime: 60,
|
||||
EnergyFullNeedTime: 0,
|
||||
OverMaxEnergy: 0,
|
||||
TrainingEnergy: 100,
|
||||
TrainingEnergyMax: 100,
|
||||
FriendMax: 99,
|
||||
InviteCode: "377385143",
|
||||
InsertDate: "2015-08-10 18:58:30",
|
||||
UpdateDate: "2018-08-09 18:13:12",
|
||||
TutorialState: -1,
|
||||
DiamondCoin: 0,
|
||||
CrystalCoin: 0,
|
||||
LpRecoveryItem: []LpRecoveryItem{},
|
||||
},
|
||||
Birth: Birth{
|
||||
BirthMonth: 10,
|
||||
BirthDay: 18,
|
||||
},
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []interface{}{},
|
||||
StatusCode: 200,
|
||||
}
|
||||
resp, err := json.Marshal(userResp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
xms := encrypt.RSA_Sign_SHA1(resp, "privatekey.pem")
|
||||
xms64 := base64.RawStdEncoding.EncodeToString(xms)
|
||||
|
||||
ctx.Header("Server-Version", config.Conf.Server.VersionNumber)
|
||||
ctx.Header("user_id", userId[0])
|
||||
ctx.Header("authorize", newAuthorizeStr)
|
||||
ctx.Header("X-Message-Sign", xms64)
|
||||
ctx.String(http.StatusOK, resp)
|
||||
ctx.String(http.StatusOK, string(resp))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user