test.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package tencent
  2. import (
  3. SysConfig "mtp2_if/config"
  4. "mtp2_if/global/app"
  5. "mtp2_if/global/e"
  6. "mtp2_if/logger"
  7. "mtp2_if/services/tencent"
  8. "mtp2_if/utils"
  9. "net/http"
  10. "github.com/gin-gonic/gin"
  11. )
  12. // CreateConsoleLoginUrl 创建电子签控制台登录链接
  13. // @Summary 创建电子签控制台登录链接
  14. // @Produce json
  15. // @Security ApiKeyAuth
  16. // @accept application/json
  17. // @Success 200 {object} app.Response
  18. // @Failure 500 {object} app.Response
  19. // @Router /Tencent/CreateConsoleLoginUrl [post]
  20. // @Tags 腾讯电子签
  21. func CreateConsoleLoginUrl(c *gin.Context) {
  22. appG := app.Gin{C: c}
  23. agent := utils.SetAgent(nil, nil, nil)
  24. proxyOrganizationName := SysConfig.SerCfg.TencentCfg.ProxyOrganizationName
  25. response, _ := tencent.CreateConsoleLoginUrl(agent, proxyOrganizationName)
  26. appG.Response(http.StatusOK, e.SUCCESS, *response.Response.ConsoleUrl)
  27. }
  28. // DescribeIntegrationEmployees 查询企业员工信息列表
  29. // @Summary 查询企业员工信息列表
  30. // @Produce json
  31. // @Security ApiKeyAuth
  32. // @accept application/json
  33. // @Success 200 {object} app.Response
  34. // @Failure 500 {object} app.Response
  35. // @Router /Tencent/DescribeIntegrationEmployees [post]
  36. // @Tags 腾讯电子签
  37. func DescribeIntegrationEmployees(c *gin.Context) {
  38. appG := app.Gin{C: c}
  39. agent := utils.SetAgent(nil, nil, nil)
  40. response, _ := tencent.DescribeIntegrationEmployees(agent)
  41. appG.Response(http.StatusOK, e.SUCCESS, response.Response.Employees)
  42. }
  43. // SyncProxyOrganizationOperators 企业员工离职
  44. // @Summary 企业员工离职
  45. // @Produce json
  46. // @Security ApiKeyAuth
  47. // @accept application/json
  48. // @Success 200 {object} app.Response
  49. // @Failure 500 {object} app.Response
  50. // @Router /Tencent/SyncProxyOrganizationOperators [post]
  51. // @Tags 腾讯电子签
  52. func SyncProxyOrganizationOperators(c *gin.Context) {
  53. appG := app.Gin{C: c}
  54. agent := utils.SetAgent(nil, nil, nil)
  55. response, _ := tencent.SyncProxyOrganizationOperators(agent)
  56. appG.Response(http.StatusOK, e.SUCCESS, response.Response)
  57. }
  58. type GetTemplateInfoReq struct {
  59. ContractName string `form:"contractName" binding:"required"` // 合同模块名称
  60. }
  61. // GetTemplateInfo 获取合同模板信息(测试)
  62. // @Summary 获取合同模板信息(测试)
  63. // @Produce json
  64. // @Security ApiKeyAuth
  65. // @accept application/json
  66. // @Param contractName query string true "合同模块名称"
  67. // @Success 200 {object} app.Response
  68. // @Failure 500 {object} app.Response
  69. // @Router /Tencent/GetTemplateInfo [get]
  70. // @Tags 腾讯电子签
  71. func GetTemplateInfo(c *gin.Context) {
  72. appG := app.Gin{C: c}
  73. // 获取请求参数
  74. var req GetTemplateInfoReq
  75. if err := appG.C.ShouldBindQuery(&req); err != nil {
  76. logger.GetLogger().Errorf("GetTemplateInfo failed: %s", err.Error())
  77. appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
  78. return
  79. }
  80. if rsp, err := tencent.GetTemplateInfo(&req.ContractName, nil, nil, nil); err == nil {
  81. appG.Response(http.StatusOK, e.SUCCESS, rsp)
  82. } else {
  83. appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
  84. }
  85. }