123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- // 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))
- }
|