79 lines
2.0 KiB
Go
79 lines
2.0 KiB
Go
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
|
||
}
|