overflow_server_app/module/member/signup.go

44 lines
1008 B
Go
Raw Normal View History

2017-08-23 09:19:21 +00:00
package member
import (
"fmt"
"git.loafle.net/overflow/overflow_server_app/server"
2017-08-24 06:06:09 +00:00
"git.loafle.net/overflow/overflow_server_app/backend"
2017-08-23 09:19:21 +00:00
"github.com/valyala/fasthttp"
2017-08-24 06:06:09 +00:00
"encoding/json"
2017-08-23 09:19:21 +00:00
)
2017-08-24 06:06:09 +00:00
type Member struct {
Id string `json:"id"`
Email string `json:"email"`
Pw string `json:"pw"`
Name string `json:"name"`
CompanyName string `json:"companyName"`
Phone string `json:"phone"`
}
2017-08-23 09:19:21 +00:00
func SignUp(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
2017-08-24 06:06:09 +00:00
grpcPool := sctx.Value("grpc").(backend.Pool)
c, err := grpcPool.Get()
if nil != err {
}
defer c.Close()
m := &Member{}
m.Email = string(ctx.FormValue("email"))
m.Name = string(ctx.FormValue("name"))
m.CompanyName = string(ctx.FormValue("companyName"))
m.Phone = string(ctx.FormValue("phone"))
m.Pw = string(ctx.FormValue("pw"))
mm,_ := json.Marshal(m)
params := []string{string(mm), string(m.Pw)}
2017-08-23 09:19:21 +00:00
2017-08-24 06:06:09 +00:00
r, err := c.Exec("MemberService", "signup", params)
2017-08-23 09:19:21 +00:00
2017-08-24 06:06:09 +00:00
fmt.Fprintf(ctx, "Welcome!!!!: %s\n", r)
2017-08-23 09:19:21 +00:00
}