单个账号流注册流程
This commit is contained in:
@@ -3,16 +3,50 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
"go-account-register/libs"
|
||||
"go-account-register/services"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Twitter struct{}
|
||||
type Twitter struct {
|
||||
}
|
||||
|
||||
type RegisterParams struct {
|
||||
}
|
||||
|
||||
func (t *Twitter) Login(ctx *gin.Context) {
|
||||
// 参数
|
||||
var res *libs.ErrorInfo
|
||||
accountId := ctx.Query("accountId")
|
||||
id, _ := strconv.Atoi(accountId)
|
||||
|
||||
var TwitterService services.TwitterService
|
||||
res = TwitterService.Login(id)
|
||||
UserService := services.InitTwitterAccountService()
|
||||
UserService.ChangeAccountLoginStatus(id, res.Msg)
|
||||
ctx.JSON(http.StatusOK, gin.H{
|
||||
"code": res.Code,
|
||||
"msg": res.Msg,
|
||||
"data": res.Data,
|
||||
})
|
||||
}
|
||||
|
||||
func (t *Twitter) Logout(ctx *gin.Context) {
|
||||
accountId := ctx.Query("accountId")
|
||||
id, _ := strconv.Atoi(accountId)
|
||||
var TwitterService services.TwitterService
|
||||
TwitterService.Logout(id)
|
||||
UserService := services.InitTwitterAccountService()
|
||||
UserService.ChangeAccountLoginStatus(id, "账号下线")
|
||||
ctx.JSON(http.StatusOK, gin.H{
|
||||
"code": 200,
|
||||
"msg": "成功",
|
||||
"data": "",
|
||||
})
|
||||
}
|
||||
|
||||
func (*Twitter) Register(ctx *gin.Context) {
|
||||
var res *libs.ErrorInfo
|
||||
var paramsJson RegisterParams
|
||||
@@ -26,8 +60,8 @@ func (*Twitter) Register(ctx *gin.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
// var TwitterService services.TwitterAccountService
|
||||
// res = TwitterService.Register()
|
||||
var BitBrowserService services.BitBrowserService
|
||||
res = BitBrowserService.Register()
|
||||
ctx.JSON(http.StatusOK, gin.H{
|
||||
"code": res.Code,
|
||||
"msg": res.Msg,
|
||||
|
||||
Reference in New Issue
Block a user