overflow_server_app/module/member/modify.go

38 lines
921 B
Go
Raw Normal View History

2017-08-24 09:26:35 +00:00
package member
import (
"fmt"
"git.loafle.net/overflow/overflow_server_app/backend"
"git.loafle.net/overflow/overflow_server_app/server"
"github.com/valyala/fasthttp"
"encoding/json"
)
func Modify(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
grpcPool := sctx.Value("grpc").(backend.Pool)
fmt.Fprintf(ctx, "avail: %d\n", grpcPool.Available())
c, err := grpcPool.Get()
if nil != err {
}
defer c.Close()
fmt.Fprintf(ctx, "avail: %d\n", grpcPool.Available())
m := &Member{}
m.Id = string(ctx.FormValue("id"))
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)}
r, err := c.Exec("MemberService", "modify", params)
fmt.Fprintf(ctx, "Welcome!!!!: %s\n", r)
}