// Copyright 2019 utimes.cc. All rights reserved. // Use of this source code is governed by utimes.cc. // package impl implement all interfaces of micro service in gd_auth_check package impl import ( "context" "gd_auth_check/apis" "gd_auth_check/impl/data_api_check" "gd_auth_check/impl/management" "encoding/json" "gd_auth_check/common.in/jsonrpc2" "gd_auth_check/common.in/task" "github.com/astaxie/beego/orm" ) // 具体实现 type Rcvr struct { } func (c *Rcvr) ManagementCheckApi(ctx context.Context, req *apis.ManagementCheckApiReq, reply *apis.ManagementCheckApiReply) error { t1 := func() error { return data_api_check.ManagementCheckApi(ctx, req, reply) } err := task.Do(ctx, t1) if err != nil { var e jsonrpc2.Error merr := json.Unmarshal([]byte(err.Error()), &e) if merr != nil { reply.ErrCode = int(1001) reply.ErrMsg = "服务错误" } reply.ErrCode = e.Code reply.ErrMsg = e.Message } return nil } func (c *Rcvr) ManagementCheckProviderApi(ctx context.Context, req *apis.ManagementCheckProviderApiReq, reply *apis.ManagementCheckProviderApiReply) error { t1 := func() error { return data_api_check.ManagementCheckProviderApi(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ManagementThirdpartCountIncrease(ctx context.Context, req *apis.ManagementThirdpartCountIncreaseReq, reply *apis.ManagementThirdpartCountIncreaseReply) error { t1 := func() error { return data_api_check.ManagementThirdpartCountIncrease(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ManagementCheckCountCode(ctx context.Context, req *apis.ManagementCheckCountCodeReq, reply *apis.ManagementCheckCountCodeReply) error { t1 := func() error { return data_api_check.ManagementCheckCountCode(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) MerchantAppLogin(ctx context.Context, req *apis.MerchantAppLoginReq, reply *apis.MerchantAppLoginReply) error { t1 := func() error { return data_api_check.MerchantAppLogin(ctx, req, reply) } return task.Do(ctx, t1) } func (r *Rcvr) ManagementGetProviderApiLimitCount(ctx context.Context, req *apis.ManagementGetProviderApiLimitCountReq, reply *apis.ManagementGetProviderApiLimitCountReply) error { t1 := func() error { return management.ManagementGetProviderApiLimitCount(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ManagementGetName(ctx context.Context, req *apis.ManagementGetNameReq, reply *apis.ManagementGetNameReply) error { t1 := func() error { return management.ManagementGetName(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) GetApiThreshold(ctx context.Context, req *apis.GetApiThresholdReq, reply *apis.GetApiThresholdReply) error { t1 := func() error { return management.GetApiThreshold(ctx, req, reply) } return task.Do(ctx, t1) } // 获取商户计数码 func (c *Rcvr) MangementGetUserMerchantCountCode(ctx context.Context, req *apis.MangementGetUserMerchantCountCodeReq, reply *apis.MangementGetUserMerchantCountCodeReply) error { t1 := func() error { return management.MangementGetUserMerchantCountCode(ctx, req, reply) } return task.Do(ctx, t1) } // 获取商户id和名称列表 func (c *Rcvr) ManagementGetMerchantIds(ctx context.Context, req *apis.ManagementGetMerchantIdsReq, reply *apis.ManagementGetMerchantIdsReply) error { t1 := func() error { return management.ManagementGetMerchantIds(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ManagementGetMerchantApiId(ctx context.Context, req *apis.ManagementGetMerchantApiIdReq, reply *apis.ManagementGetMerchantApiIdReply) error { t1 := func() error { return management.ManagementGetMerchantApiId(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ManagementGetProviderCountInfo(ctx context.Context, req *apis.ManagementGetProviderCountInfoReq, reply *apis.ManagementGetProviderCountInfoReply) error { t1 := func() error { return management.ManagementGetProviderCountInfo(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ManagementGetProviderIds(ctx context.Context, req *apis.ManagementGetProviderIdsReq, reply *apis.ManagementGetProviderIdsReply) error { t1 := func() error { return management.ManagementGetProviderIds(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ManagementGetApiShowInfo(ctx context.Context, req *apis.ManagementGetApiShowInfoReq, reply *apis.ManagementGetApiShowInfoReply) error { t1 := func() error { return management.ManagementGetApiShowInfo(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ManagementGetMerchantApiTimeout(ctx context.Context, req *apis.ManagementGetMerchantApiTimeoutReq, reply *apis.ManagementGetMerchantApiTimeoutReply) error { t1 := func() error { return management.ManagementGetMerchantApiTimeout(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) ReleaseToken(ctx context.Context, req *apis.RateLimitToken, reply *apis.RateLimitToken) error { t1 := func() error { return data_api_check.ReleaseToken(ctx, req, reply) } return task.Do(ctx, t1) } func RegisterModel() { orm.RegisterModel(new(apis.TGdApi)) orm.RegisterModel(new(apis.TGdMerchants)) orm.RegisterModel(new(apis.ManagementThirdpartCount)) }