feat:init

master
dengxiangcun 2023-10-31 14:07:26 +08:00
commit 56ac08c576
202 changed files with 46889 additions and 0 deletions

24
Dockerfile 100644
View File

@ -0,0 +1,24 @@
FROM docker.finogeeks.club/mop-infra/alpine:latest
MAINTAINER xuls <xulishan@finogeeks.com>
RUN mkdir -p /opt/conf/
COPY ./infrastructure/config/conf/bindingWhiteList.json /opt/conf/
COPY ./infrastructure/config/conf/bindingWhiteListHccDev.json /opt/conf/
COPY ./infrastructure/config/conf/bindingWhiteListHccUat.json /opt/conf/
RUN chown 1024 /opt/conf/
#USER 1024
COPY finclip-app-manager /opt/finclip-app-manager
WORKDIR /opt/
ENTRYPOINT ./finclip-app-manager
# FROM docker.finogeeks.club/base/alpine
# RUN ls
# RUN set -ex \
# && apk add --no-cache ca-certificates
# COPY finclip-app-manager /opt/finclip-app-manager
# ENTRYPOINT /opt/finclip-app-manager

3137
application/app.go 100644

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,78 @@
package application
import (
"finclip-app-manager/domain/service"
"finclip-app-manager/infrastructure/logger"
"finclip-app-manager/infrastructure/utility"
"net/http"
"github.com/gin-gonic/gin"
"gitlab.finogeeks.club/finclip-backend/apm"
)
/**
* @api {GET} /api/v1/mop/finstore/admin/app-oper-conifg/info [C/S]
* @apiGroup Finclip App Manager
* @apiVersion __API_VERSION__
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "",
* "data":{
* "autoReviewApp":1 //1代表打开0代表关闭
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func QueryAppOperConfig(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
s := service.NewAppConfigService()
rsp, errStr := s.GetOperConfig(traceCtx)
if errStr != utility.OK {
utility.MakeLocRsp(c, http.StatusOK, errStr, nil)
return
} else {
utility.MakeLocRsp(c, http.StatusOK, errStr, rsp)
return
}
}
/**
* @api {POST} /api/v1/mop/finstore/admin/app-oper-conifg/update [C/S]
* @apiGroup Finclip App Manager
* @apiVersion __API_VERSION__
* @apiParam (RequestBody) {int} autoReviewApp
* @apiParamExample {json} Request-Example:
* {
* "autoReviewApp": 1
* }
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "",
* "data":{}
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func UpdateAppOperConfig(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
var req service.UpdateAppOperCofigReq
if err := c.BindJSON(&req); err != nil {
logger.GetLogger().Errorf("UpdateAppOperConfig bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
s := service.NewAppConfigService()
errStr, errCode := s.UpdateAppOperCofig(traceCtx, req)
utility.MakeLocRsp(c, errCode, errStr, nil)
return
}

View File

@ -0,0 +1,829 @@
package application
import (
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/domain/service"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/utility"
"net/http"
"strconv"
"strings"
"github.com/gin-gonic/gin"
"gitlab.finogeeks.club/finclip-backend/apm"
)
type InternalGetAppVerInfoRsp struct {
AppID string `json:"appId"`
Name string `json:"name"`
Sequence int `json:"sequence"`
AppClass string `json:"appClass"`
AppType string `json:"appType"`
Status entity.Status `json:"status"`
PublishedStatus entity.SpecificStatus `json:"publishedStatus"`
UnpublishedStatus entity.SpecificStatus `json:"unpublishedStatus"`
ActionStatus entity.SpecificStatus `json:"actionStatus"`
DeveloperID string `json:"developerId"`
GroupID string `json:"groupId"`
GroupName string `json:"groupName"`
Created int64 `json:"created"`
CreatedBy string `json:"createdBy"`
CustomData entity.CustomDataInfo `json:"customData"`
Version string `json:"version"`
CorporationID string `json:"corporationId"`
CoreDescription string `json:"coreDescription"`
Logo string `json:"logo"`
}
func InternalGetAppVerInfo(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
appId := c.Param("appId")
seqStr := c.Param("sequence")
SDKKey := c.GetHeader(utility.SDK_KEY_SIGNAL)
sdkVer := c.GetHeader(utility.SDKKEY_VER_HEADER_KEY)
log.Infof("InternalGetAppVerInfo req appId:%s,seq:%s,sdk-key:%s,sdk-ver:%s", appId, seqStr, SDKKey, sdkVer)
if appId == "" {
log.Errorf("InternalGetAppVerInfo appId empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_APPID, gin.H{})
return
}
if SDKKey == "" {
log.Errorf("InternalGetAppVerInfo sdk-key empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_SDKKEY, gin.H{})
return
}
//sdkKey白名单的校验
if !utility.InArry(SDKKey, config.WhiteSDKArry) {
if config.Cfg.PublishEnv == entity.ENV_PRIVATE {
svr := service.NewBindingService()
checkStatus := svr.CheckReviewBySdkKey(traceCtx, SDKKey)
if checkStatus != utility.OK {
log.Errorf("RuntimeGetAppVersionInfo sdk not in reviewlist,sdk-key:%s", SDKKey)
utility.MakeLocRsp(c, http.StatusForbidden, checkStatus, gin.H{})
return
}
} else {
log.Errorf("RuntimeGetAppVersionInfo sdk not in white sdk arry,sdk-key:%s", SDKKey)
utility.MakeLocRsp(c, http.StatusForbidden, utility.FS_COOPERATION_TERMINATED, gin.H{})
return
}
}
sequence, err := strconv.Atoi(seqStr)
if err != nil {
log.Errorf("InternalGetAppVerInfo sequence format err,seq:%s,err:%s", seqStr, err.Error())
utility.MakeLocRsp(c, http.StatusForbidden, utility.FS_BAD_JSON, gin.H{})
return
}
svr := service.NewAppService()
data, rsp := svr.OpenApiGetAppVerInfo(traceCtx, appId, sequence, sdkVer)
log.Infof("OpenApiGetAppVerInfo rsp data:%+v,info:%+v", data, rsp)
if rsp.ErrCode != utility.OK {
rsp.MakeRsp(c, gin.H{})
} else {
data.GroupName = ChangeGroupName(data.GroupName)
rsp.MakeRsp(c, data)
}
return
}
func ChangeGroupName(groupName string) string {
if len(groupName) == 18 && strings.Contains(groupName, "个人-") {
phone := groupName[7:]
if isOK := utility.IsMobile(phone); isOK {
newName := "个人-"
for i := 0; i < len(phone); i++ {
if i >= 3 && i <= 6 {
newName += "*"
} else {
newName += string(phone[i])
}
}
groupName = newName
}
}
return groupName
}
type GetGroupIdByAppIdRspData struct {
GroupId string `json:"groupId"`
AppName string `json:"appName"`
}
type GetGroupIdByAppIdRsp struct {
Data GetGroupIdByAppIdRspData `json:"data"`
Errcode string `json:"errcode"`
Errmsg string `json:"error"`
}
func GetGroupIdByAppId(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
appID := c.Param("appId")
if appID == "" {
log.Errorf("GetGroupIdByAppId app id empty!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_APPID, gin.H{})
return
}
log.Infof("GetGroupIdByAppId req appId:%s", appID)
app, err := service.NewAppService().GetAppInfoByAppId(traceCtx, appID)
if err != nil {
log.Errorf("GetGroupIdByAppId db err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
rspData := GetGroupIdByAppIdRsp{}
rspData.Data.GroupId = app.GroupID
rspData.Data.AppName = app.Name
rspData.Errmsg = ""
rspData.Errmsg = "OK"
c.JSON(http.StatusOK, rspData)
}
type GetRuleEngineVerPubListRspItem struct {
Version int `json:"version"`
VersionStr string `json:"versionStr"`
}
type VerToDescItem struct {
Version int `json:"version"`
Desc string `json:"desc"`
}
type GetRuleEngineVerPubListRsp struct {
VerList []GetRuleEngineVerPubListRspItem `json:"verList"` //大于等于MaxPubVer的序列号列表
NowPubVer GetRuleEngineVerPubListRspItem `json:"nowPubVer"` //当前上架版本
MaxPubVer GetRuleEngineVerPubListRspItem `json:"maxPubVer"` //已发布、已下架、审核通过三种状态里面的最大版本号
VerToDesc []VerToDescItem `json:"verToDesc"` //序列号到版本描述的映射
}
func GetRuleEngineVerPubList(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
appId := c.Param("appId")
if appId == "" {
log.Errorf("GetRuleEngineVerPubList app id empty !")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_APP_ID_NOT_FOUND, gin.H{})
return
}
log.Infof("GetRuleEngineVerPubList appId:%s", appId)
svr := service.NewAppService()
data, rsp := svr.GetRuleEngineVerPubList(traceCtx, appId)
rsp.MakeRsp(c, data)
return
}
func RuleEngineGetAppInfo(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
appID := c.Param("appId")
if appID == "" {
log.Infof("RuleEngineGetAppInfo appId empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_APPID, gin.H{})
return
}
sdkKey := c.GetHeader(utility.SDK_KEY_SIGNAL)
sdkVer := c.GetHeader(utility.SDKKEY_VER_HEADER_KEY)
log.Infof("RuleEngineGetAppInfo req appId:%s sdkKey:%s sdkver:%s", appID, sdkKey, sdkVer)
svr := service.NewAppService()
data, rsp := svr.RuntimeGetPubAppInfo(traceCtx, sdkKey, appID, sdkVer)
if rsp.ErrCode != utility.OK {
rsp.MakeRsp(c, gin.H{})
} else {
rsp.MakeRsp(c, data)
}
}
func RuleEngineGetAppVerInfo(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
appId := c.Param("appId")
seqStr := c.Param("version")
log.Infof("RuleEngineGetAppVerInfo req appId:%s,seq:%s", appId, seqStr)
if appId == "" {
log.Errorf("RuleEngineGetAppVerInfo appId empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_APPID, gin.H{})
return
}
sequence, err := strconv.Atoi(seqStr)
if err != nil {
log.Errorf("RuleEngineGetAppVerInfo sequence format err,seq:%s,err:%s", seqStr, err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
sdkKey := c.GetHeader(utility.SDK_KEY_SIGNAL)
if sdkKey == "" {
log.Errorf("RuleEngineGetAppVerInfo sdk key empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_SDKKEY_NOT, gin.H{})
return
}
sdkVer := c.GetHeader(utility.SDKKEY_VER_HEADER_KEY)
svr := service.NewAppService()
data, rsp := svr.RuleEngineGetAppVerInfo(traceCtx, appId, sequence, sdkKey, sdkVer)
if rsp.ErrCode != utility.OK {
rsp.MakeRsp(c, gin.H{})
} else {
rsp.MakeRsp(c, data)
}
}
type GrayNotifyAppReq struct {
AppId string `json:"appId"`
Version int `json:"version"`
Status bool `json:"status"`
}
func GrayNotifyApp(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := GrayNotifyAppReq{}
if err := c.BindJSON(&req); err != nil {
log.Errorf("GrayNotifyApp bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
err := service.NewAppService().UpdateGrayPubStatus(traceCtx, req.AppId, req.Version, req.Status)
if err != nil {
log.Errorf("GrayNotifyApp db err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}
type GetPubVerListRspItem struct {
AppID string `json:"appId" bson:"appId"`
Name string `json:"name" bson:"name"`
Version string `json:"version" bson:"version"`
Sequence int `json:"sequence" bson:"sequence"`
AppBuildID string `json:"appBuildID" bson:"appBuildID"`
AppBuildInfoId string `json:"buildInfoId" bson:"buildInfoId"`
StartParams entity.AppStartParams `json:"startParams"`
WechatInfo WechatInfoRsp `json:"wechatInfo" bson:"wechatInfo"`
}
func GetAppVerBuildInfos(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
appId := c.Query("appId")
if appId == "" {
log.Errorf("appId is empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_APPID, gin.H{})
return
}
log.Infof("get app ver build info req appid:[%s]", appId)
svr := service.NewAppService()
appInfo, err := svr.GetAppInfoByAppId(traceCtx, appId)
if err != nil {
log.Errorf("GetAppVerBuildInfos db err:%s", err.Error())
if service.NotFound(err) {
utility.MakeLocRsp(c, http.StatusNotFound, utility.FS_APP_ID_NOT_FOUND, gin.H{})
return
}
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
buildSvr := service.NewAppAppletInfoService()
trialResult, err := buildSvr.GetTrialInfoByAppId(traceCtx, appId)
if err != nil && !service.NotFound(err) {
log.Errorf("GetTrialInfoByAppId db err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
log.Debugf("trialResult data:", trialResult)
appSvr := service.NewAppService()
publishedList, _, err := appSvr.GetAllPublishedVerList(traceCtx, appId)
if err != nil {
log.Errorf("GetAllPublishedVerList err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
var pubResult []GetPubVerListRspItem
for _, v := range publishedList {
pubItem := GetPubVerListRspItem{}
if len(v.AppBuildID) > 0 {
buildInfo := &entity.AppBuildInfo{}
buildInfo, err = buildSvr.GetInfoById(traceCtx, v.AppBuildID)
if err != nil {
log.Infof("GetInfoById err:%s", err.Error())
buildInfo, err = buildSvr.GetInfoByBuildInfoId(traceCtx, v.AppBuildID)
if err != nil {
log.Infof("GetInfoByBuildInfoId err:%s", err.Error())
}
} else {
pubItem.AppID = v.AppID
pubItem.AppBuildID = v.AppBuildID
pubItem.AppBuildInfoId = buildInfo.BuildInfoId
pubItem.Sequence = v.Sequence
pubItem.Version = v.Version
pubItem.Name = v.Name
pubItem.StartParams = buildInfo.StartParams
}
wechatInfo, err := hCaller.GetWeChatInfo(traceCtx, appId)
if err != nil {
log.Errorf("GetWeChatInfo err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, gin.H{})
return
}
if wechatInfo.Updated == 0 {
wechatInfo.Updated = appInfo.PublishedStatus.LastUpdated
}
pubItem.WechatInfo = WechatInfoRsp{
WechatAppSecret: wechatInfo.WechatAppSecret,
WechatAppId: wechatInfo.WechatAppId,
WechatPath: wechatInfo.WechatPath,
WechatSize: wechatInfo.WechatSize,
QrcodeUrl: wechatInfo.QrcodeUrl,
QrcodeDownloadUrl: wechatInfo.QrcodeDownloadUrl,
Updated: wechatInfo.Updated,
//ShowHint:wechatInfo.ShowHint,
}
pubResult = append(pubResult, pubItem)
}
}
log.Debugf("pubResult data:", pubResult)
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{"trialVer": trialResult, "pubVer": pubResult})
return
}
type GetGrayStatisticsVerListReq struct {
AppId string `form:"appId"`
Version int `form:"version"`
BeginTime int64 `form:"begin_time"`
EndTime int64 `form:"end_time"`
}
func GetGrayStatisticsVerList(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := GetGrayStatisticsVerListReq{}
if err := c.Bind(&req); err != nil {
log.Errorf("GetGrayStatisticsVerList req bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
log.Infof("GetGrayStatisticsVerList req:%+v", req)
svr := service.NewAppService()
data, rsp := svr.GetGrayStatisticsVerList(traceCtx, req.AppId, req.Version, req.BeginTime, req.EndTime)
if rsp.ErrCode == utility.OK {
rsp.MakeRsp(c, data)
} else {
rsp.MakeRsp(c, gin.H{})
}
return
}
type RuleEngineBatchGetAppReq struct {
SdkKey string `json:"sdkKey"`
SdkVer string `json:"sdkVer"`
AppList []string `json:"appList"`
AppVerList []struct {
AppId string `json:"appId"`
Sequence int `json:"sequence"`
} `json:"appVerList"`
}
type RuleEngineBatchGetAppRsp struct {
AppFailList []string `json:"appFailList"`
AppVerFailList []string `json:"appVerFailList"`
AppDataList []interface{} `json:"appDataList"`
AppVerDataList []interface{} `json:"appVerDataList"`
}
func RuleEngineBatchGetApp(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := RuleEngineBatchGetAppReq{}
rsp := RuleEngineBatchGetAppRsp{}
rsp.AppFailList = make([]string, 0)
rsp.AppVerFailList = make([]string, 0)
rsp.AppDataList = make([]interface{}, 0)
rsp.AppVerDataList = make([]interface{}, 0)
if err := c.BindJSON(&req); err != nil {
log.Errorf("RuleEngineBatchGetApp bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
log.Infof("http RuleEngineBatchGetApp req:%+v", req)
//首先获取小程序详情
rs := service.NewAppService()
for _, appId := range req.AppList {
data, tempRsp := rs.RuntimeGetPubAppInfo(traceCtx, req.SdkKey, appId, req.SdkVer)
if tempRsp.ErrCode != utility.OK {
log.Errorf("RuleEngineBatchGetApp get info data:%v,resp:%+v", data, tempRsp)
rsp.AppFailList = append(rsp.AppFailList, appId)
continue
}
log.Debugf("RuleEngineBatchGetApp info:%+v", data.CustomData.SourceFile)
log.Infof("http RuleEngineBatchGetApp info:", utility.InterfaceToJsonString(data))
rsp.AppDataList = append(rsp.AppDataList, data)
}
//获取小程序版本详情
for _, appVer := range req.AppVerList {
rspData, tempRsp := rs.RuleEngineGetAppVerInfo(traceCtx, appVer.AppId, appVer.Sequence, req.SdkKey, req.SdkVer)
if tempRsp.ErrCode != utility.OK {
rsp.AppVerFailList = append(rsp.AppVerFailList, appVer.AppId)
continue
}
rsp.AppVerDataList = append(rsp.AppVerDataList, rspData)
}
log.Infof("http RuleEngineBatchGetApp resp:", utility.InterfaceToJsonString(rsp))
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rsp)
return
}
func GetAppTagAndClassification(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
svr := service.NewAppService()
appClassList, err := svr.GetAppClassList(traceCtx)
if err != nil {
log.Debugf("GetAppTagAndClassification err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
appTagList, err := svr.GetAppTagList(traceCtx)
if err != nil {
log.Debugf("GetAppTagAndClassification err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
c.JSON(http.StatusOK, gin.H{"appTag": appTagList, "appClass": appClassList})
}
/**
* @api {PUT} /api/v1/mop/finstore/update-expire/:type/:businessId [S/S][MOP]
* @apiGroup Finclip App Manager
* @apiVersion __API_VERSION__
*
* @apiParam {string=app,binding} type -app:binding:
* @apiParam {string=app,binding} businessId IdIdId
* @apiParam (RequestBody) {Number} expire /ms
* @apiParamExample {json} Request-Example:
* /api/v1/finstore/update-expire/app/5edf44b56ef940000153c3f7
* {
* "expire":1596445961000,
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
//支付系统同步过期信息到应用市场
func UpdateExpireInfo(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := apiproto.UpdateExpireInfoReq{}
rsp := make(map[string]interface{})
if err := c.BindJSON(&req); err != nil {
log.Errorf("UpdateExpireInfo bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, rsp)
return
}
upType := c.Param("type")
bussId := c.Param("businessId")
if upType == "" || bussId == "" {
log.Errorf("UpdateExpireInfo param err:%s", "type or businessId empty")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, rsp)
return
}
log.Infof("NotifySyncInfoHand req,upType:%s,buss id:%s,expire:%d", upType, bussId, req.Expire)
if req.Expire == 0 {
req.Expire = service.MAX_EXPIRE_DATA
}
svrRsp := &utility.SvrRsp{}
switch upType {
case "app":
appSvr := service.NewAppService()
svrRsp = appSvr.UpExpire(traceCtx, bussId, req.Expire)
case "binding":
bindSvr := service.NewBindingService()
svrRsp = bindSvr.UpExpire(traceCtx, bussId, req.Expire)
default:
log.Errorf("UpdateExpireInfo up type err:%s,up type:%s", "up type err", upType)
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, rsp)
return
}
svrRsp.MakeRsp(c, rsp)
return
}
//根据小程序包标识符md5、sha256进行小程序信息的获取
func BatchAppsByIdentity(c *gin.Context) {
var (
req = apiproto.BatchAppsByIdentityReq{}
traceCtx = apm.ApmClient().TraceContextFromGin(c)
)
if err := c.BindJSON(&req); err != nil {
log.Errorf("bind para err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
if len(req.Apps) == 0 {
log.Errorf("BatchAppsByIdentity apps empty ...")
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}
req.IdentityType = strings.ToLower(req.IdentityType)
sdkKey := c.GetHeader(utility.SDK_KEY_SIGNAL)
log.Infof("BatchAppsByIdentity req:%+v", req)
svr := service.NewAppService()
rsp := svr.BatchAppsByIdentity(traceCtx, sdkKey, &req)
utility.MakeLocRsp(c, int(rsp.GetResult().Httpcode), rsp.GetResult().Errcode, rsp.GetData())
return
}
//根据小程序包标识符md5、sha256获取小程序包是否合法
func IdentityAppsCheck(c *gin.Context) {
var (
traceCtx = apm.ApmClient().TraceContextFromGin(c)
req = apiproto.IdentityAppsCheckReq{}
)
if err := c.BindJSON(&req); err != nil {
log.Errorf("bind para err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_PARAM_ERR, gin.H{})
return
}
if len(req.Apps) == 0 {
log.Errorf("IdentityAppsCheck apps empty ...")
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}
sdk := c.GetHeader(utility.SDK_KEY_SIGNAL)
log.Debugf("IdentityAppsCheck req:%+v", req)
svr := service.NewAppService()
rsp := svr.IdentityAppsCheck(traceCtx, sdk, &req)
//todo 处理nil
utility.MakeLocRsp(c, int(rsp.GetResult().Httpcode), rsp.GetResult().Errcode, rsp.GetData())
return
}
//根据sdkKey获取关联的应用
//再根据关联的应用获取所有的小程序
type GetAppListBySdkKeyHandReq struct {
BindingId string `form:"bindingId"`
PageNo int `form:"pageNo"`
PageSize int `form:"pageSize"`
}
type GetAppListBySdkKeyHandRspItem struct {
AppId string `bson:"appId" json:"appId"`
Name string `bson:"name" json:"name"`
Logo string `bson:"logo" json:"logo"`
Sequence int `bson:"sequence" json:"sequence"`
}
type GetAppListBySdkKeyHandRsp struct {
Total int `json:"total"`
List []GetAppListBySdkKeyHandRspItem `json:"list"`
}
func GetAppListByBindIdHand(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := GetAppListBySdkKeyHandReq{}
if err := c.BindQuery(&req); err != nil {
log.Errorf("GetAppListBySdkKeyHand bind error:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
log.Infof("GetAppListByBindIdHand req:%+v", req)
if req.BindingId == "" {
log.Errorf("GetAppListBySdkKeyHand binding id empty")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BINDINGID_NOT, gin.H{})
return
}
if req.PageNo <= 0 {
req.PageNo = 1
}
if req.PageSize >= 100 || req.PageSize <= 0 {
req.PageSize = 100
}
svr := service.NewAppService()
total, apps, err := svr.GetLinkAppsByBindingID(traceCtx, req.BindingId, req.PageNo, req.PageSize, "")
if err != nil {
log.Errorf("GetLinkAppsByBindingID err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
rsp := GetAppListBySdkKeyHandRsp{
Total: total,
List: make([]GetAppListBySdkKeyHandRspItem, 0),
}
for _, v := range apps {
item := GetAppListBySdkKeyHandRspItem{
AppId: v.AppID,
Name: v.Name,
Logo: v.Logo,
Sequence: v.Sequence,
}
rsp.List = append(rsp.List, item)
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rsp)
}
type GetAppListBySdkKeyReq struct {
SDKKey string `form:"sdkKey"`
PageNo int `form:"pageNo"`
PageSize int `form:"pageSize"`
}
type GetAppBySDKKeyRspItem struct {
AppId string `bson:"appId" json:"appId"`
Name string `bson:"name" json:"name"`
Logo string `bson:"logo" json:"logo"`
AppTag []string `bson:"appTag" json:"appTag"`
AppClass string `bson:"appClass" json:"appClass"`
CoreDescription string `bson:"coreDescription" json:"coreDescription"`
SourceFileUrl string `bson:"sourceFileUrl" json:"sourceFileUrl"`
}
type GetAppBySDKKeyRsp struct {
Total int `json:"total"`
List []GetAppBySDKKeyRspItem `json:"list"`
}
func GetAppBySDKKey(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := GetAppListBySdkKeyReq{}
if err := c.BindQuery(&req); err != nil {
log.Errorf("GetAppBySDKKey bind error:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
log.Infof("GetAppBySDKKey req:%+v", req)
if req.SDKKey == "" {
log.Errorf("GetAppListBySdkKeyHand sdkKey empty")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_SDKKEY_NOT, gin.H{})
return
}
if req.PageSize >= 100 || req.PageSize <= 0 {
req.PageSize = 100
}
svr := service.NewAppService()
total, apps, err := svr.GetLinkAppsBySDKKey(traceCtx, req.SDKKey, req.PageNo, req.PageSize)
if err != nil {
log.Errorf("GetAppBySDKKey err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
rsp := GetAppBySDKKeyRsp{
Total: total,
List: make([]GetAppBySDKKeyRspItem, 0),
}
for _, v := range apps {
latestVersion, _ := svr.GetLatestPubAppVer(traceCtx, v.AppID)
item := GetAppBySDKKeyRspItem{
AppId: v.AppID,
Name: v.Name,
Logo: v.Logo,
AppTag: v.AppTag,
AppClass: v.AppClass,
CoreDescription: v.CoreDescription,
SourceFileUrl: latestVersion.CustomData.SourceFile[0].SourceFileUrl,
}
rsp.List = append(rsp.List, item)
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rsp)
}
type GetAppsInfoByListHandReq struct {
AppIdList string `form:"list"` //用逗号分隔
}
type GetAppsInfoByListHandRspItem struct {
AppId string `json:"appId"`
Name string `json:"name"`
Logo string `json:"logo"`
Desc string `json:"desc"`
GroupId string `json:"groupId"`
}
type GetAppsInfoByListHandRsp struct {
List []GetAppsInfoByListHandRspItem `json:"list"`
}
func GetAppsInfoByListHand(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := GetAppsInfoByListHandReq{}
if err := c.BindQuery(&req); err != nil {
log.Errorf("GetAppsInfoByListHand bind error:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
appIdList := strings.Split(req.AppIdList, ",")
if len(appIdList) == 0 {
log.Errorf("GetAppsInfoByListHand appId list zero")
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}
log.Infof("GetAppsInfoByListHand req:%+v", req)
svr := service.NewAppService()
apps, err := svr.GetAppsByAppIds(traceCtx, appIdList)
if err != nil {
log.Errorf("GetAppsByAppIds err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
log.Infof("get result:%+v", apps)
rsp := GetAppsInfoByListHandRsp{
List: make([]GetAppsInfoByListHandRspItem, 0),
}
for _, v := range apps {
item := GetAppsInfoByListHandRspItem{}
item.AppId = v.AppID
item.Name = v.Name
item.Logo = v.Logo
item.Desc = v.CoreDescription
item.GroupId = v.GroupID
rsp.List = append(rsp.List, item)
}
log.Infof("get rsp:%+v", rsp)
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rsp)
}
type SearchAppHandReq struct {
SearchTxt string `form:"searchTxt"`
BindingId string `form:"bindingId"`
PageNo int `form:"pageNo"`
PageSize int `form:"pageSize"`
}
type SearchAppHandRspItem struct {
AppId string `bson:"appId" json:"appId"`
Name string `bson:"name" json:"name"`
Logo string `bson:"logo" json:"logo"`
Desc string `bson:"desc" json:"desc"`
Sequence int `bson:"sequence" json:"sequence"`
}
type SearchAppHandRsp struct {
Total int `json:"total"`
List []SearchAppHandRspItem `json:"list"`
}
//搜索应用已经上架的小程序信息
func SearchAppHand(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := SearchAppHandReq{}
if err := c.BindQuery(&req); err != nil {
log.Errorf("SearchAppHand bind error:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
if req.BindingId == "" {
log.Errorf("SearchAppHand binding id empty")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BINDINGID_NOT, gin.H{})
return
}
if req.PageNo <= 0 {
req.PageNo = 1
}
if req.PageSize >= 100 || req.PageSize <= 0 {
req.PageSize = 100
}
rsp := SearchAppHandRsp{
Total: 0,
List: make([]SearchAppHandRspItem, 0),
}
svr := service.NewAppService()
total, apps, err := svr.GetLinkAppsByBindingID(traceCtx, req.BindingId, req.PageNo, req.PageSize, req.SearchTxt)
if err != nil {
log.Errorf("GetLinkAppsByBindingID err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusIMUsed, utility.FS_DB_ERR, gin.H{})
return
}
rsp.Total = total
for _, v := range apps {
item := SearchAppHandRspItem{
AppId: v.AppID,
Name: v.Name,
Logo: v.Logo,
Desc: v.CoreDescription,
Sequence: v.Sequence,
}
rsp.List = append(rsp.List, item)
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rsp)
}
//账号系统同步信息到应用市场
type NotifySyncInfoHandReq struct {
TraceId string `json:"traceId"`
SubId string `json:"subId"`
Type string `json:"type"`
Data map[string]interface{} `json:"data"`
}
func NotifySyncInfoHand(c *gin.Context) {
//traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := NotifySyncInfoHandReq{}
if err := c.BindJSON(&req); err != nil {
log.Errorf("NotifySyncInfoHand bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
//log.Infof("NotifySyncInfoHand req:%+v", req)
//svr := service.NewNotifySyncInfoService()
//httpCode, errcode := svr.NotifySyncInfo(traceCtx, req.TraceId, req.SubId, req.Type, req.Data)
//common.MakeRsp(c, httpCode, errcode, rsp)
return
}

View File

@ -0,0 +1,207 @@
package application
import (
"finclip-app-manager/domain/entity"
"finclip-app-manager/infrastructure/utility"
"github.com/gin-gonic/gin"
"net/http"
)
func RuntimeGetAppInfo(c *gin.Context) {
//traceCtx := apm.ApmClient().TraceContextFromGin(c)
appID := c.Param("path1") //appId
if appID == "" {
log.Infof("RuntimeGetAppInfo appId empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_APPID, gin.H{})
return
}
//key := c.Request.Header.Get("SDK-Key")
////安全校验
//err := CheckSignatureAuth(traceCtx, key, c)
//if err != nil {
// log.Infof("RuntimeGetAppInfo CheckSignatureAuth err:%s", err.Error())
// MakeRsp(c, http.StatusBadRequest, err.Error(), rsp)
// return
//}
//rs := service.NewRuntimeService()
//resp, err := rs.GetAppInfo(traceCtx, key, appID, "")
//if err != nil {
// log.Errorf("GetGrayAppInfo get info from cache err:%s", err.Error())
// MakeRsp(c, http.StatusInternalServerError, FS_SYSTEM_CALL, rsp)
// return
//}
//if resp == nil {
// log.Warnf("GetGrayAppInfo app info is nil !!!")
// if rs.AppNotFound() {
// log.Errorf("GetGrayAppInfo get info app id Not Found,appId:%s", appID)
// MakeRsp(c, http.StatusNotFound, FS_APP_ID_NOT_FOUND, rsp)
// return
// }
// if !rs.AppStatusValid() {
// log.Errorf("GetGrayAppInfo get info app status invalid,appId:%s", appID)
// MakeRsp(c, http.StatusForbidden, FS_SERVICE_UNAVAILABLE, rsp)
// return
// }
// if !rs.PayAppIdStatusOk() {
// log.Errorf("GetGrayAppInfo get info app pay status invaild,appId:%s", appID)
// MakeRsp(c, http.StatusForbidden, FS_APP_PAY_EXPIRE, rsp)
// return
// }
// if !rs.OrganIsValid() {
// log.Errorf("GetGrayAppInfo get info organ info invalid,appId:%s", appID)
// MakeRsp(c, http.StatusForbidden, FS_COOPERATION_TERMINATED, rsp)
// return
// }
// if rs.BindNotFound() {
// log.Errorf("GetGrayAppInfo get info bind not found,sdkKey:%s,appId:%s", key, appID)
// MakeRsp(c, http.StatusForbidden, FS_COOPERATION_TERMINATED, rsp)
// return
// }
// if !rs.BindCoopValid() {
// log.Errorf("GetGrayAppInfo get info bind coop status invalid,sdkKey:%s", key)
// MakeRsp(c, http.StatusForbidden, FS_COOPERATION_TERMINATED, rsp)
// return
// }
// if !rs.BindAssociateValid() {
// log.Errorf("GetGrayAppInfo get info bind ass app invalid,sdkKey:%s,appId:%s", key, appID)
// MakeRsp(c, http.StatusForbidden, FS_APP_NOT_ASS_BIND, rsp)
// return
// }
// if !rs.PayBindIdStatusOk() {
// log.Errorf("GetGrayAppInfo get info bind pay status invaild,appId:%s", appID)
// MakeRsp(c, http.StatusForbidden, FS_BIND_PAY_EXPIRE, rsp)
// return
// }
// if !rs.LicenseValid() {
// log.Errorf("GetGrayAppInfo get info license invalid,sdkKey:%s,appId:%s", key, appID)
// MakeRsp(c, http.StatusForbidden, FS_LICENSE_INVALID_ERR, rsp)
// return
// }
// MakeRsp(c, http.StatusInternalServerError, FS_SYSTEM_CALL, rsp)
// return
//}
//c.JSON(http.StatusOK, resp)
return
}
type RuntimeGetAppVersionInfoRsp struct {
AppID string `json:"appId"`
Name string `json:"name"`
Sequence int `json:"sequence"`
AppClass string `json:"appClass"`
AppType string `json:"appType"`
Status entity.Status `json:"status"`
PublishedStatus entity.SpecificStatus `json:"publishedStatus"`
ActionStatus entity.SpecificStatus `json:"actionStatus"`
DeveloperID string `json:"developerId"`
GroupID string `json:"groupId"`
GroupName string `json:"groupName"`
Created int64 `json:"created"`
CreatedBy string `json:"createdBy"`
//CustomData proto.AppRspCustomData `json:"customData"`
Version string `json:"version"`
CorporationID string `json:"corporationId"`
CoreDescription string `json:"coreDescription"`
Logo string `json:"logo"`
Platform []string `json:"platform"`
MarketID string `json:"marketId"`
FcID string `json:"fcId"`
}
func RuntimeGetAppVersionInfo(c *gin.Context) {
//traceCtx := apm.ApmClient().TraceContextFromGin(c)
appID := c.Param("path1")
seqStr := c.Param("path3")
log.Infof("RuntimeGetAppVersionInfo appId:%s,sequence:%s", appID, seqStr)
if appID == "" {
log.Errorf("RuntimeGetAppVersionInfo appID empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_APPID, gin.H{})
return
}
//sequence, err := strconv.Atoi(seqStr)
//if err != nil {
// log.Errorf("RuntimeGetAppVersionInfo seueence format err:%s,seqstr:%s", err.Error(), seqStr)
// utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
// return
//}
//t := db.NewTable(db.TableAppVersion)
//appVerInfo := model.AppVersion{}
//if err := t.GetOne(traceCtx, bson.M{"appId": appID, "sequence": sequence}, &appVerInfo); err != nil {
// log.Errorf("RuntimeGetAppVersionInfo get appVer err:%s", err.Error())
// MakeRsp(c, http.StatusInternalServerError, FS_DB_ERR, rsp)
// return
//}
//if t.NotFound() {
// log.Error("RuntimeGetAppVersionInfo get appVer not found!")
// MakeRsp(c, http.StatusNotFound, FS_APP_SEQUENCE_NOT_FOUND, rsp)
// return
//}
//
//key := c.Request.Header.Get("SDK-Key")
////白名单
//if !InArry(key, config.WhiteSDKArry) {
// log.Errorf("RuntimeGetAppVersionInfo sdk not in white sdk arry,sdk-key:%s", key)
// MakeRsp(c, http.StatusForbidden, FS_COOPERATION_TERMINATED, rsp)
// return
//}
////安全校验
//err = CheckSignatureAuth(traceCtx, key, c)
//if err != nil {
// log.Error("RuntimeGetAppVersionInfo CheckSignatureAuth err:%s", err.Error())
// MakeRsp(c, http.StatusBadRequest, err.Error(), rsp)
// return
//}
////校验企业的状态
//log.Infof("get group info id:%s", appVerInfo.GroupID)
//groupInfo, err := provider.GetGroupInfoByGroupId(traceCtx, appVerInfo.GroupID)
//if err != nil {
// log.Errorf("RuntimeGetAppVersionInfo GetGroupInfoByGroupId err:%s", err.Error())
// MakeRsp(c, http.StatusBadRequest, FS_GET_GROUP_FAILED, rsp)
// return
//}
//log.Infof("RuntimeGetAppVersionInfo get group info:%+v", groupInfo)
////如果是私有化版本,白名单不需要校验
//if config.Cfg.PublishEnv != ENV_PRIVATE {
// if groupInfo.ReviewStatus != client.StOrganApproved &&
// groupInfo.ReviewStatus != client.StOrganPersonalReviewing &&
// groupInfo.ReviewStatus != client.StOrganPersonalUnPass {
// log.Errorf("RuntimeGetAppVersionInfo organ status:%v", groupInfo.ReviewStatus)
// MakeRsp(c, http.StatusForbidden, FS_COOPERATION_TERMINATED, rsp)
// return
// }
//}
////appVerInfo.CustomData["appRuntimeDomain"] = data
//rspInfo := RuntimeGetAppVersionInfoRsp{
// AppID: appVerInfo.AppID,
// Name: appVerInfo.Name,
// Sequence: appVerInfo.Sequence,
// AppClass: appVerInfo.AppClass,
// AppType: appVerInfo.AppType,
// Status: appVerInfo.Status,
// PublishedStatus: appVerInfo.PublishedStatus,
// //UnpublishedStatus: appVerInfo.UnpublishedStatus,
// ActionStatus: appVerInfo.ActionStatus,
// DeveloperID: appVerInfo.DeveloperID,
// GroupID: appVerInfo.GroupID,
// GroupName: groupInfo.GroupName, //实时获取 todo 加个缓存
// Created: appVerInfo.Created,
// CreatedBy: appVerInfo.CreatedBy,
// //CustomData: appVerInfo.CustomData,
// Version: appVerInfo.Version,
// CorporationID: appVerInfo.CorporationID,
// CoreDescription: appVerInfo.CoreDescription,
// Logo: appVerInfo.Logo,
// Platform: appVerInfo.Platform,
// MarketID: appVerInfo.MarketID,
// FcID: appVerInfo.FcID,
//}
//err, errCode, customData := service.ConvertModelCustomDataToRpc(traceCtx, service.NewRuntimeService(), appVerInfo.GroupID, appVerInfo.CustomData, nil, "")
//rspInfo.CustomData = *customData
//if err != nil {
// log.Errorf("RuntimeGetAppVersionInfo ConvertModelCustomDataToPb err:%s", err.Error())
// MakeRsp(c, http.StatusInternalServerError, errCode, rsp)
// return
//}
//c.JSON(http.StatusOK, rspInfo)
//return
}

View File

@ -0,0 +1,70 @@
package application
import (
"finclip-app-manager/domain/entity/proto"
"finclip-app-manager/domain/service"
"finclip-app-manager/infrastructure/utility"
"net/http"
"github.com/gin-gonic/gin"
)
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func UpdateTempApp(c *gin.Context) {
var (
errRspData = make(map[string]interface{})
)
req := proto.UpdateTempAppInfoReq{}
err := c.BindJSON(&req)
if err != nil {
log.Errorf("UpdateTempApp bind json err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_PARAM_ERR, errRspData)
return
}
appId := c.Param("appId")
log.Infof("UpdateTempApp appId:[%s],req:%+v", appId, req)
svr := service.NewAppTempInfoService()
svr.UpdateTempApp(c, appId, &req)
return
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func GenTempApp(c *gin.Context) {
req := proto.CreateTempAppInfoReq{}
err := c.ShouldBindJSON(&req)
if err != nil {
log.Errorf("GenTempApp bind json err:%s", err.Error())
}
svr := service.NewAppTempInfoService()
svr.GenTempApp(c, req)
return
}

View File

@ -0,0 +1,38 @@
package application
/**
* DDD: application
*
* ,
*
* (service)
* (task)
*
**/
import (
"github.com/gin-gonic/gin"
)
/**
* @api {GET} /api/v1/finclip-app-manager/user [C/S]user api
* @apiGroup []@apiGroup ddd Gin Framework
* @apiVersion __API_VERSION__
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
* "say":"hello"
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func UserApi(c *gin.Context) {
//rsp := gin.H{"say": "hello"}
//utility.MakeRsp(c, http.StatusOK, utility.OK, rsp)
return
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
package application
import (
"finclip-app-manager/domain/entity"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/utility"
"net/http"
"time"
"github.com/gin-gonic/gin"
"gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo/bson"
"gitlab.finogeeks.club/finclip-backend/apm"
)
func UploadFile(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
inFile, fileHeader, err := c.Request.FormFile("file")
if err != nil {
log.Errorf("get form file err:", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
url, err := hCaller.Upload(traceCtx, fileHeader.Filename, inFile, config.Cfg.OpenCdn)
if err != nil {
log.Errorf("Upload err:", err.Error())
utility.MakeErrRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, err.Error(), gin.H{})
return
}
file := entity.File{
FileID: bson.NewObjectId().Hex(),
Name: fileHeader.Filename,
UploadDate: time.Now().UnixNano() / 1000000,
Size: fileHeader.Size,
Url: url,
}
c.JSON(http.StatusOK, file)
}

View File

@ -0,0 +1,303 @@
package grpcHandler
import (
"context"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/domain/service"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/logger"
pb "finclip-app-manager/infrastructure/protobuf/golang"
"finclip-app-manager/infrastructure/utility"
"strings"
"gitlab.finogeeks.club/finclip-backend/apm"
"net/http"
)
var (
log = logger.GetLogger()
)
type GrpcServer struct {
}
func (g GrpcServer) RuleEngineGetAppInfo(ctx context.Context, req *pb.RuleEngineGetAppInfoReq) (*pb.RuleEngineGetAppInfoRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.RuleEngineGetAppInfo")
defer span.End()
svr := service.NewAppService()
rspData, rsp := svr.RuntimeGetPubAppInfo(ctx, req.GetSdkKey(), req.GetAppId(), req.GetSdkVer())
log.Infof("RuleEngineGetAppInfo service rsp data:%+v,rsp:%v", rspData, rsp)
result := pb.RuleEngineGetAppInfoRsp{}
if rsp.ErrCode != utility.OK {
utility.MakeGrpcCommonResult(rsp.HttpStatus, rsp.ErrCode, &result.Result)
return &result, nil
}
result.Data = service.CovertAppToPbAppInfoRsp(&rspData)
utility.MakeGrpcCommonResult(rsp.HttpStatus, rsp.ErrCode, &result.Result)
return &result, nil
}
func (g GrpcServer) RuleEngineGetAppVerInfo(ctx context.Context, req *pb.RuleEngineGetAppVerInfoReq) (*pb.RuleEngineGetAppVerInfoRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.RuleEngineGetAppVerInfo")
defer span.End()
svr := service.NewAppService()
rspData, rsp := svr.RuleEngineGetAppVerInfo(ctx, req.AppId, int(req.GetVersion()), req.GetSdkKey(), req.GetSdkVer())
log.Infof("RuleEngineGetAppVerInfo service rsp data:%+v,rsp:%v", rspData, rsp)
result := pb.RuleEngineGetAppVerInfoRsp{}
if rsp.ErrCode != utility.OK {
utility.MakeGrpcCommonResult(rsp.HttpStatus, rsp.ErrCode, &result.Result)
return &result, nil
}
result.Data = service.CovertAppToPbAppInfoRsp(&rspData)
utility.MakeGrpcCommonResult(rsp.HttpStatus, rsp.ErrCode, &result.Result)
return &result, nil
}
func (g GrpcServer) OpenApiGetAppVerInfo(ctx context.Context, req *pb.OpenApiGetAppVerInfoReq) (*pb.OpenApiGetAppVerInfoRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.OpenApiGetAppVerInfo")
defer span.End()
result := pb.OpenApiGetAppVerInfoRsp{}
if req.GetAppId() == "" || req.GetSdkKey() == "" {
log.Errorf("InternalGetAppVerInfo sdk key or appid empty,appId:%s,sdkKey:%s", req.GetAppId(), req.GetSdkKey())
switch {
case req.GetAppId() == "":
utility.MakeGrpcCommonResult(http.StatusBadRequest, utility.FS_LACK_OF_APPID, &result.Result)
case req.GetSdkKey() == "":
utility.MakeGrpcCommonResult(http.StatusBadRequest, utility.FS_LACK_OF_SDKKEY, &result.Result)
default:
utility.MakeGrpcCommonResult(http.StatusBadRequest, utility.FS_LACK_OF_APPID, &result.Result)
}
return &result, nil
}
//sdkKey白名单的校验
if !utility.InArry(req.SdkKey, config.WhiteSDKArry) {
if config.Cfg.PublishEnv == entity.ENV_PRIVATE {
svr := service.NewBindingService()
//if !svr.CheckReviewBySdkKey(ctx, req.SdkKey) {
checkStatus := svr.CheckReviewBySdkKey(ctx, req.SdkKey)
if checkStatus != utility.OK {
log.Errorf("RuntimeGetAppVersionInfo sdk not in review list,sdk-key:%s", req.SdkKey)
utility.MakeGrpcCommonResult(http.StatusForbidden, checkStatus, &result.Result)
return &result, nil
}
} else {
log.Errorf("RuntimeGetAppVersionInfo sdk not in white sdk arry,sdk-key:%s", req.SdkKey)
utility.MakeGrpcCommonResult(http.StatusForbidden, utility.FS_COOPERATION_TERMINATED, &result.Result)
return &result, nil
}
}
svr := service.NewAppService()
rspData, rsp := svr.OpenApiGetAppVerInfo(ctx, req.GetAppId(), int(req.GetVersion()), req.GetSdkVer())
log.Infof("OpenApiGetAppVerInfo rsp data:%+v,rsp:%+v", rspData, rsp)
if rsp.ErrCode != utility.OK {
utility.MakeGrpcCommonResult(rsp.HttpStatus, rsp.ErrCode, &result.Result)
return &result, nil
}
result.Data = service.CovertInternalAppToPbAppInfoRsp(&rspData)
result.Data.GroupName = g.ChangeGroupName(result.Data.GroupName)
utility.MakeGrpcCommonResult(rsp.HttpStatus, rsp.ErrCode, &result.Result)
return &result, nil
}
func (g GrpcServer) ChangeGroupName(groupName string) string {
if len(groupName) == 18 && strings.Contains(groupName, "个人-") {
phone := groupName[7:]
if isOK := utility.IsMobile(phone); isOK {
newName := "个人-"
for i := 0; i < len(phone); i++ {
if i >= 3 && i <= 6 {
newName += "*"
} else {
newName += string(phone[i])
}
}
groupName = newName
}
}
return groupName
}
func (g GrpcServer) GetOrganIdBySdkKey(ctx context.Context, req *pb.GetOrganIdBySdkKeyReq) (*pb.GetOrganIdBySdkKeyRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.GetOrganIdBySdkKey")
defer span.End()
rsp := pb.GetOrganIdBySdkKeyRsp{}
rsp.Data = new(pb.GetOrganIdBySdkKeyRsp_DATA)
rsp.Data.OrganId = ""
rsp.Data.IsWhite = false
if req.SdkKey == "" {
log.Errorf("GetOrganIdBySdkKey sdk-key empty!!!")
utility.MakeGrpcCommonResult(http.StatusBadRequest, utility.FS_LACK_OF_SDKKEY, &rsp.Result)
return &rsp, nil
}
//sdkKey白名单的校验
if utility.InArry(req.SdkKey, config.WhiteSDKArry) {
log.Errorf("GetOrganIdBySdkKey is white list,sdk key:%s", req.SdkKey)
rsp.Data.IsWhite = true
utility.MakeGrpcCommonResult(http.StatusOK, utility.OK, &rsp.Result)
return &rsp, nil
}
//非白名单
//svr := service.NewBindingService()
//t := db.NewTable(db.TableBinding)
//result := model.Binding{}
//err := t.GetOne(ctx, bson.M{"bundleInfos.SDKKey": bson.M{"$in": []string{req.SdkKey}}}, &result)
//if err != nil {
// log.Errorf("GetOrganIdBySdkKey get binding info error:%s", err.Error())
// common.MakeGrpcCommonResult(http.StatusInternalServerError, common.FS_SERVICE_UNAVAILABLE, &rsp.Result)
// return &rsp, nil
//}
//rsp.Data.OrganId = result.GroupID
//rsp.Data.IsWhite = false
//log.Infof("GetOrganIdBySdkKey sdkKey:%s,result:%+v", req.SdkKey, result)
//common.MakeGrpcCommonResult(http.StatusOK, common.OK, &rsp.Result)
return &rsp, nil
}
func (g GrpcServer) BatchGetAppAndVerInfo(ctx context.Context, req *pb.BatchGetAppAndVerInfoReq) (*pb.BatchGetAppAndVerInfoRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.BatchGetAppAndVerInfo")
defer span.End()
rsp := new(pb.BatchGetAppAndVerInfoRsp)
rsp.Data = new(pb.BatchGetAppAndVerInfoRsp_DATA)
rsp.Data.AppFailList = make([]string, 0)
rsp.Data.AppVerFailList = make([]string, 0)
rsp.Data.AppDataList = make([]*pb.AppInfoRspData, 0)
rsp.Data.AppVerDataList = make([]*pb.AppInfoRspData, 0)
log.Infof("BatchGetAppAndVerInfo req:%+v", req)
//首先获取小程序详情
rs := service.NewAppService()
for _, appId := range req.AppList {
data, tempRsp := rs.RuntimeGetPubAppInfo(ctx, req.SdkKey, appId, req.SdkVer)
if tempRsp.ErrCode != utility.OK {
log.Errorf("RuleEngineBatchGetApp get info data:%v,resp:%+v", data, tempRsp)
rsp.Data.AppFailList = append(rsp.Data.AppFailList, appId)
continue
}
log.Debugf("RuleEngineBatchGetApp info:%+v", data.CustomData.SourceFile)
log.Debugf("RuleEngineBatchGetApp info:%+v", utility.InterfaceToJsonString(data))
rsp.Data.AppDataList = append(rsp.Data.AppDataList, service.CovertAppToPbAppInfoRsp(&data))
}
//获取小程序版本详情
for _, appVer := range req.AppVerList {
rspData, tempRsp := rs.RuleEngineGetAppVerInfo(ctx, appVer.AppId, int(appVer.Sequence), req.SdkKey, req.SdkVer)
if tempRsp.ErrCode != utility.OK {
rsp.Data.AppVerFailList = append(rsp.Data.AppVerFailList, appVer.AppId)
continue
}
rsp.Data.AppVerDataList = append(rsp.Data.AppVerDataList, service.CovertAppToPbAppInfoRsp(&rspData))
}
utility.MakeGrpcCommonResult(http.StatusOK, utility.OK, &rsp.Result)
log.Infof("grpc BatchGetAppAndVerInfo resp:", utility.InterfaceToJsonString(rsp))
return rsp, nil
}
func (g GrpcServer) OpenApiGetQRcodeAppVerInfo(ctx context.Context, req *pb.OpenApiGetQRcodeAppVerInfoReq) (*pb.OpenApiGetAppVerInfoRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.OpenApiGetAppVerInfo")
defer span.End()
rsp := pb.OpenApiGetAppVerInfoRsp{}
rsp.Data = new(pb.AppInfoRspData)
if req.RedisKey == "" {
log.Errorf("InternalGetAppVerInfo redisKey empty!!!")
return &rsp, nil
}
if req.SdkKey == "" {
log.Errorf("InternalGetAppVerInfo sdk-key empty!!!")
return &rsp, nil
}
//sdkKey白名单的校验
if !utility.InArry(req.SdkKey, config.WhiteSDKArry) {
if config.Cfg.PublishEnv == entity.ENV_PRIVATE {
svr := service.NewBindingService()
checkStatus := svr.CheckReviewBySdkKey(ctx, req.SdkKey)
if checkStatus != utility.OK {
log.Errorf("RuntimeGetAppVersionInfo sdk not in review list,sdk-key:%s", req.SdkKey)
return &rsp, nil
}
} else {
log.Errorf("RuntimeGetAppVersionInfo sdk not in white sdk arry,sdk-key:%s", req.SdkKey)
return &rsp, nil
}
}
rspInfo := service.InternalGetAppVerInfoRsp{}
//dataBytes, err := cache.NewQRcodeAppCache().GetQRcodeAppInfo(ctx, req.RedisKey)
//fmt.Println("dataBytes------------", dataBytes)
//if err != nil {
// if len(dataBytes) == 0 {
// log.Debugln("qrcode is refresh:")
// common.MakeGrpcCommonResult(http.StatusOK, common.FS_QRCODE_HAS_EXPIRE, &rsp.Result)
// return &rsp, nil
//
// } else {
// log.Errorf("redis error:", err.Error())
// return &rsp, nil
// }
//}
//err = json.Unmarshal(dataBytes, &rspInfo)
//if err != nil {
// log.Errorf("json unmarshal error:", err.Error())
// return &rsp, nil
//}
rsp.Data.AppClass = rspInfo.AppClass
rsp.Data.AppId = rspInfo.AppID
rsp.Data.AppType = rspInfo.AppType
rsp.Data.CoreDescription = rspInfo.CoreDescription
rsp.Data.CorporationId = rspInfo.CorporationID
rsp.Data.Created = rspInfo.Created
rsp.Data.CreatedBy = rspInfo.CreatedBy
rsp.Data.CustomData = service.ConvertRpcCustomDataToPb(rspInfo.CustomData)
rsp.Data.DeveloperId = rspInfo.DeveloperID
rsp.Data.GroupId = rspInfo.GroupID
rsp.Data.GroupName = rspInfo.GroupName
rsp.Data.InGrayRelease = rspInfo.InGrayRelease
rsp.Data.Logo = rspInfo.Logo
rsp.Data.Name = rspInfo.Name
rsp.Data.Sequence = int32(rspInfo.Sequence)
rsp.Data.Version = rspInfo.Version
if &rspInfo.Status != nil {
rsp.Data.Status = new(pb.Status)
rsp.Data.Status.Value = rspInfo.Status.Value
rsp.Data.Status.LastUpdated = rspInfo.Status.LastUpdated
rsp.Data.Status.ModifiedBy = rspInfo.Status.ModifiedBy
rsp.Data.Status.Reason = rspInfo.Status.Reason
}
rsp.Data.IsTemp = rspInfo.IsTemp
rsp.Data.IsUserLimit = false
rsp.Data.NeedCrt = rspInfo.NeedCrt
rsp.Data.WechatLoginInfo = service.ConvertWechatLoginInfoToPb(&rspInfo.WechatLoginInfo)
rsp.Data.PrivacySettingType = int32(rspInfo.PrivacySettingType)
rsp.Data.ProjectType = int32(rspInfo.ProjectType)
rsp.Data.AppTag = rspInfo.AppTag
log.Debugln("appver info:", rspInfo, ",data:", rsp.Data)
utility.MakeGrpcCommonResult(http.StatusOK, utility.OK, &rsp.Result)
return &rsp, nil
}
func (g GrpcServer) GetBuildAppInfo(ctx context.Context, req *pb.GetBuildAppInfoReq) (*pb.GetBuildAppInfoRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.GetBuildAppInfo")
defer span.End()
log.Infof("grpc GetBuildAppInfo req:%+v", req)
svr := service.NewAppService()
svrReq := apiproto.GetBuildAppInfoReq{
Type: req.GetType(),
CodeId: req.GetCodeId(),
}
rspData, rsp := svr.GetBuildInfo(ctx, svrReq, req.GetSdkKey())
//buildInfo, svrRsp := svr.GetBuildInfo(ctx, svrReq, req.GetSdkKey())
log.Infof("grp GetBuildAppInfo rsp data:%+v,rsp:%+v", rspData, rsp)
result := new(pb.GetBuildAppInfoRsp)
result.Data = rspData
utility.MakeGrpcCommonResultNoLoc(rsp.HttpStatus, rsp.ErrCode, rsp.ErrMsg, &result.Result)
return result, nil
}

View File

@ -0,0 +1,47 @@
package grpcHandler
import (
"context"
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/domain/service"
pb "finclip-app-manager/infrastructure/protobuf/golang"
"gitlab.finogeeks.club/finclip-backend/apm"
)
func (GrpcServer) BatchAppsByIdentity(ctx context.Context, req *pb.BatchAppsByIdentityReq) (*pb.BatchAppsByIdentityRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.BatchAppsByIdentity")
defer span.End()
svr := service.NewAppService()
svrReq := &apiproto.BatchAppsByIdentityReq{
Source: req.Source,
IdentityType: req.IdentityType,
Apps: make([]apiproto.BatchAppsByIdentityAppsItem, 0),
}
for _, v := range req.Apps {
item := apiproto.BatchAppsByIdentityAppsItem{
AppId: v.GetAppId(),
Identity: v.GetIdentity(),
}
svrReq.Apps = append(svrReq.Apps, item)
}
return svr.BatchAppsByIdentity(ctx, req.GetSdkKey(), svrReq), nil
}
func (GrpcServer) IdentityAppsCheck(ctx context.Context, req *pb.IdentityAppsCheckReq) (*pb.IdentityAppsCheckRsp, error) {
span, ctx := apm.ApmClient().CreateGRpcEntrySpan(ctx, "GrpcServer.IdentityAppsCheck")
defer span.End()
svr := service.NewAppService()
svrReq := &apiproto.IdentityAppsCheckReq{
Source: req.Source,
IdentityType: req.IdentityType,
Apps: make([]apiproto.IdentityAppsCheckAppsItem, 0),
}
for _, v := range req.Apps {
item := apiproto.IdentityAppsCheckAppsItem{
AppId: v.GetAppId(),
Identity: v.GetIdentity(),
}
svrReq.Apps = append(svrReq.Apps, item)
}
return svr.IdentityAppsCheck(ctx, req.GetSdkKey(), svrReq), nil
}

View File

@ -0,0 +1,216 @@
package application
import (
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/domain/service"
"finclip-app-manager/infrastructure/utility"
"github.com/gin-gonic/gin"
"gitlab.finogeeks.club/finclip-backend/apm"
"net/http"
)
/**
* @api {POST}
* @apiGroup Finclip App Manager
* @apiParam (RequestBody) {string} name
* @apiParam (RequestBody) {string} id
* @apiParam (RequestBody) {string} image
* @apiParamExample {json} Request-Example:
* {
* "name":"111",
* "id":"1112",
* "image":"11"
* }
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func AddMenuHand(c *gin.Context) {
var (
traceCtx = apm.ApmClient().TraceContextFromGin(c)
req = apiproto.AddMenuReq{}
)
if err := c.BindJSON(&req); err != nil {
log.Errorf("AddMenuHand bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
if req.Name == "" || req.ID == "" || req.Image == "" {
log.Errorf("AddMenuHand param err:[empty],req:%+v", req)
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
svr := service.NewMenuInfoService()
svr.AddMenu(traceCtx, c, &req)
return
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "data": {},
* "errcode": "OK",
* "error": ""
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func DelMenuHand(c *gin.Context) {
var (
traceCtx = apm.ApmClient().TraceContextFromGin(c)
)
traceId := c.Param("traceId")
if traceId == "" {
log.Errorf("trace id empty ...")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
svr := service.NewMenuInfoService()
svr.DelMenu(traceCtx, c, traceId)
return
}
/**
* @api {PUT}
* @apiGroup Finclip App Manager
* @apiParam (RequestBody) {string} traceId
* @apiParam (RequestBody) {string} name
* @apiParam (RequestBody) {string} id
* @apiParam (RequestBody) {string} image
* @apiParamExample {json} Request-Example:
* {
* "name":"111",
* "id":"1112",
* "image":"11"
* }
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "data": {},
* "errcode": "OK",
* "error": ""
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func UpdateMenuHand(c *gin.Context) {
var (
traceCtx = apm.ApmClient().TraceContextFromGin(c)
)
traceId := c.Param("traceId")
if traceId == "" {
log.Errorf("trace id empty ...")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
req := apiproto.UpdateMenuReq{}
if err := c.BindJSON(&req); err != nil {
log.Errorf("UpdateMenuHand bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
svr := service.NewMenuInfoService()
svr.UpdateMenu(traceCtx, c, traceId, &req)
return
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* {
* "data": {
* "total": 1,
* "list": [
* {
* "traceId": "6049d56024c81800015698cc",
* "name": "12",
* "id": "12",
* "image": "/api/v1/mop/netdisk/download/6049d55f264ec50001706a4c",
* "sortNum": 0,
* "createTime": 1615451488106,
* "updateTime": 1615451488106,
* "updateOperator": "叼叼叼kk"
* }
* ]
* },
* "errcode": "OK",
* "error": ""
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func GetAllMenuHand(c *gin.Context) {
var (
traceCtx = apm.ApmClient().TraceContextFromGin(c)
)
svr := service.NewMenuInfoService()
svr.GetAllMenu(traceCtx, c)
return
}
/**
* @api {POST}
* @apiGroup Finclip App Manager
* @apiParam (RequestBody) {string} traceId
* @apiParam (RequestBody) {string} sortNum
* @apiParamExample {json} Request-Example:
* {
* "list": [
* {
* "traceId": "61f2658437236900015ad666",
* "sortNum": 5
* },
* {
* "traceId": "61f266ea37236900015ad667",
* "sortNum": 4
* }
* ]
* }
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "data": {},
* "errcode": "OK",
* "error": ""
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func SortMenuHand(c *gin.Context) {
var (
traceCtx = apm.ApmClient().TraceContextFromGin(c)
)
req := apiproto.MenuSortReq{}
if err := c.BindJSON(&req); err != nil {
log.Errorf("AddMenuHand bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
svr := service.NewMenuInfoService()
svr.SortMenu(traceCtx, c, &req)
return
}

View File

@ -0,0 +1,11 @@
package application
import (
"finclip-app-manager/infrastructure/client/httpcall"
"finclip-app-manager/infrastructure/logger"
)
var (
hCaller = httpcall.NewClient()
log = logger.GetLogger()
)

View File

@ -0,0 +1,485 @@
package application
import (
"encoding/json"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto"
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/domain/service"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/logger"
"finclip-app-manager/infrastructure/utility"
"finclip-app-manager/infrastructure/utils"
"fmt"
"net/http"
"net/url"
"path"
"strconv"
"strings"
"time"
"github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid"
"gitlab.finogeeks.club/finclip-backend/apm"
)
/**
* @api {POST}
* @apiGroup Finclip App Manager
* @apiParam (RequestBody) {string} appId Id
* @apiParam (RequestBody) {string} sequence
* @apiParam (RequestBody) {string} apiServer apiServer
* @apiParam (RequestBody) {string} type
* @apiParam (RequestBody) {string} codeId id
* @apiParam (RequestBody) {string} startParams
* @apiParamExample {json} Request-Example:
* {
* "appId": "5fd17becec413300012b1911",
* "sequence": 0,
* "apiServer": "https://finchat-mop-b.finogeeks.club",
* "type": "trial",
* "codeId": "c1218720c7a34e5f43b3b6d3",
* "startParams": {
* "path": "",
* "query": ""
* }
* }
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "data": {
* "url": "https://finchat-mop-b.finogeeks.club/api/v1/mop/runtime/applet/-f-NDhiNThiOGIwYjJlNDdmZg--"
* },
* "errcode": "OK",
* "error": ""
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func GenQrcodeHand(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := proto.GenQrcodeReq{}
if err := c.BindJSON(&req); err != nil {
log.Errorf("GenQrcodeHand bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_PARAM_ERR, gin.H{})
return
}
log.Infof("GenQrcodeHand req:%+v", req)
svr := service.NewQrCodeInfoService()
info, err := svr.GenQrcodeInfo(traceCtx, req)
if err != nil {
log.Errorf("GenQrcodeHand GenQrcodeInfo err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
log.Debugf("get qrcode type:%s info:%+v", info.Type, info)
rspInfo := gin.H{}
if info.Type == entity.QrCodeTypeTemporary || info.Type == entity.QrCodeTypeRomoteDebug || info.Type == entity.QrCodeTypeReview {
rspInfo["expireTime"] = info.ExpireTime
}
server, err := parseServer(req.ApiServer)
if err != nil {
log.Errorf("gen url err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_PARAM_ERR, gin.H{})
return
}
var serverUrl string
if req.Limit != "" {
serverUrl = config.GetConfig().QRcodeUriV2
} else {
serverUrl = config.GetConfig().QRcodeUri
}
resultUrl := server + path.Join(serverUrl, req.Limit, "/", info.Uuid)
rspInfo["url"] = resultUrl
log.Debugf("qrcode type:%s result info:%+v", info.Type, rspInfo)
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rspInfo)
return
}
//对原有的二维码逻辑进行重新处理
//文档见https://wiki.finogeeks.club/pages/viewpage.action?pageId=161317118
func joinUrl(server string, uri, uuid string) (string, error) {
u, err := url.Parse(server)
if err != nil {
return "", err
}
u.Path = path.Join(u.Path, uri, uuid)
return u.String(), nil
}
func parseServer(server string) (string, error) {
u, err := url.Parse(server)
if err != nil {
return "", err
}
return u.String(), nil
}
type appQRcodeInfoReq struct {
AppID string `json:"appId"`
Sequence int `json:"sequence"`
ApiServer string `json:"apiServer"`
CodeId string `json:"codeId"`
Type string `json:"type"`
StartParams appQRcodeInfoStartParams `json:"startParams"`
}
type appQRcodeInfoStartParams struct {
Path string `json:"path"`
Query string `json:"query"`
}
type EncryptInfo struct {
AppID string `json:"appId"`
Sequence int `json:"sequence"`
ApiServer string `json:"apiServer"`
CodeId string `json:"codeId"`
Type string `json:"type"`
StartParams appQRcodeInfoStartParams `json:"startParams"`
ExpireTime int64 `json:"expireTime"`
Uuid string `json:"uuid"`
}
type appQRcodeInfoRsp struct {
QRData string `json:"qrData"`
ExpireTime int `json:"expireTime"`
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func QRCodeRefresh(c *gin.Context) {
req := appQRcodeInfoReq{}
if err := c.ShouldBindJSON(&req); err != nil {
log.Errorf("appInfo bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
log.Infof("QRCodeRefresh req:%+v", req)
addSecond, _ := time.ParseDuration(strconv.Itoa(config.GetConfig().QRcodeExpireTime) + "s")
encryptData := EncryptInfo{}
encryptData.AppID = req.AppID
encryptData.Sequence = req.Sequence
encryptData.ApiServer = req.ApiServer
encryptData.CodeId = req.CodeId
encryptData.Type = req.Type
if config.GetConfig().ApiServer != "" {
encryptData.ApiServer = config.GetConfig().ApiServer
}
encryptData.StartParams.Path = req.StartParams.Path
encryptData.StartParams.Query = req.StartParams.Query
//过期时间
encryptData.ExpireTime = -1
encryptData.Uuid = uuid.NewV4().String()
if req.Type == "temporary" {
encryptData.ExpireTime = time.Now().Add(addSecond).UnixNano() / 1e6
}
jsonByte, _ := json.Marshal(encryptData)
logger.GetLogger().Debugf("jsonByte:%s", string(jsonByte))
encodeStr := utils.EncodeAESContent(string(jsonByte))
//if req.Type == "temporary" {
// /*err := cache.NewAppCache(req.AppID).SetAppInfoQRcode(traceCtx, encodeStr, jsonByte, config.Cfg.QRcodeExpireTime)
// if err != nil {
// logger.GetLogger().Errorf("redis set data error:", err.Error())
// MakeRsp(c, http.StatusBadRequest, utility.FS_REDIS_ERR, nil)
// return
// }*/
// encryptData.ExpireTime = time.Now().Add(addSecond).UnixNano() / 1e6
//}
rsp := appQRcodeInfoRsp{}
rsp.QRData = encodeStr
rsp.ExpireTime = config.GetConfig().QRcodeExpireTime
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rsp)
return
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func InternalGetQRcodeAppVerInfo(c *gin.Context) {
//traceCtx := apm.ApmClient().TraceContextFromGin(c)
SDKKey := c.GetHeader(entity.SDKKEY_HEADER_KEY)
redisKey := c.GetHeader("redisKey")
log.Infof("InternalGetAppVerInfo req appId:%s,seq:%s,sdk-key:%s,sdk-ver:%s", SDKKey, redisKey)
rspErr := make(map[string]interface{})
if redisKey == "" {
log.Errorf("InternalGetAppVerInfo redisKey empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_APPID, rspErr)
return
}
if SDKKey == "" {
log.Errorf("InternalGetAppVerInfo sdk-key empty!!!")
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_LACK_OF_SDKKEY, rspErr)
return
}
//sdkKey白名单的校验
if !utils.InArry(SDKKey, config.WhiteSDKArry) {
log.Errorf("RuntimeGetAppVersionInfo sdk not in white sdk arry,sdk-key:%s", SDKKey)
utility.MakeLocRsp(c, http.StatusForbidden, utility.FS_COOPERATION_TERMINATED, rspErr)
return
}
/* appVerSvr := service.NewAppVerService()
data, httpCode, errcode := appVerSvr.OpenApiGetAppVerInfo(traceCtx, appId, sequence, sdkVer)
if data == nil {
MakeRsp(c, httpCode, errcode, rspErr)
return
}
MakeRsp(c, httpCode, errcode, data)*/
rspInfo := InternalGetAppVerInfoRsp{}
// 临时注释
//dataBytes, err := cache.NewQRcodeAppCache().GetQRcodeAppInfo(c, redisKey)
//fmt.Println("dataBytes------------", dataBytes)
//if err != nil {
// if len(dataBytes) == 0 {
// log.Debugln("qrcode is refresh:")
// utility.MakeLocRsp(c, http.StatusOK, utility.FS_QRCODE_HAS_EXPIRE, rspInfo)
// return
// } else {
// log.Errorf("redis error:", err.Error())
// utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_DB_ERR, rspInfo)
// return
// }
//}
//err = json.Unmarshal(dataBytes, &rspInfo)
//if err != nil {
// log.Errorf("json unmarshal error:", err.Error())
// utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, rspInfo)
// return
//}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rspInfo)
return
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func DeleteWechatQrcode(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := apiproto.DeleteWechatInfoReq{}
if err := c.ShouldBindJSON(&req); err != nil {
log.Errorf("UpdateWechatInfo err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
svr := service.NewQrCodeInfoService()
if err := svr.DeleteWechatQrcode(traceCtx, req); err != nil {
log.Errorf("DeleteWechatQrcode err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_DB_ERR, nil)
return
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, nil)
return
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func GetQrcodeInfo(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
uuid := c.Param("uuid")
log.Infof("GetQrcodeInfo req uuid:%v", uuid)
svr := service.NewQrCodeInfoService()
info, err := svr.GetQrcodeInfo(traceCtx, uuid)
log.Errorf(utility.InterfaceToJsonString(info))
if err != nil {
log.Errorf("GetQrcodeInfo err:%s", err.Error())
if err == entity.NotFoundErr {
utility.MakeLocRsp(c, http.StatusNotFound, utility.FS_NOT_FOUND, gin.H{})
return
}
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
now := time.Now().UnixNano() / 1e6
if info.Type == entity.QrCodeTypeReview && now >= info.ExpireTime {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_QR_CODE_EXPIRED, gin.H{})
return
}
//uat多域名兼容
if utils.InArry(info.ApiServer, config.GetConfig().UatDomainList) {
info.ApiServer = "https://api.finclip.com"
}
//if info.ApiServer == "https://www.finclip.com" || info.ApiServer == "https://www.finclip.com/" {
// info.ApiServer = "https://api.finclip.com"
//}
resultInfo := make(map[string]interface{})
resultInfo["apiServer"] = info.ApiServer
resultInfo["type"] = info.Type
switch info.Type {
case entity.QrCodeTypeReview:
resultInfo["appId"] = info.AppId
resultInfo["sequence"] = info.Sequence
resultInfo["expireTime"] = info.ExpireTime
case entity.QrCodeTypeRelease:
resultInfo["appId"] = info.AppId
case entity.APP_BUILD_SOURCE_TRIAL:
resultInfo["codeId"] = info.CodeId
//这里的返回做一个转换
StartParamsMap := map[string]string{
"path": "",
"query": "",
}
paramList := strings.Split(info.StartParams.PathAndQuery, "?")
if len(paramList) > 0 {
StartParamsMap["path"] = paramList[0]
}
if len(paramList) > 1 {
StartParamsMap["query"] = paramList[1]
}
resultInfo["startParams"] = StartParamsMap
case entity.QrCodeTypeTemporary:
resultInfo["appId"] = info.AppId
resultInfo["codeId"] = info.AppId
resultInfo["sequence"] = info.Sequence
resultInfo["expireTime"] = info.ExpireTime
StartParamsMap := map[string]string{
"path": "",
"query": "",
}
paramList := strings.Split(info.StartParams.PathAndQuery, "?")
if len(paramList) > 0 {
StartParamsMap["path"] = paramList[0]
}
if len(paramList) > 1 {
StartParamsMap["query"] = paramList[1]
}
resultInfo["startParams"] = StartParamsMap
case entity.QrCodeTypeRomoteDebug:
resultInfo["appId"] = info.AppId
resultInfo["codeId"] = info.AppId
resultInfo["sequence"] = info.Sequence
resultInfo["expireTime"] = info.ExpireTime
resultInfo["debugInfo"] = info.DebugInfo
}
log.Infof("GetQrcodeInfo rsp:%+v", resultInfo)
infoByte, _ := json.Marshal(resultInfo)
infoStr := utils.EncodeAESContent(string(infoByte))
log.Infof("info.ApiServer:%v", info.ApiServer)
link := info.ApiServer + "/mop/scattered-page/#/sdktip"
resultUrl := fmt.Sprintf("%s?info=%s&type=scanOpen&codeType=%s", link, infoStr, info.Type)
//resultUrl := fmt.Sprintf("%s/mop/scattered-page/#/sdktip?info=%s&type=scanOpen&codeType=%s", info.ApiServer, infoStr, info.Type)
//c.Redirect(http.StatusMovedPermanently, resultUrl)
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{"url": resultUrl})
return
}
const (
QRCodeMinWidth = 280
QRCodeMaxWidth = 1280
QRCodeDefaultWidth = 430
)
func GetQRCode(c *gin.Context) {
//traceCtx := apm.ApmClient().TraceContextFromGin(c)
//appID := c.Param("path1")
//widthStr := c.Query("width")
//width := QRCodeDefaultWidth
//if widthStr != "" {
// var err error
// width, err = strconv.Atoi(c.Query("width"))
// if err != nil {
// //msg := "Invalid width format: should be integer"
// utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
// return
// }
//}
//if width < QRCodeMinWidth || width > QRCodeMaxWidth {
// //msg := "Invalid width"
// utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
// return
//}
//if appID == "" {
// //msg := "Lack of appId"
// utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
// return
//}
//qr := model.QRCode{}
//if err := qr.GetOne(traceCtx, bson.M{"appId": appID}); err != nil {
// if err.Error() == model.ErrorNotFound {
// msg := fmt.Sprintf("QR Code info with appId %s not found", appID)
// LogAndSetErrResp(c, http.StatusNotFound, FS_NOT_FOUND, nil, msg, nil)
// return
// }
//}
//app := model.App{}
//if err := app.GetOne(traceCtx, bson.M{"appId": appID}); err != nil {
// if err.Error() == model.ErrorNotFound {
// msg := fmt.Sprintf("App with appId %s not found", appID)
// LogAndSetErrResp(c, http.StatusBadRequest, FS_BAD_JSON, nil, msg, nil)
// } else {
// LogAndSetErrResp(c, http.StatusInternalServerError, FS_SYSTEM_CALL, err, "Failed to get app", nil)
// }
// return
//}
////qrCodeStr := fmt.Sprintf("%s://applet/appid/%s?path=%s", qr.Scheme, appID, qr.Path)
//qrCodeStr := fmt.Sprintf("%s://applet/appid/%s", qr.Scheme, appID)
//if qr.Path != "" {
// qrCodeStr = qrCodeStr + "?path=" + qr.Path
//}
//bytes, err := createQRCode(traceCtx, qrCodeStr, app.Logo, width)
//if err != nil {
// LogAndSetErrResp(c, http.StatusInternalServerError, FS_SYSTEM_CALL, err, "Failed create QR Code", nil)
// return
//}
//c.Data(http.StatusOK, "image/png", bytes)
}
func GetQRCodeInfo(c *gin.Context) {
}

View File

@ -0,0 +1,61 @@
package application
import (
"finclip-app-manager/domain/service"
"finclip-app-manager/infrastructure/utility"
"github.com/gin-gonic/gin"
"gitlab.finogeeks.club/finclip-backend/apm"
"net/http"
)
type ReadRedDotReq struct {
Type string `json:"type"`
Id string `json:"id"`
}
/**
* @api {POST}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func ReadRedDotHand(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := ReadRedDotReq{}
if err := c.BindJSON(&req); err != nil {
log.Errorf("ReadRedDotHand read err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
userId := utility.GetUserId(c)
if userId == "" {
log.Errorf("ReadRedDotHand user id empty,req:%+v", req)
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
var err error
svr := service.NewRedDotService()
switch req.Type {
case "trialAppQr":
err = svr.ReadTrialQr(traceCtx, req.Id, userId)
default:
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, gin.H{})
return
}
if err != nil {
log.Errorf("ReadRedDotHand ReadTrialQr err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, gin.H{})
return
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}

View File

@ -0,0 +1,199 @@
package application
import (
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/service"
"finclip-app-manager/infrastructure/utility"
"finclip-app-manager/infrastructure/utils"
"github.com/gin-gonic/gin"
"gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo/bson"
"gitlab.finogeeks.club/finclip-backend/apm"
"net/http"
"sort"
)
type listTypeConfigResponse struct {
Total int `json:"total"`
List []entity.TypeConfig `json:"list"`
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "data": {
* "total": 1,
* "list": [
* {
* "typeConfigId": "619659a31bcd700001146eb1",
* "namespace": "appClass",
* "value": "jinrong",
* "marketId": "",
* "customData": {
* "chinese": "金融"
* },
* "sortNum": 1
* }
* ]
* },
* "errcode": "OK",
* "error": ""
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func ListTypeConfig(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
queryFilter, sortFilter, searchFilter, _, _, err := utils.GetCommonParam(c)
if err != nil {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
if len(sortFilter) == 0 {
sortFilter = []string{"namespace"}
}
filter := bson.M{"namespace": "appClass"}
if len(searchFilter) > 0 {
filter = searchFilter
}
if len(queryFilter) > 0 {
filter = bson.M{"$and": []bson.M{filter, queryFilter}}
}
svr := service.NewTypeConfigService()
//total, cfgs, err := svr.GetTypeConfigList(traceCtx, pageSize, pageNo)
total, cfgs, err := svr.GetAllTypeConfigList(traceCtx)
if err != nil {
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, nil)
return
}
sort.Sort(entity.TypeConfigList(cfgs))
utility.MakeLocRsp(c, http.StatusOK, utility.OK, listTypeConfigResponse{
Total: total,
List: cfgs,
})
}
type typeConfigRequest struct {
AdministratorID string `json:"administratorId"`
entity.TypeConfig
}
/**
* @api {POST}
* @apiGroup Finclip App Manager
* @apiParam (RequestBody) {string} administratorId
* @apiParam (RequestBody) {string} namespace
* @apiParam (RequestBody) {string} value
* @apiParam (RequestBody) {string} customData
* @apiParam (RequestBody) {string} marketId
* @apiParamExample {json} Request-Example:
* {
* "administratorId":"1",
* "namespace": "appClass",
* "value": "1",
* "customData": {
* "chinese": "哈哈"
* },
* "marketId": "1"
* }
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "errcode": "OK",
* "error": "成功",
* "data":{
*
* }
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func AddTypeConfig(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
reqJSON := typeConfigRequest{}
if err := c.ShouldBindJSON(&reqJSON); err != nil {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
if reqJSON.AdministratorID == "" {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
t := entity.TypeConfig{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: reqJSON.Namespace,
Value: reqJSON.Value,
MarketID: reqJSON.MarketID,
CustomData: reqJSON.CustomData,
}
log.Errorln(111)
svr := service.NewTypeConfigService()
exist, err := svr.Exist(traceCtx, reqJSON.Namespace, reqJSON.Value)
log.Errorln(222)
log.Errorln(exist)
log.Errorln(err)
if err != nil && !svr.NotFound(err) {
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, nil)
return
}
if exist {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
} else {
//获取当前最高sortNum
nowSortNumInfo, err := svr.GetNowSortNumInfo(traceCtx)
if err != nil {
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, nil)
return
}
t.SortNum = nowSortNumInfo.SortNum + 1
err = svr.Insert(traceCtx, &t)
if err != nil {
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, nil)
return
}
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
}
/**
* @api {GET}
* @apiGroup Finclip App Manager
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "data": {},
* "errcode": "OK",
* "error": ""
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func DeleteTypeConfig(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
typeConfigID := c.Param("typeConfigId")
administratorID := c.Query("administratorId")
if typeConfigID == "" {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
if administratorID == "" {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
svr := service.NewTypeConfigService()
err := svr.Delete(traceCtx, typeConfigID)
if err != nil {
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, nil)
return
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}

View File

@ -0,0 +1,95 @@
package application
import (
"finclip-app-manager/infrastructure/client/httpcall"
"finclip-app-manager/infrastructure/utility"
"net/http"
"strings"
"github.com/gin-gonic/gin"
"gitlab.finogeeks.club/finclip-backend/apm"
)
/**
* @api {POST} /api/v1/mop/finstore/dev/wechat/info [C/S]线
* @apiGroup Finclip App Manager
* @apiParam (RequestBody) {string} appId //小程序id
* @apiParam (RequestBody) {string} wechatAppSecret //微信密钥
* @apiParam (RequestBody) {string} wechatAppId //微信appid
* @apiParam (RequestBody) {string} wechatPath //微信访问path
* @apiParam (RequestBody) {string} wechatSize //尺寸
* @apiParamExample {json} Request-Example:
* {
* "appId":"61b32654659d2b00016264a8",
* "seq": 1,
* "wechatAppSecret":"3534534"
* "wechatAppId":"23345",
* "wechatPath":"sfsgfd",
* "wechatSize":"345"
* }
* @apiSuccessExample {json} Success Status:
* HTTP/1.1 200 OK
* {
* "data": {},
* "errcode": "OK",
* "error": ""
* }
* @apiErrorExample Error Status:
* HTTP/1.1 !=200
*/
func UpdateWechatInfo(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := httpcall.UpdateWechatInfoReq{}
if err := c.ShouldBindJSON(&req); err != nil {
log.Errorf("UpdateWechatInfo bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
errCode, err := hCaller.UpsertWeChatInfo(traceCtx, req)
if err != nil {
utility.MakeLocRsp(c, http.StatusBadRequest, errCode, nil)
return
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, nil)
return
}
func ReadWechatHint(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
req := httpcall.ReadWechatHintoReq{}
developerID := c.Request.Header.Get("X-Consumer-Custom-ID")
if err := c.ShouldBindJSON(&req); err != nil {
log.Errorf("ReadWechatHint bind err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_BAD_JSON, nil)
return
}
req.DeveloperId = developerID
err := hCaller.ReadWechatHint(traceCtx, req)
if err != nil {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_SERVER_ERR, nil)
return
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, nil)
return
}
func GetAppByWechat(c *gin.Context) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
qrcode := c.Query("qrcode")
if strings.TrimSpace(qrcode) == "" {
utility.MakeLocRsp(c, http.StatusOK, utility.OK, "")
return
}
appId, err := hCaller.GetAppByWechat(traceCtx, qrcode)
if err != nil {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_SERVER_ERR, "")
return
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, appId)
return
}

26
domain/domain.go 100644
View File

@ -0,0 +1,26 @@
package domain
import (
"context"
"finclip-app-manager/domain/script"
"fmt"
)
/**
* DDD: domain
*
* domain
* :
* (Entities)
* (Value Objects):
* (Domain Services):
* /(Aggregates,Aggregate Roots): rootboundary
* (Factories):
* (Repository):
**/
func Start() {
fmt.Printf("script start...\n")
ctx := context.Background()
go script.NewAutoReviewApp().ReviewApps(ctx)
}

View File

@ -0,0 +1,123 @@
package entity
// Unpublish current sequence due to new sequence published.
const (
TypeUnpublishedByAdmin = "UnpublishedByAdmin"
TypeUnpublishedByDev = "UnpublishedByDev"
TypeUnpublishedDueToNewSeq = "UnpublishedDueToNewSeq"
)
const (
APP_FORBIDDEN_NOT_STATUS = 0
APP_FORBIDDEN_IS_STATUS = 1
APP_FORBIDDEN_ALL_STATUS = 2
)
type TestInfo struct {
Account string `json:"account" bson:"account"`
Password string `json:"password" bson:"password"`
Description string `json:"description" bson:"description"`
Images []string `json:"images" bson:"images"`
}
//App 小程序元信息
type App struct {
AppID string `json:"appId" bson:"appId"` //id
Name string `json:"name" bson:"name"` //名字
Sequence int `json:"sequence" bson:"sequence"` //版本号
AppClass string `json:"appClass" bson:"appClass"` //用途 现在改为分类
AppTag []string `json:"appTag" bson:"appTag"` //标签
AppType string `json:"appType" bson:"appType"` //应用类型--mop使用为了和应用市场区分开
Status Status `json:"status" bson:"status"` //状态
PublishedStatus SpecificStatus `json:"publishedStatus" bson:"publishedStatus"` //上架
UnpublishedStatus SpecificStatus `json:"unpublishedStatus" bson:"unpublishedStatus"` //下架
ActionStatus SpecificStatus `json:"actionStatus" bson:"actionStatus"` //上下架
DeveloperID string `json:"developerId" bson:"developerId"` //开发者id
GroupID string `json:"groupId" bson:"groupId"` //组id
Created int64 `json:"created" bson:"created"`
CreatedBy string `json:"createdBy" bson:"createdBy"`
CustomData CustomDataInfo `json:"customData" bson:"customData"` //预留
Version string `json:"version" bson:"version"` //应用版本
CoreDescription string `json:"coreDescription" bson:"coreDescription"` //小程序简介
Logo string `json:"logo" bson:"logo"` //图标
TestInfo TestInfo `json:"testInfo" bson:"testInfo"` //测试信息
Expire int64 `json:"expire" bson:"expire"`
IsRollback bool `json:"isRollback" bson:"isRollback"` // 是否回滚发布
ApplyStatus string `json:"applyStatus" bson:"-"` // 关联审核状态
IsForbidden int `json:"isForbidden" bson:"isForbidden"` //是否禁用 0:未禁用 1:禁用
PrivacySettingType int `json:"privacySettingType" bson:"privacySettingType"` //是否设置隐私 0:未设置 1:自定义内容 2默认
ProjectType int `json:"projectType" bson:"projectType"` //项目类型,默认 0代表小程序1 小游戏2 H5
}
//AppVersion 小程序版本信息
type AppVersion struct {
AppID string `json:"appId" bson:"appId"`
Name string `json:"name" bson:"name"`
AppClass string `json:"appClass" bson:"appClass"` //用途 现在改为分类
AppTag []string `json:"appTag" bson:"appTag"` //标签
AppType string `json:"appType" bson:"appType"`
Status Status `json:"status" bson:"status"`
PublishingStatus SpecificStatus `json:"publishingStatus" bson:"publishingStatus"` //提交上架审核
UnpublishingStatus SpecificStatus `json:"unpublishingStatus" bson:"unpublishingStatus"` //下架审核
PublishingApprovalStatus SpecificStatus `json:"publishingApprovalStatus" bson:"publishingApprovalStatus"` //管理员审核上架记录
UnpublishingApprovalStatus SpecificStatus `json:"unpublishingApprovalStatus" bson:"unpublishingApprovalStatus"` //管理员审核下架记录
PublishedStatus SpecificStatus `json:"publishedStatus" bson:"publishedStatus"` //执行上架记录
UnpublishedStatus UnpublishedStatus `json:"unpublishedStatus" bson:"unpublishedStatus"` //执行下架记录
RequestStatus SpecificStatus `json:"requestStatus" bson:"requestStatus"` //合并开发者申请上下架状态
ApprovalStatus SpecificStatus `json:"approvalStatus" bson:"approvalStatus"` //合并管理员申请上下架状态
ActionStatus SpecificStatus `json:"actionStatus" bson:"actionStatus"` //执行上下架合并
DeveloperID string `json:"developerId" bson:"developerId"`
GroupID string `json:"groupId" bson:"groupId"`
Created int64 `json:"created" bson:"created"`
CreatedBy string `json:"createdBy" bson:"createdBy"` // 提交审核的用户
CustomData CustomDataInfo `json:"customData" bson:"customData"`
Version string `json:"version" bson:"version"`
Sequence int `json:"sequence" bson:"sequence"`
CorporationID string `json:"corporationId" bson:"corporationId"` //与groupid类似
CoreDescription string `json:"coreDescription" bson:"coreDescription"`
Logo string `json:"logo" bson:"logo"`
IsRollback bool `json:"isRollback" bson:"isRollback"`
TestInfo TestInfo `json:"testInfo" bson:"testInfo"`
NeedAutoPub bool `json:"needAutoPub" bson:"needAutoPub"`
InGrayRelease bool `json:"inGrayRelease" bson:"inGrayRelease"` //是否在灰度发布中
Expire int64 `json:"expire" bson:"expire"`
AppBuildID string `json:"appBuildID" bson:"appBuildID"`
}
type SubmitAppReq struct {
AppId string
BuildId string
Account string
NeedAutoPub bool
TestInfo TestInfo
UserId string
}
type AppClassPerRsp struct {
Class string `bson:"class"`
Count int `bson:"count"`
Name []string `bson:"name"`
}
type AdminGetLinkAppsRspItem struct {
Id string `json:"_id"`
AppIdDetail struct {
AppId string `json:"appId"`
Name string `json:"name"`
Sequence int `json:"sequence"`
} `json:"appIdDetail"`
AppInfos struct {
AssociatedAt int64 `json:"associatedAt"`
} `json:"appInfos"`
BindingId string `json:"bindingId"`
GroupName string `json:"groupName"`
Name string `json:"name"`
}
type CItem struct {
Id string `json:"_id" bson:"_id"`
}
type TagItem struct {
Id []string `json:"_id" bson:"_id"`
}

View File

@ -0,0 +1,24 @@
package entity
const (
APP_BUILD_SOURCE_BUILD = "build"
APP_BUILD_SOURCE_TRIAL = "trial"
)
//AppStartParams 小程序启动参数
type AppBuildInfo struct {
Id string `json:"id"`
BuildInfoId string `json:"buildInfoId"`
Source string `json:"source"` // 该上传版本的状态: build:正常版本, trail:被设置为体验版
AppID string `json:"appId"`
GroupID string `json:"groupId"`
Created int64 `json:"created"` //创建该编译版本的时间
UserId string `json:"userId"`
CreatedBy string `json:"createdBy"` //创建人
CustomData CustomDataInfo `json:"customData"`
Version string `json:"version"`
//VersionDescription string `json:"versionDescription"`
StartParams AppStartParams `json:"startParams"`
Status bool `json:"status" bson:"status"`
}

View File

@ -0,0 +1,67 @@
package entity
import (
"errors"
)
const APPTEMPINFO_DB_NAME = "appTempInfo"
var (
AppTempDefSequence = 1
appTempNotFoundErr = errors.New("NOT FOUND")
)
type AppTempInfo struct {
AppID string `json:"appId" bson:"appId"` //id
Name string `json:"name" bson:"name"` //名字
Sequence int `json:"sequence" bson:"sequence"` //版本号
AppClass string `json:"appClass" bson:"appClass"` //用途
AppType string `json:"appType" bson:"appType"` //应用类型--mop使用为了和应用市场区分开
Status Status `json:"status" bson:"status"` //状态
DeveloperID string `json:"developerId" bson:"developerId"` //开发者id
GroupID string `json:"groupId" bson:"groupId"` //组id
Created int64 `json:"created" bson:"created"`
CreatedBy string `json:"createdBy" bson:"createdBy"`
CustomData CustomDataInfo `json:"customData" bson:"customData"` //预留
Version string `json:"version" bson:"version"` //应用版本
CoreDescription string `json:"coreDescription" bson:"coreDescription"` //核心描述
Logo string `json:"logo" bson:"logo"` //图标
ProjectType int `json:"rojectType" bson:"projectType"` //项目类型
}
//type IAppTempInfoRepo interface {
// Insert(ctx context.Context, info *AppTempInfo) error
// UpdateInfo(ctx context.Context, info *AppTempInfo) error
// GetInfoByAppId(ctx context.Context, appId string) (*AppTempInfo, error)
// GetInfoByAppIdAndSeq(ctx context.Context, appId string, seq int) (*AppTempInfo, error)
// NotFound(err error) bool
//}
//
//func NewDefaultInfo(appId string) *AppTempInfo {
// now := time.Now().UnixNano() / 1e6
// return &AppTempInfo{
// AppID: appId,
// Name: "",
// Sequence: AppTempDefSequence,
// AppClass: "Others",
// AppType: "Applet",
// Status: Status{
// Value: "Published",
// Reason: "ide测试",
// LastUpdated: now,
// ModifiedBy: "ide测试",
// },
// DeveloperID: "",
// GroupID: "",
// Created: now,
// CreatedBy: "",
// CustomData: CustomDataInfo{
// DetailDescription: "ide测试小程序",
// VersionDescription: "ide测试小程序",
// SourceFile: make([]CustomDataSourceFile, 0),
// },
// Version: "1.0.0",
// CoreDescription: "ide测试小程序",
// Logo: "",
// }
//}

View File

@ -0,0 +1,119 @@
package entity
import (
"time"
"github.com/patrickmn/go-cache"
)
const BINDING_DB_NAME = "binding"
const BUNDLEINFO_DB_NAME = "bundleInfo"
const (
BUNDLE_ID_LIMITI = 2
BINGING_PLATFORM_ORGAN = 0
BINGING_PLATFORM_OPER = 1
BINGING_PLATFORM_ALL = 2
BINGING_NOT_AUTO_BIND = 0
BINGING_AUTO_BIND = 1
)
var SdkExiCache *cache.Cache
func init() {
SdkExiCache = cache.New(24*time.Hour, time.Hour)
}
type BundleInfo struct {
//Id uint64 `json:"id" bson:"id"`
BundleID string `json:"bundleId" bson:"bundleId"`
Remark string `json:"remark" bson:"remark"`
SDKKey string `json:"SDKKey" bson:"SDKKey"`
SDKID string `json:"SDKID" bson:"SDKID"`
IsFirstCreate bool `json:"isFirstCreate" bson:"isFirstCreate"` //是否第一次创建
CreatedAt int64 `json:"createdAt" bson:"createdAt"`
CreatedAccount string `json:"createdAccount" bson:"createdAccount"`
CreatedBy string `json:"createdBy" bson:"createdBy"`
IsForbidden int `json:"isForbidden" bson:"isForbidden"`
IsReview int `json:"-" bson:"-"`
}
type CreatedInfo struct {
CreatedBy string `json:"createdBy" bson:"created_by"`
CreatedAt int64 `json:"createdAt" bson:"created_at"`
CreatedAccount string `json:"createdAccount" bson:"created_account"`
}
type AppInfo struct {
//Id uint64 `json:"id" bson:"id"`
AppID string `json:"appId" bson:"appId"`
AssociatedAt int64 `json:"associatedAt" bson:"associatedAt"`
AssociatedBy string `json:"associatedBy" bson:"associatedBy"`
}
//应用维度
type Binding struct {
BindingID string `json:"bindingId" bson:"bindingId"` //应用的id
Name string `json:"name" bson:"name"` //应用名称
BundleInfos []BundleInfo `json:"bundleInfos" bson:"bundleInfos"` //bundle ids
CreatedInfo CreatedInfo `json:"createdInfo" bson:"createdInfo"` //创建信息
GroupID string `json:"groupId" bson:"groupId"` //企业ID
GroupName string `json:"groupName" bson:"groupName"` //企业名称(为了查询)
CooperateStatus Status `json:"cooperateStatus" bson:"cooperateStatus"` //合作状态
CooperateValidStatus SpecificStatus `json:"cooperateValidStatus" bson:"cooperateValidStatus"` //合作状态详情
CooperateInvalidStatus SpecificStatus `json:"cooperateInvalidStatus" bson:"cooperateInvalidStatus"` //解除合作状态详情
AppInfos []AppInfo `json:"appInfos" bson:"appInfos"` //appid 的信息
Owner string `json:"owner" bson:"owner"` //所属企业
Expire int64 `json:"expire" bson:"expire"`
ApiServer string `json:"apiServer" bson:"apiServer"` //子域名
PlatForm int `json:"platform" bson:"platform"` //来源平台
AutoBind int `json:"autoBind" bson:"autoBind"` //自动关联小程序
HiddenBundle int `json:"hiddenBundle" bson:"hiddenBundle"` //隐藏bundle信息
FromBindingID string `json:"fromBindingId" bson:"fromBindingId"` //来源ID
}
//type IBindingRepo interface {
// GetInfo(ctx context.Context, bindingId string) (*Binding, error)
// GetByGroupIdAndName(ctx context.Context, groupId string, name string) (*Binding, error)
// GetByApiServer(ctx context.Context, apiServer string) (*Binding, error)
// GetBindingsByAppIdAndSdkKey(ctx context.Context, appId, sdkKey string) (*Binding, error)
// GetInfoBySdkKeyOrganId(ctx context.Context, organId, sdkKey string) (*Binding, error)
// GetAllSdkKey(ctx context.Context, organId string) ([]string, error)
// GetBindListBySdkKey(ctx context.Context, sdkKey string) ([]Binding, error)
// SdkKeyExi(ctx context.Context, sdkKey string) (bool, error)
// Insert(ctx context.Context, bind *Binding) error
// Count(ctx context.Context) (int, error)
// GetBundleIdNum(ctx context.Context) (int, error)
// NotFound(err error) bool
//}
//
//func IsAssAppId(info *Binding, appId string) bool {
// if info == nil {
// return false
// }
// for _, a := range info.AppInfos {
// if a.AppID == appId {
// return true
// }
// }
// return false
//}
type BindingUsed struct {
LimitNum int `json:"limitNum"`
HasUseNum int `json:"hasUseNum"`
RemainNum int `json:"remainNum"`
}
type ReviewBundleInfo struct {
BindingId string `json:"bindingId"`
CreatedInfoAt int64 `json:"createdInfoAt"`
Name string `json:"name"`
Status string `json:"status"`
BundleID string `json:"bundleId"`
Remark string `json:"remark"`
SDKKey string `json:"sdkKey"`
SDKID string `json:"sdkId"`
IsForbidden int `json:"isForbidden"` //是否禁用 0:未禁用 1:禁用
IsReview int `json:"isReview"`
}

View File

@ -0,0 +1,15 @@
package entity
//Bundle 私有化环境下bundle管理由运营端管理这里新建一个表来处理
//机构端创建应用时只需要选择其中一个选择之后会重新生成一个新的bundleInfo与应用关联
type Bundle struct {
BundleID string `json:"bundleId" bson:"bundleId"`
Remark string `json:"remark" bson:"remark"`
SDKKey string `json:"SDKKey" bson:"SDKKey"`
SDKID string `json:"SDKID" bson:"SDKID"`
IsFirstCreate bool `json:"isFirstCreate" bson:"isFirstCreate"` //是否第一次创建
CreatedAt int64 `json:"createdAt" bson:"createdAt"`
CreatedAccount string `json:"createdAccount" bson:"createdAccount"`
CreatedBy string `json:"createdBy" bson:"createdBy"`
IsForbidden int `json:"isForbidden" bson:"isForbidden"` //0可用 1禁用
}

View File

@ -0,0 +1,187 @@
package entity
import "errors"
var (
NotFoundErr = errors.New("not found")
)
const (
ACCOUNT_ID_HEADER_KEY = "X-Consumer-Custom-Id"
SDKKEY_HEADER_KEY = "mop-sdk-key"
SDKEY_VER_HEADER_KEY = "mop-sdk-version"
)
const (
APP_MARKET_TYPE_FINANCE = "金融"
APP_MARKET_TYPE_TOOL = "工具"
APP_MARKET_TYPE_INFORMATION = "资讯"
APP_MARKET_TYPE_OTHER = "其他"
)
const (
AppTypeBot = "Bot"
AppTypeWeb = "Web"
AppTypeApplet = "Applet"
)
const (
ErrFake = "fake error"
)
const (
ENV_UAT = "mop-uat"
ENV_PRIVATE = "mop-private"
ENV_FDEP = "mop-fdep"
ENV_COMMUNITY = "mop-community"
)
const (
ScopeUserInfo = "user-info"
ScopeMessageSending = "message-sending"
ScopeProfile = "profile"
ScopeEmail = "email"
)
const (
StKeyPublishingApprovalStatus = "publishingApprovalStatus"
StKeyUnpublishingApprovalStatus = "unpublishingApprovalStatus"
)
const (
OpCreate = "Create"
OpUpdate = "Update"
OpDelete = "Delete"
OpSubmitPublishReq = "Submit publish request"
OpWithdrawPublishReq = "Withdraw publish request"
OpPublish = "Publish"
OpApprovePublishReq = "Approve publish request"
OpRejectPublishReq = "Reject publish request"
OpSubmitUnpublishReq = "Submit unpublish request"
OpWithdrawUnpublishReq = "Withdraw unpublish request"
OpUnpublish = "Unpublish"
OpApproveUnpublishReq = "Approve unpublish request"
OpRejectUnpublishReq = "Reject unpublish request"
)
var AppOperationMap = map[string]string{
OpCreate: "创建应用",
OpUpdate: "更新应用",
OpDelete: "删除应用",
OpSubmitPublishReq: "提交上架申请",
OpWithdrawPublishReq: "撤回上架申请",
OpPublish: "上架",
OpApprovePublishReq: "通过上架申请",
OpRejectPublishReq: "驳回上架申请",
OpSubmitUnpublishReq: "提交下架申请",
OpWithdrawUnpublishReq: "撤回下架申请",
OpUnpublish: "下架",
OpApproveUnpublishReq: "通过下架申请",
OpRejectUnpublishReq: "驳回下架申请",
}
const (
OpBindingAssociate = "Associate"
OpBindBundle = "BindBundle"
OpUpdateBundle = "UpdateBundle"
OpBindingDisassociate = "Disassociate"
OpBindingRecooperate = "Recooperate"
OpBindingDiscooperate = "Discooperate"
OpBindingModifyName = "ModifyName"
OpBindingApplyAssociate = "ApplyAssociate"
OpBindingAutoBind = "AutoBind"
OpBindingHiddenBundle = "HiddenBundle"
OpBindingReviewAdd = "add"
OpBindingReviewRemove = "remove"
OpMoveBundle = "MoveBundle"
)
var BindingOperationMap = map[string]string{
OpBindingAssociate: "关联小程序",
OpBindingDisassociate: "取消关联小程序",
OpBindingRecooperate: "恢复合作",
OpBindingDiscooperate: "取消合作",
OpBindingModifyName: "修改应用名称",
OpBindingApplyAssociate: "申请关联小程序",
}
const (
StLinkAuditApplying = "Applying"
StLinkAuditRejected = "Rejected"
StLinkAuditApplied = "Applied"
)
const (
StLinkAuditAssociate = "Associated"
StLinkAuditUnAssociate = "UnAssociated"
)
const (
StBindValid = "Valid"
StBindInvalid = "Invalid"
)
const (
BuildInfoTypeTrial = "trial"
BuildInfoTypeTemporary = "temporary"
BuildInfoTypeReview = "review"
BuildInfoTypeRelease = "release"
BuildInfoTypeDevelopment = "development"
BuildInfoTypeRomoteDebug = "remoteDebug" //真机调试版
)
var BindingStatusMap = map[string]string{
StBindValid: "已合作",
StBindInvalid: "已取消合作",
}
const (
StInDevelopment = "InDevelopment" // 开发中,客户端不感知
StPublishing = "Publishing" // 上架审核中
StPublishWithdrawed = "PublishWithdrawed" // 上架审核已撤回
StPublishApproved = "PublishApproved" // 上架审核已通过
StPublishRejected = "PublishRejected" // 上架审核已拒绝
StPublished = "Published" // 已上架
StUnpublishing = "Unpublishing" // 下架审核中
StUnpublishApproved = "UnpublishApproved" // 下架审核已通过
StUnpublishRejected = "UnpublishRejected" // 下架审核已拒绝
StUnpublished = "Unpublished" // 已下架
StDeleted = "Deleted" // 已删除,客户端不感知
StGrayPublished = "StGrayPublished" //灰度发布中
)
var AppStatusMap = map[string]string{
StInDevelopment: "开发中",
StPublishing: "上架申请审核中",
StPublishWithdrawed: "上架申请已撤回",
StPublishApproved: "上架申请已通过",
StPublishRejected: "上架申请已驳回",
StPublished: "已上架",
StUnpublishing: "下架申请审核中",
StUnpublishApproved: "下架申请已通过",
StUnpublishRejected: "下架申请已驳回",
StUnpublished: "已下架",
StDeleted: "已删除",
}
const (
StOwnershipInstalled = "Installed"
StOwnershipUninstalled = "Uninstalled"
)
const (
PLATFORM_ANDROID = "android"
PLATFORM_IOS = "ios"
PLATFROM_IOS_ANDROID = "ios_android"
)
func NotFound(err error) bool {
return err == ErrNotFound
}

View File

@ -0,0 +1,7 @@
package entity
/**
* DDD: domain -
* (Entities)
* /(Aggregates,Aggregate Roots): rootboundary
**/

View File

@ -0,0 +1,9 @@
package entity
type File struct {
FileID string `json:"fileId" bson:"fileId"`
Name string `json:"name" bson:"name"`
UploadDate int64 `json:"uploadDate" bson:"uploadDate"`
Size int64 `json:"size" bson:"size"`
Url string `json:"url" bson:"url"`
}

View File

@ -0,0 +1,19 @@
package entity
type LinkAudit struct {
AuditId string `json:"auditId" bson:"auditId"` //id
Version int `json:"version" bson:"version"` //审核序号
AppId string `json:"appId" bson:"appId"` //应用名称
AppName string `json:"appName" bson:"appName"` //应用名称
BindingId string `json:"bindingId" bson:"bindingId"` //应用名称
BindingName string `json:"bindingName" bson:"bindingName"` //应用名称
GroupID string `json:"groupId" bson:"groupId"` //企业ID
Owner string `json:"owner" bson:"owner"` //所属企业
ApplyBy string `json:"applyBy" bson:"applyBy"` // 申请人
ApplyStatus string `json:"applyStatus" bson:"applyStatus"` // 审核状态
ApplyAt int64 `json:"applyAt" bson:"applyAt"` // timestamp
AuditBy string `json:"auditBy" bson:"auditBy"` // 审核人
AuditAt int64 `json:"auditAt" bson:"auditAt"` // 审核人
AssociateStatus string `json:"associateStatus" bson:"associateStatus"` //绑定状态
Reason string `json:"reason" bson:"reason"` //原因
}

View File

@ -0,0 +1,44 @@
package entity
import (
"errors"
)
var (
MenuIdOrNameExiErr = errors.New("ID OR Name exists")
MenuLockKey = "mop_app_manage_svr_menu_lock_key"
)
type MenuInfo struct {
TraceId string `bson:"traceId" json:"traceId"`
Name string `bson:"name" json:"name"`
InfoId string `bson:"infoId" json:"infoId"`
ImageUrl string `bson:"imageUrl" json:"imageUrl"`
SortNum int `bson:"sortNum" json:"sortNum"`
CreateTime int64 `bson:"createTime" json:"createTime"`
UpdateTime int64 `bson:"updateTime" json:"updateTime"`
UpdateOperator string `bson:"updateOperator" json:"updateOperator"`
}
//type IMenuInfoRepo interface {
// GetInfoByTraceId(ctx context.Context, id string) (*MenuInfo, error)
// GetAllMenuList(ctx context.Context, sort []string) ([]MenuInfo, int, error)
// Add(ctx context.Context, info *MenuInfo) error
// GetNextSortNum(ctx context.Context) (int, error)
// DelByTraceId(ctx context.Context, id string) error
// UpdateInfo(ctx context.Context, id string, info *MenuInfo) error
// AllCount(ctx context.Context) (int, error)
// Sort(ctx context.Context, req *apiproto.MenuSortReq) error
// NotFound(err error) bool
//}
//
//func Lock(ctx context.Context, t time.Duration) error {
// notExi, _ := utils.Setnx(ctx, MenuLockKey, "ok", int(t.Seconds()))
// if notExi {
// return nil
// }
// return errors.New("try lock err")
//}
//func Unlock(ctx context.Context) error {
// return fcredis.Client().Del(ctx, MenuLockKey).Err()
//}

View File

@ -0,0 +1,48 @@
package entity
type SdkMessageInfoObj struct {
Name string `json:"name"` //名称
Provider string `json:"provider"` //提供方
}
type ContactInfoObj struct {
Phone string `json:"phone"` //电话
Email string `json:"email"` //邮箱
WeChat string `json:"weChat"` //微信号
Other string `json:"other"` //其它
}
type UserMessageTypeObj struct {
UserMes string `json:"userMes"` //用户信息
LocationMes string `json:"locationMes"` //位置信息
Microphone string `json:"microphone"` //麦克风
Camera string `json:"camera"` //摄像头
EquipmentMes string `json:"equipmentMes"` //设备信息
AddressBook string `json:"addressBook"` //通讯录
PhotoAlbum string `json:"photoAlbum"` //相册
Calendar string `json:"calendar"` //日历
OperationLog string `json:"operationLog"` //操作日志
Bluetooth string `json:"bluetooth"` //蓝牙
Others string `json:"others"` //其他
//OthersExt string `json:"othersExt"`
}
type PrivacySettingInfo struct {
AppId string `json:"appId"`
CommitType int `json:"commitType"` //提交类型 //1:本小程序开发者承诺并保证,未以任何方式处理用户的任何信息。如后续有处理用户信息,会及时更新《小程序隐私保护指引》 2:本小程序处理了用户信息,将如实填写并及时更新用户信息处理情况
UserMessageType string `json:"userMessageType"` //用户使用类型
SdkMessage string `json:"sdkMessage"` //sdk信息
ContactInfoPhone string `json:"contactInfoPhone"` //联系方式
ContactInfoEmail string `json:"contactInfoEmail"` //联系方式
ContactInfoWeChat string `json:"contactInfoWeChat"` //联系方式
ContactInfoOther string `json:"contactInfoOther"` //联系方式
FixedStorageTime int `json:"fixedStorageTime"` //固定存储时间
IsShortestTime bool `json:"isShortestTime"` //是否是最短时间
AdditionalDocName string `json:"additionalDocName"` //补充文档名称
AdditionalDocContent string `json:"additionalDocContent"` //补充文档内容
AdditionalDocNetDiskId string `json:"additionalDocNetDiskId"` //补充文档网盘id
IsFirstSave bool `json:"isFirstSave"` //是否第一次保存
EffectiveTime int64 `json:"effectiveTime"` //生效时间
CreateTime int64 `json:"createTime"` //创建时间
UpdateTime int64 `json:"updateTime"` //更新时间
}

View File

@ -0,0 +1,127 @@
package apiproto
import "finclip-app-manager/domain/entity"
type ListAppVerReq struct {
AppId string `json:"appId" form:"appId"`
PageNo int `json:"pageNo" form:"pageNo"`
PageSize int `json:"pageSize" form:"pageSize"`
Sort string `json:"sort" form:"sort"`
IsIncludeStatus bool `json:"isIncludeStatus" form:"isIncludeStatus"`
Status string `json:"status" form:"status"`
SearchFields string `json:"searchFields" form:"searchFields"`
SearchText string `json:"searchText" form:"searchText"`
DeveloperId string `json:"developerId" from:"developerId"`
}
type AdminGetAppReviewsReq struct {
PageNo int `form:"pageNo"`
PageSize int `form:"pageSize"`
SearchText string `form:"searchText"`
Status string `form:"status"`
}
type UpdateAppUpinfo struct {
CustomData entity.CustomDataInfo `json:"customData"`
Version string `json:"version"`
Status bool `json:"status"`
}
type UpdateAppInfoReq struct {
AppId string `json:"appId"`
BuildInfoId string `json:"buildInfoId"`
UserId string `json:"userId"`
Username string `json:"username"`
UpInfo UpdateAppUpinfo `json:"upInfo"`
}
type SubmitPublishReqest struct {
Id string `json:"id"` // AppBuildID
AppID string `json:"appId" bson:"appId"`
DeveloperID string `json:"developerId" bson:"developerId"`
NeedAutoPub bool `json:"needAutoPub" bson:"needAutoPub"`
TestInfo entity.TestInfo `json:"testInfo"`
}
type ApproveAppReq struct {
AppID string `json:"appId"`
Sequence int `json:"sequence"`
//AdministratorID string `json:"administratorId" bson:"administratorId"`
Status string `json:"status"`
Reason string `json:"reason"`
RequestFrom string `json:"requestFrom"`
}
type ListAppsToBindReq struct {
BindingId string `form:"bindingId"`
SearchText string `form:"searchText"`
SearchFields string `form:"searchFields"`
PageSize int `form:"pageSize"`
PageNo int `form:"pageNo"`
}
type BatchAppsByIdentityReq struct {
Source string `json:"source"`
IdentityType string `json:"identityType"`
Apps []BatchAppsByIdentityAppsItem `json:"apps"`
}
type BatchAppsByIdentityAppsItem struct {
AppId string `json:"appId"`
Identity string `json:"identity"`
}
type IdentityAppsCheckReq struct {
Source string `json:"source"`
IdentityType string `json:"identityType"`
Apps []IdentityAppsCheckAppsItem `json:"apps"`
}
type IdentityAppsCheckAppsItem struct {
AppId string `json:"appId"`
Identity string `json:"identity"`
}
type UpdateExpireInfoReq struct {
Expire int64 `json:"expire"`
}
type SdkMessageInfoObj struct {
Name string `json:"name"` //名称
Provider string `json:"provider"` //提供方
}
type ContactInfoObj struct {
Phone string `json:"phone"` //电话
Email string `json:"email"` //邮箱
WeChat string `json:"weChat"` //微信号
Other string `json:"other"` //其它
}
type UserMessageTypeObj struct {
UserMes string `json:"userMes"` //用户信息
LocationMes string `json:"locationMes"` //位置信息
Microphone string `json:"microphone"` //麦克风
Camera string `json:"camera"` //摄像头
EquipmentMes string `json:"equipmentMes"` //设备信息
AddressBook string `json:"addressBook"` //通讯录
PhotoAlbum string `json:"photoAlbum"` //相册
Calendar string `json:"calendar"` //日历
OperationLog string `json:"operationLog"` //操作日志
Bluetooth string `json:"bluetooth"` //蓝牙
Others string `json:"others"` //其他
//OthersExt string `json:"othersExt"` //其他
}
type PrivacySettingReq struct {
AppId string `json:"appId"`
CommitType int `json:"commitType"` //提交类型 //1:本小程序开发者承诺并保证,未以任何方式处理用户的任何信息。如后续有处理用户信息,会及时更新《小程序隐私保护指引》 2:本小程序处理了用户信息,将如实填写并及时更新用户信息处理情况
UserMessageType UserMessageTypeObj `json:"userMessageType"` //用户使用类型
SdkMessage []SdkMessageInfoObj `json:"sdkMessage"` //sdk信息
ContactInfo ContactInfoObj `json:"contactInfo"` //联系方式
FixedStorageTime int `json:"fixedStorageTime"` //固定存储时间
IsShortestTime bool `json:"isShortestTime"` //是否是最短时间
AdditionalDocName string `json:"additionalDocName"` //补充文档名称
AdditionalDocNetDiskId string `json:"additionalDocNetDiskId"` //补充文档网盘id
AdditionalDocContent string `json:"additionalDocContent"` //补充文档内容
}

View File

@ -0,0 +1,88 @@
package apiproto
type CreateBundleReq struct {
BundleId string `json:"bundleId"`
Platform string `json:"platform"`
SDKKey string `json:"SDKKey" `
SDKID string `json:"SDKID"`
IsFirstCreate bool `json:"isFirstCreate"`
CreatedAt int64 `json:"createdAt"`
CreatedAccount string `json:"createdAccount"`
CreatedBy string `json:"createdBy"`
IsForbidden int `json:"isForbidden"`
IsReview int `json:"-"`
}
type BindingUpdateReq struct {
IsDev bool
Type string
BindingId string
AppIds []string
Reason string
}
type ListBindingsReq struct {
PullType string `json:"pullType" form:"pullType"`
PageNo int `json:"pageNo" form:"pageNo"`
PageSize int `json:"pageSize" form:"pageSize"`
Sort string `json:"sort" form:"sort"`
SearchFields string `json:"searchFields" form:"searchFields"`
SearchText string `json:"searchText" form:"searchText"`
DeveloperId string `json:"developerId" from:"developerId"`
CooperateStatus string `json:"cooperateStatus" form:"cooperateStatus,default=all"`
Platform int `json:"platform" form:"platform,default=2"`
}
type DevListBindingReq struct {
PullType string
SortType string
PageNo int
PageSize int
SearchTxt string
BindStatus string
UserId string
Platform int
}
type GetBindingsByAppIdReq struct {
PageNo int `json:"pageNo" form:"pageNo"`
PageSize int `json:"pageSize" form:"pageSize"`
AppId string `json:"appId" form:"appId"`
}
type BindingUpdateRequest struct {
BindingID string `json:"bindingId" bson:"bindingId"`
Operation string `json:"operation" bson:"operation"`
AppIDs []string `json:"appIds" bson:"appIds"`
AppName string `json:"appName" bson:"appName"`
Owner string `json:"owner" bson:"owner"`
BundlesInfo []CreateBundleReq `json:"bundleInfos" bson:"bundleInfos"`
AddLimitNum int `json:"addLimitNum" bson:"addLimitNum"`
AutoBind int `json:"autoBind"`
HiddenBundle int `json:"hiddenBundle"`
Reason string `json:"reason"`
ToBindingID string `json:"toBindingId"`
}
type SyncOrganBindingReq struct {
GroupID string `json:"groupId"`
GroupName string `json:"groupName"`
Operation string `json:"operation"`
}
type ListReviewBundleReq struct {
SearchText string `json:"searchText" form:"searchText"`
PageSize int `json:"pageSize" form:"pageSize"`
PageNo int `json:"pageNo" form:"pageNo"`
Type int `json:"type" form:"type"`
}
type BundleReviewItem struct {
BindingId string `json:"bindingId"`
BundleId string `json:"bundleId"`
}
type UpdateReviewBundleReq struct {
Operation string `json:"operation"`
Reviews []BundleReviewItem `json:"reviews"`
}

View File

@ -0,0 +1,36 @@
package apiproto
type AddMenuReq struct {
Name string `json:"name"`
ID string `json:"id"`
Image string `json:"image"`
}
type UpdateMenuReq struct {
Name string `json:"name"`
ID string `json:"id"`
Image string `json:"image"`
}
type GetAllMenuRspItem struct {
TraceId string `json:"traceId" `
Name string `json:"name"`
ID string `json:"id" `
Image string `json:"image" `
SortNum int `json:"sortNum" `
CreateTime int64 `json:"createTime"` //创建时间
UpdateTime int64 `json:"updateTime"` //更新时间
UpdateOperator string `json:"updateOperator"` //更新时间
}
type GetAllMenuRsp struct {
Total int `json:"total"`
List []GetAllMenuRspItem `json:"list"`
}
type MenuSortReq struct {
List []struct {
TraceId string `json:"traceId"`
SortNum int `json:"sortNum"`
} `json:"list"`
}

View File

@ -0,0 +1,52 @@
package apiproto
type UpdateTrialAppPathReq struct {
TraceId string `json:"traceId"`
PathAndQuery string `json:"pathAndQuery"`
}
type GetBuildAppInfoReq struct {
Type string `json:"type"`
CodeId string `json:"codeId"`
}
type ManageReleaseInfo struct {
AppId string `json:"appId"`
Version string `json:"version"`
VersionDescription string `json:"versionDescription"`
CreateBy string `json:"createBy"`
CreateAt int64 `json:"createAt"`
}
type ManageTrialInfo struct {
CodeId string `json:"codeId"`
Version string `json:"version"`
VersionDescription string `json:"versionDescription"`
CreateBy string `json:"createBy"`
CreateAt int64 `json:"createAt"`
QrcodeSign string `json:"qrcodeSign"`
}
type ManageDevInfo struct {
List []ManageDevInfoItem `json:"list"`
Total int `json:"total"`
}
type ManageDevInfoItem struct {
CodeId string `json:"codeId"`
Version string `json:"version"`
VersionDescription string `json:"versionDescription"`
CreateBy string `json:"createBy"`
CreateAt int64 `json:"createAt"`
QrcodeSign string `json:"qrcodeSign"`
}
type GetManageAppVerListRspData struct {
ReleaseInfo *ManageReleaseInfo `json:"releaseInfo"`
TrialInfo *ManageTrialInfo `json:"trialInfo"`
DevInfo *ManageDevInfo `json:"devInfo"`
ApiServer string `json:"apiServer"`
}
type GetManageAppListRspDataItem struct {
AppId string `json:"appId"`
Logo string `json:"logo"`
Name string `json:"name"`
}

View File

@ -0,0 +1,13 @@
package apiproto
type UpdateWechatInfoReq struct {
AppId string `json:"appId"`
WechatAppSecret string `json:"wechatAppSecret"`
WechatAppId string `json:"wechatAppId"`
WechatPath string `json:"wechatPath"`
WechatSize string `json:"wechatSize"`
}
type DeleteWechatInfoReq struct {
AppId string `json:"appId"`
}

View File

@ -0,0 +1,102 @@
package proto
type AppUpdateReq struct {
AppId string `json:"appId"`
Name string `json:"name"`
Logo string `json:"logo"`
AppClass string `json:"appClass"`
AppTag []string `json:"appTag"`
CoreDescription string `json:"coreDescription"`
CustomData struct {
DetailDescription string `json:"detailDescription"`
} `json:"customData"`
}
type AppIsForbiddenUpdateReq struct {
AppId string `json:"appId"`
IsForbidden int `json:"isForbidden"` //0:未禁用 1:禁用
}
type CreateAppReq struct {
AppClass string `json:"appClass"`
AppTag []string `json:"appTag"`
AppType string `json:"appType"`
CoreDescription string `json:"coreDescription"`
Logo string `json:"logo"`
Name string `json:"name"`
ProjectType int `json:"projectType"`
}
type MenuInfoRspDataItem struct {
Name string `json:"name"`
ID string `json:"id"`
Image string `json:"image"`
}
type MenuInfoRspData struct {
Total int `json:"total"`
List []MenuInfoRspDataItem `json:"list"`
}
type ApiInfoRspData struct {
ApiName string `json:"apiName"`
Url string `json:"url"`
}
type RspCustomDataSourceFile struct {
FileMd5 string `json:"fileMd5"`
Name string `json:"name"`
SourceFileUrl string `json:"sourceFileUrl"`
UploadDate int64 `json:"uploadDate"`
Url string `json:"url"`
BasicPackVer string `json:"basicPackVer"`
Packages []Package `json:"packages"`
}
type AppRspDomainInfo struct {
Business map[string]interface{} `json:"business"`
Service map[string]interface{} `json:"service"`
Whitelist map[string]interface{} `json:"whitelist"`
}
type AppRuntimeDomainData struct {
Service struct {
Request []string `json:"request"`
Socket []string `json:"socket"`
Download []string `json:"download"`
Upload []string `json:"upload"`
} `json:"service"`
Business struct {
Domains []string `json:"domains"`
} `json:"business"`
Whitelist struct {
Domains []string `json:"domains"`
} `json:"whitelist"`
Blacklist struct {
Domains []string `json:"domains"`
} `json:"blacklist"`
}
type AppRspCustomData struct {
DetailDescription string `json:"detailDescription"` //小程序详细描述
SourceFile []RspCustomDataSourceFile `json:"sourceFile"`
VersionDescription string `json:"versionDescription"` //小程序编译包版本描述
AppRuntimeDomain AppRuntimeDomainData `json:"appRuntimeDomain"`
MenuInfo *MenuInfoRspData `json:"menuInfo"` //菜单信息
ApiInfo *[]ApiInfoRspData `json:"apiInfo"` // 已备案接口列表
}
type AppRspStatus struct {
Value string `json:"value"`
Reason string `json:"reason"`
LastUpdated int64 `json:"lastUpdated"`
ModifiedBy string `json:"modifiedBy"`
}
type WechatLoginInfo struct {
WechatOriginId string `json:"wechatOriginId"`
ProfileUrl string `json:"profileUrl"`
PhoneUrl string `json:"phoneUrl"`
PaymentUrl string `json:"paymentUrl"`
ExtUrls []ExtUrls `json:"extUrls"`
}
type ExtUrls struct {
FieldName string `json:"fieldName"`
PageUrl string `json:"pageUrl"`
}

View File

@ -0,0 +1,29 @@
package proto
type UpdateTempAppInfoReq struct {
FileMd5 string `json:"fileMd5"`
Name string `json:"name"`
SourceFileUrl string `json:"sourceFileUrl"`
UploadDate int64 `json:"uploadDate"`
Url string `json:"url"`
EncryptedUrl string `json:"encryptedUrl"`
EncryptedFileMd5 string `json:"encryptedFileMd5"`
AppName string `json:"appName"`
AppLogo string `json:"appLogo"`
Packages []Package `json:"packages"`
EncryptPackages []Package `json:"encryptPackages"`
}
type Package struct {
Root string `json:"root" bson:"root"`
Name string `json:"name" bson:"name"`
Pages []string `json:"pages" bson:"pages"`
Independent bool `json:"independent" bson:"independent"`
Filename string `json:"filename" bson:"filename"`
FileUrl string `json:"fileUrl" bson:"fileUrl"`
FileMd5 string `json:"fileMd5" bson:"fileMd5"`
}
type CreateTempAppInfoReq struct {
ProjectType int `json:"projectType"`
}

View File

@ -0,0 +1,17 @@
package proto
type GenQrcodeReq struct {
Type string `json:"type"`
AppId string `json:"appId"`
CodeId string `json:"codeId"`
Sequence int `json:"sequence"`
ApiServer string `json:"apiServer"`
Limit string `json:"limit"`
StartParams AppStartParams `json:"startParams"` //小程序启动参数
DebugInfo map[string]interface{} `json:"debugInfo"` //真机调试模式扩展信息
}
type AppStartParams struct {
Path string `json:"path"`
Query string `json:"query"`
}

View File

@ -0,0 +1,59 @@
package entity
import "errors"
var (
ErrNotFound = errors.New("not found")
)
//状态信息
type Status struct {
Value string `json:"value" bson:"value"`
Reason string `json:"reason" bson:"reason"`
LastUpdated int64 `json:"lastUpdated" bson:"lastUpdated"`
ModifiedBy string `json:"modifiedBy" bson:"modifiedBy"`
}
type SpecificStatus struct {
Reason string `json:"reason" bson:"reson"`
LastUpdated int64 `json:"lastUpdated" bson:"lastUpdated"`
ModifiedBy string `json:"modifiedBy" bson:"modifiedBy"`
}
type UnpublishedStatus struct {
Reason string `json:"reason" bson:"reson"`
LastUpdated int64 `json:"lastUpdated" bson:"lastUpdated"`
ModifiedBy string `json:"modifiedBy" bson:"modifiedBy"`
Type string `json:"type" bson:"type"`
}
type CustomDataSourceFile struct {
FileMd5 string `bson:"fileMd5" json:"fileMd5"`
Name string `bson:"name" json:"name"`
SourceFileUrl string `bson:"sourceFileUrl" json:"sourceFileUrl"`
UploadDate int64 `bson:"uploadDate" json:"uploadDate"`
Url string `bson:"url" json:"url"`
EncryptedUrl string `bson:"encryptedUrl" json:"encryptedUrl"`
EncryptedFileMd5 string `bson:"encryptedFileMd5" json:"encryptedFileMd5"`
EncryptedFileSha256 string `bson:"encryptedFileSha256" json:"encryptedFileSha256"`
BasicPackVer string `bson:"basicPackVer" json:"basicPackVer"`
Packages []Package `bson:"packages"`
EncryptPackages []Package `bson:"encryptPackages"`
}
type Package struct {
Root string `json:"root" bson:"root"`
Name string `json:"name" bson:"name"`
Pages []string `json:"pages" bson:"pages"`
Independent bool `json:"independent" bson:"independent"`
Filename string `json:"filename" bson:"filename"`
FileUrl string `json:"fileUrl" bson:"fileUrl"`
FileMd5 string `json:"fileMd5" bson:"fileMd5"`
}
type CustomDataInfo struct {
DetailDescription string `bson:"detailDescription" json:"detailDescription"` //小程序详细描述
SourceFile []CustomDataSourceFile `bson:"sourceFile" json:"sourceFile"`
VersionDescription string `bson:"versionDescription" json:"versionDescription"` //小程序编译包版本描述
Developer string `bson:"developer" json:"developer"` //开发者
}

View File

@ -0,0 +1,46 @@
package entity
const QRCODEINFO_DB_NAME = "qrCodeInfo"
const (
QrCodeTypeReview = "review" //审核版二维码信息
QrCodeTypeTrial = "trial" //体验版
QrCodeTypeTemporary = "temporary" //临时版
QrCodeTypeRelease = "release" //线上版
QrCodeTypeRomoteDebug = "remoteDebug" //真机调试版
)
//AppStartParams 小程序启动参数
type AppStartParams struct {
PathAndQuery string `json:"pathAndQuery" bson:"path_and_query"`
}
type QrCodeInfo struct {
Type string `json:"type" bson:"type"` //二维码的类型
Uuid string `json:"uuid" bson:"uuid"` //标识该二维码
AppId string `json:"appId" bson:"appId"` //小程序Id
Sequence int `json:"sequence" bson:"sequence"` //小程序序列号
ApiServer string `json:"apiServer" bson:"apiServer"` //小程序apiServer
CodeId string `json:"codeId" bson:"codeId"` //标识某个编译版本的id
StartParams AppStartParams `json:"startParams" bson:"startParams"` //小程序启动参数
ExpireTime int64 `json:"expireTime" bson:"expireTime"` //过期时间
CreateTime int64 `json:"createTime" bson:"createTime"` //创建时间
UpdateTime int64 `json:"updateTime" bson:"UpdateTime"` //更新时间
DeleteTime int64 `json:"deleteTime" bson:"DeleteTime"` //删除时间-暂不用
DebugInfo map[string]interface{} `json:"debugInfo" bson:"debugInfo"` //拓展数据
}
//type IQrCodeInfoRepo interface {
// Insert(ctx context.Context, info *QrCodeInfo) error
// GenInfo(ctx context.Context, info *QrCodeInfo) error
// GetInfoByUuid(ctx context.Context, uuid string) (*QrCodeInfo, error)
// GetReviewInfo(ctx context.Context, appId string, seq int) (*QrCodeInfo, error)
// GetReleaseInfo(ctx context.Context, appId string) (*QrCodeInfo, error)
// GetTrialInfo(ctx context.Context, appId string) (*QrCodeInfo, error)
// GetTemporaryInfo(ctx context.Context, appId string, seq int) (*QrCodeInfo, error)
// UpdateTrialStartParams(ctx context.Context, codeId string, p AppStartParams) error
// UpdateApiServer(ctx context.Context, uuid string, apiServer string) error
// UpdateInfo(ctx context.Context, uuid string, upInfo map[string]interface{}) error
// GenReviewQrCodeInfo(ctx context.Context, info *QrCodeInfo) error
// NotFound(err error) bool
//}

View File

@ -0,0 +1,9 @@
package entity
type RedDotReadRecord struct {
Type string `json:"type" bson:"type"` //红点类型
TraceId string `json:"traceId" bson:"traceId"` //红点唯一标识
AccountId string `json:"accountId" bson:"accountId"` //已经阅读的账户Id
CreateTime int64 `json:"createTime" bson:"createTime""` //创建时间
UpdateTime int64 `json:"updateTime" bson:"UpdateTime"` //更新时间
}

View File

@ -0,0 +1,146 @@
package entity
import "gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo/bson"
const TYPECONFIG_DB_NAME = "typeConfig"
type TypeConfigCustomData struct {
Chinese string `json:Chinese bson:Chinese`
}
type TypeConfig struct {
TypeConfigID string `json:"typeConfigId" bson:"typeConfigId"`
Namespace string `json:"namespace" bson:"namespace"`
Value string `json:"value" bson:"value"`
MarketID string `json:"marketId" bson:"marketId"`
CustomData TypeConfigCustomData `json:"customData" bson:"customData"`
SortNum int `json:"sortNum" bson:"sortNum"`
}
//type ITypeConfigRepo interface {
// Insert(ctx context.Context, typeConfig *TypeConfig) error
// GetOne(ctx context.Context, filter bson.M) error
// Exist(ctx context.Context, namespace string, value string) (bool, error)
// Update(ctx context.Context, selector bson.M, update bson.M) error
// GetSome(ctx context.Context, filter bson.M, sort []string, pageSize, pageNo int) (int, []TypeConfig, error)
// Delete(ctx context.Context, typeConfigId string) error
// GetNowSortNumInfo(ctx context.Context) (*TypeConfig, error)
// NotFound(err error) bool
//}
//
type TypeConfigList []TypeConfig
func (l TypeConfigList) Len() int {
return len(l)
}
func (l TypeConfigList) Less(i, j int) bool {
return l[i].SortNum < l[j].SortNum
}
func (l TypeConfigList) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
var MopCfg = []TypeConfig{
{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "jinrong",
CustomData: TypeConfigCustomData{
Chinese: "金融",
},
SortNum: 1,
},
{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "zixun",
CustomData: TypeConfigCustomData{
Chinese: "资讯",
},
SortNum: 2,
},
{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "gongju",
CustomData: TypeConfigCustomData{
Chinese: "工具",
},
SortNum: 3,
},
/*{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "qita",
CustomData: TypeConfigCustomData{
Chinese: "其他",
},
SortNum: 4,
},*/
/*{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "LifeService",
CustomData: TypeConfigCustomData{
Chinese: "生活服务",
},
SortNum: 5,
},
{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "GovernmentAffairs",
CustomData: TypeConfigCustomData{
Chinese: "政务",
},
SortNum: 6,
},
{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "Education",
CustomData: TypeConfigCustomData{
Chinese: "教育",
},
SortNum: 7,
},
{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "E-commerce",
CustomData: TypeConfigCustomData{
Chinese: "电商",
},
SortNum: 8,
},*/
//"其它"要一直在最后
{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "qita",
CustomData: TypeConfigCustomData{
Chinese: "其他",
},
SortNum: 99990000,
},
//研报、投教为老数据保留下对之前做兼容chinese修改为投教研报
/*{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "Report",
CustomData: TypeConfigCustomData{
Chinese: "投教研报",
},
SortNum: 99990001,
},
{
TypeConfigID: bson.NewObjectId().Hex(),
Namespace: "appClass",
Value: "Teach",
CustomData: TypeConfigCustomData{
Chinese: "投教研报",
},
SortNum: 99990002,
},*/
}

View File

@ -0,0 +1,16 @@
package entity
type WechatInfo struct {
Id string `json:"id" bson:"id"`
AppID string `json:"appId" bson:"appId"`
GroupID string `json:"groupId" bson:"groupId"`
Created int64 `json:"created" bson:"created"`
Updated int64 `json:"updated" bson:"updated"`
WechatAppSecret string `json:"wechatAppSecret" bson:"wechatAppSecret"`
WechatAppId string `json:"wechatAppId" bson:"wechatAppId"`
WechatPath string `json:"wechatPath" bson:"wechatPath"`
WechatSize string `json:"wechatSize" bson:"wechatSize"`
QrcodeUrl string `json:"qrcodeUrl" bson:"qrcodeUrl"`
QrcodeDownloadUrl string `json:"qrcodeDownloadUrl" bson:"qrcodeDownloadUrl"`
}

View File

@ -0,0 +1,5 @@
package entityFac
/**
* DDD: domain --
**/

View File

@ -0,0 +1,6 @@
package factory
/**
* DDD: domain -
* (Factories):
**/

View File

@ -0,0 +1,5 @@
package valueObjFac
/**
* DDD: domain --
**/

View File

@ -0,0 +1,73 @@
package repository
import (
"context"
"errors"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto/apiproto"
mgo "gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo"
"gorm.io/gorm"
)
type AppRepository interface {
AppCount(ctx context.Context, organId string) (int, error)
InsertApp(ctx context.Context, info entity.App) error
GetAppInfo(ctx context.Context, appId string) (entity.App, error)
UpdateApp(ctx context.Context, info entity.App) error
GetAppVerInfo(ctx context.Context, appId string, seq int) (entity.AppVersion, error)
GetOnlineAppVer(ctx context.Context, appId string) (entity.AppVersion, error)
GetLatestPubAppVer(ctx context.Context, appId string) (entity.AppVersion, error)
GetLatestReviewAppVer(ctx context.Context, appId string) (entity.AppVersion, error)
GetAllPermitGrayPubVers(ctx context.Context, appId string, nowPubSeq int) ([]entity.AppVersion, error)
GetMaxSeqAppVer(ctx context.Context, appId string) (entity.AppVersion, error)
UpdateAppVerAppName(ctx context.Context, appId, appName string) error
SubmitApp(ctx context.Context, req entity.SubmitAppReq, expire int64, userId string) error
WithdrawPubApp(ctx context.Context, appId string, seq int, account string) error
PubApp(ctx context.Context, appId string, seq int, account string, isDev, isRollback bool) error
UnpubApp(ctx context.Context, appId string, seq int, account, reason string, isDev bool) error
ListApps(ctx context.Context, groupId string, pageNo, pageSize int, searchText string, sortType, pullType string) (int, []entity.App, error)
ListAppVers(ctx context.Context, pageNo, pageSize int, searchText string, t string, groupId string) (int, []entity.AppVersion, error)
ListAppVersByAppId(ctx context.Context, appId string, pageNo, pageSize int) (int, []entity.AppVersion, error)
GetAppReviews(ctx context.Context, req apiproto.AdminGetAppReviewsReq) (int, []entity.AppVersion, error)
GetAllPublishedVerList(ctx context.Context, appId string) ([]entity.AppVersion, int, error)
GetPublishedAppList(ctx context.Context, pageNo, pageSize int, searchText string) ([]entity.AppVersion, int, error)
GetAllVers(ctx context.Context, appId string) ([]entity.AppVersion, int, error)
GetAppsByAppIds(ctx context.Context, appIds []string) ([]entity.App, error)
GetAppsByGroupIds(ctx context.Context, groupIds []string) (int, []entity.App, error)
GetAppsToBinding(ctx context.Context, bindingId string, pageNo, pageSize int, searchText string) (int, []entity.App, error)
GetLinkAppsByBindingId(ctx context.Context, bindingId string, pageNo, pageSize int, searchText string) (int, []entity.App, error)
GetLinkAppsBySDKKey(ctx context.Context, sdkKey string, pageNo, pageSize int) (int, []entity.App, error)
AdminGetLinkApps(ctx context.Context, pageNo, pageSize int, searchText string) (int, []entity.AdminGetLinkAppsRspItem, error)
ApproveApp(ctx context.Context, appId string, seq int, account, reason string, isPass bool) error
GetRollbackAbleList(ctx context.Context, groupId, appId string, latestPubSeq int) ([]entity.AppVersion, error)
UpdateGrayStatus(ctx context.Context, appId string, seq int, status bool) error
UpdateExpire(ctx context.Context, appId string, expire int64) error
UpdateExpireAppVersion(ctx context.Context, appId string, seq int, expire int64) error
//statistics
GetCreatedStatistics(ctx context.Context, startTime, endTime int64, groupId string, isForbidden int) (int, error)
GetPublishedStatistics(ctx context.Context, startTime, endTime int64, groupId string) (int, error)
GetSubmittedStatistics(ctx context.Context, startTime, endTime int64, groupId string, distinct bool) (int, error)
GetApprovedStatistics(ctx context.Context, startTime, endTime int64, groupId string, distinct bool) (int, error)
GetAppClassPer(ctx context.Context, status string) ([]entity.AppClassPerRsp, error)
GetGrayStatisticsVerList(ctx context.Context, appId string, seq int, begin, end int64) (int, []entity.AppVersion, error)
//对接wx
GetAppVerLimitByIdentity(ctx context.Context, t, appId, identity string, limit int) ([]entity.AppVersion, error)
GetAppClassList(ctx context.Context) ([]entity.CItem, error)
GetAppTagList(ctx context.Context) ([]entity.TagItem, error)
GetAppsBySearchText(ctx context.Context, searchText string) ([]entity.App, error)
GetAppByCreator(ctx context.Context, phone string) ([]entity.App, error)
}
func NotFound(err error) bool {
return err == gorm.ErrRecordNotFound ||
err == mgo.ErrNotFound ||
err == entity.NotFoundErr ||
err == entity.ErrNotFound ||
errors.Is(err, gorm.ErrRecordNotFound)
}

View File

@ -0,0 +1,25 @@
package repository
import (
"context"
"finclip-app-manager/domain/entity"
)
type IAppBuildInfoRepo interface {
Insert(ctx context.Context, item entity.AppBuildInfo) error
GetLatestInfoByAppId(ctx context.Context, appId string) (*entity.AppBuildInfo, error)
GetInfoById(ctx context.Context, id string) (*entity.AppBuildInfo, error)
GetInfoByBuildInfoId(ctx context.Context, buildInfoId string) (*entity.AppBuildInfo, error)
GetTrialInfoByAppId(ctx context.Context, appId string) (*entity.AppBuildInfo, error)
GetTrialInfoById(ctx context.Context, id string) (*entity.AppBuildInfo, error)
AddTrial(ctx context.Context, id string) error
CancelTrial(ctx context.Context, id string) error
UpdateTrialStartParams(ctx context.Context, id string, params entity.AppStartParams) error
UpdateTrialPath(ctx context.Context, id, path string) error
UpdateOneStatus(ctx context.Context, id string, status bool) error
GetList(ctx context.Context, appId string, pageNo, pageSize int) (int64, []entity.AppBuildInfo, error)
GetAll(ctx context.Context) ([]entity.AppBuildInfo, error)
GetAppBuilds(ctx context.Context, groupID, appId string, pageSize, pageNo int) (int64, []entity.AppBuildInfo, error)
NotFound(err error) bool
GetInfoByBuildId(ctx context.Context, id string) (*entity.AppBuildInfo, error)
}

View File

@ -0,0 +1,23 @@
package repository
import (
"context"
)
type AppOperConfig struct {
Id uint64 `gorm:"primary_key;column:id;type:BIGINT(16) AUTO_INCREMENT;comment:'自增id'" sql:"auto_increment;primary_key"`
AutoReviewApp int `json:"autoReviewApp" bson:"auto_review_app" gorm:"column:auto_review_app;type:tinyint(4);comment:"是否自动审核小程序"`
CreateTime int64 `json:"createTime" bson:"create_time" gorm:"column:create_time;type:BIGINT(16);NOT NULL;comment:'创建时间'"` //创建时间
UpdateTime int64 `json:"updateTime" bson:"update_time" gorm:"column:update_time;type:BIGINT(16);default:0;comment:'更新时间'"` //更新时间
}
func (AppOperConfig) TableName() string {
return "app_oper_config"
}
type IAppOperConfigRepo interface {
Insert(ctx context.Context, item AppOperConfig) error
Update(ctx context.Context, item AppOperConfig) error
Find(ctx context.Context) (AppOperConfig, error)
}

View File

@ -0,0 +1,100 @@
package repository
import (
"context"
"finclip-app-manager/domain/entity"
"time"
)
//const APPTEMPINFO_DB_NAME = "appTempInfo"
//
//var (
// AppTempDefSequence = 1
// appTempNotFoundErr = errors.New("NOT FOUND")
//)
//
//type CustomDataInfo struct {
// DetailDescription string `bson:"detail_description" json:"detailDescription"` //小程序详细描述
// SourceFile []CustomDataSourceFile `bson:"source_file" json:"sourceFile"`
// VersionDescription string `bson:"version_description" json:"versionDescription"` //小程序编译包版本描述
// Developer string `bson:"developer" json:"developer"` //开发者
//}
//
//type CustomDataSourceFile struct {
// FileMd5 string `bson:"file_md5" json:"fileMd5"`
// Name string `bson:"name" json:"name"`
// SourceFileUrl string `bson:"source_file_url" json:"sourceFileUrl"`
// UploadDate int64 `bson:"upload_date" json:"uploadDate"`
// Url string `bson:"url" json:"url"`
// EncryptedUrl string `bson:"encrypted_url" json:"encryptedUrl"`
// EncryptedFileMd5 string `bson:"encrypted_file_md5" json:"encryptedFileMd5"`
// EncryptedFileSha256 string `bson:"encrypted_file_sha256" json:"encryptedFileSha256"`
// BasicPackVer string `bson:"basic_pack_ver" json:"basicPackVer"`
// Packages []Package `bson:"packages"`
// EncryptPackages []Package `bson:"encrypt_packages"`
//}
//
//type Package struct {
// Root string `json:"root" bson:"root"`
// Name string `json:"name" bson:"name"`
// Pages []string `json:"pages" bson:"pages"`
// Independent bool `json:"independent" bson:"independent"`
// Filename string `json:"filename" bson:"filename"`
// FileUrl string `json:"fileUrl" bson:"file_url"`
// FileMd5 string `json:"fileMd5" bson:"file_md5"`
//}
//
//type AppTempInfo struct {
// AppID string `json:"appId" bson:"app_id"` //id
// Name string `json:"name" bson:"name"` //名字
// Sequence int `json:"sequence" bson:"sequence"` //版本号
// AppClass string `json:"appClass" bson:"app_class"` //用途
// AppType string `json:"appType" bson:"app_type"` //应用类型--mop使用为了和应用市场区分开
// Status Status `json:"status" bson:"status"` //状态
// DeveloperID string `json:"developerId" bson:"developer_id"` //开发者id
// GroupID string `json:"groupId" bson:"group_id"` //组id
// Created int64 `json:"created" bson:"created"`
// CreatedBy string `json:"createdBy" bson:"created_by"`
// CustomData CustomDataInfo `json:"customData" bson:"custom_data"` //预留
// Version string `json:"version" bson:"version"` //应用版本
// CoreDescription string `json:"coreDescription" bson:"core_description"` //核心描述
// Logo string `json:"logo" bson:"logo"` //图标
//}
type IAppTempInfoRepo interface {
Insert(ctx context.Context, info *entity.AppTempInfo) error
UpdateInfo(ctx context.Context, info *entity.AppTempInfo) error
GetInfoByAppId(ctx context.Context, appId string) (*entity.AppTempInfo, error)
GetInfoByAppIdAndSeq(ctx context.Context, appId string, seq int) (*entity.AppTempInfo, error)
NotFound(err error) bool
}
func NewDefaultInfo(appId string, projectType int) *entity.AppTempInfo {
now := time.Now().UnixNano() / 1e6
return &entity.AppTempInfo{
AppID: appId,
Name: "",
Sequence: entity.AppTempDefSequence,
AppClass: "Others",
AppType: "Applet",
Status: entity.Status{
Value: "Published",
Reason: "ide测试",
LastUpdated: now,
ModifiedBy: "ide测试",
},
DeveloperID: "",
GroupID: "",
Created: now,
CreatedBy: "",
CustomData: entity.CustomDataInfo{
DetailDescription: "ide测试小程序",
VersionDescription: "ide测试小程序",
SourceFile: make([]entity.CustomDataSourceFile, 0),
},
Version: "1.0.0",
CoreDescription: "ide测试小程序",
Logo: "",
ProjectType: projectType,
}
}

View File

@ -0,0 +1,137 @@
package repository
import (
"context"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto/apiproto"
)
//const BINDING_DB_NAME = "binding"
//const BUNDLEINFO_DB_NAME = "bundleInfo"
//
//const (
// BUNDLE_ID_LIMITI = 2
//)
//
//var SdkExiCache *cache.Cache
//
//type Status struct {
// Value string `json:"value" bson:"value"`
// Reason string `json:"reason" bson:"reason"`
// LastUpdated int64 `json:"lastUpdated" bson:"last_updated"`
// ModifiedBy string `json:"modifiedBy" bson:"modified_by"`
//}
//
//type SpecificStatus struct {
// Reason string `json:"reason" bson:"reson"`
// LastUpdated int64 `json:"lastUpdated" bson:"last_updated"`
// ModifiedBy string `json:"modifiedBy" bson:"modified_by"`
//}
//
//type UnpublishedStatus struct {
// Reason string `json:"reason" bson:"reson"`
// LastUpdated int64 `json:"lastUpdated" bson:"last_ipdated"`
// ModifiedBy string `json:"modifiedBy" bson:"modified_by"`
// Type string `json:"type" bson:"type"`
//}
//
//type BundleInfo struct {
// BundleID string `json:"bundleId" bson:"bundle_id"`
// Remark string `json:"remark" bson:"remark"`
// SDKKey string `json:"SDKKey" bson:"sdk_key"`
// SDKID string `json:"SDKID" bson:"sdk_id"`
// IsFirstCreate bool `json:"isFirstCreate" bson:"is_first_create"` //是否第一次创建
// CreatedAt int64 `json:"createdAt" bson:"created_at"`
// CreatedAccount string `json:"createdAccount" bson:"created_account"`
// CreatedBy string `json:"createdBy" bson:"created_by"`
//}
//
//type CreatedInfo struct {
// CreatedBy string `json:"createdBy" bson:"created_by"`
// CreatedAt int64 `json:"createdAt" bson:"created_at"`
//}
//
//type AppInfo struct {
// AppID string `json:"appId" bson:"app_id"`
// AssociatedAt int64 `json:"associatedAt" bson:"associated_at"`
// AssociatedBy string `json:"associatedBy" bson:"associated_by"`
//}
//
////应用维度
//type Binding struct {
// BindingID string `json:"bindingId" bson:"binding_id"` //应用的id
// Name string `json:"name" bson:"name"` //应用名称
// BundleInfos []BundleInfo `json:"bundleInfos" bson:"bundle_infos"` //bundle ids
// CreatedInfo CreatedInfo `json:"createdInfo" bson:"created_info"` //创建信息
// GroupID string `json:"groupId" bson:"group_id"` //企业ID
// GroupName string `json:"groupName" bson:"group_name"` //企业名称(为了查询)
// CooperateStatus Status `json:"cooperateStatus" bson:"cooperate_status"` //合作状态
// CooperateValidStatus SpecificStatus `json:"cooperateValidStatus" bson:"cooperate_valid_status"` //合作状态详情
// CooperateInvalidStatus SpecificStatus `json:"cooperateInvalidStatus" bson:"cooperate_invalid_status"` //解除合作状态详情
// AppInfos []AppInfo `json:"appInfos" bson:"app_infos"` //appid 的信息
// Owner string `json:"owner" bson:"owner"` //所属企业
// Expire int64 `json:"expire" bson:"expire"`
// ApiServer string `json:"apiServer" bson:"api_server"` //子域名
//}
type IBindingRepo interface {
GetInfo(ctx context.Context, bindingId string) (*entity.Binding, error)
GetByGroupIdAndName(ctx context.Context, groupId string, name string, isAdmin bool) (*entity.Binding, error)
GetByApiServer(ctx context.Context, apiServer string) (entity.Binding, error)
GetInfoByParams(ctx context.Context, sdkKey, organId, appId string) (*entity.Binding, error)
GetInfoBySdkKeyOrganId(ctx context.Context, organId, sdkKey string) (*entity.Binding, error)
GetAllSdkKey(ctx context.Context, organId string) ([]string, error)
GetBindListBySdkKey(ctx context.Context, sdkKey string) ([]entity.Binding, error)
SdkKeyExi(ctx context.Context, sdkKey string) (bool, error)
Insert(ctx context.Context, bind *entity.Binding) error
Count(ctx context.Context) (int, error)
GetCountByStatus(ctx context.Context, status string, platform int) (int, error)
GetBundleIdNum(ctx context.Context) (int, error)
GetBundleIdLimitHand(ctx context.Context, groupId string) (int, error)
GetBundleLimit(ctx context.Context) (int, error)
GetBindingByGroupIdAndBindingId(ctx context.Context, groupId string, bindingId string) (*entity.Binding, error)
GetBindingByGroupIdAndSdkKey(ctx context.Context, groupId string, sdkKey string) (*entity.Binding, error)
UpdateBundleInfosByGroupIdAndBindId(ctx context.Context, groupId string, bindingId string, infos []entity.BundleInfo) error
AppendBundles(ctx context.Context, bindingId, groupId string, bundles []entity.BundleInfo) error
UpdateBundles(ctx context.Context, bindingId, groupId string, bundles []entity.BundleInfo) error
GetByBindIdList(ctx context.Context, ids []string) ([]entity.Binding, error)
GetBindListByGroupId(ctx context.Context, groupId string, pageSize int, pageNo int) ([]entity.Binding, int, error)
UpdateByBindId(ctx context.Context, bindingId string, bind *entity.Binding) error
UpdateExpire(ctx context.Context, bindingId string, expire int64) error
BundleIdCount(ctx context.Context, groupId string) (int, error)
GetBundleByGroupIdAndBundleId(ctx context.Context, groupId string, bundleId string) (*entity.Binding, error)
GetbundlesByBundleId(ctx context.Context, bundleId string) (*entity.Binding, error)
GetBindingsBySearch(ctx context.Context, pageSize int, pageNo int, sort string, searchText string, searchFields string, cooperateStatus string, platform int) ([]entity.Binding, int, error)
GetBindingsByAppId(ctx context.Context, pageSize int, pageNo int, appId string) ([]entity.Binding, int, error)
GetDevListBinding(ctx context.Context, pageSize int, pageNo int, sort string, searchText string, pullType string, groupId string, bindStatus string, platform int) ([]entity.Binding, int, error)
GetBindingBySdkKey(ctx context.Context, sdkKey string) (*entity.Binding, error)
ListBindings(ctx context.Context, groupId string, searchText string, pageNo int, pageSize int) ([]entity.Binding, int, error)
GetAllAssBinds(ctx context.Context, appId string) ([]entity.Binding, error)
UpdateBundleIdIsForbidden(ctx context.Context, bundleId string) error
UpdateBundleIdPlatform(ctx context.Context, bundleId, platform string) error
UpdateRelatedBindingCooperate(ctx context.Context, bindingId string, status entity.Status, specificStatus entity.SpecificStatus, cooperate bool) error
UpdateBindingInfo(ctx context.Context, bindingId string, info map[string]interface{}, platform int) error
UpdateBindingGroupName(ctx context.Context, groupId, groupName string) error
ListAutoBindAppBinding(ctx context.Context, groupId string) ([]string, error)
ListCopyOperBinding(ctx context.Context, bindingId string) ([]string, []entity.Binding, error)
AppendApps(ctx context.Context, bindingId string, apps []entity.AppInfo) error
RemoveApps(ctx context.Context, bindingId string, appIds []string) error
UpdateBundleIsView(ctx context.Context, reviews []apiproto.BundleReviewItem, isReview int) error
ListReviewBundle(ctx context.Context, pageSize int, pageNo int, searchText string, isReview int) (int64, []entity.ReviewBundleInfo, error)
CheckReviewBySdkKey(ctx context.Context, sdkKey string) bool
GetReviewBindBySdkKey(ctx context.Context, sdkKey string) (*entity.ReviewBundleInfo, error)
UpdateBundleBindingId(ctx context.Context, bundleId, bindingId, toBindingId string) error
NotFound(err error) bool
}
func IsAssAppId(info *entity.Binding, appId string) bool {
if info == nil {
return false
}
for _, a := range info.AppInfos {
if a.AppID == appId {
return true
}
}
return false
}

View File

@ -0,0 +1,19 @@
package repository
import (
"context"
"finclip-app-manager/domain/entity"
)
type IBundleRepo interface {
Insert(ctx context.Context, bundles []entity.Bundle) error
GetListByBundleId(ctx context.Context, ids []string, pageNo int, pageSize int) (int, []entity.Bundle, error)
GetListByBundleIds(ctx context.Context, ids []string) ([]entity.Bundle, error)
ExistBundleId(ctx context.Context, bundleId string) (bool, error)
GetInfoByBundleId(ctx context.Context, bundleId string) (entity.Bundle, error)
ListAllBundleInfos(ctx context.Context, searchText string, selectType, pageNo int, pageSize int) (int, []entity.Bundle, error)
AllCount(ctx context.Context) (int, error)
UpdateBundleForbidden(ctx context.Context, bundleId string, IsForbidden int) error
UpdateBundlePlatform(ctx context.Context, bundleId, remark string) error
NotFound(err error) bool
}

View File

@ -0,0 +1,8 @@
package repository
import "context"
type ILinkAuditRepo interface {
Count(ctx context.Context, appID string, groupId string, bindingID string, stLinkAudit string) (int, error)
NotFound(err error) bool
}

View File

@ -0,0 +1,52 @@
package repository
import (
"context"
"errors"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto/apiproto"
utils "finclip-app-manager/infrastructure/cache/redis"
fcredis "gitlab.finogeeks.club/finclip-backend-v2/finclip-redis"
"time"
)
//const MENUINFO_DB_NAME = "menuInfo"
//
//var (
// MenuIdOrNameExiErr = errors.New("ID OR Name exists")
// MenuLockKey = "mop_app_manage_svr_menu_lock_key"
//)
//
//type MenuInfo struct {
// TraceId string `bson:"trace_id" json:"traceId"`
// Name string `bson:"name" json:"name"`
// InfoId string `bson:"info_id" json:"infoId"`
// ImageUrl string `bson:"image_url" json:"imageUrl"`
// SortNum int `bson:"sort_num" json:"sortNum"`
// CreateTime int64 `bson:"create_time" json:"createTime"`
// UpdateTime int64 `bson:"update_time" json:"updateTime"`
// UpdateOperator string `bson:"update_operator" json:"updateOperator"`
//}
type IMenuInfoRepo interface {
GetInfoByTraceId(ctx context.Context, id string) (*entity.MenuInfo, error)
GetAllMenuList(ctx context.Context, sort []string) ([]entity.MenuInfo, int, error)
Add(ctx context.Context, info *entity.MenuInfo) error
GetNextSortNum(ctx context.Context) (int, error)
DelByTraceId(ctx context.Context, id string) error
UpdateInfo(ctx context.Context, id string, info *entity.MenuInfo) error
AllCount(ctx context.Context) (int, error)
Sort(ctx context.Context, req *apiproto.MenuSortReq) error
NotFound(err error) bool
}
func Lock(ctx context.Context, t time.Duration) error {
notExi, _ := utils.Setnx(ctx, entity.MenuLockKey, "ok", int(t.Seconds()))
if notExi {
return nil
}
return errors.New("try lock err")
}
func Unlock(ctx context.Context) error {
return fcredis.Client().Del(ctx, entity.MenuLockKey).Err()
}

View File

@ -0,0 +1,15 @@
package repository
import (
"context"
"finclip-app-manager/domain/entity"
)
type IPrivacySettingRepo interface {
Insert(ctx context.Context, item entity.PrivacySettingInfo) error
Count(ctx context.Context, appId string) (int, error)
GetInfoByAppId(ctx context.Context, appId string) (*entity.PrivacySettingInfo, error)
UpdateInfo(ctx context.Context, info entity.PrivacySettingInfo) error
DelInfoByAppId(ctx context.Context, appId string) error
NotFound(err error) bool
}

View File

@ -0,0 +1,52 @@
package repository
import (
"context"
"finclip-app-manager/domain/entity"
)
//const QRCODEINFO_DB_NAME = "qrCodeInfo"
//
//const (
// QrCodeTypeReview = "review" //审核版二维码信息
// QrCodeTypeTrial = "trial" //体验版
// QrCodeTypeTemporary = "temporary" //临时版
// QrCodeTypeRelease = "release" //线上版
//)
//
////AppStartParams 小程序启动参数
//type AppStartParams struct {
// PathAndQuery string `json:"pathAndQuery" bson:"path_and_query"`
//}
//
//type QrCodeInfo struct {
// Type string `json:"type" bson:"type"` //二维码的类型
// Uuid string `json:"uuid" bson:"uuid"` //标识该二维码
// AppId string `json:"appId" bson:"app_id"` //小程序Id
// Sequence int `json:"sequence" bson:"sequence"` //小程序序列号
// ApiServer string `json:"apiServer" bson:"api_server"` //小程序apiServer
// CodeId string `json:"codeId" bson:"code_id"` //标识某个编译版本的id
// StartParams AppStartParams `json:"startParams" bson:"start_params"` //小程序启动参数
// ExpireTime int64 `json:"expireTime" bson:"expire_time"` //过期时间
// CreateTime int64 `json:"createTime" bson:"create_time"` //创建时间
// UpdateTime string `json:"updateTime" bson:"Update_time"` //更新时间
// DeleteTime int64 `json:"deleteTime" bson:"Delete_time"` //删除时间-暂不用
//}
type IQrCodeInfoRepo interface {
Insert(ctx context.Context, info *entity.QrCodeInfo) error
GenInfo(ctx context.Context, info *entity.QrCodeInfo) error
GetInfoByUuid(ctx context.Context, uuid string) (*entity.QrCodeInfo, error)
GetInfoByCodeId(ctx context.Context, codeId string) (*entity.QrCodeInfo, error)
GetReviewInfo(ctx context.Context, appId string, seq int) (*entity.QrCodeInfo, error)
GetReleaseInfo(ctx context.Context, appId string) (*entity.QrCodeInfo, error)
GetTrialInfo(ctx context.Context, appId string) (*entity.QrCodeInfo, error)
GetTemporaryInfo(ctx context.Context, appId string, seq int) (*entity.QrCodeInfo, error)
GetRemoteDebugInfo(ctx context.Context, appId string, seq int) (*entity.QrCodeInfo, error)
UpdateTrialStartParams(ctx context.Context, codeId string, p entity.AppStartParams) error
UpdateStartParamsByUuid(ctx context.Context, uuid string, p entity.AppStartParams) error
UpdateApiServer(ctx context.Context, uuid string, apiServer string) error
UpdateInfo(ctx context.Context, uuid string, upInfo map[string]interface{}) error
GenReviewQrCodeInfo(ctx context.Context, info *entity.QrCodeInfo) error
NotFound(err error) bool
}

View File

@ -0,0 +1,8 @@
package repository
import "context"
type IRedDotRepo interface {
ReadTrialQr(ctx context.Context, readDotType string, id string, userId string) error
NotFound(err error) bool
}

View File

@ -0,0 +1,44 @@
package repository
import (
"context"
"finclip-app-manager/domain/entity"
"gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo/bson"
)
//const TYPECONFIG_DB_NAME = "typeConfig"
//
//type TypeConfig struct {
// TypeConfigID string `json:"typeConfigId" bson:"type_config_id"`
// Namespace string `json:"namespace" bson:"namespace"`
// Value string `json:"value" bson:"value"`
// MarketID string `json:"marketId" bson:"market_id"`
// CustomData map[string]interface{} `json:"customData" bson:"custom_data"`
// SortNum int `json:"sortNum" bson:"sort_num"`
//}
type ITypeConfigRepo interface {
Insert(ctx context.Context, typeConfig *entity.TypeConfig) error
GetOne(ctx context.Context, filter bson.M) error
Exist(ctx context.Context, namespace string, value string) (bool, error)
Update(ctx context.Context, selector bson.M, update bson.M) error
GetSome(ctx context.Context, pageSize, pageNo int) (int, []entity.TypeConfig, error)
GetAll(ctx context.Context) (int, []entity.TypeConfig, error)
Delete(ctx context.Context, typeConfigId string) error
GetNowSortNumInfo(ctx context.Context) (*entity.TypeConfig, error)
NotFound(err error) bool
}
//type TypeConfigList []TypeConfig
//
//func (l TypeConfigList) Len() int {
// return len(l)
//}
//
//func (l TypeConfigList) Less(i, j int) bool {
// return l[i].SortNum < l[j].SortNum
//}
//
//func (l TypeConfigList) Swap(i, j int) {
// l[i], l[j] = l[j], l[i]
//}

View File

@ -0,0 +1,189 @@
package script
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"time"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/repository"
cache "finclip-app-manager/infrastructure/cache/redis"
"finclip-app-manager/infrastructure/client/httpcall"
"finclip-app-manager/infrastructure/config"
impl "finclip-app-manager/infrastructure/db/repo"
"finclip-app-manager/infrastructure/logger"
"finclip-app-manager/infrastructure/utility"
)
type AutoReviewApp struct {
AppOperConfigRepo repository.IAppOperConfigRepo
appRepo repository.AppRepository
}
func NewAutoReviewApp() *AutoReviewApp {
return &AutoReviewApp{
AppOperConfigRepo: impl.InitAppOperConfigRepo(),
appRepo: impl.InitAppRepo(),
}
}
func (a *AutoReviewApp) ReviewApps(ctx context.Context) {
fmt.Printf("start auto review app...\n")
if config.Cfg.PublishEnv != entity.ENV_PRIVATE {
fmt.Printf("no need auto review app\n")
return
}
redisLockKey := "mop_auto_review_app_lock"
getOperAdminInfo := false
adminInfo := &GetOperAdminInfoRsp{}
for {
time.Sleep(60 * time.Second)
isSuc, err := cache.TryLock(ctx, redisLockKey, 600) //可以多实例部署,但是任何使用只有一个实例可以工作
if !isSuc || err != nil {
if err != nil {
logger.GetLogger().Errorf("lock err:%s\n", err.Error())
} else {
logger.GetLogger().Errorf("lock fail")
}
continue
}
//获取配置
configItem, _ := a.AppOperConfigRepo.Find(ctx)
if configItem.AutoReviewApp == 0 {
fmt.Printf("auto review app configItem.AutoReviewApp = %d\n", configItem.AutoReviewApp)
cache.Unlock(ctx, redisLockKey)
continue
}
if !getOperAdminInfo {
adminInfo, err = a.GetOperAdminInfo(ctx)
if err != nil || adminInfo == nil {
cache.Unlock(ctx, redisLockKey)
continue
} else if adminInfo.Data.Info.ID == "" {
logger.GetLogger().Errorf("adminInfo.Data.Info.ID empty")
cache.Unlock(ctx, redisLockKey)
continue
}
getOperAdminInfo = true
}
//获取审核中列表
pageNo := 1
pageSize := 20
for {
_, list, err := a.appRepo.ListAppVers(ctx, pageNo, pageSize, "", "pendingReview", "")
if err != nil {
logger.GetLogger().Errorf("a.appRepo.ListAppVers err:%s\n", err.Error())
break
} else if len(list) == 0 {
fmt.Printf("auto review app a.appRepo.ListAppVers empty\n")
break
}
a.DoReview(ctx, list, adminInfo.Data.Info.ID)
pageNo += 1
}
cache.Unlock(ctx, redisLockKey)
fmt.Printf("auto review app success\n")
}
}
func (a *AutoReviewApp) DoReview(ctx context.Context, list []entity.AppVersion, userId string) {
for _, v := range list {
var auditReq AuditAppInternalReq
auditReq.AccountId = userId
auditReq.AppId = v.AppID
auditReq.Sequence = v.Sequence
auditReq.Operation = "Approve"
auditReq.Reason = "系统(自动审核)"
auditReq.Platform = "oper"
a.AuditAppInternal(ctx, &auditReq, userId)
time.Sleep(1 * time.Second)
}
}
type AuditAppInternalRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
}
type AuditAppInternalReq struct {
AccountId string `json:"accountId"`
AppId string `json:"appId"`
Sequence int `json:"sequence"`
Operation string `json:"operation"`
Reason string `json:"reason"`
Platform string `json:"platform"`
}
func (a *AutoReviewApp) AuditAppInternal(ctx context.Context, req *AuditAppInternalReq, accountId string) (*AuditAppInternalRsp, error) {
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"X-Consumer-Custom-ID": accountId,
"url-call": "internal",
}
url := "http://mop-audit-manage-svr:8080/api/v1/mop/mop-audit-manage-svr/operation/applications"
client := httpcall.NewClient()
rsp := AuditAppInternalRsp{}
resp, err := client.Request(ctx).SetHeaders(headers).SetBody(req).SetResult(&rsp).Put(url)
if err != nil {
logger.GetLogger().Errorf("AuditAppInternal req error:%s", err.Error())
return nil, err
}
if resp.StatusCode() != http.StatusOK {
json.Unmarshal([]byte(resp.Body()), &rsp)
logger.GetLogger().Errorf("AuditAppInternal status code err,rsp:%s", resp.String())
return &rsp, errors.New("AuditAppInternal status code err")
}
logger.GetLogger().Debugf("AuditAppInternal rsp=%s", utility.InterfaceToJsonString(rsp))
return &rsp, nil
}
type MopOperAdminInfo struct {
Info struct {
ID string `json:"id"`
Phone string `json:"phone"`
Account string `json:"account"`
CreateTime int64 `json:"createTime"`
} `json:"info"`
}
type GetOperAdminInfoRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
Data MopOperAdminInfo `json:"data"`
}
func (a *AutoReviewApp) GetOperAdminInfo(ctx context.Context) (*GetOperAdminInfoRsp, error) {
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
var result GetOperAdminInfoRsp
client := httpcall.NewClient()
url := "http://mop-account-system:8080/api/v1/mop/applets-ecol-account/operation/admin-info"
rsp, err := client.Request(ctx).SetHeaders(headers).SetResult(&result).Get(url)
if err != nil {
logger.GetLogger().Errorf("goResty fail, rsp:%s, err:%s", rsp.String(), err.Error())
return nil, err
} else if rsp.StatusCode() != 200 {
logger.GetLogger().Errorf("goResty fail, httpCode:%d", rsp.StatusCode())
return nil, errors.New("status err")
}
return &result, nil
}

View File

@ -0,0 +1,39 @@
package service
import (
"finclip-app-manager/infrastructure/client/httpcall"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/utility"
"net/http"
)
type AccountInfoService struct {
}
func NewAccountInfoService() *AccountInfoService {
return &AccountInfoService{}
}
func (a *AccountInfoService) UpInfo(organId, subId, t string, m map[string]interface{}) (int, string) {
return http.StatusOK, utility.OK
}
func (a *AccountInfoService) getAccountStatus(groupIDData *httpcall.GroupIDData /*, developerData *client.DeveloperData*/) int {
//if developerData.Type == client.ORGAN_ACCOUNT_TYPE_PERSON {
// return developerData.Status
//}
//if developerData.Type == client.ORGAN_ACCOUNT_TYPE_BUSINESS {
log.Infof("getAccountStatus-----groupIDData.ReviewStatus: %d\n", groupIDData.ReviewStatus)
if config.Cfg.IsUatEnv() {
if groupIDData.ReviewStatus == httpcall.StOrganApproved {
return httpcall.ORGAN_STATUS_NORMAL
}
if groupIDData.ReviewStatus == httpcall.StOrganUnApproved {
return httpcall.ORGAN_STATUS_FREEZE
}
}
//}
// 私有化环境固定返回1
return httpcall.ORGAN_STATUS_NORMAL
}

3418
domain/service/app.go 100644

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
package service
import (
"context"
"finclip-app-manager/domain/repository"
impl "finclip-app-manager/infrastructure/db/repo"
"finclip-app-manager/infrastructure/utility"
"net/http"
"time"
)
type AppConfigService struct {
AppOperConfigRepo repository.IAppOperConfigRepo
}
func NewAppConfigService() *AppConfigService {
return &AppConfigService{
AppOperConfigRepo: impl.InitAppOperConfigRepo(),
}
}
type GetOperConfigRsp struct {
AutoReviewApp int `json:"autoReviewApp"`
}
func (a *AppConfigService) GetOperConfig(ctx context.Context) (GetOperConfigRsp, string) {
item, err := a.AppOperConfigRepo.Find(ctx)
//没有不需要返回错误
if err != nil {
log.Errorln("a.AppOperConfigRepo.Find err:%s", err.Error())
}
var result GetOperConfigRsp
result.AutoReviewApp = item.AutoReviewApp
return result, utility.OK
}
type UpdateAppOperCofigReq struct {
AutoReviewApp int `json:"autoReviewApp"`
}
func (a *AppConfigService) UpdateAppOperCofig(ctx context.Context, req UpdateAppOperCofigReq) (string, int) {
if req.AutoReviewApp != 0 && req.AutoReviewApp != 1 {
log.Errorln("param err")
return utility.FS_PARAM_ERR, http.StatusBadRequest
}
log.Debugf("UpdateAppOperCofig:%s\n", utility.InterfaceToJsonString(req))
item, err := a.AppOperConfigRepo.Find(ctx)
found := true
if repository.NotFound(err) {
item.CreateTime = time.Now().UnixNano() / 1e6
item.UpdateTime = item.CreateTime
found = false
} else {
item.UpdateTime = time.Now().UnixNano() / 1e6
log.Debugf("UpdateAppOperCofig found\n")
}
item.AutoReviewApp = req.AutoReviewApp
if found {
err = a.AppOperConfigRepo.Update(ctx, item)
if err != nil {
log.Errorln("a.AppOperConfigRepo.Update err:%s", err.Error())
return utility.FS_DB_ERR, http.StatusBadRequest
}
} else {
err = a.AppOperConfigRepo.Insert(ctx, item)
if err != nil {
log.Errorln("a.AppOperConfigRepo.Insert err:%s", err.Error())
return utility.FS_DB_ERR, http.StatusBadRequest
}
}
return utility.OK, http.StatusOK
}

View File

@ -0,0 +1,146 @@
package service
import (
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto"
"finclip-app-manager/domain/repository"
"finclip-app-manager/infrastructure/config"
impl "finclip-app-manager/infrastructure/db/repo"
"finclip-app-manager/infrastructure/utility"
"finclip-app-manager/infrastructure/utils"
"net/http"
"github.com/gin-gonic/gin"
"gitlab.finogeeks.club/finclip-backend/apm"
"gopkg.in/mgo.v2/bson"
)
type AppTempInfoService struct {
}
func NewAppTempInfoService() *AppTempInfoService {
var s AppTempInfoService
return &s
}
func (s AppTempInfoService) UpdateTempApp(c *gin.Context, appId string, req *proto.UpdateTempAppInfoReq) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
var (
rspData = make(map[string]interface{})
)
repo := impl.InitAppTempInfoRepo()
appTempInfo, err := repo.GetInfoByAppId(traceCtx, appId)
if err != nil {
log.Errorf("GetInfoByAppIdAndSeq err:%s", err.Error())
if repo.NotFound(err) {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_APP_SEQUENCE_NOT_FOUND, rspData)
return
}
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, rspData)
return
}
if appTempInfo.CustomData.SourceFile == nil {
appTempInfo.CustomData.SourceFile = make([]entity.CustomDataSourceFile, 0)
}
appTempInfo.Name = req.AppName
appTempInfo.Logo = req.AppLogo
sourceFileInfo := entity.CustomDataSourceFile{
FileMd5: req.FileMd5,
Name: req.Name,
SourceFileUrl: req.SourceFileUrl,
UploadDate: req.UploadDate,
Url: req.Url,
EncryptedUrl: req.EncryptedUrl,
EncryptedFileMd5: req.EncryptedFileMd5,
Packages: convertPackages(req.Packages),
EncryptPackages: convertPackages(req.EncryptPackages),
}
appTempInfo.CustomData.SourceFile = append(appTempInfo.CustomData.SourceFile, sourceFileInfo)
log.Infof("new temp info:%+v", appTempInfo)
err = repo.UpdateInfo(traceCtx, appTempInfo)
if err != nil {
log.Errorf("UpdateInfo err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, rspData)
return
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rspData)
return
}
func (s AppTempInfoService) GenTempApp(c *gin.Context, req proto.CreateTempAppInfoReq) {
traceCtx := apm.ApmClient().TraceContextFromGin(c)
var (
rspData = make(map[string]interface{})
appId = bson.NewObjectId().Hex()
)
if req.ProjectType < 0 || req.ProjectType > 2 {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_PARAM_ERR, nil)
return
}
log.Infof("GenTempApp appId:[%s]", appId)
appTempInfo := repository.NewDefaultInfo(appId, req.ProjectType)
repo := impl.InitAppTempInfoRepo()
err := repo.Insert(traceCtx, appTempInfo)
if err != nil {
log.Errorf("GenTempApp db err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, rspData)
return
}
nowMs := utils.GetNowMs()
qrcodeInfo := &entity.QrCodeInfo{
Type: entity.QrCodeTypeTemporary,
Uuid: GenTemporaryQrCodeUuid(appId, entity.AppTempDefSequence),
AppId: appId,
Sequence: appTempInfo.Sequence,
ApiServer: config.Cfg.ApiServer,
CodeId: "", //codeid 和 appid 相同
StartParams: entity.AppStartParams{},
ExpireTime: nowMs + int64(config.Cfg.QRcodeExpireTime*1e3),
CreateTime: nowMs,
}
//插入二维码信息
qrCodeRepo := impl.InitQrCodeInfoRepo()
err = qrCodeRepo.GenInfo(traceCtx, qrcodeInfo)
if err != nil {
log.Errorf("gen temp qrcode info err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_DB_ERR, rspData)
return
}
log.Infof("GenTempApp appId:[%s]", appId)
rspData["appId"] = appId
rspData["sequence"] = entity.AppTempDefSequence
log.Infof("GenTempApp rsp:%+v", rspData)
utility.MakeLocRsp(c, http.StatusOK, utility.OK, rspData)
return
}
func convertPackages(old []proto.Package) []entity.Package {
n := len(old)
if n == 0 {
return nil
}
res := make([]entity.Package, 0, n)
for _, val := range old {
res = append(res, entity.Package{
Root: val.Root,
Name: val.Name,
Pages: val.Pages,
Independent: val.Independent,
Filename: val.Filename,
FileUrl: val.FileUrl,
FileMd5: val.FileMd5,
})
}
return res
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,120 @@
package service
import (
"context"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto"
"finclip-app-manager/infrastructure/client/httpcall"
"finclip-app-manager/infrastructure/config"
pb "finclip-app-manager/infrastructure/protobuf/golang"
)
type BoxTool struct{}
func NewBoxTool() *BoxTool {
return &BoxTool{}
}
func (b *BoxTool) CovertAppVerToAppRspData(appVer *entity.AppVersion, rspData *pb.AppInfoRspData) {
if appVer == nil {
return
}
if rspData == nil {
rspData = new(pb.AppInfoRspData)
}
rspData.AppClass = appVer.AppClass
rspData.AppId = appVer.AppID
rspData.AppType = appVer.AppType
rspData.CoreDescription = appVer.CoreDescription
rspData.CorporationId = appVer.CorporationID
rspData.Created = appVer.Created
rspData.CreatedBy = appVer.CreatedBy
rspData.DeveloperId = appVer.DeveloperID
rspData.GroupId = appVer.GroupID
//rspItem.AppInfo.GroupName = appVer.groupname
rspData.InGrayRelease = appVer.InGrayRelease
rspData.Logo = appVer.Logo
rspData.Name = appVer.Name
rspData.Sequence = int32(appVer.Sequence)
rspData.Version = appVer.Version
rspData.IsTemp = false
rspData.Status = new(pb.Status)
rspData.Status.Value = appVer.Status.Value
rspData.Status.Reason = appVer.Status.Reason
rspData.Status.ModifiedBy = appVer.Status.ModifiedBy
rspData.Status.LastUpdated = appVer.Status.LastUpdated
if rspData.CustomData == nil {
rspData.CustomData = new(pb.CustomData)
}
err, _, customData := ConvertModelCustomDataToPb(context.Background(), appVer.GroupID, appVer.CustomData, nil, "")
if err != nil {
log.Errorf("openApiGetAppVerInfoFromCache ConvertModelCustomDataToRpc err:[%s]", err.Error())
return
}
rspData.CustomData = customData
return
}
func (b *BoxTool) PackDomainToAppRspCustom(rspData *pb.AppInfoRspData, domainInfo *httpcall.DomainResponseData) {
if rspData.CustomData == nil {
rspData.CustomData = new(pb.CustomData)
}
if rspData.CustomData.AppRuntimeDomain == nil {
rspData.CustomData.AppRuntimeDomain = new(pb.AppRuntimeDomain)
}
if domainInfo != nil {
rspData.CustomData.AppRuntimeDomain = new(pb.AppRuntimeDomain)
rspData.CustomData.AppRuntimeDomain.Business = new(pb.AppRuntimeDomain_Business)
rspData.CustomData.AppRuntimeDomain.Business.Domains = domainInfo.Business.Domains
rspData.CustomData.AppRuntimeDomain.Service = new(pb.AppRuntimeDomain_Service)
rspData.CustomData.AppRuntimeDomain.Service.Socket = domainInfo.Service.Socket
rspData.CustomData.AppRuntimeDomain.Service.Request = domainInfo.Service.Request
rspData.CustomData.AppRuntimeDomain.Service.Download = domainInfo.Service.Download
rspData.CustomData.AppRuntimeDomain.Service.Upload = domainInfo.Service.Upload
rspData.CustomData.AppRuntimeDomain.Whitelist = new(pb.AppRuntimeDomain_Whitelist)
rspData.CustomData.AppRuntimeDomain.Whitelist.Domains = domainInfo.Whitelist.Domains
rspData.CustomData.AppRuntimeDomain.Blacklist = new(pb.AppRuntimeDomain_Blacklist)
rspData.CustomData.AppRuntimeDomain.Blacklist.Domains = domainInfo.Blacklist.Domains
}
}
func (b *BoxTool) PackMenuToAppRspCustom(rspData *pb.AppInfoRspData, menuInfo *proto.MenuInfoRspData) {
if rspData.CustomData == nil {
rspData.CustomData = new(pb.CustomData)
}
if menuInfo != nil {
rspData.CustomData.MenuInfo = new(pb.MenuInfoRspData)
rspData.CustomData.MenuInfo.Total = int32(menuInfo.Total)
rspData.CustomData.MenuInfo.List = make([]*pb.MenuInfoRspDataItem, 0)
if menuInfo.List != nil {
for _, v := range menuInfo.List {
item := pb.MenuInfoRspDataItem{}
item.Name = v.Name
item.Image = v.Image
item.Id = v.ID
rspData.CustomData.MenuInfo.List = append(rspData.CustomData.MenuInfo.List, &item)
}
}
}
}
func (b *BoxTool) PackApiInfoToAppRspCustom(rspData *pb.AppInfoRspData, apiInfo *[]proto.ApiInfoRspData) {
if rspData.CustomData == nil {
rspData.CustomData = new(pb.CustomData)
}
rspData.CustomData.ApiInfo = nil
if apiInfo != nil && config.Cfg.EnableApiManage() {
if rspData.CustomData.ApiInfo == nil {
rspData.CustomData.ApiInfo = make([]*pb.ApiInfoRspData, 0)
}
for _, v := range *apiInfo {
item := new(pb.ApiInfoRspData)
item.Url = v.Url
item.ApiName = v.ApiName
rspData.CustomData.ApiInfo = append(rspData.CustomData.ApiInfo, item)
}
}
}

View File

@ -0,0 +1,125 @@
package service
import (
"context"
"finclip-app-manager/domain/entity"
"finclip-app-manager/infrastructure/config"
impl "finclip-app-manager/infrastructure/db/repo"
"gitlab.finogeeks.club/finclip-backend/apm"
"sync"
"time"
)
const (
LICENSE_VALID_EXPIRE = 60
LICENSE_IS_VALID = 0
BUNDLE_ID_COUNT_INVAILD = 1
)
var LicenseValid int32
var mutex = sync.Mutex{}
func GetLicenseValid() int32 {
result := LicenseValid
return result
}
func LicenceCheckStart() {
//LICENSE_VALID_EXPIRE跑一次
go func() {
updateLicenseValid(context.Background())
t := time.NewTicker(time.Second * LICENSE_VALID_EXPIRE)
for {
select {
case <-t.C:
func() {
span, ctx := apm.ApmClient().CreateLocalSpan(context.Background())
span.SetOperationName("updateLicenseValid")
defer span.End()
go updateLicenseValid(ctx)
}()
}
}
}()
}
func updateLicenseValid(ctx context.Context) {
var upErr error = nil
defer func(e error) {
if e != nil {
log.Debugf("updateLicenseValid panic err:%s", e.Error())
upValid(LICENSE_IS_VALID)
}
}(upErr)
licenseInfo, err := hCaller.GetLicense(ctx)
if err != nil {
upErr = err
log.Errorf("updateLicenseValid get license info err:%s", err.Error())
return
}
log.Debugf("updateLicenseValid get license info:%+v", licenseInfo)
bindingTotal, err := getBindingNum(ctx)
if err != nil {
upErr = err
log.Errorf("updateLicenseValid get binding count err:%s", err.Error())
return
}
log.Debugf("updateLicenseValid get binding count:%d", bindingTotal)
bundleIdTotal, err := getBundleIdNum(ctx)
if err != nil {
upErr = err
log.Errorf("updateLicenseValid get bundle id count err:%s", err.Error())
return
}
log.Debugf("updateLicenseValid get bundle id count:%d", bundleIdTotal)
//获取小程序数量
appNum, err := getAppNum(ctx)
if err != nil {
upErr = err
log.Errorf("updateLicenseValid get app count err:%s", err.Error())
return
}
//校验应用数量
if (licenseInfo.BundleIdCount < bundleIdTotal) ||
(licenseInfo.CooAppCount < bindingTotal) ||
(licenseInfo.AppCount < appNum) {
log.Errorf("updateLicenseValid bundle id or app num over limit,"+
"license info:%+v,bundle id num:%d,appNum:%d", licenseInfo, bundleIdTotal, appNum)
upValid(BUNDLE_ID_COUNT_INVAILD)
} else {
upValid(LICENSE_IS_VALID)
}
}
func upValid(result int32) {
mutex.Lock()
defer mutex.Unlock()
LicenseValid = result
log.Debugf("upValid valid:%d", LicenseValid)
}
func getAppNum(ctx context.Context) (int, error) {
appRepo := impl.InitAppRepo()
count, err := appRepo.AppCount(ctx, "")
if err != nil {
log.Errorf("license valid update err:%s", err.Error())
}
return count, err
}
func getBindingNum(ctx context.Context) (int, error) {
bindingRepo := impl.InitBindingRepo()
return bindingRepo.GetCountByStatus(ctx, "Valid", entity.BINGING_PLATFORM_ALL)
}
func getBundleIdNum(ctx context.Context) (int, error) {
if config.GetConfig().IsPrivateEnv() {
return impl.InitBundleRepo().AllCount(ctx)
}
return 0, nil
}

View File

@ -0,0 +1,24 @@
package service
import (
"context"
impl "finclip-app-manager/infrastructure/db/repo"
)
type LinkAuditService struct {
}
func NewLinkAuditService() *LinkAuditService {
var s LinkAuditService
return &s
}
func (s LinkAuditService) Count(ctx context.Context, appID string, groupId string, bindingID string, stLinkAudit string) (int, error) {
repo := impl.InitLinkAuditRepo()
return repo.Count(ctx, appID, groupId, bindingID, stLinkAudit)
}
func (s LinkAuditService) NotFound(err error) bool {
repo := impl.InitLinkAuditRepo()
return repo.NotFound(err)
}

View File

@ -0,0 +1,180 @@
package service
import (
"context"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/infrastructure/cache/redis"
impl "finclip-app-manager/infrastructure/db/repo"
"finclip-app-manager/infrastructure/utility"
"github.com/gin-gonic/gin"
"gopkg.in/mgo.v2/bson"
"net/http"
"time"
)
type MenuInfoService struct {
}
func NewMenuInfoService() *MenuInfoService {
var s MenuInfoService
return &s
}
func (m *MenuInfoService) AddMenu(ctx context.Context, c *gin.Context, req *apiproto.AddMenuReq) {
errRsp := make(map[string]interface{})
userId := c.GetHeader(entity.ACCOUNT_ID_HEADER_KEY)
adminInfo, err := hCaller.GetAdminAccountInfo(ctx, userId)
if err != nil {
log.Errorf("get admin info err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, gin.H{})
return
}
now := time.Now().UnixNano() / 1e6
menuInfo := entity.MenuInfo{
TraceId: bson.NewObjectId().Hex(),
Name: req.Name,
InfoId: req.ID,
ImageUrl: req.Image,
CreateTime: now,
UpdateTime: now,
UpdateOperator: adminInfo.Account,
}
repo := impl.InitMenuInfoRepo()
err = repo.Add(ctx, &menuInfo)
if err != nil {
log.Errorf("add menu err:%s", err.Error())
if err == entity.MenuIdOrNameExiErr {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_MENU_ID_EXITS_ERR, gin.H{})
return
}
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SERVER_ERR, gin.H{})
return
}
//m.menuCache.UpdateMemMenuCreatedInfo(true)
//m.menuCache.SetRedisMenuCreatedInfo(ctx)
//m.menuCache.Update(ctx)
redis.RedisSet(ctx, utility.MenuCreatedKey, utility.MenuCreatedValue, 0)
errRsp["traceId"] = menuInfo.TraceId
utility.MakeLocRsp(c, http.StatusOK, utility.OK, errRsp)
return
}
func (m *MenuInfoService) DelMenu(ctx context.Context, c *gin.Context, traceId string) {
userId := c.GetHeader(entity.ACCOUNT_ID_HEADER_KEY)
_, err := hCaller.GetAdminAccountInfo(ctx, userId)
if err != nil {
log.Errorf("get admin info err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, gin.H{})
return
}
repo := impl.InitMenuInfoRepo()
err = repo.DelByTraceId(ctx, traceId)
if err != nil {
log.Errorf("del menu err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SERVER_ERR, gin.H{})
return
}
//m.menuCache.Update(ctx)
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}
func (m *MenuInfoService) UpdateMenu(ctx context.Context, c *gin.Context, traceId string, req *apiproto.UpdateMenuReq) {
userId := c.GetHeader(entity.ACCOUNT_ID_HEADER_KEY)
adminInfo, err := hCaller.GetAdminAccountInfo(ctx, userId)
if err != nil {
log.Errorf("get admin info err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, gin.H{})
return
}
repo := impl.InitMenuInfoRepo()
menuInfo, err := repo.GetInfoByTraceId(ctx, traceId)
if err != nil {
log.Errorf("get menu info by trace id err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SERVER_ERR, gin.H{})
return
}
menuInfo.Name = req.Name
menuInfo.ImageUrl = req.Image
menuInfo.InfoId = req.ID
menuInfo.UpdateOperator = adminInfo.Account
err = repo.UpdateInfo(ctx, traceId, menuInfo)
if err != nil {
if err == entity.MenuIdOrNameExiErr {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_MENU_ID_EXITS_ERR, gin.H{})
return
}
log.Errorf("update menu err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SERVER_ERR, gin.H{})
return
}
//m.menuCache.Update(ctx)
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}
func (m *MenuInfoService) GetAllMenu(ctx context.Context, c *gin.Context) {
result := apiproto.GetAllMenuRsp{}
repo := impl.InitMenuInfoRepo()
infoList, total, err := repo.GetAllMenuList(ctx, []string{"sort_num"})
if err != nil {
log.Errorf("get all menu err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, result)
return
}
result.List = make([]apiproto.GetAllMenuRspItem, 0)
result.Total = total
for _, v := range infoList {
item := apiproto.GetAllMenuRspItem{}
item.TraceId = v.TraceId
item.Name = v.Name
item.Image = v.ImageUrl
item.ID = v.InfoId
item.SortNum = v.SortNum
item.CreateTime = v.CreateTime
item.UpdateTime = v.UpdateTime
item.UpdateOperator = v.UpdateOperator
result.List = append(result.List, item)
}
utility.MakeLocRsp(c, http.StatusOK, utility.OK, result)
return
}
func (m *MenuInfoService) SortMenu(ctx context.Context, c *gin.Context, req *apiproto.MenuSortReq) {
userId := c.GetHeader(entity.ACCOUNT_ID_HEADER_KEY)
_, err := hCaller.GetAdminAccountInfo(ctx, userId)
if err != nil {
log.Errorf("get admin info err:%s", err.Error())
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SYSTEM_CALL, gin.H{})
return
}
repo := impl.InitMenuInfoRepo()
err = repo.Sort(ctx, req)
if err != nil {
log.Errorf("sort menu err:%s", err.Error())
if err.Error() == "has deleted" {
utility.MakeLocRsp(c, http.StatusBadRequest, utility.FS_DATA_HAS_DEL_ERR, gin.H{})
return
}
utility.MakeLocRsp(c, http.StatusInternalServerError, utility.FS_SERVER_ERR, gin.H{})
return
}
//m.menuCache.Update(ctx)
utility.MakeLocRsp(c, http.StatusOK, utility.OK, gin.H{})
return
}

View File

@ -0,0 +1,6 @@
package protocol
/**
* DDD: domain -service-protocol
* : applicationgin httpservice
**/

View File

@ -0,0 +1,587 @@
package service
import (
"context"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto"
"finclip-app-manager/domain/repository"
"finclip-app-manager/infrastructure/client/httpcall"
"finclip-app-manager/infrastructure/config"
impl "finclip-app-manager/infrastructure/db/repo"
"finclip-app-manager/infrastructure/logger"
pb "finclip-app-manager/infrastructure/protobuf/golang"
"finclip-app-manager/infrastructure/utils"
)
var (
log = logger.GetLogger()
hCaller = httpcall.NewClient()
)
func NotFound(err error) bool {
return repository.NotFound(err)
}
func ConvertModelCustomDataToRpc(
ctx context.Context,
groupId string,
data entity.CustomDataInfo,
domain *httpcall.DomainResponseData,
sdkVer string,
) (error, string, *proto.AppRspCustomData) {
err, errCode, customData := ConvertModelCustomDataToPb(ctx, groupId, data, domain, sdkVer)
if err != nil {
return err, errCode, nil
}
return nil, "", convertPbCustomDataToRpc(customData)
}
func convertPbCustomDataToRpc(info *pb.CustomData) *proto.AppRspCustomData {
rsp := new(proto.AppRspCustomData)
rsp.DetailDescription = info.DetailDescription
rsp.VersionDescription = info.VersionDescription
rsp.AppRuntimeDomain = *GetProtoRuntimeDomainsFromPb(info)
if info.MenuInfo != nil {
rsp.MenuInfo = new(proto.MenuInfoRspData)
rsp.MenuInfo.Total = int(info.MenuInfo.Total)
if info.MenuInfo.List != nil {
if len(info.MenuInfo.List) == 0 {
rsp.MenuInfo.List = make([]proto.MenuInfoRspDataItem, 0)
} else {
for _, v := range info.MenuInfo.List {
item := proto.MenuInfoRspDataItem{}
item.Name = v.Name
item.Image = v.Image
item.ID = v.Id
rsp.MenuInfo.List = append(rsp.MenuInfo.List, item)
}
}
}
}
if info.ApiInfo != nil {
apiInfos := []proto.ApiInfoRspData{}
for i := 0; i < len(info.ApiInfo); i++ {
api := info.ApiInfo[i]
item := proto.ApiInfoRspData{ApiName: api.ApiName, Url: api.Url}
apiInfos = append(apiInfos, item)
}
rsp.ApiInfo = &apiInfos
}
if len(info.ApiInfo) == 0 && config.GetConfig().EnableApiManage() {
rsp.ApiInfo = &[]proto.ApiInfoRspData{{ApiName: "", Url: ""}}
}
rsp.SourceFile = make([]proto.RspCustomDataSourceFile, 0)
if len(info.SourceFile) > 0 {
temp := info.SourceFile[0]
item := proto.RspCustomDataSourceFile{}
item.Name = temp.Name
item.Url = temp.Url
item.FileMd5 = temp.FileMd5
item.SourceFileUrl = temp.SourceFileUrl
item.UploadDate = temp.UploadDate
item.BasicPackVer = temp.BasicPackVer
for _, val := range temp.Packages {
item.Packages = append(item.Packages, proto.Package{
Root: val.Root,
Name: val.Name,
Pages: val.Pages,
Independent: val.Independent,
Filename: val.Filename,
FileUrl: val.FileUrl,
FileMd5: val.FileMd5,
})
}
rsp.SourceFile = append(rsp.SourceFile, item)
}
return rsp
}
func GetProtoRuntimeDomainsFromPb(data *pb.CustomData) *proto.AppRuntimeDomainData {
domainInfo := data.AppRuntimeDomain
result := &proto.AppRuntimeDomainData{}
if domainInfo == nil {
return result
}
if domainInfo.Business.Domains != nil {
result.Business.Domains = domainInfo.Business.Domains
}
if domainInfo.Service.Download != nil {
result.Service.Download = domainInfo.Service.Download
}
if domainInfo.Service.Request != nil {
result.Service.Request = domainInfo.Service.Request
}
if domainInfo.Service.Socket != nil {
result.Service.Socket = domainInfo.Service.Socket
}
if domainInfo.Service.Download != nil {
result.Service.Upload = domainInfo.Service.Upload
}
if domainInfo.Whitelist.Domains != nil {
result.Whitelist.Domains = domainInfo.Whitelist.Domains
}
if domainInfo.Blacklist.Domains != nil {
result.Blacklist.Domains = domainInfo.Blacklist.Domains
}
return result
}
func covertAppToRsp(ctx context.Context, info *entity.AppVersion, rsp *RuntimeGetAppResponse, sdkVer string, domainData *httpcall.DomainResponseData) error {
rsp.AppID = info.AppID
rsp.Name = info.Name
rsp.Sequence = info.Sequence
rsp.AppClass = info.AppClass
rsp.AppTag = info.AppTag
rsp.AppType = info.AppType
rsp.DeveloperID = info.DeveloperID
rsp.GroupID = info.GroupID
rsp.GroupName = ""
rsp.Created = info.Created
rsp.CreatedBy = info.CreatedBy
rsp.Version = info.Version
rsp.CorporationID = info.CorporationID
rsp.CoreDescription = info.CoreDescription
rsp.Logo = info.Logo
err, _, customData := ConvertModelCustomDataToRpc(ctx, info.GroupID, info.CustomData, domainData, sdkVer)
if err != nil {
log.Errorf("openApiGetAppVerInfoFromCache ConvertModelCustomDataToRpc err:[%s]", err.Error())
return err
}
rsp.CustomData = *customData
rsp.Status.Value = info.Status.Value
rsp.Status.ModifiedBy = info.Status.ModifiedBy
rsp.Status.Reason = info.Status.Reason
rsp.Status.LastUpdated = info.Status.LastUpdated
rsp.IsTemp = false
rsp.NeedCrt = domainData.NeedCrt
rsp.InGrayRelease = info.InGrayRelease
return nil
}
func ConvertRpcCustomDataToPb(info proto.AppRspCustomData) *pb.CustomData {
rsp := new(pb.CustomData)
rsp.DetailDescription = info.DetailDescription
rsp.VersionDescription = info.VersionDescription
rsp.AppRuntimeDomain = GetPbRuntimeDomainsFromProto(info.AppRuntimeDomain)
if info.MenuInfo != nil {
rsp.MenuInfo = new(pb.MenuInfoRspData)
rsp.MenuInfo.Total = int32(info.MenuInfo.Total)
if info.MenuInfo.List != nil {
for _, v := range info.MenuInfo.List {
item := pb.MenuInfoRspDataItem{}
item.Name = v.Name
item.Image = v.Image
item.Id = v.ID
rsp.MenuInfo.List = append(rsp.MenuInfo.List, &item)
}
}
}
if info.ApiInfo != nil {
apiInfos := *info.ApiInfo
for i := 0; i < len(apiInfos); i++ {
api := apiInfos[i]
item := &pb.ApiInfoRspData{ApiName: api.ApiName, Url: api.Url}
rsp.ApiInfo = append(rsp.ApiInfo, item)
}
}
if len(rsp.ApiInfo) == 0 && config.GetConfig().EnableApiManage() {
item := &pb.ApiInfoRspData{ApiName: "", Url: ""}
rsp.ApiInfo = append(rsp.ApiInfo, item)
}
rsp.SourceFile = make([]*pb.SourceFileData, 0)
if len(info.SourceFile) > 0 {
temp := info.SourceFile[0]
item := new(pb.SourceFileData)
item.Name = temp.Name
item.Url = temp.Url
item.FileMd5 = temp.FileMd5
item.SourceFileUrl = temp.SourceFileUrl
item.UploadDate = temp.UploadDate
item.BasicPackVer = temp.BasicPackVer
for _, val := range temp.Packages {
item.Packages = append(item.Packages, &pb.Package{
Root: val.Root,
Name: val.Name,
Pages: val.Pages,
Independent: val.Independent,
Filename: val.Filename,
FileUrl: val.FileUrl,
FileMd5: val.FileMd5,
})
}
rsp.SourceFile = append(rsp.SourceFile, item)
}
return rsp
}
func GetPbRuntimeDomainsFromProto(domainInfo proto.AppRuntimeDomainData) *pb.AppRuntimeDomain {
return &pb.AppRuntimeDomain{
Business: &pb.AppRuntimeDomain_Business{
Domains: domainInfo.Business.Domains,
},
Service: &pb.AppRuntimeDomain_Service{
Download: domainInfo.Service.Download,
Request: domainInfo.Service.Request,
Socket: domainInfo.Service.Socket,
Upload: domainInfo.Service.Upload,
},
Whitelist: &pb.AppRuntimeDomain_Whitelist{
Domains: domainInfo.Whitelist.Domains,
},
Blacklist: &pb.AppRuntimeDomain_Blacklist{
Domains: domainInfo.Blacklist.Domains,
},
}
}
type RuleEngineGetAppVerInfoRsp struct {
AppID string `json:"appId"`
Name string `json:"name"`
Sequence int `json:"sequence"`
AppClass string `json:"appClass"`
AppType string `json:"appType"`
DeveloperID string `json:"developerId"`
DeveloperStatus int `json:"developerStatus"`
GroupID string `json:"groupId"`
GroupName string `json:"groupName"`
Created int64 `json:"created"`
CreatedBy string `json:"createdBy"`
CustomData proto.AppRspCustomData `json:"customData"`
Version string `json:"version"`
CorporationID string `json:"corporationId"`
CoreDescription string `json:"coreDescription"`
Logo string `json:"logo"`
Status proto.AppRspStatus `json:"status"`
InGrayRelease bool `json:"inGrayRelease"` //是否在灰度发布中
IsTemp bool `json:"isTemp"`
NeedCrt bool `json:"needCrt"`
WechatLoginInfo proto.WechatLoginInfo `json:"wechatLoginInfo"`
}
func covertAppVerToRuleEngineRsp(appVer *entity.AppVersion) (rsp *RuleEngineGetAppVerInfoRsp) {
if appVer == nil {
return
}
rsp = &RuleEngineGetAppVerInfoRsp{
AppID: appVer.AppID,
Name: appVer.Name,
Sequence: appVer.Sequence,
AppClass: appVer.AppClass,
AppType: appVer.AppType,
DeveloperID: appVer.DeveloperID,
GroupID: appVer.GroupID,
Created: appVer.Created,
CreatedBy: appVer.CreatedBy,
Version: appVer.Version,
CorporationID: appVer.CorporationID,
CoreDescription: appVer.CoreDescription,
Logo: appVer.Logo,
InGrayRelease: appVer.InGrayRelease,
}
rsp.Status.ModifiedBy = appVer.Status.ModifiedBy
rsp.Status.Reason = appVer.Status.Reason
rsp.Status.LastUpdated = appVer.Status.LastUpdated
rsp.Status.Value = appVer.Status.Value
rsp.IsTemp = false
return
}
func getAccountStatus(groupIDData *httpcall.GroupIDData) int {
//if developerData.Type == client.ORGAN_ACCOUNT_TYPE_PERSON {
// return developerData.Status
//}
//if developerData.Type == client.ORGAN_ACCOUNT_TYPE_BUSINESS {
log.Infof("getAccountStatus-----groupIDData.ReviewStatus: %d\n", groupIDData.ReviewStatus)
if config.Cfg.IsUatEnv() {
if groupIDData.ReviewStatus == httpcall.StOrganApproved {
return httpcall.ORGAN_STATUS_NORMAL
}
if groupIDData.ReviewStatus == httpcall.StOrganUnApproved {
return httpcall.ORGAN_STATUS_FREEZE
}
}
//}
// 私有化环境固定返回1
return httpcall.ORGAN_STATUS_NORMAL
}
func convertPackages2(old []entity.Package) []proto.Package {
n := len(old)
if n == 0 {
return nil
}
res := make([]proto.Package, 0, n)
for _, val := range old {
res = append(res, proto.Package{
Root: val.Root,
Name: val.Name,
Pages: val.Pages,
Independent: val.Independent,
Filename: val.Filename,
FileUrl: val.FileUrl,
FileMd5: val.FileMd5,
})
}
return res
}
func CovertAppToPbAppInfoRsp(info *RuntimeGetAppResponse) *pb.AppInfoRspData {
if info == nil {
return nil
}
rspInfo := &pb.AppInfoRspData{}
rspInfo.AppId = info.AppID
rspInfo.AppClass = info.AppClass
rspInfo.AppId = info.AppID
rspInfo.AppType = info.AppType
rspInfo.CoreDescription = info.CoreDescription
rspInfo.CorporationId = info.CorporationID
rspInfo.Created = info.Created
rspInfo.CreatedBy = info.CreatedBy
rspInfo.DeveloperId = info.DeveloperID
rspInfo.GroupId = info.GroupID
rspInfo.GroupName = info.GroupName
rspInfo.InGrayRelease = info.InGrayRelease
rspInfo.Logo = info.Logo
rspInfo.Name = info.Name
rspInfo.Sequence = int32(info.Sequence)
rspInfo.Version = info.Version
rspInfo.CustomData = ConvertRpcCustomDataToPb(info.CustomData)
rspInfo.Status = new(pb.Status)
rspInfo.Status.Value = info.Status.Value
rspInfo.Status.Reason = info.Status.Reason
rspInfo.Status.ModifiedBy = info.Status.ModifiedBy
rspInfo.Status.LastUpdated = info.Status.LastUpdated
rspInfo.IsTemp = info.IsTemp
rspInfo.NeedCrt = info.NeedCrt
rspInfo.DeveloperStatus = int32(info.DeveloperStatus)
rspInfo.WechatLoginInfo = new(pb.WechatLoginInfo)
rspInfo.WechatLoginInfo.WechatOriginId = info.WechatLoginInfo.WechatOriginId
rspInfo.WechatLoginInfo.ProfileUrl = info.WechatLoginInfo.ProfileUrl
rspInfo.WechatLoginInfo.PhoneUrl = info.WechatLoginInfo.PhoneUrl
rspInfo.WechatLoginInfo.PaymentUrl = info.WechatLoginInfo.PaymentUrl
for _, v := range info.WechatLoginInfo.ExtUrls {
ext := pb.ExtUrls{
FieldName: v.FieldName,
PageUrl: v.PageUrl,
}
rspInfo.WechatLoginInfo.ExtUrls = append(rspInfo.WechatLoginInfo.ExtUrls, &ext)
}
rspInfo.AppTag = info.AppTag
rspInfo.PrivacySettingType = int32(info.PrivacySettingType)
rspInfo.ProjectType = int32(info.ProjectType)
return rspInfo
}
func CovertInternalAppToPbAppInfoRsp(info *InternalGetAppVerInfoRsp) *pb.AppInfoRspData {
if info == nil {
return nil
}
rspInfo := &pb.AppInfoRspData{}
rspInfo.AppId = info.AppID
rspInfo.AppClass = info.AppClass
rspInfo.AppId = info.AppID
rspInfo.AppType = info.AppType
rspInfo.CoreDescription = info.CoreDescription
rspInfo.CorporationId = info.CorporationID
rspInfo.Created = info.Created
rspInfo.CreatedBy = info.CreatedBy
rspInfo.DeveloperId = info.DeveloperID
rspInfo.GroupId = info.GroupID
rspInfo.GroupName = info.GroupName
rspInfo.InGrayRelease = info.InGrayRelease
rspInfo.Logo = info.Logo
rspInfo.Name = info.Name
rspInfo.Sequence = int32(info.Sequence)
rspInfo.Version = info.Version
rspInfo.CustomData = ConvertRpcCustomDataToPb(info.CustomData)
rspInfo.Status = new(pb.Status)
rspInfo.Status.Value = info.Status.Value
rspInfo.Status.Reason = info.Status.Reason
rspInfo.Status.ModifiedBy = info.Status.ModifiedBy
rspInfo.Status.LastUpdated = info.Status.LastUpdated
rspInfo.IsTemp = info.IsTemp
rspInfo.NeedCrt = info.NeedCrt
rspInfo.DeveloperStatus = int32(info.DeveloperStatus)
rspInfo.WechatLoginInfo = ConvertWechatLoginInfoToPb(&info.WechatLoginInfo)
rspInfo.AppTag = info.AppTag
rspInfo.PrivacySettingType = int32(info.PrivacySettingType)
rspInfo.ProjectType = int32(info.ProjectType)
return rspInfo
}
//金易联活动上报
func sendSwanReport(traceCtx context.Context, t, id string) {
if !config.GetConfig().SwanReportEnable {
return
}
log.Infof("sendSwanReport req t:[%s],id:[%s]", t, id)
var (
accountInfo *httpcall.AccountInfoData
err error
)
/*if t == "userId" {
accountInfo, err = hCaller.GetAccountInfo(traceCtx, id)
if err != nil {
log.Errorf("sendSwanReport get account info err:%s", err.Error())
return
}
if len(accountInfo.Phone) == 0 {
log.Errorf("sendSwanReport get account info phone len is 0")
return
}
} else {*/
accountInfo, err = hCaller.GetAccountInfoByAccount(traceCtx, id)
if err != nil {
log.Errorf("sendSwanReport get account info err:%s", err.Error())
return
}
//}
if len(accountInfo.Phone) == 0 {
log.Errorf("sendSwanReport get account info phone len is 0")
return
}
hCaller.SwanReport(traceCtx, accountInfo.Phone, "上架小程序")
}
func sendDelaySms(traceCtx context.Context, developerID string, isPass, isPubImmediately, isPub bool, appId, appName string, sequence int) {
if !config.Cfg.IsFdepEnv() && !config.Cfg.IsUatEnv() {
return
}
accountInfo, err := hCaller.GetAccountInfo(traceCtx, developerID)
if err != nil {
log.Errorf("sendSmsNotify get account info err:%s", err.Error())
return
}
decryptPhone, err := utils.DES_ECB{}.DecryptDES_ECB(accountInfo.Phone, utils.DES_CRYPT_KEY)
if err != nil {
log.Errorf("DecryptDES_ECB err:%s", err.Error())
return
}
// 上架通过审核的小程序
if isPub {
// 删除待发生的审核通过短信
if config.GetConfig().ThirdEnv == httpcall.THIRD_ENV_ZHAOS {
if err = hCaller.SendDelaySms(traceCtx, httpcall.SMS_ZHAOS_APP_PUBLISH_SUCC, decryptPhone, appId, appName, sequence); err != nil {
log.Errorf("SendDelaySms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_ZHAOS_APP_PUBLISH_SUCC, appId, appName, sequence, err.Error())
}
} else {
if err = hCaller.SendDelaySms(traceCtx, httpcall.SMS_APP_PUBLISH_SUCC, decryptPhone, appId, appName, sequence); err != nil {
log.Errorf("SendDelaySms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_APP_PUBLISH_SUCC, appId, appName, sequence, err.Error())
}
}
return
}
// 还在审核阶段
// 审核通过
if isPass {
// 不是立即上架
if !isPubImmediately {
// 延迟发送审核通过短信,并删除原来的待发生的申请上架审核短信, 在audit中做
if config.GetConfig().ThirdEnv == httpcall.THIRD_ENV_ZHAOS {
if err = hCaller.SendDelaySms(traceCtx, httpcall.SMS_ZHAOS_APP_PUBLISH_APPROVE, decryptPhone, appId, appName, sequence); err != nil {
log.Errorf("SendDelaySms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_ZHAOS_APP_PUBLISH_APPROVE, appId, appName, sequence, err.Error())
}
} else {
if err = hCaller.SendDelaySms(traceCtx, httpcall.SMS_APP_PUBLISH_APPROVE, decryptPhone, appId, appName, sequence); err != nil {
log.Errorf("SendDelaySms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_APP_PUBLISH_APPROVE, appId, appName, sequence, err.Error())
}
}
} else {
// 是立即上架,删除原来的待发生的申请上架审核短信
if config.GetConfig().ThirdEnv == httpcall.THIRD_ENV_ZHAOS {
if err = hCaller.SendDelaySms(traceCtx, httpcall.SMS_ZHAOS_APP_PUBLISH_IMMED, decryptPhone, appId, appName, sequence); err != nil {
log.Errorf("SendDelaySms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_ZHAOS_APP_PUBLISH_IMMED, appId, appName, sequence, err.Error())
}
} else {
if err = hCaller.SendDelaySms(traceCtx, httpcall.SMS_APP_PUBLISH_IMMED, decryptPhone, appId, appName, sequence); err != nil {
log.Errorf("SendDelaySms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_APP_PUBLISH_IMMED, appId, appName, sequence, err.Error())
}
}
}
} else {
if config.GetConfig().ThirdEnv == httpcall.THIRD_ENV_ZHAOS {
// 拒绝,立即发送拒绝短信
if err = hCaller.SendThirdSms(traceCtx, httpcall.SMS_ZHAOS_APP_PUBLISH_REJECT, decryptPhone, appName); err != nil {
log.Errorf("SendThirdSms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_ZHAOS_APP_PUBLISH_REJECT, appId, appName, sequence, err.Error())
}
// 删除原来的待发生的申请上架审核短信
if err = hCaller.SendDelaySms(traceCtx, httpcall.SMS_ZHAOS_APP_PUBLISH_REJECT, decryptPhone, appId, appName, sequence); err != nil {
log.Errorf("SendDelaySms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_ZHAOS_APP_PUBLISH_REJECT, appId, appName, sequence, err.Error())
}
} else {
// 拒绝,立即发送拒绝短信
if err = hCaller.SendSmsNotify(traceCtx, httpcall.SMS_APP_PUBLISH_REJECT, decryptPhone, appName); err != nil {
log.Errorf("sendSmsNotify smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_APP_PUBLISH_REJECT, appId, appName, sequence, err.Error())
}
// 删除原来的待发生的申请上架审核短信
if err = hCaller.SendDelaySms(traceCtx, httpcall.SMS_APP_PUBLISH_REJECT, decryptPhone, appId, appName, sequence); err != nil {
log.Errorf("SendDelaySms smsType:%s appId:%s appName:%s sequence:%d err:%s", httpcall.SMS_APP_PUBLISH_REJECT, appId, appName, sequence, err.Error())
}
}
}
}
func notifySpiderPubApp(ctx context.Context, appId, appName, desc, organName, sourceUrl, appTag, appClass string) {
//获取小程序关联的sdkKeys
bindRepo := impl.InitBindingRepo()
result, err := bindRepo.GetAllAssBinds(ctx, appId)
if err != nil {
log.Errorf("notifySpiderPubApp err:%s", err.Error())
return
}
var sdkKeyListMap = make(map[string]bool, 0)
var sdkKeyList = make([]string, 0)
for _, v := range result {
for _, sdkKeyInfo := range v.BundleInfos {
if _, ok := sdkKeyListMap[sdkKeyInfo.SDKKey]; !ok {
sdkKeyListMap[sdkKeyInfo.SDKKey] = true
}
}
}
for k, _ := range sdkKeyListMap {
sdkKeyList = append(sdkKeyList, k)
}
req := &httpcall.SpiderPubReq{
AppId: appId,
AppName: appName,
AppDesc: desc,
OrganName: organName,
SdkKeys: sdkKeyList,
Resource: sourceUrl,
AppTag: appTag,
AppClass: appClass,
}
log.Infof("notifySpiderPubApp req:%+v", req)
_, err = hCaller.PubAppNotifySearchApp(ctx, req)
if err != nil {
log.Errorf("notfiy spider publishApp appId:%s err:%s", appId, err.Error())
} else {
log.Infof("notify spider publishApp appId:%s succ", appId)
}
return
}
func notifySpiderPushApp(ctx context.Context, appId string, state int) {
notifys := &httpcall.NotifySpiderUpdate{Type: httpcall.STATE_UPDATE, State: httpcall.StateUpdate{
AppId: appId,
State: state,
}}
_, err := hCaller.Notify(ctx, notifys)
if err != nil {
log.Errorf("notfiy spider publishApp appId:%s err:%s", appId, err.Error())
} else {
log.Infof("notify spider publishApp appId:%s succ", appId)
}
}

View File

@ -0,0 +1,275 @@
package service
import (
"context"
"encoding/base64"
"errors"
"finclip-app-manager/domain/entity"
"finclip-app-manager/domain/entity/proto"
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/domain/repository"
"finclip-app-manager/infrastructure/config"
impl "finclip-app-manager/infrastructure/db/repo"
"finclip-app-manager/infrastructure/utils"
"fmt"
)
const (
qrcodePrefix = "-f-"
qrcodeSuffix = "--"
)
type QrCodeInfoService struct {
qrcodeRepo repository.IQrCodeInfoRepo
buildInfoRepo repository.IAppBuildInfoRepo
}
func NewQrCodeInfoService() *QrCodeInfoService {
return &QrCodeInfoService{
qrcodeRepo: impl.InitQrCodeInfoRepo(),
buildInfoRepo: impl.InitBuildInfoRepo(),
}
}
func (q *QrCodeInfoService) GenQrcodeInfo(ctx context.Context, req proto.GenQrcodeReq) (*entity.QrCodeInfo, error) {
var (
info *entity.QrCodeInfo
err error
)
//首先查看是否已经存在uuid
switch req.Type {
case entity.QrCodeTypeReview:
info, err = q.qrcodeRepo.GetReviewInfo(ctx, req.AppId, req.Sequence)
case entity.QrCodeTypeRelease:
info, err = q.qrcodeRepo.GetReleaseInfo(ctx, req.AppId)
case entity.QrCodeTypeTrial:
info, err = q.qrcodeRepo.GetTrialInfo(ctx, req.AppId)
case entity.QrCodeTypeTemporary:
info, err = q.qrcodeRepo.GetTemporaryInfo(ctx, req.AppId, req.Sequence)
case entity.QrCodeTypeRomoteDebug:
info, err = q.qrcodeRepo.GetRemoteDebugInfo(ctx, req.AppId, req.Sequence)
default:
return nil, errors.New("type err")
}
if err != nil {
if !q.qrcodeRepo.NotFound(err) {
return nil, err
}
//不存在则进行插入
info, err = q.insertQrcodeInfo(ctx, req)
if err != nil {
log.Errorf("insertQrcodeInfo err:%s", err.Error())
return nil, err
}
return info, nil
}
//ide 临时小程序更新二维码时需更新过期时间
if info.Type == entity.QrCodeTypeTemporary || info.Type == entity.QrCodeTypeRomoteDebug || info.Type == entity.QrCodeTypeReview {
expTime := int64(0)
if info.Type == entity.QrCodeTypeReview {
expTime = utils.GetNowMs() + int64(config.GetConfig().ReviewQRcodeExpireTime*1e3)
} else {
expTime = utils.GetNowMs() + int64(config.GetConfig().QRcodeExpireTime*1e3)
}
err = q.qrcodeRepo.UpdateInfo(ctx, info.Uuid, map[string]interface{}{"expire_time": expTime})
if err != nil {
return nil, err
}
info.ExpireTime = expTime
if req.Type == entity.QrCodeTypeTemporary {
path := req.StartParams.Path
query := req.StartParams.Query
appStartParams := entity.AppStartParams{}
if len(query) > 0 {
appStartParams.PathAndQuery = path + "?" + query
} else {
appStartParams.PathAndQuery = path
}
err = q.qrcodeRepo.UpdateStartParamsByUuid(ctx, info.Uuid, appStartParams)
if err != nil {
return nil, err
}
}
}
if req.ApiServer != info.ApiServer {
err = q.qrcodeRepo.UpdateApiServer(ctx, info.Uuid, req.ApiServer)
if err != nil {
log.Errorf("GenQrcodeInfo UpdateApiServer err:%s", err.Error())
return nil, err
}
info.ApiServer = req.ApiServer
}
return info, nil
}
func (q *QrCodeInfoService) insertQrcodeInfo(ctx context.Context, req proto.GenQrcodeReq) (*entity.QrCodeInfo, error) {
//首先查看是否已经存在uuid
var (
qrCodeInfo *entity.QrCodeInfo
nowMs = utils.GetNowMs()
)
path := req.StartParams.Path
query := req.StartParams.Query
appStartParams := entity.AppStartParams{}
if len(query) > 0 {
appStartParams.PathAndQuery = path + "?" + query
} else {
appStartParams.PathAndQuery = path
}
switch req.Type {
case entity.QrCodeTypeReview:
//生成该版本的二维码信息
qrCodeInfo = &entity.QrCodeInfo{
Type: entity.QrCodeTypeReview,
Uuid: GenReviewQrCodeUuid(req.AppId, req.Sequence),
AppId: req.AppId,
Sequence: req.Sequence,
ApiServer: req.ApiServer,
CodeId: req.CodeId,
StartParams: appStartParams,
CreateTime: nowMs,
DebugInfo: req.DebugInfo,
ExpireTime: nowMs + int64(config.GetConfig().ReviewQRcodeExpireTime*1e3),
}
case entity.QrCodeTypeRelease:
qrCodeInfo = &entity.QrCodeInfo{
Type: entity.QrCodeTypeRelease,
Uuid: GenReleaseQrCodeUuid(req.AppId),
AppId: req.AppId,
Sequence: req.Sequence,
ApiServer: req.ApiServer,
StartParams: appStartParams,
ExpireTime: 0,
CreateTime: nowMs,
DebugInfo: req.DebugInfo,
}
case entity.QrCodeTypeTrial:
qrCodeInfo = &entity.QrCodeInfo{
Type: entity.QrCodeTypeTrial,
Uuid: GenTrialQrCodeUuid(req.AppId),
AppId: req.AppId,
Sequence: 0,
ApiServer: req.ApiServer,
CodeId: req.CodeId,
//todo ccc
StartParams: appStartParams,
CreateTime: nowMs,
DebugInfo: req.DebugInfo,
}
case entity.QrCodeTypeTemporary:
qrCodeInfo = &entity.QrCodeInfo{
Type: entity.QrCodeTypeTemporary,
Uuid: GenTemporaryQrCodeUuid(req.AppId, entity.AppTempDefSequence),
AppId: req.AppId,
Sequence: entity.AppTempDefSequence,
ApiServer: req.ApiServer,
CodeId: "",
StartParams: appStartParams,
ExpireTime: nowMs + int64(config.GetConfig().QRcodeExpireTime*1e3),
CreateTime: nowMs,
DebugInfo: req.DebugInfo,
}
case entity.QrCodeTypeRomoteDebug:
qrCodeInfo = &entity.QrCodeInfo{
Type: entity.QrCodeTypeRomoteDebug,
Uuid: GenRemoteDebugQrCodeUuid(req.AppId, entity.AppTempDefSequence),
AppId: req.AppId,
Sequence: entity.AppTempDefSequence,
ApiServer: req.ApiServer,
CodeId: "",
StartParams: appStartParams,
ExpireTime: nowMs + int64(config.GetConfig().QRcodeExpireTime*1e3),
CreateTime: nowMs,
DebugInfo: req.DebugInfo,
}
default:
return nil, errors.New("type err")
}
return qrCodeInfo, q.qrcodeRepo.Insert(ctx, qrCodeInfo)
}
func (q *QrCodeInfoService) DeleteWechatQrcode(ctx context.Context, req apiproto.DeleteWechatInfoReq) error {
//wechatT := db.NewTable(db.TableWechatInfo)
//params := map[string]interface{}{"qrcodeUrl": "", "qrcodeDownloadUrl": "", "updated": time.Now().UnixNano() / 1e6}
//wechatT.UpdateOne(ctx, bson.M{"appId": req.AppId}, bson.M{"$set": params})
//s.ResetWechatHint(ctx, req.AppId)
err := hCaller.DeleteWechatQrcode(ctx, req)
if err != nil {
return err
}
return nil
}
func (q *QrCodeInfoService) GetQrcodeInfo(ctx context.Context, uuid string) (*entity.QrCodeInfo, error) {
repo := impl.InitQrCodeInfoRepo()
info, err := repo.GetInfoByUuid(ctx, uuid)
if err != nil {
if repo.NotFound(err) {
return nil, entity.NotFoundErr
}
return nil, err
}
return info, nil
}
func (q *QrCodeInfoService) UpdateTrialStartParams(ctx context.Context, codeId string, params entity.AppStartParams) error {
_, err := q.qrcodeRepo.GetInfoByCodeId(ctx, codeId)
if err != nil {
if !repository.NotFound(err) {
return err
}
buildInfo, err := q.buildInfoRepo.GetInfoById(ctx, codeId)
if err != nil {
return err
}
newQrcodeInfo := &entity.QrCodeInfo{
Type: entity.QrCodeTypeTrial,
Uuid: GenTrialQrCodeUuid(buildInfo.AppID),
AppId: buildInfo.AppID,
Sequence: 0,
ApiServer: config.Cfg.ApiServer,
CodeId: codeId,
//todo ccc
StartParams: params,
CreateTime: utils.GetNowMs(),
}
err = q.qrcodeRepo.Insert(ctx, newQrcodeInfo)
if err != nil {
return err
}
}
return q.qrcodeRepo.UpdateTrialStartParams(ctx, codeId, params)
}
func GenReviewQrCodeUuid(appId string, seq int) string {
s := utils.Gen16Md5(fmt.Sprintf("type=%s&appId=%s&sequence=%d", entity.QrCodeTypeReview, appId, seq))
return UuidJoinFix(base64.RawURLEncoding.EncodeToString([]byte(s)))
}
func GenReleaseQrCodeUuid(appId string) string {
s := utils.Gen16Md5(fmt.Sprintf("type=%s&appId=%s", entity.QrCodeTypeRelease, appId))
return UuidJoinFix(base64.RawURLEncoding.EncodeToString([]byte(s)))
}
func GenTrialQrCodeUuid(appId string) string {
s := utils.Gen16Md5(fmt.Sprintf("type=%s&appId=%s", entity.QrCodeTypeTrial, appId))
return UuidJoinFix(base64.RawURLEncoding.EncodeToString([]byte(s)))
}
func GenTemporaryQrCodeUuid(appId string, seq int) string {
s := utils.Gen16Md5(fmt.Sprintf("type=%s&appId=%s&sequence=%d", entity.QrCodeTypeTemporary, appId, seq))
return UuidJoinFix(base64.RawURLEncoding.EncodeToString([]byte(s)))
}
func GenRemoteDebugQrCodeUuid(appId string, seq int) string {
s := utils.Gen16Md5(fmt.Sprintf("type=%s&appId=%s&sequence=%d", entity.QrCodeTypeRomoteDebug, appId, seq))
return UuidJoinFix(base64.RawURLEncoding.EncodeToString([]byte(s)))
}
func UuidJoinFix(id string) string {
return qrcodePrefix + id + qrcodeSuffix
}

View File

@ -0,0 +1,25 @@
package service
import (
"context"
)
//const (
// RedDotTypePubApp = "pubApp"
// RedDotTypeTrialApp = "trialApp"
//)
type RedDotService struct {
}
func NewRedDotService() *RedDotService {
var s RedDotService
return &s
}
func (s RedDotService) ReadTrialQr(ctx context.Context, id string, userId string) error {
return hCaller.ReadTrialQr(ctx, id, userId)
//repo := impl.InitRedDotRepo()
//return repo.ReadTrialQr(ctx, RedDotTypeTrialApp, id, userId)
}

View File

@ -0,0 +1,6 @@
package service
/**
* DDD: domain -service
* (Domain Services):
**/

View File

@ -0,0 +1,85 @@
package service
import (
"context"
"finclip-app-manager/domain/entity"
impl "finclip-app-manager/infrastructure/db/repo"
"gitlab.finogeeks.club/finclip-backend/apm"
"time"
)
func InitTypeConfig() {
span, ctx := apm.ApmClient().CreateLocalSpan(context.Background())
span.Log(time.Now(), "config.Cfg.IsMOP init")
defer span.End()
repo := impl.InitTypeConfigRepo()
total, _, err := repo.GetAll(ctx)
if err != nil && !repo.NotFound(err) {
panic(err)
}
if total == 0 {
for _, v := range entity.MopCfg {
err := repo.Insert(ctx, &v)
if err != nil {
log.Errorf("init type config err:%s", err.Error())
break
}
}
return
}
}
type TypeConfigService struct {
}
func NewTypeConfigService() *TypeConfigService {
var s TypeConfigService
return &s
}
func (s *TypeConfigService) GetTypeConfigList(ctx context.Context, pageSize int, pageNo int) (int, []entity.TypeConfig, error) {
repo := impl.InitTypeConfigRepo()
total, configs, err := repo.GetSome(ctx, pageSize, pageNo)
if repo.NotFound(err) {
return 0, []entity.TypeConfig{}, nil
}
return total, configs, err
}
func (s *TypeConfigService) GetAllTypeConfigList(ctx context.Context) (int, []entity.TypeConfig, error) {
repo := impl.InitTypeConfigRepo()
total, configs, err := repo.GetAll(ctx)
if repo.NotFound(err) {
return 0, []entity.TypeConfig{}, nil
}
return total, configs, err
}
func (s *TypeConfigService) Exist(ctx context.Context, namespace string, value string) (bool, error) {
repo := impl.InitTypeConfigRepo()
return repo.Exist(ctx, namespace, value)
}
func (s *TypeConfigService) GetNowSortNumInfo(ctx context.Context) (*entity.TypeConfig, error) {
repo := impl.InitTypeConfigRepo()
return repo.GetNowSortNumInfo(ctx)
}
func (s *TypeConfigService) Insert(ctx context.Context, typeConfig *entity.TypeConfig) error {
repo := impl.InitTypeConfigRepo()
return repo.Insert(ctx, typeConfig)
}
func (s *TypeConfigService) Delete(ctx context.Context, typeConfigId string) error {
repo := impl.InitTypeConfigRepo()
return repo.Delete(ctx, typeConfigId)
}
func (s *TypeConfigService) NotFound(err error) bool {
repo := impl.InitTypeConfigRepo()
return repo.NotFound(err)
}

View File

@ -0,0 +1,6 @@
package valueObject
/**
* DDD: domain -
* (Value Objects):
**/

44
go.mod 100644
View File

@ -0,0 +1,44 @@
module finclip-app-manager
require (
github.com/Chain-Zhang/pinyin v0.1.3
github.com/Shopify/sarama v1.24.1
github.com/SkyAPM/go2sky v0.5.0
github.com/alexmullins/zip v0.0.0-20180717182244-4affb64b04d0
github.com/bitly/go-simplejson v0.5.0
github.com/bluele/gcache v0.0.2
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/bsm/sarama-cluster v2.1.15+incompatible
github.com/caarlos0/env/v6 v6.3.0
github.com/garyburd/redigo v1.6.0
github.com/gin-gonic/gin v1.7.1
github.com/go-redis/redis/v8 v8.11.3
github.com/go-resty/resty/v2 v2.7.0
github.com/golang/protobuf v1.5.2 // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/gorilla/mux v1.7.3 // indirect
github.com/hashicorp/consul/api v1.7.0
github.com/jinzhu/copier v0.3.5
github.com/mbobakov/grpc-consul-resolver v1.4.3
github.com/openzipkin/zipkin-go v0.2.2
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.4.0
github.com/satori/go.uuid v1.2.0
github.com/tealeg/xlsx v1.0.5
github.com/xdg-go/scram v1.1.1
github.com/zzfup/go-fetch v1.0.1
gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo v1.0.1
gitlab.finogeeks.club/finclip-backend-v2/finclip-redis v0.0.0-20210723095205-13a1cd72e5d4
gitlab.finogeeks.club/finclip-backend/apm v0.2.4
gitlab.finogeeks.club/finclip-backend/mop-middleware-auth v0.1.23
gitlab.finogeeks.club/finclip-backend/rmconf v0.1.1
golang.org/x/text v0.3.7 // indirect
google.golang.org/grpc v1.29.1
google.golang.org/protobuf v1.27.1
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gorm.io/driver/mysql v1.2.3
gorm.io/gorm v1.22.5
)
go 1.13

538
go.sum 100644
View File

@ -0,0 +1,538 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Chain-Zhang/pinyin v0.1.3 h1:RzErNyNwVa8z2sOLCuXSOtVdY/AsARb8mBzI2p2qtnE=
github.com/Chain-Zhang/pinyin v0.1.3/go.mod h1:5iHpt9p4znrnaP59/hfPMnAojajkDxQaP9io+tRMPho=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/sarama v1.24.1 h1:svn9vfN3R1Hz21WR2Gj0VW9ehaDGkiOS+VqlIcZOkMI=
github.com/Shopify/sarama v1.24.1/go.mod h1:fGP8eQ6PugKEI0iUETYYtnP6d1pH/bdDMTel1X5ajsU=
github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/SkyAPM/go2sky v0.5.0 h1:9RDBQviaeazG7PJMLLnMcU4U++PORbqEls4ix4OEgQw=
github.com/SkyAPM/go2sky v0.5.0/go.mod h1:TANzYw5EvIlTidGWvQxtvO87rM6C746HkM0xkWqnPQw=
github.com/SkyAPM/go2sky-plugins/gin/v3 v3.0.0-20200929011259-46b345515dcd/go.mod h1:PJOl29eK8/DkEva1PozhZDqMDHFbVY89mas9L8rbiwQ=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alexmullins/zip v0.0.0-20180717182244-4affb64b04d0 h1:BVts5dexXf4i+JX8tXlKT0aKoi38JwTXSe+3WUneX0k=
github.com/alexmullins/zip v0.0.0-20180717182244-4affb64b04d0/go.mod h1:FDIQmoMNJJl5/k7upZEnGvgWVZfFeE6qHeN7iCMbCsA=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-metrics v0.3.2 h1:EyUnxyP2yaGpLgMiuyyz8sHnByqeTJUfGs72pdH0i4A=
github.com/armon/go-metrics v0.3.2/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y=
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
github.com/bluele/gcache v0.0.2 h1:WcbfdXICg7G/DGBh1PFfcirkWOQV+v077yF1pSy3DGw=
github.com/bluele/gcache v0.0.2/go.mod h1:m15KV+ECjptwSPxKhOhQoAFQVtUFjTVkc3H8o0t/fp0=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/bsm/sarama-cluster v2.1.15+incompatible h1:RkV6WiNRnqEEbp81druK8zYhmnIgdOjqSVi0+9Cnl2A=
github.com/bsm/sarama-cluster v2.1.15+incompatible/go.mod h1:r7ao+4tTNXvWm+VRpRJchr2kQhqxgmAp2iEX5W96gMM=
github.com/caarlos0/env/v6 v6.3.0 h1:PaqGnS5iHScZ5SnZNBPvQbA2VE/eMAwlp51mKGuEZLg=
github.com/caarlos0/env/v6 v6.3.0/go.mod h1:nXKfztzgWXH0C5Adnp+gb+vXHmMjKdBnMrSVSczSkiw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-resiliency v1.2.0 h1:v7g92e/KSN71Rq7vSThKaWIq68fL4YHvWyiUKorFR1Q=
github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/frankban/quicktest v1.4.1/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ=
github.com/frankban/quicktest v1.10.2 h1:19ARM85nVi4xH7xPXuc5eM/udya5ieh7b/Sv+d844Tk=
github.com/frankban/quicktest v1.10.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/garyburd/redigo v1.6.0 h1:0VruCpn7yAIIu7pWVClQC8wxCJEcG3nyzpMSHKi1PQc=
github.com/garyburd/redigo v1.6.0/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gin-gonic/gin v1.7.1 h1:qC89GU3p8TvKWMAVhEpmpB2CIb1hnqt2UdKZaP93mS8=
github.com/gin-gonic/gin v1.7.1/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/form v3.1.4+incompatible h1:lvKiHVxE2WvzDIoyMnWcjyiBxKt2+uFJyZcPYWsLnjI=
github.com/go-playground/form v3.1.4+incompatible/go.mod h1:lhcKXfTuhRtIZCIKUeJ0b5F207aeQCPbZU09ScKjwWg=
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/go-redis/redis/v8 v8.11.0/go.mod h1:DLomh7y2e3ggQXQLd1YgmvIfecPJoFl7WU5SOQ/r06M=
github.com/go-redis/redis/v8 v8.11.3 h1:GCjoYp8c+yQTJfc0n69iwSiHjvuAdruxl7elnZCxgt8=
github.com/go-redis/redis/v8 v8.11.3/go.mod h1:xNJ9xDG09FsIPwh3bWdk+0oDWHbtF9rPN0F/oD9XeKc=
github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=
github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
github.com/hashicorp/consul/api v1.7.0 h1:tGs8Oep67r8CcA2Ycmb/8BLBcJ70St44mF2X10a/qPg=
github.com/hashicorp/consul/api v1.7.0/go.mod h1:1NSuaUUkFaJzMasbfq/11wKYWSR67Xn6r2DXKhuDNFg=
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
github.com/hashicorp/consul/sdk v0.6.0 h1:FfhMEkwvQl57CildXJyGHnwGGM4HMODGyfjGwNM1Vdw=
github.com/hashicorp/consul/sdk v0.6.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tkrmZM=
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.1.0 h1:vN9wG1D6KG6YHRTWr8512cxGOVgTMEfgEdSj/hr8MPc=
github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY=
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/memberlist v0.2.2 h1:5+RffWKwqJ71YPu9mWsF7ZOscZmwfasdA8kbdC7AO2g=
github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hashicorp/serf v0.8.5/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k=
github.com/hashicorp/serf v0.9.3 h1:AVF6JDQQens6nMHT9OGERBvK0f8rPrAGILnsKLr6lzM=
github.com/hashicorp/serf v0.9.3/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jcmturner/gofork v0.0.0-20190328161633-dc7c13fece03/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
github.com/jcmturner/gofork v1.0.0 h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8=
github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg=
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.3/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jinzhu/now v1.1.4 h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas=
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.11.0 h1:wJbzvpYMVGG9iTI9VxpnNZfd4DzMPoCWze3GgSqz8yg=
github.com/klauspost/compress v1.11.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mbobakov/grpc-consul-resolver v1.4.3 h1:jnwggRTBeSg8QtAc1cQcFUmBo6FGPSWOV3LTxU1Bhgc=
github.com/mbobakov/grpc-consul-resolver v1.4.3/go.mod h1:4XagwDYAljLu9tulY7bKuynGZgrx5siDRRlrdU5d3yg=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.26 h1:gPxPSwALAeHJSjarOs00QjVdV9QoBvc1D2ujQUr5BzU=
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg=
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
github.com/onsi/gomega v1.15.0 h1:WjP/FQ/sk43MRmnEcT+MlDw2TFvkrXlprrPST/IudjU=
github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0=
github.com/openzipkin/zipkin-go v0.2.2 h1:nY8Hti+WKaP0cRsSeQ026wU03QsM762XBeCXBb9NAWI=
github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.2.6+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pierrec/lz4 v2.5.2+incompatible h1:WCjObylUIOlKy/+7Abdn34TLIkXiA4UWUMhxq9m9ZXI=
github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 h1:MkV+77GLUNo5oJ0jf870itWm3D0Sjh7+Za9gazKc5LQ=
github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/zzfup/go-fetch v1.0.1 h1:K6kaDv4Asp6zTMsKJZbY4OdgjgXS9D1JHMlmVyS3yiA=
github.com/zzfup/go-fetch v1.0.1/go.mod h1:HJgl/egXQ5uBAsuvdUeuOkminiCzlA1Of1wJuN30cU4=
gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo v1.0.1 h1:GBQQxSdr1L4vvPnplmYa7/ZW/BHpRrdtP7qd5wMqMrs=
gitlab.finogeeks.club/finclip-backend-v2/finclip-mgo v1.0.1/go.mod h1:MKzEpaTj8iVHHbkvdVryKgVc+yYNlu0ccWvc5ERjgTE=
gitlab.finogeeks.club/finclip-backend-v2/finclip-redis v0.0.0-20210723095205-13a1cd72e5d4 h1:5TIEQFaTRoZac7X/2ZeSBzswJFtgDrSvArknEQgn+/c=
gitlab.finogeeks.club/finclip-backend-v2/finclip-redis v0.0.0-20210723095205-13a1cd72e5d4/go.mod h1:kEPGV2TGliSBEWGPHMw/V+1Kjj6Ls9gCKpXuUCFBvbw=
gitlab.finogeeks.club/finclip-backend/apm v0.2.4 h1:tWroZ500nXoGrxppJqtuGMTM5rBHADWn/DcPIOJV53g=
gitlab.finogeeks.club/finclip-backend/apm v0.2.4/go.mod h1:Qpl3kqAC1ZhoEOH0nwDiwycOCRlZvchlxOQeOyFYy4Q=
gitlab.finogeeks.club/finclip-backend/mop-middleware-auth v0.1.23 h1:wTv1YT1jaLZyW1CMQUuKjqXayFSicCZ4GRtFJOUQSmQ=
gitlab.finogeeks.club/finclip-backend/mop-middleware-auth v0.1.23/go.mod h1:tK4vYEMCvbr9h5Hx1HKK1yB59GbUbTfnCBZpzA+T22o=
gitlab.finogeeks.club/finclip-backend/rmconf v0.1.1 h1:gyVCjtA9OarRVrqJ9+kqmVPpCOHbQf0iPuWnja46MsY=
gitlab.finogeeks.club/finclip-backend/rmconf v0.1.1/go.mod h1:RORGCrEwiuSRJF6VFWvEniHlhd0HQ8lgLgB4xj/TBC0=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211029224645-99673261e6eb h1:pirldcYWx7rx7kE5r+9WsOXPXK0+WH5+uZ7uPmJ44uM=
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181010134911-4d1c5fb19474/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200210034751-acff78025515/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U=
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/jcmturner/aescts.v1 v1.0.1 h1:cVVZBK2b1zY26haWB4vbBiZrfFQnfbTVrE3xZq6hrEw=
gopkg.in/jcmturner/aescts.v1 v1.0.1/go.mod h1:nsR8qBOg+OucoIW+WMhB3GspUQXq9XorLnQb9XtvcOo=
gopkg.in/jcmturner/dnsutils.v1 v1.0.1 h1:cIuC1OLRGZrld+16ZJvvZxVJeKPsvd5eUIvxfoN5hSM=
gopkg.in/jcmturner/dnsutils.v1 v1.0.1/go.mod h1:m3v+5svpVOhtFAP/wSz+yzh4Mc0Fg7eRhxkJMWSIz9Q=
gopkg.in/jcmturner/goidentity.v3 v3.0.0 h1:1duIyWiTaYvVx3YX2CYtpJbUFd7/UuPYCfgXtQ3VTbI=
gopkg.in/jcmturner/goidentity.v3 v3.0.0/go.mod h1:oG2kH0IvSYNIu80dVAyu/yoefjq1mNfM5bm88whjWx4=
gopkg.in/jcmturner/gokrb5.v7 v7.2.3/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM=
gopkg.in/jcmturner/gokrb5.v7 v7.5.0 h1:a9tsXlIDD9SKxotJMK3niV7rPZAJeX2aD/0yg3qlIrg=
gopkg.in/jcmturner/gokrb5.v7 v7.5.0/go.mod h1:l8VISx+WGYp+Fp7KRbsiUuXTTOnxIc3Tuvyavf11/WM=
gopkg.in/jcmturner/rpc.v1 v1.1.0 h1:QHIUxTX1ISuAv9dD2wJ9HWQVuWDX/Zc0PfeC2tjc4rU=
gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.2.3 h1:cZqzlOfg5Kf1VIdLC1D9hT6Cy9BgxhExLj/2tIgUe7Y=
gorm.io/driver/mysql v1.2.3/go.mod h1:qsiz+XcAyMrS6QY+X3M9R6b/lKM1imKmcuK9kac5LTo=
gorm.io/gorm v1.22.4/go.mod h1:1aeVC+pe9ZmvKZban/gW4QPra7PRoTEssyc922qCAkk=
gorm.io/gorm v1.22.5 h1:lYREBgc02Be/5lSCTuysZZDb6ffL2qrat6fg9CFbvXU=
gorm.io/gorm v1.22.5/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

33
infrastructure/cache/mem/mem.go vendored 100644
View File

@ -0,0 +1,33 @@
package mem
import (
"time"
"github.com/bluele/gcache"
)
//如果不够用修改100000
var memCache gcache.Cache = gcache.New(100000).LRU().Build()
type MemCache struct {
c gcache.Cache
}
func NewMemCache() *MemCache {
return &MemCache{
c: memCache,
}
}
func (m *MemCache) Set(k string, v interface{}, d time.Duration) {
m.c.SetWithExpire(k, v, d)
}
func (m *MemCache) Get(k string) (interface{}, bool) {
v, err := m.c.Get(k)
if err == nil {
return v, true
}
return v, false
}

View File

@ -0,0 +1,175 @@
package redis
import (
"context"
"finclip-app-manager/infrastructure/config"
"strings"
"time"
"github.com/SkyAPM/go2sky"
"github.com/garyburd/redigo/redis"
goRedis "github.com/go-redis/redis/v8"
fcredis "gitlab.finogeeks.club/finclip-backend-v2/finclip-redis"
"gitlab.finogeeks.club/finclip-backend/apm"
)
const (
MODE_SINGLE = "single"
MODE_SENTINEL = "sentinel"
MODE_SENTINEL_V2 = "sentinel_v2"
MODE_CLUSTER = "cluster"
MODE_CLUSTER_V2 = "cluster_v2"
)
func init() {
RedisStart()
}
func RedisStart() {
cfg := config.GetConfig()
switch cfg.RedisMode {
case "single":
opt, err := goRedis.ParseURL(cfg.RedisAddr)
if err != nil {
panic(err)
}
opt.Password = cfg.RedisPassword
err = fcredis.Init("single", opt)
if err != nil {
panic(err)
}
case "sentinel", "sentinel_v2":
opt := &goRedis.FailoverOptions{
SentinelAddrs: strings.Split(cfg.RedisSentinelAddr, ","),
SentinelPassword: cfg.RedisSentinelPassword,
MasterName: cfg.RedisMasterName,
DB: cfg.RedisDatabase,
}
if err := fcredis.Init("sentinel", opt); err != nil {
panic(err)
}
case "cluster", "cluster_v2":
opt := &goRedis.ClusterOptions{
Addrs: strings.Split(cfg.RedisAddr, ","),
Password: cfg.RedisPassword,
}
if err := fcredis.Init("cluster", opt); err != nil {
panic(err)
}
}
return
}
func createRedisSpan(ctx context.Context, action string) go2sky.Span {
switch config.GetConfig().RedisMode {
case MODE_SENTINEL_V2:
span := apm.ApmClient().CreateRedisExitSpan(ctx, action,
config.GetConfig().RedisSentinelAddr, "")
span.Log(time.Now(), "Mode", config.GetConfig().RedisMode)
span.Log(time.Now(), "MasterName", config.GetConfig().RedisMasterName)
return span
case MODE_CLUSTER:
span := apm.ApmClient().CreateRedisExitSpan(ctx, action,
config.GetConfig().RedisAddr, "")
span.Log(time.Now(), "Mode", config.GetConfig().RedisMode)
return span
case MODE_CLUSTER_V2:
span := apm.ApmClient().CreateRedisExitSpan(ctx, action,
config.GetConfig().RedisAddr, "")
span.Log(time.Now(), "Mode", config.GetConfig().RedisMode)
return span
default:
if config.GetConfig().RedisMode == MODE_SENTINEL {
span := apm.ApmClient().CreateRedisExitSpan(ctx, action,
config.GetConfig().RedisSentinelAddr, "")
span.Log(time.Now(), "Mode", config.GetConfig().RedisMode)
span.Log(time.Now(), "MasterName", config.GetConfig().RedisMasterName)
return span
} else {
span := apm.ApmClient().CreateRedisExitSpan(ctx, action,
config.GetConfig().RedisAddr, "")
span.Log(time.Now(), "Mode", config.GetConfig().RedisMode)
return span
}
}
}
func RedisSet(ctx context.Context, key string, value string, expireTime int) (err error) {
span := createRedisSpan(ctx, "RedisSet")
span.Log(time.Now(), "key", key)
defer span.End()
return fcredis.Client().Set(ctx, "finclip_"+key, value, time.Duration(expireTime)*time.Second).Err()
}
func RedisGet(ctx context.Context, key string) (s string, err error) {
span := createRedisSpan(ctx, "RedisGet")
span.Log(time.Now(), "key", key)
return fcredis.Client().Get(ctx, "finclip_"+key).Result()
}
func RedisGetNum(ctx context.Context, key string) (s int, err error) {
span := createRedisSpan(ctx, "RedisGet")
span.Log(time.Now(), "key", key)
defer span.End()
return fcredis.Client().Get(ctx, "finclip_"+key).Int()
}
func RedisDel(ctx context.Context, key string) (err error) {
span := createRedisSpan(ctx, "RedisDel")
span.Log(time.Now(), "key", key)
defer span.End()
return fcredis.Client().Del(ctx, "finclip_"+key).Err()
}
func Setnx(ctx context.Context, key string, value string, expireTime int) (exi bool, err error) {
span := createRedisSpan(ctx, "Setnx")
span.Log(time.Now(), "key", key)
defer span.End()
notExi, err := fcredis.Client().SetNX(ctx, "finclip_"+key, value, time.Duration(expireTime)*time.Second).Result()
return !notExi, err
}
func RedisSetByte(ctx context.Context, key string, value []byte, expireTime int) (err error) {
span := createRedisSpan(ctx, "RedisSetByte")
span.Log(time.Now(), "key", key)
defer span.End()
return fcredis.Client().Set(ctx, "finclip_"+key, value, time.Duration(expireTime)*time.Second).Err()
}
func RedisGetByte(ctx context.Context, key string) (bytes []byte, err error) {
span := createRedisSpan(ctx, "RedisGetByte")
span.Log(time.Now(), "key", key)
defer span.End()
return fcredis.Client().Get(ctx, "finclip_"+key).Bytes()
}
func RedisSetExpire(ctx context.Context, key string, sec int) (err error) {
span := createRedisSpan(ctx, "RedisSetExpire")
span.Log(time.Now(), "key", key)
defer span.End()
return fcredis.Client().Expire(ctx, "finclip_"+key, time.Duration(sec)*time.Second).Err()
}
func RedisIncrValue(ctx context.Context, key string) (value int, err error) {
span := createRedisSpan(ctx, "RedisIncrValue")
span.Log(time.Now(), "key", key)
result, err := fcredis.Client().Incr(ctx, "finclip_"+key).Result()
return int(result), err
}
func RedisGetIntValue(ctx context.Context, key string) (val int, err error) {
return fcredis.Client().Get(ctx, "finclip_"+key).Int()
}
func TryLock(ctx context.Context, key string, lockTime time.Duration) (ok bool, err error) {
return fcredis.Lock(ctx, "finclip_"+key, lockTime*time.Second)
}
func Unlock(ctx context.Context, key string) error {
return fcredis.Client().Del(ctx, "finclip_"+key).Err()
}
func RedisNotFound(err error) bool {
return err == goRedis.Nil || err == redis.ErrNil
}

View File

@ -0,0 +1,122 @@
package grpc
import (
"errors"
pb "finclip-app-manager/infrastructure/protobuf/golang"
"finclip-app-manager/infrastructure/utility"
"fmt"
"sync"
"sync/atomic"
"unsafe"
"google.golang.org/grpc"
"google.golang.org/grpc/connectivity"
_ "github.com/mbobakov/grpc-consul-resolver"
)
var (
grpcConnectManager GrpcConnectManager
initOnce sync.Once
)
func GetGrpcConnManager() *GrpcConnectManager {
initOnce.Do(func() {
grpcConnectManager.GrpcConnectItemMap = make(map[string]GrpcConnectItem)
})
return &grpcConnectManager
}
type GrpcConnectItem struct { //单个连接建立例如和账号系统多实例连接上一个item可以理解为对应一个mop服务多实例的连接
ClientConn unsafe.Pointer
ServerName string
}
type GrpcConnectManager struct {
CreateLock sync.Mutex //防止多协程同时建立连接
GrpcConnectItemMap map[string]GrpcConnectItem //一开始是空
}
//param是指url的参数例如wait=10s&tag=mop代表这个连接超时10秒建立consul的服务tag是mop
func (g *GrpcConnectManager) GetConn(consulUrl, server, param string) (*grpc.ClientConn, error) {
if connItem, ok := g.GrpcConnectItemMap[server]; ok { //first check
if atomic.LoadPointer(&connItem.ClientConn) != nil {
return (*grpc.ClientConn)(connItem.ClientConn), nil
}
}
g.CreateLock.Lock()
defer g.CreateLock.Unlock()
fmt.Println("GetConn lock")
connItem, ok := g.GrpcConnectItemMap[server]
if ok { //double check
if atomic.LoadPointer(&connItem.ClientConn) != nil {
cc := (*grpc.ClientConn)(connItem.ClientConn)
if g.checkState(cc) == nil {
return cc, nil
} else { //旧的连接存在服务端断开的情况,需要先关闭
cc.Close()
}
}
}
target := "consul://" + consulUrl + "/" + server
if param != "" {
target += "?" + param
}
fmt.Println("new conn, url=" + target)
cli, err := g.newGrpcConn(target)
if err != nil {
return nil, err
}
var newItem GrpcConnectItem
newItem.ServerName = server
atomic.StorePointer(&newItem.ClientConn, unsafe.Pointer(cli))
g.GrpcConnectItemMap[server] = newItem
return cli, nil
}
func (g *GrpcConnectManager) checkState(conn *grpc.ClientConn) error {
state := conn.GetState()
switch state {
case connectivity.TransientFailure, connectivity.Shutdown:
return errors.New("ErrConn")
}
return nil
}
func (g *GrpcConnectManager) newGrpcConn(target string) (*grpc.ClientConn, error) {
conn, err := grpc.Dial(
target,
//grpc.WithBlock(),
grpc.WithInsecure(),
grpc.WithBalancerName("round_robin"),
//grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy": "round_robin"}`),
)
if err != nil {
return nil, err
}
return conn, nil
}
func MakeGrpcCommonResult(httpStatus int, errCode string, result **pb.CommonResult) {
*result = &pb.CommonResult{}
(*result).Error = utility.GetErrMsg(errCode)
(*result).Errcode = errCode
(*result).Httpcode = int32(httpStatus)
}
func MakeGrpcCommonResultNoLoc(httpStatus int, errCode, errmsg string, result **pb.CommonResult) {
*result = &pb.CommonResult{}
(*result).Error = errmsg
(*result).Errcode = errCode
(*result).Httpcode = int32(httpStatus)
}

View File

@ -0,0 +1,41 @@
package grpc
import (
"context"
"errors"
"finclip-app-manager/infrastructure/config"
pb "finclip-app-manager/infrastructure/protobuf/golang"
)
func GetGroupInfoByGroupId(ctx context.Context, organId string) (*pb.GetBusinessInfoByIdRsp_DATA, error) {
var rsp *pb.GetBusinessInfoByIdRsp
var err error
for i := 0; i < 2; i++ {
conn, err1 := GetGrpcConnManager().GetConn(config.GetConfig().ConsulAddr, "mop-account-system", "tag="+config.GetConfig().ConsulTag)
if err1 != nil {
err = err1
continue
}
c := pb.NewMopAccountSystemClient(conn)
var req pb.GetBusinessInfoByIdReq
req.OrganTraceId = organId
rsp, err = c.GetBusinessInfoById(ctx, &req)
if err != nil {
log.Errorf("err=%s", err.Error())
continue
} else {
err = nil
break
}
}
if err != nil {
return nil, err
}
if rsp.Result.Httpcode != 200 {
return nil, errors.New(rsp.Result.Error)
}
return rsp.Data, nil
}

View File

@ -0,0 +1,42 @@
package grpc
import (
"context"
"errors"
"finclip-app-manager/infrastructure/config"
pb "finclip-app-manager/infrastructure/protobuf/golang"
)
func GetSdkVerEncrypted(ctx context.Context, sdkVer string) (bool, error) {
var rsp *pb.QueryEncryptedRsp
var err error
for i := 0; i < 2; i++ {
conn, err1 := GetGrpcConnManager().GetConn(config.GetConfig().ConsulAddr, "mop-applet-build-manager", "tag="+config.GetConfig().ConsulTag)
if err1 != nil {
err = err1
continue
}
c := pb.NewMopAppletBuildMangerClient(conn)
var req pb.QueryEncryptedReq
req.SdkVersion = sdkVer
rsp, err = c.QueryEncrypted(ctx, &req)
if err != nil {
log.Errorf("err=%s", err.Error())
continue
} else {
err = nil
break
}
}
if err != nil {
return false, err
}
if rsp.Result.Httpcode != 200 {
return false, errors.New(rsp.Result.Error)
}
return rsp.Data.Encrypted, nil
}

View File

@ -0,0 +1,74 @@
package grpc
import (
"context"
"errors"
"finclip-app-manager/infrastructure/config"
pb "finclip-app-manager/infrastructure/protobuf/golang"
)
func GetDomainInfo(ctx context.Context, appId string) (*pb.GetAllDomainInternalRsp_DATA, error) {
var rsp *pb.GetAllDomainInternalRsp
var err error
for i := 0; i < 2; i++ {
conn, err1 := GetGrpcConnManager().GetConn(config.GetConfig().ConsulAddr, "mop-domain-manager", "tag="+config.GetConfig().ConsulTag)
if err1 != nil {
err = err1
continue
}
c := pb.NewMopDomainManagerClient(conn)
var req pb.GetAllDomainInternalReq
req.AppId = appId
rsp, err = c.GetAllDomainInternal(ctx, &req)
if err != nil {
log.Errorf("err=%s", err.Error())
continue
} else {
err = nil
break
}
}
if err != nil {
return nil, err
}
if rsp.Result.Httpcode != 200 {
return nil, errors.New(rsp.Result.Error)
}
return rsp.Data, nil
}
func GetDomainInfoV2(ctx context.Context, organId string) (*pb.GetAllDomainInternalV2Rsp_DATA, error) {
var rsp *pb.GetAllDomainInternalV2Rsp
var err error
for i := 0; i < 2; i++ {
conn, err1 := GetGrpcConnManager().GetConn(config.GetConfig().ConsulAddr, "mop-domain-manager", "tag="+config.GetConfig().ConsulTag)
if err1 != nil {
err = err1
continue
}
c := pb.NewMopDomainManagerClient(conn)
var req pb.GetAllDomainInternalV2Req
req.OrganId = organId
rsp, err = c.GetAllDomainInternalV2(ctx, &req)
if err != nil {
log.Errorf("err=%s", err.Error())
continue
} else {
err = nil
break
}
}
if err != nil {
return nil, err
}
if rsp.Result.Httpcode != 200 {
return nil, errors.New(rsp.Result.Error)
}
return rsp.Data, nil
}

View File

@ -0,0 +1,42 @@
package grpc
import (
"context"
"errors"
"finclip-app-manager/infrastructure/config"
pb "finclip-app-manager/infrastructure/protobuf/golang"
)
func PurchasingGetIdStatus(ctx context.Context, id string) (int, error) {
rsp := &pb.QueryBusinessStatusRsp{}
var err error
for i := 0; i < 2; i++ {
conn, err1 := GetGrpcConnManager().GetConn(config.GetConfig().ConsulAddr, "mop-purchasing-rights-manager", "tag="+config.GetConfig().ConsulTag)
if err1 != nil {
err = err1
continue
}
c := pb.NewMopPurchasingRightsManagerClient(conn)
req := pb.QueryBusinessStatusReq{}
req.BusinessId = id
rsp, err = c.QueryBusinessStatus(ctx, &req)
if err != nil {
log.Errorf("PurchasingGetIdStatus err=%s", err.Error())
continue
} else {
err = nil
break
}
}
if err != nil {
return 0, err
}
if rsp.Result.Httpcode != 200 {
log.Errorf("PurchasingGetIdStatus status code err:%+v", rsp)
return 0, errors.New(rsp.Result.Error)
}
log.Debugf("PurchasingGetIdStatus rsp:%+v", rsp)
return int(rsp.Data.Status), nil
}

View File

@ -0,0 +1,7 @@
package grpc
import "finclip-app-manager/infrastructure/logger"
var (
log = logger.GetLogger()
)

View File

@ -0,0 +1,386 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/utility"
"fmt"
"gopkg.in/mgo.v2/bson"
"net/http"
)
type GroupIDData struct {
GroupID string `json:"groupId"`
GroupName string `json:"groupName"`
ReviewStatus int `json:"reviewStatus"`
SocialCreditCode string `json:"socialCreditCode"`
AdminAccountId string `json:"AdminAccountId"`
}
type GetGroupIDResponse struct {
ErrInfo
Data GroupIDData `json:"data"`
}
func (c *Client) GetGroupInfoByUserId(ctx context.Context, userId string) (*GroupIDData, error) {
url := config.GetConfig().AccountProviderURL + userId
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetGroupInfoByUserId err:%s", err.Error())
return nil, err
}
result := GetGroupIDResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("GetGroupInfoByUserId err:%s", err.Error())
return nil, err
}
log.Infof("GetGroupInfoByUserId rsp:%+v", result)
if result.Errcode != "OK" {
log.Errorf("GetGroupInfoByUserId result errcode err:%+v", result)
return nil, errors.New("errcode invalid")
}
return &result.Data, nil
}
func (c *Client) GetGroupInfoByGroupId(ctx context.Context, groupId string) (*GroupIDData, error) {
urlPrefix := config.Cfg.GroupInfoProviderURL
url := urlPrefix + groupId
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetGroupInfoByGroupId err:%s", err.Error())
return nil, err
}
result := GetGroupIDResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("GetGroupInfoByGroupId err:%s", err.Error())
return nil, err
}
log.Infof("GetGroupInfoByGroupId rsp:%+v", result)
if result.Errcode != "OK" {
log.Errorf("GetGroupInfoByGroupId result errcode err:%+v", result)
return nil, errors.New("errcode invalid")
}
return &result.Data, nil
}
type AccountInfoData struct {
Account string `json:"account"`
Name string `json:"name"`
Identity string `json:"identity"`
Phone string `json:"phone"`
Email string `json:"email"`
OrganId string `json:"organId"`
}
type GetAccountInfoResponse struct {
ErrInfo
Data AccountInfoData `json:"data"`
}
func (c *Client) GetAccountInfo(ctx context.Context, accountId string) (*AccountInfoData, error) {
url := config.Cfg.AccountInfoURL
h := c.getNewDefaultReqHeader()
h["X-Consumer-Custom-ID"] = accountId
rsp, err := c.Request(ctx).SetHeaders(h).Get(url)
if err != nil {
log.Errorf("GetAccountInfo err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("GetAccountInfo http status err:%+v", rsp.Body())
return nil, errors.New("http status err")
}
result := GetAccountInfoResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("GetAccountInfo unmarshal err:%s,rsp:%s", err.Error(), rsp.Body())
return nil, err
}
log.Infof("GetAccountInfo rsp:%+v", result)
return &result.Data, nil
}
func (c *Client) GetAccountInfoByAccount(ctx context.Context, account string) (*AccountInfoData, error) {
url := fmt.Sprintf(config.Cfg.AccountSearchURL+"?account=%s", account)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetAccountInfoByAccount err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("GetAccountInfoByAccount http code not ok,rsp:%s", rsp.String())
return nil, errors.New(ErrHttpCode)
}
resp := GetAccountInfoResponse{}
if err = json.Unmarshal(rsp.Body(), &resp); err != nil {
log.Errorf("Failed to unmarshal response to GetAccountInfoResponse, error: %v", err)
return nil, err
}
return &resp.Data, nil
}
//获取运营端账号信息
type AdminAccountInfo struct {
Account string `json:"account"`
Name string `json:"name"`
}
type AdminAccountInfoData struct {
Info AdminAccountInfo `json:"info"`
}
type GetAdminAccountInfoResponse struct {
ErrInfo
Data AdminAccountInfoData `json:"data"`
}
func (c *Client) GetAdminAccountInfo(ctx context.Context, accountId string) (*AdminAccountInfo, error) {
url := config.Cfg.AdminAccountInfoUrl + accountId
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetAdminAccountInfo fetch err:%s", err.Error())
return nil, err
} else if rsp.StatusCode() != http.StatusOK {
log.Errorf("GetAdminAccountInfo StatusCode err,body:%s", string(rsp.Body()))
return nil, errors.New("http status err")
}
resp := GetAdminAccountInfoResponse{}
if err = json.Unmarshal(rsp.Body(), &resp); err != nil {
log.Errorf("Failed to unmarshal response to GetAdminAccountInfo Response, error: %v", err)
return nil, err
}
return &resp.Data.Info, nil
}
type AddLimitInfoReq struct {
Type string `json:"type"`
OrganId string `json:"organId"`
AddNum int `json:"addNum"`
}
type AddLimitInfoRsp struct {
ErrInfo
Data map[string]interface{} `json:"data"`
}
func (c *Client) AddLimitInfo(ctx context.Context, n *AddLimitInfoReq) (int, *AddLimitInfoRsp, error) {
url := config.Cfg.AddLimitInfoURL
log.Infof("AddLimitInfo info:%+v,url:%s", n, url)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(n).Post(url)
if err != nil {
log.Errorf("AddLimitInfo request err:%s", err.Error())
return http.StatusInternalServerError, nil, err
}
resp := &AddLimitInfoRsp{}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("AddLimitInfo status code no ok,rsp:%s", rsp.Body())
return rsp.StatusCode(), nil, errors.New("status code err")
}
return http.StatusOK, resp, nil
}
type RoleData struct {
IsOK bool `json:"isOK"`
}
type RoleResponse struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
Data RoleData `json:"data"`
}
func (c *Client) HasRole(ctx context.Context, userID string) (bool, *RoleResponse, error) {
url := fmt.Sprintf(config.Cfg.GetRoleURL+"%s", userID)
rsp, err := c.Request(ctx).Get(url)
if err != nil {
log.Errorf("HasRole err:%s", err.Error())
return false, nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("HasRole http code err,rsp:%+v", rsp.String())
return false, nil, errors.New(ErrHttpCode)
}
resp := RoleResponse{}
if err = json.Unmarshal(rsp.Body(), &resp); err != nil {
log.Errorf("Failed to unmarshal roleResponse: %v\n", err)
return false, nil, errors.New(ErrSystemCall)
}
if resp.Data.IsOK {
return true, nil, nil
}
return false, &resp, nil
}
type OrganListItem struct {
ID bson.ObjectId `json:"id,omitempty" ` //唯一id
Name string `json:"name" ` //企业名称
Account string `json:"account" ` //企业账户
AccountStatus int `json:"accountStatus"` //企业状态 1-审核中 2-未认证 3-已认证 4-已过期 5-已冻结
SocialCreditCode string `json:"socialCreditCode"` //社会统一信用代码
LicenseNetdiskId string `json:"licenseNetdiskId"` //资格证书
OrganRoleType string `json:"organRoleType"`
AuthorizationNetdiskId string `json:"authorizationNetdiskId"` //授权书
ExpireDate int64 `json:"expireDate"` //过期时间 动态生成
OrganId string `json:organId`
DelayTime int64 `json:"delayTime" bson:"delayTime"` //延期时间
CreateTime int64 `json:"createTime"` //创建时间
UpdateTime int64 `json:"updateTime"` //更新时间
}
type OrganListData struct {
Total int `json:"total"`
List []*OrganListItem `json:"list"`
}
type OrganListResp struct {
Error string `json:"error"`
Errcode string `json:"errcode"`
Data OrganListData `json:"data"`
}
func (c *Client) GetOrganList(ctx context.Context) ([]*OrganListItem, error) {
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
url := fmt.Sprintf("%s?page=%d&num=%d", config.Cfg.OrganListURL, 1, 1000)
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil {
log.Errorf("GetOrganList err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("GetOrganList http code err,rsp:%+v", rsp.String())
return nil, errors.New(ErrHttpCode)
}
resp := OrganListResp{}
if err = json.Unmarshal(rsp.Body(), &resp); err != nil {
log.Errorf("Failed to unmarshal OrganListResp: %v\n", err)
return nil, errors.New(ErrSystemCall)
}
if resp.Errcode != utility.OK {
log.Errorf("GetOrganList errCode:%s", resp.Errcode)
return nil, errors.New(ErrSystemCall)
}
return resp.Data.List, nil
}
type BindLimitInfo struct {
LimitNum int `bson:"limitNum"`
HasUseNum int `bson:"hasUseNum"`
UpMember string `bson:"upMember"`
UpTimestamp int64 `bson:"upTimestamp"`
CreateBinding int `bson:"createBinding"`
}
type BindLimitResp struct {
Error string `json:"error"`
Errcode string `json:"errcode"`
Data BindLimitInfo `json:"data"`
}
func (c *Client) GetBindLimitInfo(ctx context.Context, accountId string) (*BindLimitInfo, error) {
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"X-Consumer-Custom-ID": accountId,
}
url := config.Cfg.BindLimitURL
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil {
log.Errorf("GetBindLimitInfo err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("GetBindLimitInfo http code err,rsp:%+v", rsp.String())
return nil, errors.New(ErrHttpCode)
}
resp := BindLimitResp{}
if err = json.Unmarshal(rsp.Body(), &resp); err != nil {
log.Errorf("Failed to unmarshal GetBindLimitInfo: %v\n", err)
return nil, errors.New(ErrSystemCall)
}
if resp.Errcode != utility.OK {
log.Errorf("GetBindLimitInfo errCode:%s", resp.Errcode)
return nil, errors.New(ErrSystemCall)
}
return &resp.Data, nil
}
type IsAdminRsp struct {
IsAdmin bool `json:"isAdmin"`
OrganId string `json:"organId"`
}
type GetIsOrganAdminResp struct {
Error string `json:"error"`
Errcode string `json:"errcode"`
Data IsAdminRsp `json:"data"`
}
func (c *Client) GetIsOrganAdmin(ctx context.Context, phone string) (*IsAdminRsp, error) {
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
url := fmt.Sprintf("%s?phone=%s", config.Cfg.GetIsOrganAdminURL, phone)
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil {
log.Errorf("GetIsOrganAdmin err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("GetIsOrganAdmin http code err,rsp:%+v", rsp.String())
return nil, errors.New(ErrHttpCode)
}
resp := GetIsOrganAdminResp{}
if err = json.Unmarshal(rsp.Body(), &resp); err != nil {
log.Errorf("Failed to unmarshal GetIsOrganAdmin: %v\n", err)
return nil, errors.New(ErrSystemCall)
}
if resp.Errcode != utility.OK {
log.Errorf("GetIsOrganAdmin errCode:%s", resp.Errcode)
return nil, errors.New(ErrSystemCall)
}
return &resp.Data, nil
}
type IsCreatorRsp struct {
IsCreator bool `json:"isCreator"`
OrganId string `json:"organId"`
}
type GetIsOrganCreatorResp struct {
Error string `json:"error"`
Errcode string `json:"errcode"`
Data IsCreatorRsp `json:"data"`
}
func (c *Client) GetIsOrganCreator(ctx context.Context, phone string) (*IsCreatorRsp, error) {
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
url := fmt.Sprintf("%s?phone=%s", config.Cfg.GetIsOrganCreatorURL, phone)
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil {
log.Errorf("GetIsOrganCreator err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("GetIsOrganCreator http code err,rsp:%+v", rsp.String())
return nil, errors.New(ErrHttpCode)
}
resp := GetIsOrganCreatorResp{}
if err = json.Unmarshal(rsp.Body(), &resp); err != nil {
log.Errorf("Failed to unmarshal GetIsOrganCreator: %v\n", err)
return nil, errors.New(ErrSystemCall)
}
if resp.Errcode != utility.OK {
log.Errorf("GetIsOrganCreator errCode:%s", resp.Errcode)
return nil, errors.New(ErrSystemCall)
}
return &resp.Data, nil
}

View File

@ -0,0 +1,347 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"finclip-app-manager/domain/entity/proto"
"finclip-app-manager/domain/entity/proto/apiproto"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/utility"
"net/http"
)
type WechatInfo struct {
Id uint `json:"id" bson:"_id" gorm:"primary_key;column:id" sql:"auto_increment;primary_key;unique"`
WechatInfoId string `json:"wechat_info_id" bson:"wechat_info_id" gorm:"column:wechat_info_id;type:varchar(40);NOT NULL;comment:'小程序id'"`
AppId string `json:"app_id" bson:"app_id" gorm:"column:app_id;type:varchar(40);NOT NULL;comment:'小程序id'"` //小程序id
GroupId string `json:"group_id" bson:"group_id" gorm:"column:group_id;type:varchar(40);NOT NULL;comment:'group_id'"` //小程序id
WechatAppSecret string `json:"wechat_app_secret" bson:"wechat_app_secret" gorm:"column:wechat_app_secret;type:varchar(40);NOT NULL;comment:'wechat_app_secret'"`
WechatAppId string `json:"wechat_app_id" bson:"wechat_app_id" gorm:"column:wechat_app_id;type:varchar(40);NOT NULL;comment:'wechat_app_id'"`
WechatPath string `json:"wechat_path" bson:"wechat_path" gorm:"column:wechat_path;type:varchar(128);NOT NULL;comment:'wechat_path'"`
WechatSize string `json:"wechat_size" bson:"wechat_size" gorm:"column:wechat_size;type:varchar(40);NOT NULL;comment:'wechat_size'"`
QrcodeUrl string `json:"qrcode_url" bson:"qrcode_url" gorm:"column:qrcode_url;type:varchar(128);NOT NULL;comment:'qrcode_url'"`
QrcodeDownloadUrl string `json:"qrcode_download_url" bson:"qrcode_download_url" gorm:"column:qrcode_download_url;type:varchar(128);NOT NULL;comment:'group_id'"`
Created int64 `json:"created" bson:"created" gorm:"column:created;type:BIGINT(16);NOT NULL;comment:'创建时间'"` //创建时间
Updated int64 `json:"updated" bson:"updated" gorm:"column:updated;type:BIGINT(16);default:0;comment:'更新时间'"`
}
type GetWechatInfoResponse struct {
ErrInfo
Data WechatInfo `json:"data"`
}
func (c *Client) GetWeChatInfo(ctx context.Context, appId string) (*WechatInfo, error) {
url := config.GetConfig().WechatInfoURL + appId
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetWeChatInfo err:%s", err.Error())
return nil, err
}
result := GetWechatInfoResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("GetWeChatInfo err:%s", err.Error())
return nil, err
}
log.Infof("GetWeChatInfo rsp:%+v", result)
if result.Errcode != "OK" {
log.Errorf("GetWeChatInfo result errcode err:%+v", result)
return nil, errors.New("errcode invalid")
}
return &result.Data, nil
}
type WechatLoginInfo struct {
WechatOriginId string `json:"wechatOriginId"`
ProfileUrl string `json:"profileUrl"`
PhoneUrl string `json:"phoneUrl"`
}
type GetWechatLoginInfoResponse struct {
ErrInfo
Data proto.WechatLoginInfo `json:"data"`
}
func (c *Client) GetWeChatLoginInfo(ctx context.Context, appId string) (*proto.WechatLoginInfo, error) {
url := config.GetConfig().WechatLoginInfoURL + appId
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetWeChatLoginInfo err:%s", err.Error())
return nil, err
}
result := GetWechatLoginInfoResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("GetWeChatLoginInfo err:%s", err.Error())
return nil, err
}
log.Infof("GetWeChatLoginInfo rsp:%+v", result)
if result.Errcode != "OK" {
log.Errorf("GetWeChatLoginInfo result errcode err:%+v", result)
return nil, errors.New("errcode invalid")
}
return &result.Data, nil
}
func (c *Client) TouchWechatInfo(ctx context.Context, appId string) error {
url := config.GetConfig().TouchWechatInfoURL + appId
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Post(url)
if err != nil {
log.Errorf("TouchWechatInfo err:%s", err.Error())
return err
}
result := UpsertWeChatInfoResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("TouchWechatInfo err:%s", err.Error())
return err
}
log.Infof("TouchWechatInfo rsp:%+v", rsp)
if rsp.StatusCode() != http.StatusOK {
log.Errorf("TouchWechatInfo result errcode err:%+v", rsp)
return errors.New("errcode invalid")
}
return nil
}
type UpdateWechatInfoReq struct {
AppId string `json:"appId"`
WechatAppSecret string `json:"wechatAppSecret"`
WechatAppId string `json:"wechatAppId"`
WechatPath string `json:"wechatPath"`
WechatSize string `json:"wechatSize"`
}
type UpsertWeChatInfoResponse struct {
ErrInfo
}
func (c *Client) UpsertWeChatInfo(ctx context.Context, req UpdateWechatInfoReq) (string, error) {
url := config.GetConfig().UpsertWeChatInfoURL
body, _ := json.Marshal(req)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("UpsertWeChatInfo err:%s", err.Error())
return utility.FS_SERVER_ERR, err
}
result := UpsertWeChatInfoResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("GetWeChatInfo err:%s", err.Error())
return utility.FS_SERVER_ERR, err
}
log.Infof("UpsertWeChatInfo rsp:%+v", rsp)
if rsp.StatusCode() != http.StatusOK {
log.Errorf("UpsertWeChatInfo result errcode err:%+v", rsp)
return result.Errcode, errors.New("errcode invalid")
}
return utility.OK, nil
}
func (c *Client) DeleteWechatQrcode(ctx context.Context, req apiproto.DeleteWechatInfoReq) error {
url := config.GetConfig().DeleteWechatQrcodeURL
body, _ := json.Marshal(req)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("UpsertWeChatInfo err:%s", err.Error())
return err
}
//result := GetWechatInfoResponse{}
/*if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("GetWeChatInfo err:%s", err.Error())
return err
}*/
log.Infof("DeleteWechatQrcode rsp:%+v", rsp)
if rsp.StatusCode() != http.StatusOK {
log.Errorf("DeleteWechatQrcode result errcode err:%+v", rsp)
return errors.New("errcode invalid")
}
return nil
}
type ResetHintDotRecordReq struct {
Id string `json:"id"`
Type string `json:"type"`
}
func (c *Client) TrialQrReset(ctx context.Context, Id string) error {
url := config.GetConfig().HintDotResetURL
req := ResetHintDotRecordReq{
Id: Id,
Type: "trialApp",
}
body, _ := json.Marshal(req)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("TrialQrReset err:%+v,status code:%+v", err, rsp)
return err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("TrialQrReset status code no 200 :%+v,boyd:%+v", rsp.StatusCode(), rsp.String())
return nil
}
log.Infof("TrialQrReset rsp:%+v", rsp.String())
return nil
}
type IsReadRecordReq struct {
Id string `json:"id"`
Type string `json:"type"`
AccountId string `json:"accountId"`
}
type IsReadRecordRsp struct {
ErrInfo
Data IsReadRsp `json:"data"`
}
type IsReadRsp struct {
IsRead bool `json:"isRead"`
}
func (c *Client) IsTrialHasRead(ctx context.Context, Id, accountId string) (bool, error) {
///read_dot/is_read
url := config.GetConfig().IsTrialHasReadURL
req := IsReadRecordReq{
Id: Id,
Type: "trialApp",
AccountId: accountId,
}
body, _ := json.Marshal(req)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("IsTrialHasRead err:%+v,status code:%+v", err, rsp)
return false, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("IsTrialHasRead status code no 200 :%+v,boyd:%+v", rsp.StatusCode(), rsp.String())
return false, nil
}
result := IsReadRecordRsp{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("IsTrialHasRead err:%s", err.Error())
return false, err
}
log.Infof("IsTrialHasRead result:%+v", result)
return result.Data.IsRead, nil
}
func (c *Client) ReadTrialQr(ctx context.Context, Id, accountId string) error {
url := config.GetConfig().ReadTrialQrURL
req := IsReadRecordReq{
Id: Id,
Type: "trialApp",
AccountId: accountId,
}
body, _ := json.Marshal(req)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("ReadTrialQr err:%+v,status code:%+v", err, rsp)
return err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("ReadTrialQr status code no 200 :%+v,boyd:%+v", rsp.StatusCode(), rsp.String())
return nil
}
log.Infof("ReadTrialQr rsp:%+v", rsp.String())
return nil
}
///read_dot/is_show_hint
type IsShowHintReq struct {
AppId string `json:"appId"`
AccountId string `json:"accountId"`
}
type IsShowHintRsp struct {
IsShow bool `json:"isShow"`
}
type GetIsShowHintResponse struct {
ErrInfo
Data IsShowHintRsp `json:"data"`
}
func (c *Client) IsShowHint(ctx context.Context, appId, accountId string) (bool, error) {
url := config.GetConfig().IsShowHintURL
req := IsShowHintReq{
AppId: appId,
AccountId: accountId,
}
body, _ := json.Marshal(req)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("ReadTrialQr err:%+v,status code:%+v", err, rsp)
return false, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("ReadTrialQr status code no 200 :%+v,boyd:%+v", rsp.StatusCode(), rsp.String())
return false, nil
}
log.Infof("ReadTrialQr rsp:%+v", rsp.String())
result := GetIsShowHintResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("IsTrialHasRead err:%s", err.Error())
return false, err
}
log.Infof("IsTrialHasRead rsp:%+v", rsp.String())
return result.Data.IsShow, nil
}
type ReadWechatHintoReq struct {
AppId string `json:"appId"`
DeveloperId string `json:"developerId"`
}
func (c *Client) ReadWechatHint(ctx context.Context, req ReadWechatHintoReq) error {
url := config.GetConfig().ReadWechatHintURL
body, _ := json.Marshal(req)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("ReadWechatHint err:%s", err.Error())
return err
}
//result := GetWechatInfoResponse{}
/*if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("GetWeChatInfo err:%s", err.Error())
return err
}*/
log.Infof("ReadWechatHint rsp:%+v", rsp)
if rsp.StatusCode() != http.StatusOK {
log.Errorf("ReadWechatHint result errcode err:%+v", rsp)
return errors.New("errcode invalid")
}
return nil
}
type GetAppByQrcodeRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
Data string `json:"data"`
}
func (c *Client) GetAppByWechat(ctx context.Context, qrcode string) (string, error) {
url := config.GetConfig().GetAppByWechatURL + "?qrcode=" + qrcode
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("ReadWechatHint err:%s", err.Error())
return "", err
}
rspInfo := GetAppByQrcodeRsp{}
err = json.Unmarshal(rsp.Body(), &rspInfo)
if err != nil {
log.Errorf("GetAppByQrcode bind json err:%s", err.Error())
return "", err
}
log.Infof("GetAppByQrcode rsp struct:%+v", rspInfo)
return rspInfo.Data, nil
}

View File

@ -0,0 +1,146 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"finclip-app-manager/infrastructure/config"
)
type GetSdkVerIsEncryptedRspData struct {
Encrypted bool `json:"encrypted"`
}
type GetSdkVerIsEncryptedRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
Data GetSdkVerIsEncryptedRspData `json:"data"`
}
func (c *Client) GetSdkVerIsEncrypted(ctx context.Context, sdkVer string) (bool, error) {
url := config.GetConfig().AppletBuildManageHost + config.GetConfig().SdkVerJudgeUrl + "?sdkVersion=" + sdkVer
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil {
log.Errorf("GetSdkVerIsEncrypted client req err:%s", err.Error())
return false, err
}
if rsp.StatusCode() != 200 {
log.Errorf("GetSdkVerIsEncrypted rsp code err:%s", rsp.String())
return false, errors.New("GetSdkVerIsEncrypted rsp code no 200")
}
log.Infof("GetSdkVerIsEncrypted info:%s", rsp.String())
resp := GetSdkVerIsEncryptedRsp{}
err = json.Unmarshal(rsp.Body(), &resp)
if err != nil {
log.Errorf("Failed to unmarshal DomainResponse: %v\n", err)
return false, err
}
return resp.Data.Encrypted, nil
}
type BuildInfo struct {
Id string `json:"id" gorm:"primary_key;column:id" sql:"primary_key;unique" bson:"id"`
AppId string `json:"appId" gorm:"column:app_id;type:varchar(64);comment:'App id'" bson:"appId"`
UserId string `json:"userId" gorm:"column:user_id;type:varchar(64);default:0;comment:'用户id'" bson:"userId"` //用户id
Filename string `json:"filename" gorm:"column:file_name;type:varchar(64);default:'';comment:'文件名'" bson:"filename"` //文件名
FileUrl string `json:"fileUrl" gorm:"column:file_url;type:varchar(128);default:'';comment:'文件地址'" bson:"fileUrl"` //文件地址
Content string `json:"content" gorm:"column:content;type:varchar(10240);default:'';comment:''" bson:"content"` //content
Version string `json:"version" gorm:"column:version;type:varchar(64);default:'';comment:'版本'" bson:"version"` //版本
VersionRemark string `json:"versionRemark" gorm:"column:version_remark;type:varchar(256);default:'';comment:'VersionRemark'" bson:"versionRemark"` //VersionRemark
OrganId string `json:"organId" gorm:"column:organ_id;type:varchar(64);default:'';comment:'机构id'" bson:"organId"` //机构id
Username string `json:"username" gorm:"column:user_name;type:varchar(64);default:'';comment:'用户名'" bson:"username"` //用户名
CreateTime int64 `json:"createTime" gorm:"column:create_time;type:BIGINT(16);default:0;comment:'创建时间'" bson:"createTime"` //创建时间
UpdateTime int64 `json:"updateTime" gorm:"column:update_time;type:BIGINT(16);default:0;comment:'更新时间'" bson:"updateTime"` //更新时间
EncryptedUrl string `json:"encryptedUrl" gorm:"column:encrypted_url;type:varchar(128);default:'';comment:'文件加密地址'" bson:"encryptedUrl"`
Status bool `json:"status" gorm:"column:encrypted_url;type:varchar(128);default:'';comment:'文件加密地址'" bson:"status"`
Packages []Package `json:"packages" bson:"packages"`
EncryptPackage []Package `json:"encryptPackage" bson:"encryptPackage"`
Cmd string `json:"cmd" gorm:"column:cmd;type:varchar(64);default:'';comment:'编译上传类型'" bson:"cmd"` //cmd:为空默认编译上传 create:不编译直接上传 directUploadSource: 直接上传源文件
}
type Package struct {
Root string `json:"root" bson:"root"`
Name string `json:"name" bson:"name"`
Pages []string `json:"pages" bson:"pages"`
Independent bool `json:"independent" bson:"independent"`
Filename string `json:"filename" bson:"filename"`
FileUrl string `json:"fileUrl" bson:"fileUrl"`
FileMd5 string `json:"fileMd5" bson:"fileMd5"`
}
type GetAppletInfoByIdRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
InfoData GetAppletInfoData `json:"data"`
}
type GetAppletInfoData struct {
Data []BuildInfo `json:"datas`
TotalElement int `json:"totalElement"`
TotalPage int `json:"totalPage"`
Size int `json:"size"`
Page int `json:"page"`
}
func (c *Client) GetAppletInfo(ctx context.Context, appId, organId string) (*[]BuildInfo, error) {
url := config.GetConfig().AppletBuildManageHost + config.GetConfig().GetAppletInfoUrl + "?appId=" + appId + "&organId=" + organId + "&userId=&page=0&size=0"
log.Infof("GetAppletInfo url:%s", url)
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil {
log.Errorf("GetAppletInfo client req err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != 200 {
log.Errorf("GetAppletInfo rsp code err:%s", rsp.String())
return nil, errors.New("GetAppletInfo rsp code no 200")
}
log.Infof("GetAppletInfoById info:%s", rsp.String())
resp := GetAppletInfoByIdRsp{}
err = json.Unmarshal(rsp.Body(), &resp)
if err != nil {
log.Errorf("Failed to unmarshal : %v\n", err)
return nil, err
}
return &resp.InfoData.Data, nil
}
type GetAppletByIdRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
InfoData BuildInfo `json:"data"`
}
func (c *Client) GetAppletInfoById(ctx context.Context, Id string) (*BuildInfo, error) {
url := config.GetConfig().AppletBuildManageHost + config.GetConfig().GetAppletInfoByIdUrl + "?appletInfoId=" + Id
log.Infof("GetAppletInfoById url:%s", url)
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil {
log.Errorf("GetAppletInfo client req err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != 200 {
log.Errorf("GetAppletInfo rsp code err:%s", rsp.String())
return nil, errors.New("GetAppletInfo rsp code no 200")
}
log.Infof("GetAppletInfoById info:%s", rsp.String())
resp := GetAppletByIdRsp{}
err = json.Unmarshal(rsp.Body(), &resp)
if err != nil {
log.Errorf("Failed to unmarshal : %v\n", err)
return nil, err
}
return &resp.InfoData, nil
}

View File

@ -0,0 +1,261 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"finclip-app-manager/infrastructure/config"
)
const (
NotifyResultSuccess = "success"
NotifyResultFail = "fail"
)
const (
StOrganApproved = 3 //审核通过状态
StOrganUnApproved = 5 //已冻结
StOrganPersonalReviewing = 6 //个人账号升级企业账号审核中
StOrganPersonalUnPass = 7 //个人账号升级企业账号被拒绝
)
const (
ORGAN_STATUS_NORMAL = 1 //正常
ORGAN_STATUS_FREEZE = 2 //已冻结
ORGAN_STATUS_DELAY = 3 //已延期
)
//func JudgeGroupStatusValid(status int) (valid bool) {
// valid = true
// if status != StOrganApproved &&
// status != StOrganPersonalReviewing &&
// status != StOrganPersonalUnPass {
// valid = false
// }
// return
//}
//
//const (
// TypeNotificationApproval = 1000
//)
//
//const (
// TabNotificationSystem = "system"
//)
//
//type RoleData struct {
// IsOK bool `json:"isOK"`
//}
//
//type RoleResponse struct {
// Errcode string `json:"errcode"`
// Error string `json:"error"`
// Data RoleData `json:"data"`
//}
//
//type NotificationContent struct {
// Title string `json:"title"`
// Msg string `json:"msg"`
// Reason string `json:"reason"`
// Result string `json:"result"`
//}
//
//type NotificationRequest struct {
// OrganTraceID string `json:"organTraceId"`
// Tab string `json:"tab"`
// Type int `json:"type"`
// Content NotificationContent `json:"content"`
//}
//
//type AppletEcol struct {
// ClientBase
//}
//
//func NewAppletEcol() *AppletEcol {
// return &AppletEcol{
// ClientBase: ClientBase{
// Service: "Applets-ecol",
// },
// }
//}
//
//func (c *Client) GetDomainInfo(ctx context.Context, appID string) (*DomainResponseData, error) {
// url := config.Cfg.MOPDomainURL
// if url == "" {
// log.Errorf(ErrEmptyURL)
// return nil, errors.New(ErrEmptyURL)
// } else if url[len(url)-1] == '/' {
// url = url + appID
// } else {
// url = url + "/" + appID
// }
// base := ClientBase{}
// base.URL = url
// base.Method = "GET"
// base.RequestHeader = make(map[string]string)
// //zipkin上报
// /*{
// spanId := c.Request.Header.Get("Zipkin-Span-Id")
// value := c.GetString("zipkin_trace_span_id_" + spanId)
// a.RequestHeader["Zipkin-Span-Context"] = value
// }*/
// if err := base.Fetch(ctx); err != nil {
// log.Errorf(err.Error())
// return nil, err
// } else if base.StatusCode != http.StatusOK {
// log.Errorf(err.Error())
// return nil, errors.New(ErrHttpCode)
// }
// resp := DomainResponse{}
// if err := json.Unmarshal(base.ResponseBody, &resp); err != nil {
// log.Errorf("Failed to unmarshal DomainResponse: %v\n", err)
// return nil, err
// }
// return &resp.Data, nil
//}
//
func (c *Client) GetDomainInfoByOrganId(ctx context.Context, organId string) (*DomainResponseData, error) {
url := config.Cfg.MOPDomainURLV2 + "?organId=" + organId
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetDomainInfoByOrganId err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("GetDomainInfoByOrganId status code err:%v,rsp:%s", rsp.StatusCode(), rsp.Body())
return nil, errors.New("status code err")
}
resp := DomainResponse{}
if err = json.Unmarshal(rsp.Body(), &resp); err != nil {
log.Errorf("Failed to unmarshal DomainResponse: %v\n", err)
return nil, err
}
return &resp.Data, nil
}
//
//func (c *Client) HasRole(ctx context.Context, userID string) (bool, *RoleResponse, error) {
// url := config.Cfg.GetRoleURL
// if url == "" {
// log.Errorf(ErrEmptyURL)
// return false, nil, errors.New(ErrEmptyURL)
// }
// if url[len(url)-1] == '/' {
// url = url + userID
// } else {
// url = url + "/" + userID
// }
// base := ClientBase{}
//
// base.URL = url
// base.Method = "GET"
// err := base.Fetch(ctx)
// if err != nil {
// log.Errorf(err.Error())
// return false, nil, err
// } else if base.StatusCode != http.StatusOK {
// log.Errorf(err.Error())
// return false, nil, errors.New(ErrHttpCode)
// }
// resp := RoleResponse{}
// if err := json.Unmarshal(base.ResponseBody, &resp); err != nil {
// log.Errorf("Failed to unmarshal roleResponse: %v\n", err)
// return false, nil, errors.New(ErrSystemCall)
// }
// if resp.Data.IsOK {
// return true, nil, nil
// }
// return false, &resp, nil
//}
//
//func (c *Client) GetDeveloperInfo(ctx context.Context, developId string) (*DeveloperData, error) {
// var headers = map[string]string{
// "Accept": "application/json, text/plain, */*",
// "Content-Type": "application/json",
// "url-call": "internal",
// }
// urlPrefix := config.Cfg.PersonInfoProviderURL
// url := urlPrefix + developId
// log.Infof("GetDeveloperInfo url:%s", url)
//
// rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
//
// if err != nil {
// log.Errorf("GetDeveloperInfo fetch err:%s", err.Error())
// return nil, err
// }
// if rsp.StatusCode() != http.StatusOK {
// log.Errorf("GetDeveloperInfo StatusCode err,body:%s", rsp.String())
// return nil, errors.New(ErrHttpCode)
// }
// resp := GetDevelopResponse{}
// if err := json.Unmarshal(rsp.Body(), &resp); err != nil {
// log.Errorf("Failed to unmarshal response to GetDeveloperInfo, error: %v\n", err)
// return nil, err
// }
//
// log.Infof("GetDeveloperInfo rsp:%+v", resp)
//
// return &resp.Data, nil
//}
func (c *Client) UatOrganStatusIsValid(status int) bool {
return status == StOrganApproved ||
status == StOrganPersonalReviewing ||
status == StOrganPersonalUnPass ||
status == StOrganUnApproved
}
func (c *Client) OrganStatusIsValid(status int) bool {
return status == StOrganApproved ||
status == StOrganPersonalReviewing ||
status == StOrganPersonalUnPass
}
func (c *Client) JudgeGroupStatusValid(status int) (valid bool) {
valid = true
if status != StOrganApproved &&
status != StOrganPersonalReviewing &&
status != StOrganPersonalUnPass {
valid = false
}
return
}
type CheckEnterpriseIsExpiredRsp struct {
Error string `json:"error"`
Errcode string `json:"errcode"`
Data struct {
IsExpired bool `json:"isExpired"`
} `json:"data"`
}
func (c *Client) CheckEnterpriseIsExpired(ctx context.Context, userId string) (bool, error) {
url := fmt.Sprintf(config.Cfg.CheckOrganIsExpiredUrl+"?userId=%s", userId)
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
rspData := CheckEnterpriseIsExpiredRsp{}
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil {
log.Errorf("CheckEnterpriseIsExpired request err:%s", err.Error())
return false, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("CheckEnterpriseIsExpired status code err,code:%d", rsp.StatusCode())
return false, errors.New("status code err")
}
err = json.Unmarshal(rsp.Body(), &rspData)
if err != nil {
log.Errorf("CheckEnterpriseIsExpired json unmarshal err:%s", err.Error())
return false, err
}
log.Debugf("enterprise is expired rsp:%+v", rspData)
return rspData.Data.IsExpired, nil
}

View File

@ -0,0 +1,123 @@
package httpcall
//
//import (
// "bytes"
// "context"
// "gitlab.finogeeks.club/finclip-backend/apm"
// "io/ioutil"
// "net"
// "net/http"
// "time"
//)
//
//const (
// FakeStatusCode = 666
//)
//
//type ClientBase struct {
// RequestHeader map[string]string
// Method string
// URL string
// RequestBody []byte
// StatusCode int
// ResponseBody []byte
// Service string
// NotLogRequestBody bool
// NotLogResponseBody bool
//}
//
//var defaultClient = ClientBase{
// RequestHeader: map[string]string{
// "Accept": "application/json, text/plain, */*",
// "Content-Type": "application/json",
// "url-call": "internal",
// },
// Method: "GET",
//}
//
//func (b *ClientBase) Fetch(ctx context.Context) error {
// if b.Method == "" {
// b.Method = defaultClient.Method
// }
// if b.RequestHeader == nil {
// b.RequestHeader = defaultClient.RequestHeader
// }
// client := &http.Client{
// Transport: &http.Transport{
// Dial: (&net.Dialer{
// Timeout: 30 * time.Second,
// KeepAlive: 30 * time.Second,
// }).Dial,
// TLSHandshakeTimeout: 10 * time.Second,
// ResponseHeaderTimeout: 10 * time.Second,
// ExpectContinueTimeout: 1 * time.Second,
// DisableKeepAlives: true,
// },
// Timeout: 30 * time.Second,
// }
// req, err := http.NewRequest(b.Method, b.URL, bytes.NewReader(b.RequestBody))
// if err != nil {
// return err
// }
// for k, v := range b.RequestHeader {
// req.Header.Set(k, v)
// }
// //b.LogRequest()
// span := apm.ApmClient().CreateHttpExitSpan(ctx, req, req.URL.Host, req.URL.Path)
// defer span.End()
// resp, err := client.Do(req)
// if err != nil {
// return err
// }
// defer resp.Body.Close()
// body, err := ioutil.ReadAll(resp.Body)
// if err != nil {
// // Used for log.
// b.StatusCode = FakeStatusCode
// b.ResponseBody = nil
// return err
// }
// b.StatusCode = resp.StatusCode
// b.ResponseBody = body
// return nil
//}
//
////func (b *ClientBase) LogRequest() {
//// kv := log.KeysAndValues{
//// "Service", b.Service,
//// "Method", b.Method,
//// "URL", b.URL,
//// "Request Header", b.RequestHeader,
//// }
//// if !b.NotLogRequestBody {
//// kv = append(kv, "Request Body", string(b.RequestBody))
//// }
//// log.Infow("Ready to fetch", kv)
////}
////
////func (b *ClientBase) LogError(err error) {
//// kv := log.KeysAndValues{
//// "Service", b.Service,
//// "Method", b.Method,
//// "URL", b.URL,
//// "Request Header", b.RequestHeader,
//// "Status Code", b.StatusCode,
//// }
//// if !b.NotLogRequestBody {
//// kv = append(kv, "Request Body", string(b.RequestBody))
//// }
//// if !b.NotLogResponseBody {
//// kv = append(kv, "Response Body", string(b.ResponseBody))
//// }
//// if err == nil {
//// log.Errorw("Unexpected status code", kv)
//// } else {
//// kv = append(kv, "err", err)
//// log.Errorw("Fetch error", kv)
//// }
////}
//
//func (b *ClientBase) AddHeader(k string, v string) {
// b.RequestHeader[k] = v
//}

View File

@ -0,0 +1,85 @@
package httpcall
import (
"context"
"finclip-app-manager/infrastructure/logger"
"github.com/go-resty/resty/v2"
"gitlab.finogeeks.club/finclip-backend/apm"
"net"
"net/http"
"time"
)
const (
ErrConnection = "Connection failed"
ErrHttpCode = "Unexpected http response code"
ErrResponseFormat = "Invalid response format"
ErrSystemCall = "System call error"
ErrEmptyURL = "Empty URL"
)
var (
log = logger.GetLogger()
defaultReqHeader = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
restyClient = resty.NewWithClient(&http.Client{
Transport: createTransport(nil),
})
)
type ErrInfo struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
}
type Client struct{}
func NewClient() *Client {
return &Client{}
}
func (c *Client) Request(ctx context.Context) *resty.Request {
return restyClient.R().SetContext(ctx)
}
func (c *Client) getNewDefaultReqHeader() map[string]string {
newReqHeader := make(map[string]string)
for k, v := range defaultReqHeader {
newReqHeader[k] = v
}
return newReqHeader
}
func createTransport(localAddr net.Addr) http.RoundTripper {
dialer := &net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}
if localAddr != nil {
dialer.LocalAddr = localAddr
}
return &apmRetryTransport{&http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: dialer.DialContext,
MaxIdleConns: 200,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
MaxIdleConnsPerHost: 200,
}}
}
type apmRetryTransport struct {
*http.Transport
}
func (transport *apmRetryTransport) RoundTrip(request *http.Request) (*http.Response, error) {
eSpan := apm.ApmClient().CreateHttpExitSpan(request.Context(), request, request.URL.Host, request.URL.Path)
defer eSpan.End()
resp, err := transport.Transport.RoundTrip(request)
return resp, err
}

View File

@ -0,0 +1,7 @@
package httpcall
import "testing"
func TestUploadFile(t *testing.T) {
}

View File

@ -0,0 +1,58 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"finclip-app-manager/infrastructure/config"
"fmt"
)
type GetAppTagConfigRsp struct {
Data MopPrivateConfigData `json:"data"`
Errcode string `json:"errcode"`
Error string `json:"error"`
}
type MopPrivateConfigData struct {
Id string `json:"id" bson:"_id"`
PlatformName string `json:"platformName"` //平台名称
BackstageLogoUrl string `json:"backstageLogoUrl"` //后台logo
IndexWithPic string `json:"indexWithPic"` //登陆与注册页面
CopyrightNotice string `json:"copyrightNotice"` //版权提示
AppClass []CModel `json:"appClass"` //小程序分类
AppTag []CModel `json:"appTag"` //小程序标签
CreateTime int64 `json:"createTime" bson:"createTime"` //创建时间
UpdateTime int64 `json:"updateTime" bson:"updateTime"` //更新时间
Cas int64 `json:"cas" bson:"cas"` //防冲突
AppDowanloadLink string `json:"appDowanloadLink"` //app下载链接
}
type CModel struct {
Key string `json:"key"`
Name string `json:"name"`
}
func (c *Client) GetAppTagConfigInfo(ctx context.Context) (*GetAppTagConfigRsp, error) {
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
}
url := fmt.Sprintf(config.GetConfig().ConfigManagerHost + config.GetConfig().GetAppTagConfigUrl)
rspInfo := GetAppTagConfigRsp{}
rsp, err := c.Request(ctx).SetHeaders(headers).Get(url)
if err != nil || rsp.StatusCode() != 200 {
fmt.Println("rsp body", rsp.String())
return nil, errors.New("GetAppTagConfigInfo error")
}
err = json.Unmarshal(rsp.Body(), &rspInfo)
if err != nil {
log.Errorf("Failed to unmarshal DomainResponse: %v\n", err)
return nil, err
}
fmt.Println("rsp body", rsp.String())
return &rspInfo, nil
}

View File

@ -0,0 +1,157 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/utils"
"fmt"
"github.com/bitly/go-simplejson"
"github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid"
"gitlab.finogeeks.club/finclip-backend/apm"
"io/ioutil"
"net/http"
"strings"
"time"
)
type AddOperateLogReq struct {
Id string `json:"id"`
CreateTime int64 `json:"createTime"`
Operator string `json:"operator"`
IP string `json:"IP"`
Content string `json:"content"`
Url string `json:"url"`
OrganId string `json:"organId"`
Header interface{} `json:"header"`
Body interface{} `json:"body"`
Query interface{} `json:"query"`
Extra interface{} `json:"extra"`
}
func (client *Client) AddOperateLog(c *gin.Context, organId, content string, extra interface{}, oper string) error {
traceX := apm.ApmClient().TraceContextFromGin(c)
url := config.GetConfig().DataCounterHost + "/api/v1/mop/finclip-data-counter/oper/log/add"
var data AddOperateLogReq
data.Id = uuid.NewV4().String()
data.CreateTime = time.Now().UnixNano() / 1000000
data.Operator = oper
if data.Operator == "" {
account, err := utils.DesEcbDecrypt(c.GetHeader("user-account"))
if err != nil || account == "" {
data.Operator = c.GetHeader("user-account")
} else {
data.Operator = account
}
}
data.IP = c.Request.Header.Get("X-Real-Ip")
if data.IP == "" {
ip := strings.Split(c.Request.RemoteAddr, ":")
fmt.Println("ip", ip)
if len(ip) != 0 {
data.IP = ip[0]
}
}
data.Content = content
data.Url = c.Request.RequestURI
data.OrganId = organId
data.Header = c.Request.Header
body, _ := ioutil.ReadAll(c.Request.Body)
data.Body, _ = simplejson.NewJson(body)
data.Extra = extra
fmt.Println("data", data)
jsonBytes, _ := json.Marshal(data)
rsp, err := client.Request(traceX).SetHeaders(client.getNewDefaultReqHeader()).SetBody(jsonBytes).Post(url)
if err != nil {
log.Errorf("AddOperateLog err:%s", err.Error())
return err
}
log.Infof("AddOperateLog rsp:%+v", rsp)
if rsp.StatusCode() != http.StatusOK {
log.Errorf("AddOperateLog result errcode err:%+v", rsp)
return errors.New("errcode invalid")
}
return nil
}
type GenOperateDataV2Req struct {
OrganId string
Content string
Extra interface{}
Oper string
AccountId string
IsDev bool
}
func (client *Client) AddOperateLogV2(c *gin.Context, req GenOperateDataV2Req) error {
traceX := apm.ApmClient().TraceContextFromGin(c)
url := config.GetConfig().DataCounterHost + "/api/v1/mop/finclip-data-counter/oper/log/add"
var data AddOperateLogReq
data.Id = uuid.NewV4().String()
data.CreateTime = time.Now().UnixNano() / 1000000
if req.AccountId != "" {
account, err := getAccountById(traceX, req.AccountId, req.IsDev)
if err == nil {
data.Operator = account
}
}
if data.Operator == "" {
data.Operator = req.Oper
if data.Operator == "" {
account, err := utils.DesEcbDecrypt(c.GetHeader("user-account"))
if err != nil || account == "" {
data.Operator = c.GetHeader("user-account")
} else {
data.Operator = account
}
//data.Operator = c.GetHeader("user-account")
}
}
data.IP = c.Request.Header.Get("X-Real-Ip")
if data.IP == "" {
ip := strings.Split(c.Request.RemoteAddr, ":")
if len(ip) != 0 {
data.IP = ip[0]
}
}
data.Content = req.Content
data.Url = c.Request.RequestURI
data.OrganId = req.OrganId
data.Header = c.Request.Header
body, _ := ioutil.ReadAll(c.Request.Body)
data.Body, _ = simplejson.NewJson(body)
data.Extra = req.Extra
jsonBytes, _ := json.Marshal(data)
rsp, err := client.Request(traceX).SetHeaders(client.getNewDefaultReqHeader()).SetBody(jsonBytes).Post(url)
if err != nil {
log.Errorf("AddOperateLog err:%s", err.Error())
return err
}
log.Infof("AddOperateLog rsp:%+v", rsp)
if rsp.StatusCode() != http.StatusOK {
log.Errorf("AddOperateLog result errcode err:%+v", rsp)
return errors.New("errcode invalid")
}
return nil
}
func getAccountById(ctx context.Context, id string, isDev bool) (string, error) {
if isDev {
accountInfo, err := NewClient().GetAccountInfo(ctx, id)
if accountInfo != nil {
return accountInfo.Account, err
}
}
accountInfo, err := NewClient().GetAdminAccountInfo(ctx, id)
if accountInfo == nil {
return "", err
}
return accountInfo.Account, err
}

View File

@ -0,0 +1,76 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"finclip-app-manager/infrastructure/config"
)
type DomainResponseData struct {
Service struct {
Request []string `json:"request"`
Socket []string `json:"socket"`
Download []string `json:"download"`
Upload []string `json:"upload"`
} `json:"service"`
Business struct {
Domains []string `json:"domains"`
} `json:"business"`
Whitelist struct {
Domains []string `json:"domains"`
} `json:"whitelist"`
Blacklist struct {
Domains []string `json:"domains"`
} `json:"blacklist"`
NeedCrt bool `json:"needCrt"`
}
type DomainResponse struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
Data DomainResponseData `json:"data"`
}
func (c *Client) GetAppDomain(ctx context.Context, appId string) (*DomainResponseData, error) {
url := config.GetConfig().MOPDomainURL + appId
log.Infof("GetAppDomain url:%s", url)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetAppDomain client req err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != 200 {
log.Errorf("GetAppDomain rsp code err:%s", rsp.String())
return nil, errors.New("GetAppDomain rsp code no 200")
}
log.Infof("GetAppDomain info:%s", rsp.String())
resp := DomainResponse{}
err = json.Unmarshal(rsp.Body(), &resp)
if err != nil {
log.Errorf("Failed to unmarshal DomainResponse: %v\n", err)
return nil, err
}
return &resp.Data, nil
}
func (c *Client) GetAppDomainByOrganId(ctx context.Context, organId string) (*DomainResponseData, error) {
url := config.GetConfig().MOPDomainURLV2 + "?organId=" + organId
log.Infof("GetAppDomain url:%s", url)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).Get(url)
if err != nil {
log.Errorf("GetAppDomain client req err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != 200 {
log.Errorf("GetAppDomain rsp code err:%s", rsp.String())
return nil, errors.New("GetAppDomain rsp code no 200")
}
log.Infof("GetAppDomain info:%s", rsp.String())
resp := DomainResponse{}
err = json.Unmarshal(rsp.Body(), &resp)
if err != nil {
log.Errorf("Failed to unmarshal DomainResponse: %v\n", err)
return nil, err
}
return &resp.Data, nil
}

View File

@ -0,0 +1,82 @@
package httpcall
import (
"context"
"errors"
)
type CommonConfigData struct {
Error string `json:"error"`
Errcode string `json:"errcode"`
Data struct {
OrganName string `json:"organName"`
} `json:"data"`
}
var commonConfig CommonConfigData
func (c *Client) getCommonConfig(ctx context.Context) error {
var h = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
}
url := "http://mop-private-init-server:8080/api/v1/mop/mop-private-init-server/common/config"
rsp, err := c.Request(ctx).SetHeaders(h).SetResult(&commonConfig).Get(url)
if err != nil || rsp.StatusCode() != 200 {
return errors.New("mop-private-init-server err")
}
return nil
}
type LicenseData struct {
OrganName string `json:"organName"` //企业名称
AppCount int `json:"appCount"` //可创建的小程序数量上限
CooAppCount int `json:"cooAppCount"` //应用的数量
BundleIdCount int `json:"bundleIdCount"` //bundleId数量
ReviewOrganCount int `json:"reviewOrganCount"` //可认证通过的企业数量
ExpireTime int64 `json:"expireTime"` //服务有效期
CreateOperAdminByInitServer bool `json:"createOperAdminByInitServer"` //init服务是否创建运营端管理账号
OpenAPM bool `json:"openAPM"` //是否打开APM上报
OpenAppSearch bool `json:"openAppSearch"`
OpenApiManage bool `json:"openApiManage"`
IsWindows bool `json:"isWindows"`
IsMac bool `json:"isMac"`
IsLinux bool `json:"isLinux"`
IsIOS bool `json:"isIOS"`
IsAndroid bool `json:"isAndroid"`
IsConfiguration bool `json:"isConfiguration"`
IsApiCover bool `json:"isApiCover"`
Clients []string `json:"clients"`
DeviceNum int `json:"deviceNum"`
}
type GetLicenseRsp struct {
Data LicenseData `json:"data"`
Errcode string `json:"errcode"`
Errmsg string `json:"error"`
}
func (c *Client) GetLicense(ctx context.Context) (*LicenseData, error) {
if commonConfig.Data.OrganName == "" {
c.getCommonConfig(ctx)
}
var h = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"url-call": "internal",
"Organ-Name": commonConfig.Data.OrganName, //私有化部署的时候,需要修改机构名称
}
url := "http://mop-license-checker:8080/api/v1/mop/mop-license-checker/license"
var licenseInfo GetLicenseRsp
rsp, err := c.Request(ctx).SetHeaders(h).SetResult(&licenseInfo).Get(url)
if err != nil {
return nil, err
}
if rsp.StatusCode() != 200 {
log.Errorf("get license info status code err:%+v,rsp:%+v", rsp.StatusCode(), rsp.String())
return nil, errors.New("status code error")
}
return &licenseInfo.Data, nil
}

View File

@ -0,0 +1,172 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"finclip-app-manager/infrastructure/config"
)
const (
THIRD_ENV_ZHAOS = "zhaos"
// 运营端-审核管理,同意/驳回小程序审核申请
SMS_APP_PUBLISH_APPROVE = "APP_PUBLISH_APPROVE"
SMS_APP_PUBLISH_REJECT = "APP_PUBLISH_REJECT"
SMS_APP_PUBLISH_IMMED = "APP_PUBLISH_IMMED"
SMS_APP_PUBLISH_SUCC = "APP_PUBLISH_SUCC"
SMS_ZHAOS_APP_PUBLISH_APPROVE = "ZHAOS_APP_PUBLISH_APPROVE"
SMS_ZHAOS_APP_PUBLISH_REJECT = "ZHAOS_APP_PUBLISH_REJECT"
SMS_ZHAOS_APP_PUBLISH_IMMED = "ZHAOS_APP_PUBLISH_IMMED"
SMS_ZHAOS_APP_PUBLISH_SUCC = "ZHAOS_APP_PUBLISH_SUCC"
// 运营端-小程序关联管理,同意/驳回小程序关联审核申请
SMS_LINK_AUDIT_APPLY = "LINK_AUDIT_APPLY"
SMS_LINK_AUDIT_REJECT = "LINK_AUDIT_REJECT"
)
type SendSmsNotifyReq struct {
Type string `json:"type"`
Phone string `json:"phone"`
Params string `json:"params"`
}
type SendSmsNotifyRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
Data map[string]interface{} `json:"data"`
}
func validateEnvAndType(env, smsType string) bool {
if smsType == SMS_LINK_AUDIT_APPLY && env != config.ENV_FDEP {
return false
}
if smsType == SMS_LINK_AUDIT_REJECT && env != config.ENV_FDEP {
return false
}
if env != config.ENV_FDEP && env != config.ENV_UAT {
return false
}
return true
}
func (c *Client) SendSmsNotify(ctx context.Context, smsType, phone, params string) error {
if !validateEnvAndType(config.GetConfig().PublishEnv, smsType) {
return nil
}
var req SendSmsNotifyReq
req.Type = smsType
req.Phone = phone
req.Params = params
body, _ := json.Marshal(req)
url := config.GetConfig().SmsServerHost + "/api/v1/mop/sms-server/notify"
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("send sms notify err:" + err.Error())
return err
}
if rsp.StatusCode() != 200 {
log.Errorf("send sms notify status err:" + rsp.String())
return errors.New("status err")
}
var smsRsp SendSmsNotifyRsp
err = json.Unmarshal(rsp.Body(), &smsRsp)
if err != nil {
log.Errorf("json.Unmarshal error:" + err.Error())
return err
}
log.Debugf("send sms notify rsp:%+v", rsp.String())
return nil
}
type SendThirdSmsReq struct {
Type string `json:"type"`
Phone string `json:"phone"`
Params string `json:"params"`
}
type SendThirdSmsRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
Data map[string]interface{} `json:"data"`
}
func (c *Client) SendThirdSms(ctx context.Context, smsType, phone, params string) error {
if !validateEnvAndType(config.GetConfig().PublishEnv, smsType) {
return nil
}
var req SendThirdSmsReq
req.Type = smsType
req.Phone = phone
req.Params = params
body, _ := json.Marshal(req)
url := config.GetConfig().SmsGateWayUrl
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("send third sms err:" + err.Error())
return err
}
if rsp.StatusCode() != 200 {
log.Errorf("send third sms status err:" + rsp.String())
return errors.New("status err")
}
var smsRsp SendThirdSmsRsp
err = json.Unmarshal(rsp.Body(), &smsRsp)
if err != nil {
log.Errorf("send third sms json.Unmarshal error:" + err.Error())
return err
}
log.Debugf("send third sms rsp:%+v", rsp.String())
return nil
}
type SendDelaySmsReq struct {
SmsType string `json:"smsType"`
Phone string `json:"phone"`
AppId string `json:"appId"`
AppName string `json:"appName"`
Sequence int `json:"sequence"`
}
type SendDelaySmsRsp struct {
Errcode string `json:"errcode"`
Error string `json:"error"`
Data map[string]interface{} `json:"data"`
}
func (c *Client) SendDelaySms(ctx context.Context, smsType, phone string, appId, appName string, sequence int) error {
if !validateEnvAndType(config.GetConfig().PublishEnv, smsType) {
return nil
}
var req SendDelaySmsReq
req.SmsType = smsType
req.Phone = phone
req.AppId = appId
req.AppName = appName
req.Sequence = sequence
body, _ := json.Marshal(req)
url := config.GetConfig().AuditDelaySmsURL
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Post(url)
if err != nil {
log.Errorf("send sms notify err:" + err.Error())
return err
}
if rsp.StatusCode() != 200 {
log.Errorf("send delay sms status err:" + rsp.String())
return errors.New("status err")
}
var smsRsp SendDelaySmsRsp
err = json.Unmarshal(rsp.Body(), &smsRsp)
if err != nil {
log.Errorf("json.Unmarshal error:" + err.Error())
return err
}
log.Debugf("send delay sms rsp:%+v", rsp.String())
return nil
}

View File

@ -0,0 +1,97 @@
package httpcall
import (
"bytes"
"context"
"encoding/json"
"errors"
"finclip-app-manager/infrastructure/config"
"fmt"
"io"
"mime/multipart"
"net/http"
)
const (
FormDataKey = "file"
ConsumerCustomID = "finstore"
)
type netdiskResponse struct {
Location string `json:"location"`
NetdiskID string `json:"netdiskID"`
ResourceID string `json:"resourceID"`
}
func (c *Client) Download(ctx context.Context, path string) ([]byte, error) {
url := path
rsp, err := c.Request(ctx).Get(url)
if err != nil {
log.Errorf("netdisk download err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("netdisk download status code err,code:%d", rsp.StatusCode())
return nil, errors.New("download http code err")
}
return rsp.Body(), nil
}
func (c *Client) DownloadByNetdiskId(ctx context.Context, netdiskId string) ([]byte, error) {
url := fmt.Sprintf("%s%s%s", config.GetConfig().NetdiskHost, config.GetConfig().NetdiskInternalDownloadUrl, netdiskId)
rsp, err := c.Request(ctx).Get(url)
if err != nil {
log.Errorf("netdisk download err:%s", err.Error())
return nil, err
}
if rsp.StatusCode() != http.StatusOK {
log.Errorf("netdisk download status code err,code:%d", rsp.StatusCode())
return nil, errors.New("download http code err")
}
return rsp.Body(), nil
}
func (c *Client) Upload(ctx context.Context, name string, inFile io.Reader, useCdn bool) (string, error) {
url := config.GetConfig().NetdiskHost + config.GetConfig().NetdiskUploadURL
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
headers := map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": writer.FormDataContentType(),
"X-Consumer-Custom-ID": ConsumerCustomID,
"url-call": "internal",
}
rsp, err := c.Request(ctx).
SetFileReader(FormDataKey, name, inFile).
SetContentLength(true).
SetHeaders(headers).
Post(url)
if err != nil {
log.Errorf("netdisk upload request err:", err.Error())
return "", err
}
if rsp.StatusCode() != http.StatusOK {
netdiskRsp := ErrInfo{}
err = json.Unmarshal(rsp.Body(), &netdiskRsp)
if err != nil {
log.Errorf("Failed to unmarshal unmarshal netdiskResponse: %v", err)
return "", err
}
log.Errorf("netdisk upload rsp http status code err,code:", rsp.StatusCode())
return "", errors.New(netdiskRsp.Error)
}
netdiskRsp := netdiskResponse{}
err = json.Unmarshal(rsp.Body(), &netdiskRsp)
if err != nil {
log.Errorf("Failed to unmarshal unmarshal netdiskResponse: %v", err)
return "", err
}
return c.genDownloadUrl(netdiskRsp, useCdn), nil
}
func (c *Client) genDownloadUrl(rsp netdiskResponse, useCdn bool) string {
if useCdn && rsp.Location != "" {
return rsp.Location
}
return config.GetConfig().EntryURL + config.GetConfig().NetdiskDownloadURLPrefix + rsp.NetdiskID
}

View File

@ -0,0 +1,176 @@
package httpcall
import (
"context"
"encoding/json"
"errors"
"finclip-app-manager/domain/entity"
"finclip-app-manager/infrastructure/config"
"finclip-app-manager/infrastructure/utility"
"fmt"
"net/http"
)
const (
BIND_SDK = "bind"
UNBIND_SDK = "unbind"
STATE_UPDATE = "state"
UP_STATE = 1
DOWN_STATE = 0
)
type SpiderResp struct {
}
type SdkKeyUpdate struct {
AppId string `json:"appId"`
SdkKey string `json:"sdkKey"`
}
type UpdateForbiddenSdkKeys struct {
AddSdkKeys []SdkKeyUpdate `json:"sdkKeys"`
RemoveSdkKeys []SdkKeyUpdate `json:"removeSdkKeys"`
}
type StateUpdate struct {
AppId string `json:"appId"`
State int `json:"state"`
}
type NotifySpiderUpdate struct {
Type string `json:"type"`
SdkKeys []SdkKeyUpdate `json:"sdkKeys"`
State StateUpdate `json:"state"`
}
type AddNotifyReq struct {
OrganId string `json:"organTraceId"`
Tab string `json:"tab"`
Type int `json:"type"`
Content interface{} `json:"content"`
Id string `json:"id"`
}
type AddNotifyResponse struct {
ErrInfo
}
func (c *Client) AddNotify(ctx context.Context, req *AddNotifyReq) error {
url := config.GetConfig().AddNotifyURL
body, _ := json.Marshal(req)
rsp, err := c.Request(ctx).SetHeaders(c.getNewDefaultReqHeader()).SetBody(body).Put(url)
if err != nil {
log.Errorf("TouchWechatInfo err:%s", err.Error())
return err
}
result := AddNotifyResponse{}
if err = json.Unmarshal(rsp.Body(), &result); err != nil {
log.Errorf("TouchWechatInfo err:%s", err.Error())
return err
}
log.Infof("TouchWechatInfo rsp:%+v", rsp)
if rsp.StatusCode() != http.StatusOK {
log.Errorf("TouchWechatInfo result errcode err:%+v", rsp)
return errors.New("errcode invalid")
}
return nil
}
func (c *Client) Notify(ctx context.Context, req *NotifySpiderUpdate) (*SpiderResp, error) {
url := config.GetConfig().SpiderHost + config.GetConfig().SpiderNotifyPath
log.Infof("notify spider url:%s", url)
log.Infof("notify spider req:%s", utility.InterfaceToJsonString(req))
spiderResp := &SpiderResp{}
payload, _ := json.Marshal(req)
resp, err := c.Request(ctx).SetResult(&spiderResp).
SetHeader("X-Consumer-Custom-ID", "notify-spider").
SetBody(payload).
Post(url)
if err != nil || resp.StatusCode() != http.StatusOK {
if err != nil {
return nil, err
} else {
return nil, errors.New(fmt.Sprintf("notify spider code:%d", http.StatusOK))
}
}
return spiderResp, nil
}
func (c *Client) UpdateBundleForbiddenInfo(ctx context.Context, req *UpdateForbiddenSdkKeys) (*SpiderResp, error) {
url := config.GetConfig().SpiderHost + config.GetConfig().SpiderUpdateBundleForbiddenURL
log.Infof("notify spider url:%s", url)
log.Infof("notify spider req:%s", utility.InterfaceToJsonString(req))
spiderResp := &SpiderResp{}
payload, _ := json.Marshal(req)
resp, err := c.Request(ctx).SetResult(&spiderResp).
SetHeader("X-Consumer-Custom-ID", "notify-spider").
SetBody(payload).
Post(url)
if err != nil || resp.StatusCode() != http.StatusOK {
if err != nil {
return nil, err
} else {
return nil, errors.New(fmt.Sprintf("notify spider code:%d", http.StatusOK))
}
}
return spiderResp, nil
}
type SpiderPubReq struct {
AppId string `json:"appId"`
AppName string `json:"appName"`
AppDesc string `json:"appDesc"`
OrganName string `json:"organName"`
SdkKeys []string `json:"sdkKeys"`
Resource string `json:"resource"`
AppTag string `json:"appTag"`
AppClass string `json:"appClass"`
}
func (c *Client) PubAppNotifySearchApp(ctx context.Context, req *SpiderPubReq) (*SpiderResp, error) {
spiderResp := &SpiderResp{}
payload, _ := json.Marshal(req)
_, err := c.Request(ctx).SetResult(&spiderResp).
SetHeader("X-Consumer-Custom-ID", "notify-spider").
SetBody(payload).
Post(config.GetConfig().SpiderHost + config.GetConfig().SpiderPubAppNotifyURL)
if err != nil {
return nil, err
}
return spiderResp, nil
}
//预览服务
func (c *Client) PubAppNotifyToMiniprogram(ctx context.Context, req *entity.AppVersion) (*SpiderResp, error) {
spiderResp := &SpiderResp{}
//payload, _ := json.Marshal(req)
//fmt.Println("payload", payload)
fmt.Println("req", utility.InterfaceToJsonString(req))
_, err := c.Request(ctx).SetResult(&spiderResp).
//SetHeader("X-Consumer-Custom-ID", "notify-spider").
SetBody(req).
Post(config.GetConfig().MiniProgramSearchURL)
if err != nil {
fmt.Println("err:", err.Error())
return nil, err
}
return spiderResp, nil
}
func (c *Client) UpdateHistoryAppMsg(ctx context.Context) error {
//traceCtx := apm.ApmClient().TraceContextFromGin(c)
var headers = map[string]string{
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json",
"X-Consumer-Custom-ID": "notify-spider",
"url-call": "internal",
}
url := config.GetConfig().SpiderHost + config.GetConfig().SpiderUpdateAppMsg
rsp, err := c.Request(ctx).SetHeaders(headers).SetResult(&commonConfig).Get(url)
if err != nil || rsp.StatusCode() != 200 {
return errors.New("UpdateHistoryAppMsg err")
}
return nil
}

Some files were not shown because too many files have changed in this diff Show More