62 lines
1.5 KiB
Go
62 lines
1.5 KiB
Go
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
|
|
}
|