fadd
This commit is contained in:
@@ -154,6 +154,59 @@ func (h *CertificationHandler) ConfirmAuth(c *gin.Context) {
|
||||
h.response.Success(c, result, "状态确认成功")
|
||||
}
|
||||
|
||||
// ListSignPlatforms 可选签署平台列表
|
||||
func (h *CertificationHandler) ListSignPlatforms(c *gin.Context) {
|
||||
result, err := h.appService.ListSignPlatforms(c.Request.Context())
|
||||
if err != nil {
|
||||
h.response.BadRequest(c, err.Error())
|
||||
return
|
||||
}
|
||||
h.response.Success(c, result, "获取签署平台列表成功")
|
||||
}
|
||||
|
||||
// SelectSignPlatform 选择签署平台并生成企业认证链接
|
||||
func (h *CertificationHandler) SelectSignPlatform(c *gin.Context) {
|
||||
var cmd commands.SelectSignPlatformCommand
|
||||
cmd.UserID = h.getCurrentUserID(c)
|
||||
if cmd.UserID == "" {
|
||||
h.response.Unauthorized(c, "用户未登录")
|
||||
return
|
||||
}
|
||||
if err := c.ShouldBindJSON(&cmd); err != nil {
|
||||
h.response.BadRequest(c, "请求参数错误")
|
||||
return
|
||||
}
|
||||
result, err := h.appService.SelectSignPlatform(c.Request.Context(), &cmd)
|
||||
if err != nil {
|
||||
h.logger.Error("选择签署平台失败", zap.Error(err), zap.String("user_id", cmd.UserID))
|
||||
h.response.BadRequest(c, err.Error())
|
||||
return
|
||||
}
|
||||
h.response.Success(c, result, "已选择签署平台")
|
||||
}
|
||||
|
||||
// HandleFadadaCallback 法大大回调
|
||||
func (h *CertificationHandler) HandleFadadaCallback(c *gin.Context) {
|
||||
headers := make(map[string]string)
|
||||
for key, values := range c.Request.Header {
|
||||
if len(values) > 0 {
|
||||
headers[key] = values[0]
|
||||
}
|
||||
}
|
||||
body, err := io.ReadAll(c.Request.Body)
|
||||
if err != nil {
|
||||
h.logger.Error("读取法大大回调失败", zap.Error(err))
|
||||
c.String(400, "fail")
|
||||
return
|
||||
}
|
||||
if err := h.appService.HandleFadadaCallback(c.Request.Context(), headers, body); err != nil {
|
||||
h.logger.Error("处理法大大回调失败", zap.Error(err))
|
||||
c.String(400, "fail")
|
||||
return
|
||||
}
|
||||
c.Data(200, "application/json", []byte(`{"msg":"success"}`))
|
||||
}
|
||||
|
||||
// ConfirmSign 前端确认是否完成签署
|
||||
// @Summary 前端确认签署状态
|
||||
// @Description 前端轮询确认合同签署是否完成
|
||||
@@ -219,6 +272,61 @@ func (h *CertificationHandler) ApplyContract(c *gin.Context) {
|
||||
h.response.Success(c, result, "合同申请成功")
|
||||
}
|
||||
|
||||
// RefreshContractSignURL 刷新合同签署 iframe 长链
|
||||
// @Summary 刷新合同签署链接
|
||||
// @Description 重新获取可供 iframe 嵌入的签署长链(法大大约 10 分钟/单次有效)
|
||||
// @Tags 认证管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security Bearer
|
||||
// @Success 200 {object} responses.ContractSignUrlResponse "刷新成功"
|
||||
// @Failure 400 {object} map[string]interface{} "请求参数错误"
|
||||
// @Failure 401 {object} map[string]interface{} "未认证"
|
||||
// @Router /api/v1/certifications/refresh-contract-sign-url [post]
|
||||
func (h *CertificationHandler) RefreshContractSignURL(c *gin.Context) {
|
||||
userID := h.getCurrentUserID(c)
|
||||
if userID == "" {
|
||||
h.response.Unauthorized(c, "用户未登录")
|
||||
return
|
||||
}
|
||||
|
||||
result, err := h.appService.RefreshContractSignURL(c.Request.Context(), userID)
|
||||
if err != nil {
|
||||
h.logger.Error("刷新签署链接失败", zap.Error(err), zap.String("user_id", userID))
|
||||
h.response.BadRequest(c, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
h.response.Success(c, result, "签署链接已刷新")
|
||||
}
|
||||
|
||||
// RefreshContractPreviewURL 刷新合同预览链接
|
||||
// @Summary 刷新合同预览链接
|
||||
// @Description 获取签署任务预览链接(法大大 /sign-task/get-preview-url)
|
||||
// @Tags 认证管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security Bearer
|
||||
// @Success 200 {object} responses.ContractPreviewUrlResponse "刷新成功"
|
||||
// @Failure 400 {object} map[string]interface{} "请求参数错误"
|
||||
// @Router /api/v1/certifications/refresh-contract-preview-url [post]
|
||||
func (h *CertificationHandler) RefreshContractPreviewURL(c *gin.Context) {
|
||||
userID := h.getCurrentUserID(c)
|
||||
if userID == "" {
|
||||
h.response.Unauthorized(c, "用户未登录")
|
||||
return
|
||||
}
|
||||
|
||||
result, err := h.appService.RefreshContractPreviewURL(c.Request.Context(), userID)
|
||||
if err != nil {
|
||||
h.logger.Error("刷新合同预览链接失败", zap.Error(err), zap.String("user_id", userID))
|
||||
h.response.BadRequest(c, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
h.response.Success(c, result, "预览链接已刷新")
|
||||
}
|
||||
|
||||
// RecognizeBusinessLicense OCR识别营业执照
|
||||
// @Summary OCR识别营业执照
|
||||
// @Description 上传营业执照图片进行OCR识别,自动填充企业信息
|
||||
|
||||
Reference in New Issue
Block a user