Compare commits
6 Commits
aacc789dc9
...
5d865243f8
Author | SHA1 | Date |
---|---|---|
daniel.w | 5d865243f8 | |
daniel.w | 4f06c8038a | |
daniel.w | 80c8bb63a7 | |
daniel.w | b1a19ffba7 | |
daniel.w | 5d55ba14a3 | |
daniel.w | 575931f210 |
|
@ -2,5 +2,6 @@
|
||||||
go.sum
|
go.sum
|
||||||
account/
|
account/
|
||||||
gen_result/
|
gen_result/
|
||||||
etc/service.yaml
|
etc/member.yaml
|
||||||
client/
|
client/
|
||||||
|
.DS_Store
|
2
Makefile
2
Makefile
|
@ -19,7 +19,7 @@ fmt: # 格式優化
|
||||||
|
|
||||||
.PHONY: gen-rpc
|
.PHONY: gen-rpc
|
||||||
gen-rpc: # 建立 rpc code
|
gen-rpc: # 建立 rpc code
|
||||||
goctl rpc protoc ./generate/protobuf/service.proto -m --style=$(GO_ZERO_STYLE) --go_out=./gen_result/pb --go-grpc_out=./gen_result/pb --zrpc_out=.
|
goctl rpc protoc ./generate/protobuf/member.proto -m --style=$(GO_ZERO_STYLE) --go_out=./gen_result/pb --go-grpc_out=./gen_result/pb --zrpc_out=.
|
||||||
go mod tidy
|
go mod tidy
|
||||||
@echo "Generate core-api files successfully"
|
@echo "Generate core-api files successfully"
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ RUN --mount=type=ssh go mod download
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
-ldflags "$FLAG" \
|
-ldflags "$FLAG" \
|
||||||
-o service
|
-o member
|
||||||
|
|
||||||
##########
|
##########
|
||||||
## FINAL #
|
## FINAL #
|
||||||
|
@ -41,7 +41,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||||
FROM gcr.io/distroless/static-debian11
|
FROM gcr.io/distroless/static-debian11
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /app/service /app/service
|
COPY --from=builder /app/member /app/member
|
||||||
COPY --from=builder /app/etc/service.yaml /app/etc/service.yaml
|
COPY --from=builder /app/etc/member.yaml /app/etc/member.yaml
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
CMD ["/app/service"]
|
CMD ["/app/member"]
|
|
@ -169,6 +169,7 @@ message ListUserInfoResp {
|
||||||
|
|
||||||
message VerifyAuthResultReq {
|
message VerifyAuthResultReq {
|
||||||
string token = 1;
|
string token = 1;
|
||||||
|
optional string account = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message VerifyAuthResultResp {
|
message VerifyAuthResultResp {
|
||||||
|
@ -204,7 +205,11 @@ service Account {
|
||||||
rpc GenerateRefreshCode(GenerateRefreshCodeReq) returns(GenerateRefreshCodeResp);
|
rpc GenerateRefreshCode(GenerateRefreshCodeReq) returns(GenerateRefreshCodeResp);
|
||||||
// VerifyRefreshCode 驗證忘記密碼 token
|
// VerifyRefreshCode 驗證忘記密碼 token
|
||||||
rpc VerifyRefreshCode(VerifyRefreshCodeReq) returns(OKResp);
|
rpc VerifyRefreshCode(VerifyRefreshCodeReq) returns(OKResp);
|
||||||
|
// CheckRefreshCode 驗證忘記密碼 token 不刪除,只確認)
|
||||||
|
rpc CheckRefreshCode(VerifyRefreshCodeReq) returns(OKResp);
|
||||||
// VerifyGoogleAuthResult 驗證 google 登入是否有效
|
// VerifyGoogleAuthResult 驗證 google 登入是否有效
|
||||||
rpc VerifyGoogleAuthResult(VerifyAuthResultReq)returns(VerifyAuthResultResp);
|
rpc VerifyGoogleAuthResult(VerifyAuthResultReq)returns(VerifyAuthResultResp);
|
||||||
|
// VerifyPlatformAuthResult 驗證 google 登入是否有效
|
||||||
|
rpc VerifyPlatformAuthResult(VerifyAuthResultReq)returns(VerifyAuthResultResp);
|
||||||
}
|
}
|
||||||
// ================ account ================
|
// ================ account ================
|
|
@ -5,7 +5,6 @@ import "time"
|
||||||
const (
|
const (
|
||||||
DefaultPageSize = 100
|
DefaultPageSize = 100
|
||||||
DefaultPageIndex = 1
|
DefaultPageIndex = 1
|
||||||
Scope = 10
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const InitAutoId = 10000000
|
const InitAutoId = 10000000
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Code generated by goctl. DO NOT EDIT.
|
// Code generated by goctl. DO NOT EDIT.
|
||||||
// Source: service.proto
|
// Source: member.proto
|
||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
|
@ -94,8 +94,20 @@ func (s *AccountServer) VerifyRefreshCode(ctx context.Context, in *member.Verify
|
||||||
return l.VerifyRefreshCode(in)
|
return l.VerifyRefreshCode(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckRefreshCode 驗證忘記密碼 token 不刪除,只確認)
|
||||||
|
func (s *AccountServer) CheckRefreshCode(ctx context.Context, in *member.VerifyRefreshCodeReq) (*member.OKResp, error) {
|
||||||
|
l := accountlogic.NewCheckRefreshCodeLogic(ctx, s.svcCtx)
|
||||||
|
return l.CheckRefreshCode(in)
|
||||||
|
}
|
||||||
|
|
||||||
// VerifyGoogleAuthResult 驗證 google 登入是否有效
|
// VerifyGoogleAuthResult 驗證 google 登入是否有效
|
||||||
func (s *AccountServer) VerifyGoogleAuthResult(ctx context.Context, in *member.VerifyAuthResultReq) (*member.VerifyAuthResultResp, error) {
|
func (s *AccountServer) VerifyGoogleAuthResult(ctx context.Context, in *member.VerifyAuthResultReq) (*member.VerifyAuthResultResp, error) {
|
||||||
l := accountlogic.NewVerifyGoogleAuthResultLogic(ctx, s.svcCtx)
|
l := accountlogic.NewVerifyGoogleAuthResultLogic(ctx, s.svcCtx)
|
||||||
return l.VerifyGoogleAuthResult(in)
|
return l.VerifyGoogleAuthResult(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// VerifyPlatformAuthResult 驗證 google 登入是否有效
|
||||||
|
func (s *AccountServer) VerifyPlatformAuthResult(ctx context.Context, in *member.VerifyAuthResultReq) (*member.VerifyAuthResultResp, error) {
|
||||||
|
l := accountlogic.NewVerifyPlatformAuthResultLogic(ctx, s.svcCtx)
|
||||||
|
return l.VerifyPlatformAuthResult(in)
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
mgo "app-cloudep-member-server/internal/model/mongo"
|
mgo "app-cloudep-member-server/internal/model/mongo"
|
||||||
"app-cloudep-member-server/internal/usecase"
|
"app-cloudep-member-server/internal/usecase"
|
||||||
ers "code.30cm.net/digimon/library-go/errors"
|
ers "code.30cm.net/digimon/library-go/errors"
|
||||||
|
"code.30cm.net/digimon/library-go/errors/code"
|
||||||
vi "code.30cm.net/digimon/library-go/validator"
|
vi "code.30cm.net/digimon/library-go/validator"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/zeromicro/go-zero/core/stores/cache"
|
"github.com/zeromicro/go-zero/core/stores/cache"
|
||||||
|
@ -28,7 +29,7 @@ type ServiceContext struct {
|
||||||
|
|
||||||
func NewServiceContext(c config.Config) *ServiceContext {
|
func NewServiceContext(c config.Config) *ServiceContext {
|
||||||
// 設置
|
// 設置
|
||||||
ers.Scope = domain.Scope
|
ers.Scope = code.CloudEPMember
|
||||||
|
|
||||||
// TODO 可優化項目,將連線數量以及 timeout 都便可設定
|
// TODO 可優化項目,將連線數量以及 timeout 都便可設定
|
||||||
sqlConn := sqlx.NewMysql(c.DB.DsnString)
|
sqlConn := sqlx.NewMysql(c.DB.DsnString)
|
||||||
|
|
|
@ -2,8 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
|
||||||
|
|
||||||
"app-cloudep-member-server/gen_result/pb/member"
|
"app-cloudep-member-server/gen_result/pb/member"
|
||||||
"app-cloudep-member-server/internal/config"
|
"app-cloudep-member-server/internal/config"
|
||||||
|
@ -17,7 +16,7 @@ import (
|
||||||
"google.golang.org/grpc/reflection"
|
"google.golang.org/grpc/reflection"
|
||||||
)
|
)
|
||||||
|
|
||||||
var configFile = flag.String("f", "etc/service.yaml", "the config file")
|
var configFile = flag.String("f", "etc/member.yaml", "the config file")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -35,6 +34,6 @@ func main() {
|
||||||
})
|
})
|
||||||
defer s.Stop()
|
defer s.Stop()
|
||||||
|
|
||||||
logx.Info("Starting rpc server at %s...\n", c.ListenOn)
|
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
|
||||||
s.Start()
|
s.Start()
|
||||||
}
|
}
|
Loading…
Reference in New Issue