48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package handler
|
|
|
|
import (
|
|
"encoding/base64"
|
|
"encoding/json"
|
|
"fmt"
|
|
"honoka-chan/encrypt"
|
|
"honoka-chan/model"
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func ProductList(ctx *gin.Context) {
|
|
prodReesp := model.ProductResp{
|
|
ResponseData: model.ProductRes{
|
|
RestrictionInfo: model.RestrictionInfo{
|
|
Restricted: false,
|
|
},
|
|
UnderAgeInfo: model.UnderAgeInfo{
|
|
BirthSet: true,
|
|
HasLimit: false,
|
|
LimitAmount: nil,
|
|
MonthUsed: 0,
|
|
},
|
|
SnsProductList: []any{},
|
|
ProductList: []any{},
|
|
SubscriptionList: []any{},
|
|
ShowPointShop: true,
|
|
ServerTimestamp: time.Now().Unix(),
|
|
},
|
|
ReleaseInfo: []any{},
|
|
StatusCode: 200,
|
|
}
|
|
resp, err := json.Marshal(prodReesp)
|
|
CheckErr(err)
|
|
|
|
nonce := ctx.GetInt("nonce")
|
|
nonce++
|
|
|
|
ctx.Header("user_id", ctx.GetString("userid"))
|
|
ctx.Header("authorize", fmt.Sprintf("consumerKey=lovelive_test&timeStamp=%d&version=1.1&token=%s&nonce=%d&user_id=%s&requestTimeStamp=%d", time.Now().Unix(), ctx.GetString("token"), nonce, ctx.GetString("userid"), ctx.GetInt64("req_time")))
|
|
ctx.Header("X-Message-Sign", base64.StdEncoding.EncodeToString(encrypt.RSA_Sign_SHA1(resp)))
|
|
|
|
ctx.String(http.StatusOK, string(resp))
|
|
}
|