135 lines
3.3 KiB
Go
135 lines
3.3 KiB
Go
package actions
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/auth"
|
|
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/basic"
|
|
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/email"
|
|
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/encryption_decryption"
|
|
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/log"
|
|
)
|
|
|
|
var CompanyKey = "vestmore-bjwl"
|
|
|
|
// @Action base/getToken
|
|
// Base_GetToken
|
|
// action: string;
|
|
// app_market: string;
|
|
// lang: string;
|
|
// token: string;
|
|
func BaseGetToken(ctx *gin.Context, param *BaseGetTokenParam, resp *basic.Response) {
|
|
ctx.ShouldBind(param)
|
|
// model.Models.KillaraCustomerModel.Find()
|
|
log.Println()
|
|
}
|
|
|
|
// @Action account/loginWithTelephonePassword
|
|
// AccountLoginWithTelephonePassword
|
|
// action: string;
|
|
// country_code: string;
|
|
// device?: string;
|
|
// lang: string;
|
|
// password: string;
|
|
// telephone: string;
|
|
// token?: string;
|
|
// version?: string;
|
|
func AccountLoginWithTelephonePassword(ctx *gin.Context, param *AccountLoginWithTelephonePasswordParam, resp *basic.Response) {
|
|
// ctx.ShouldBind()
|
|
// model.Models.KillaraCustomerModel.Find()
|
|
|
|
// log.Println(param)
|
|
}
|
|
|
|
// @Action account/registerSmsCode
|
|
// AccountRegisterSmsCode
|
|
// action: string;
|
|
// country_code?: string;
|
|
// telephone?: string;
|
|
// token: string;
|
|
func AccountRegisterSmsCode(ctx *gin.Context, param *AccountRegisterSmsCodeParam, resp *basic.Response) {
|
|
// ctx.ShouldBind()
|
|
log.Println()
|
|
}
|
|
|
|
// @Action account/forgetSmsCode
|
|
// AccountForgetSmsCode
|
|
// action: string;
|
|
// country_code?: string;
|
|
// telephone?: string;
|
|
// token: string;
|
|
func AccountForgetSmsCode(ctx *gin.Context, param *AccountForgetSmsCodeParam, resp *basic.Response) {
|
|
// ctx.ShouldBind()
|
|
log.Println()
|
|
}
|
|
|
|
type RegisterValidEmailCode struct {
|
|
Code string
|
|
Email string
|
|
AppMarket int
|
|
}
|
|
|
|
// @Action account/registerEmailCode
|
|
// AccountRegisterEmailCode
|
|
// randstr: string;
|
|
// sign: string;
|
|
// action: string;
|
|
// app_market: int;
|
|
// email: string;
|
|
// timestamp: int64;
|
|
// token: string;
|
|
func AccountRegisterEmailCode(ctx *gin.Context, param *AccountRegisterEmailCodeParam, resp *basic.Response) {
|
|
log.Println(param)
|
|
|
|
if !email.IsEmailValid(param.Email) {
|
|
resp.Error(basic.ErrEmailFormat)
|
|
return
|
|
}
|
|
|
|
gcm := encryption_decryption.NewSecretGCM[RegisterValidEmailCode](CompanyKey)
|
|
|
|
code := auth.GenerateVerificationCode()
|
|
codetoken := &RegisterValidEmailCode{
|
|
Code: code,
|
|
Email: param.Email,
|
|
AppMarket: param.AppMarket,
|
|
}
|
|
tokenstr, err := gcm.Encrypt(codetoken)
|
|
if err != nil {
|
|
resp.Error(basic.ErrEncGcm)
|
|
return
|
|
}
|
|
|
|
resp.Success(map[string]any{
|
|
"token": tokenstr,
|
|
})
|
|
}
|
|
|
|
// @Action member/alterPassword
|
|
// MemberAlterPassword
|
|
// action: string;
|
|
// confirm_password: string;
|
|
// new_password: string;
|
|
// old_password: string;
|
|
// token?: string;
|
|
func MemberAlterPassword(ctx *gin.Context, param *MemberAlterPasswordParam, resp *basic.Response) {
|
|
// ctx.ShouldBind()
|
|
log.Println()
|
|
}
|
|
|
|
// @Action account/loginWithEmailPassword
|
|
// AccountLoginWithEmailPassword
|
|
// password: string;
|
|
// randstr: string;
|
|
// sign: string;
|
|
// action: string;
|
|
// device: string;
|
|
// version: string;
|
|
// app_market: int;
|
|
// email: string;
|
|
// timestamp: int64;
|
|
// token: string;
|
|
func AccountLoginWithEmailPassword(ctx *gin.Context, param *AccountLoginWithEmailPasswordParam, resp *basic.Response) {
|
|
|
|
log.Println(param)
|
|
}
|