From 6438942e18fc299f2e8207a5ad56d9cce7680716 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Fri, 27 Oct 2023 13:58:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=AD=BE=E7=AB=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controller/userCaCert.go | 68 +++---- api/router/router.go | 5 +- api/service/UserCaCert.go | 341 +++++++++++++++++++---------------- extend/aliyun/oss.go | 109 +++++++++++ extend/ca/CaOnlineRequest.go | 14 +- extend/ca/caOnline.go | 78 ++++---- 6 files changed, 379 insertions(+), 236 deletions(-) diff --git a/api/controller/userCaCert.go b/api/controller/userCaCert.go index e6dad5d..0b86c01 100644 --- a/api/controller/userCaCert.go +++ b/api/controller/userCaCert.go @@ -2,9 +2,11 @@ package controller import ( "github.com/gin-gonic/gin" + "hospital-admin-api/api/requests" "hospital-admin-api/api/responses" "hospital-admin-api/api/service" "hospital-admin-api/global" + "hospital-admin-api/utils" "strconv" ) @@ -116,36 +118,36 @@ func (r *UserCaCert) RemoveUserCloudCert(c *gin.Context) { } // AddUserSignConfig 添加用户签章配置 -// func (r *UserCaCert) AddUserSignConfig(c *gin.Context) { -// userCaCertRequest := requests.UserCaCertRequest{} -// req := userCaCertRequest.AddUserSignConfig -// if err := c.ShouldBind(&req); err != nil { -// responses.FailWithMessage(err.Error(), c) -// return -// } -// -// // 参数验证 -// if err := global.Validate.Struct(req); err != nil { -// responses.FailWithMessage(utils.Translate(err), c) -// return -// } -// -// // 业务处理 -// tx := global.Db.Begin() -// defer func() { -// if r := recover(); r != nil { -// tx.Rollback() -// } -// }() -// -// userCaCertService := service.UserCaCertService{} -// _, err := userCaCertService.AddUserSignConfig(tx, req) -// if err != nil { -// tx.Rollback() -// responses.FailWithMessage(err.Error(), c) -// return -// } -// -// tx.Commit() -// responses.Ok(c) -// } +func (r *UserCaCert) AddUserSignConfig(c *gin.Context) { + userCaCertRequest := requests.UserCaCertRequest{} + req := userCaCertRequest.AddUserSignConfig + if err := c.ShouldBind(&req); err != nil { + responses.FailWithMessage(err.Error(), c) + return + } + + // 参数验证 + if err := global.Validate.Struct(req); err != nil { + responses.FailWithMessage(utils.Translate(err), c) + return + } + + // 业务处理 + tx := global.Db.Begin() + defer func() { + if r := recover(); r != nil { + tx.Rollback() + } + }() + + userCaCertService := service.UserCaCertService{} + _, err := userCaCertService.AddUserSignConfig(tx, req) + if err != nil { + tx.Rollback() + responses.FailWithMessage(err.Error(), c) + return + } + + tx.Commit() + responses.Ok(c) +} diff --git a/api/router/router.go b/api/router/router.go index d7a6832..d62462e 100644 --- a/api/router/router.go +++ b/api/router/router.go @@ -575,10 +575,7 @@ func privateRouter(r *gin.Engine, api controller.Api) { signGroup := caGroup.Group("/sign") { // 添加签章配置 - // signGroup.POST("", api.UserCaCert.AddUserSignConfig) - - // 更新签章配置 - signGroup.GET("/:user_id", api.OrderPrescription.GetOrderPrescriptionPage) + signGroup.POST("", api.UserCaCert.AddUserSignConfig) } } diff --git a/api/service/UserCaCert.go b/api/service/UserCaCert.go index 4c3f4cb..2200569 100644 --- a/api/service/UserCaCert.go +++ b/api/service/UserCaCert.go @@ -1,13 +1,18 @@ package service import ( + "encoding/base64" + "encoding/json" "errors" "fmt" "gorm.io/gorm" "hospital-admin-api/api/dao" "hospital-admin-api/api/model" + "hospital-admin-api/api/requests" + "hospital-admin-api/extend/aliyun" "hospital-admin-api/extend/ca" "strconv" + "strings" "time" ) @@ -89,8 +94,8 @@ func (r *UserCaCertService) GetUserCloudCert(tx *gorm.DB, userId int64) (bool, e PersonalPhone: user.Mobile, PersonalName: cardName, PersonalIdNumber: cardNum, - OrgName: "", - OrgNumber: "", + OrgName: "成都金牛欣欣相照互联网医院有限公司", + OrgNumber: "91510106MABTJY4K9R", Pin: fmt.Sprintf("%d", userId), OrgDept: hospitalDepartment.DepartmentName, // // 卫生证书:医院部门 Province: "四川省", @@ -224,8 +229,8 @@ func (r *UserCaCertService) EditUserCloudCert(tx *gorm.DB, userId int64) (bool, PersonalPhone: user.Mobile, PersonalName: cardName, PersonalIdNumber: cardNum, - OrgName: "", - OrgNumber: "", + OrgName: "成都金牛欣欣相照互联网医院有限公司", + OrgNumber: "91510106MABTJY4K9R", Pin: fmt.Sprintf("%d", userId), OrgDept: hospitalDepartment.DepartmentName, // // 卫生证书:医院部门 Province: "四川省", @@ -238,7 +243,6 @@ func (r *UserCaCertService) EditUserCloudCert(tx *gorm.DB, userId int64) (bool, cloudCertResponse, err := ca.EditCloudCert(cloudCertRequestData) if err != nil || cloudCertResponse == nil { - tx.Rollback() return false, errors.New(err.Error()) } @@ -249,7 +253,6 @@ func (r *UserCaCertService) EditUserCloudCert(tx *gorm.DB, userId int64) (bool, data["cert_serial_number"] = cloudCertResponse.CertSerialnumber err = userCaCertDao.EditUserCaCertById(tx, userCaCert.CertId, data) if err != nil { - tx.Rollback() return false, errors.New("审核失败") } @@ -325,7 +328,6 @@ func (r *UserCaCertService) RenewUserCloudCert(tx *gorm.DB, userId int64) (bool, cloudCertResponse, err := ca.RenewCloudCert(cloudCertRequestData) if err != nil || cloudCertResponse == nil { - tx.Rollback() return false, errors.New(err.Error()) } @@ -336,7 +338,6 @@ func (r *UserCaCertService) RenewUserCloudCert(tx *gorm.DB, userId int64) (bool, data["cert_serial_number"] = cloudCertResponse.CertSerialnumber err = userCaCertDao.EditUserCaCertById(tx, userCaCert.CertId, data) if err != nil { - tx.Rollback() return false, errors.New("审核失败") } @@ -400,14 +401,12 @@ func (r *UserCaCertService) RemoveUserCloudCert(tx *gorm.DB, userId int64) (bool _, err = ca.RemoveCloudCert(cloudCertRequestData) if err != nil { - tx.Rollback() return false, errors.New(err.Error()) } // 修改ca监管证书表-注销 err = userCaCertDao.DeleteUserCaCertById(tx, userCaCert.CertId) if err != nil { - tx.Rollback() return false, errors.New("注销失败") } @@ -415,149 +414,179 @@ func (r *UserCaCertService) RemoveUserCloudCert(tx *gorm.DB, userId int64) (bool } // AddUserSignConfig 添加用户签章配置 -// func (r *UserCaCertService) AddUserSignConfig(tx *gorm.DB, req requests.AddUserSignConfig) (bool, error) { -// userCaCertDao := dao.UserCaCert{} -// -// var entityId string // 唯一标识 -// var cardNum string // 身份证号/信用代码 -// -// // 医院-固定 -// if req.Type == 1 { -// entityId = "5345345461" -// cardNum = "91510106MABTJY4K9R" -// } -// -// // 医生 -// if req.Type == 2 { -// if req.UserId == "" { -// return false, errors.New("缺少用户标识") -// } -// -// entityId = req.UserId -// -// // 将 id 转换为 int64 类型 -// userId, err := strconv.ParseInt(req.UserId, 10, 64) -// if err != nil { -// return false, errors.New("用户标识错误") -// } -// -// // 获取医生数据 -// userDoctorDao := dao.UserDoctorDao{} -// userDoctor, err := userDoctorDao.GetUserDoctorByUserId(userId) -// if err != nil || userDoctor == nil { -// return false, errors.New("医生数据错误") -// } -// -// // 获取医生详情数据 -// userDoctorInfoDao := dao.UserDoctorInfoDao{} -// userDoctorInfo, err := userDoctorInfoDao.GetUserDoctorInfoByDoctorId(userDoctor.DoctorId) -// if err != nil || userDoctorInfo == nil { -// return false, errors.New("医生详情数据错误") -// } -// -// if userDoctor.IdenAuthStatus != 1 { -// return false, errors.New("请先通过身份认证") -// } -// -// if userDoctor.MultiPointStatus != 1 { -// return false, errors.New("请先完成多点执业认证") -// } -// -// cardNum = userDoctorInfo.CardNum -// } -// -// // 药师 -// if req.Type == 3 { -// if req.UserId == "" { -// return false, errors.New("缺少用户标识") -// } -// -// entityId = req.UserId -// -// // 将 id 转换为 int64 类型 -// userId, err := strconv.ParseInt(req.UserId, 10, 64) -// if err != nil { -// return false, errors.New("用户标识错误") -// } -// -// // 获取药师详情数据 -// userPharmacistInfoDao := dao.UserPharmacistInfoDao{} -// userPharmacistInfo, err := userPharmacistInfoDao.GetUserPharmacistInfoByUserId(userId) -// if err != nil || userPharmacistInfo == nil { -// return false, errors.New("药师详情数据错误") -// } -// -// cardNum = userPharmacistInfo.CardNum -// } -// -// // 检测是否存在云证书 -// maps := make(map[string]interface{}) -// maps["ca_pin"] = entityId -// maps["type"] = 2 -// userCaCert, _ := userCaCertDao.GetUserCaCert(maps) -// if userCaCert == nil { -// return false, errors.New("医生未申请云证书,请申请后添加签章配置") -// } -// -// // 处理签章图片 -// var signImage string // 签章图片,base64格式 -// -// // 处理签章配置 -// var signParam string // 签章配置,JSON -// fmt.Println(signParam) -// var signParams []map[string]interface{} -// if req.Type == 1 { -// // 医院 -// signParam := map[string]interface{}{ -// "llx": "370", -// "lly": "210", -// "urx": "520", -// "ury": "360", -// "pageList": []int{1}, -// "sealImg": signImage, // 请替换为你的签名图像路径 -// } -// signParams = append(signParams, signParam) -// -// } -// -// // 申请云证书 -// cloudCertRequestData := &ca.AddUserSignConfigRequest{ -// UserId: entityId, -// ConfigKey: entityId, -// KeypairType: "3", -// CertSn: cardNum, -// SignType: "4", -// SignParam: "", -// SealImg: "", -// SealType: "4", -// SignTemplate: "0", -// } -// -// cloudCertResponse, err := ca.AddCloudCert(cloudCertRequestData) -// if err != nil || cloudCertResponse == nil { -// return false, errors.New(err.Error()) -// } -// -// // 新增ca监管证书表 -// userCaCert = &model.UserCaCert{ -// UserId: &userId, -// IsSystem: 0, -// IsLatest: 1, -// Type: 2, -// CertBase64: cloudCertResponse.CertBase64, -// CertChainP7: cloudCertResponse.CertP7, -// CertSerialNumber: cloudCertResponse.CertSerialnumber, -// CaPin: fmt.Sprintf("%d", userId), -// IsSignConfig: 0, -// SignConfig: "", -// CertApplicationTime: model.LocalTime(time.Now()), -// CertExpireTime: model.LocalTime(time.Now().AddDate(0, 0, 180)), // 180天以后的时间 -// } -// -// userCaCert, err = userCaCertDao.AddUserCaCert(tx, userCaCert) -// if err != nil || userCaCert == nil { -// return false, errors.New(err.Error()) -// } -// -// return true, nil -// } +func (r *UserCaCertService) AddUserSignConfig(tx *gorm.DB, req requests.AddUserSignConfig) (bool, error) { + userCaCertDao := dao.UserCaCert{} + + var entityId string // 唯一标识 + var cardNum string // 身份证号/信用代码 + var signImagePath string // 签名图片地址 + + // 医院-固定 + if req.Type == 1 { + entityId = "5345345461" + cardNum = "91510106MABTJY4K9R" + signImagePath = "basic/file/hospital_signature.png" + } + + // 医生 + if req.Type == 2 { + if req.UserId == "" { + return false, errors.New("缺少用户标识") + } + + entityId = req.UserId + + // 将 id 转换为 int64 类型 + userId, err := strconv.ParseInt(req.UserId, 10, 64) + if err != nil { + return false, errors.New("用户标识错误") + } + + // 获取医生数据 + userDoctorDao := dao.UserDoctorDao{} + userDoctor, err := userDoctorDao.GetUserDoctorByUserId(userId) + if err != nil || userDoctor == nil { + return false, errors.New("医生数据错误") + } + + // 获取医生详情数据 + userDoctorInfoDao := dao.UserDoctorInfoDao{} + userDoctorInfo, err := userDoctorInfoDao.GetUserDoctorInfoByDoctorId(userDoctor.DoctorId) + if err != nil || userDoctorInfo == nil { + return false, errors.New("医生详情数据错误") + } + + if userDoctor.IdenAuthStatus != 1 { + return false, errors.New("请先通过身份认证") + } + + if userDoctor.MultiPointStatus != 1 { + return false, errors.New("请先完成多点执业认证") + } + + cardNum = userDoctorInfo.CardNum + signImagePath = strings.TrimLeft(userDoctorInfo.SignImage, "/") + } + + // 药师 + if req.Type == 3 { + if req.UserId == "" { + return false, errors.New("缺少用户标识") + } + + entityId = req.UserId + + // 将 id 转换为 int64 类型 + userId, err := strconv.ParseInt(req.UserId, 10, 64) + if err != nil { + return false, errors.New("用户标识错误") + } + + // 获取药师详情数据 + userPharmacistInfoDao := dao.UserPharmacistInfoDao{} + userPharmacistInfo, err := userPharmacistInfoDao.GetUserPharmacistInfoByUserId(userId) + if err != nil || userPharmacistInfo == nil { + return false, errors.New("药师详情数据错误") + } + + cardNum = userPharmacistInfo.CardNum + signImagePath = strings.TrimLeft(userPharmacistInfo.SignImage, "/") + } + + // 检测是否存在云证书 + maps := make(map[string]interface{}) + maps["ca_pin"] = entityId + maps["type"] = 2 + userCaCert, _ := userCaCertDao.GetUserCaCert(maps) + if userCaCert == nil { + return false, errors.New("医生未申请云证书,请申请后添加签章配置") + } + + if userCaCert.IsSignConfig == 1 { + return false, errors.New("医生已存在签章配置,请勿重复添加") + } + + // 下载签章图片 + var style string + if req.Type == 1 { + style = "image/resize,w_300,h_300" + } else { + style = "image/resize,m_lfit,w_100,h_350" + } + + signImage, err := aliyun.GetCusTomObjectToRAM(signImagePath, style) + if err != nil { + return false, err + } + + signImage = base64.StdEncoding.EncodeToString([]byte(signImage)) + + // 签章配置,JSON + var signParam map[string]interface{} + var signParams []map[string]interface{} + + // 医院 + if req.Type == 1 { + signParam = map[string]interface{}{ + "llx": "370", + "lly": "210", + "urx": "520", + "ury": "360", + } + } + + // 医生 + if req.Type == 2 { + signParam = map[string]interface{}{ + "llx": "120", + "lly": "190", + "urx": "190", + "ury": "140", + } + } + + // 药师 + if req.Type == 2 { + signParam = map[string]interface{}{ + "llx": "350", + "lly": "190", + "urx": "440", + "ury": "140", + } + } + + signParam["pageList"] = []int{1} + signParam["sealImg"] = signImage + + signParams = append(signParams, signParam) + + signParamJson, err := json.Marshal(signParams) + if err != nil { + return false, err + } + + // 添加签章配置 + cloudCertRequestData := &ca.AddUserSignConfigRequest{ + UserId: fmt.Sprintf("%d", entityId), + ConfigKey: fmt.Sprintf("%d", entityId), + CertSn: cardNum, + SignParam: string(signParamJson), + SealImg: signImage, + } + + _, err = ca.AddUserSignConfig(cloudCertRequestData) + if err != nil { + return false, errors.New(err.Error()) + } + + // 修改ca监管证书表 + data := make(map[string]interface{}) + data["is_sign_config"] = 1 + data["sign_config"] = string(signParamJson) + err = userCaCertDao.EditUserCaCertById(tx, userCaCert.CertId, data) + if err != nil { + return false, errors.New("修改签证配置失败") + } + + return true, nil +} diff --git a/extend/aliyun/oss.go b/extend/aliyun/oss.go index c574e8e..d2c689b 100644 --- a/extend/aliyun/oss.go +++ b/extend/aliyun/oss.go @@ -5,7 +5,11 @@ import ( "crypto/sha1" "encoding/base64" "encoding/json" + "fmt" + "github.com/aliyun/aliyun-oss-go-sdk/oss" "hospital-admin-api/config" + "io" + "os" "strings" "time" ) @@ -54,3 +58,108 @@ func GetOssSign(dir string) (*GetOssSignResponse, error) { return response, nil } + +// CreateClient 创建客户端 +func CreateClient() (*oss.Client, error) { + // 创建OSSClient实例。 + client, err := oss.New(config.C.Oss.OssEndpoint, config.C.Oss.OssAccessKey, config.C.Oss.OssAccessKeySecret) + if err != nil { + return nil, err + } + + return client, nil +} + +// GetCusTomObjectToRAM 下载自定义风格文件到内存 +func GetCusTomObjectToRAM(filename string, style string) (string, error) { + if style == "" { + style = "image/resize" + } + + ossClient, err := CreateClient() + if err != nil { + return "", err + } + + // yourBucketName填写存储空间名称。 + bucket, err := ossClient.Bucket(config.C.Oss.OssBucket) + if err != nil { + return "", err + } + + // 下载文件到流。 + body, err := bucket.GetObject(filename, oss.Process(style)) + if err != nil { + return "", err + } + + // 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。 + defer func(body io.ReadCloser) { + _ = body.Close() + }(body) + + data, err := io.ReadAll(body) + if err != nil { + fmt.Println("Error:", err) + os.Exit(-1) + } + + return string(data), nil +} + +// GetObjectToRAM 下载文件到内存 +func GetObjectToRAM(filename string) (string, error) { + ossClient, err := CreateClient() + if err != nil { + return "", err + } + + // yourBucketName填写存储空间名称。 + bucket, err := ossClient.Bucket(config.C.Oss.OssBucket) + if err != nil { + return "", err + } + + // 下载文件到流。 + body, err := bucket.GetObject(filename) + if err != nil { + return "", err + } + + // 数据读取完成后,获取的流必须关闭,否则会造成连接泄漏,导致请求无连接可用,程序无法正常工作。 + defer func(body io.ReadCloser) { + _ = body.Close() + }(body) + + data, err := io.ReadAll(body) + if err != nil { + fmt.Println("Error:", err) + os.Exit(-1) + } + + return string(data), nil +} + +// GetObjectToLocal 下载文件到本地 +func GetObjectToLocal(filename, local string) (bool, error) { + ossClient, err := CreateClient() + if err != nil { + return false, err + } + + // yourBucketName填写存储空间名称。 + bucket, err := ossClient.Bucket(config.C.Oss.OssBucket) + if err != nil { + return false, err + } + + // 下载文件到本地文件,并保存到指定的本地路径中。如果指定的本地文件存在会覆盖,不存在则新建。 + // 如果未指定本地路径,则下载后的文件默认保存到示例程序所属项目对应本地路径中。 + // 依次填写Object完整路径(例如exampledir/exampleobject.txt)和本地文件的完整路径(例如D:\\localpath\\examplefile.txt)。Object完整路径中不能包含Bucket名称。 + err = bucket.GetObjectToFile(filename, local) + if err != nil { + return false, err + } + + return true, nil +} diff --git a/extend/ca/CaOnlineRequest.go b/extend/ca/CaOnlineRequest.go index 768b37f..a071cd6 100644 --- a/extend/ca/CaOnlineRequest.go +++ b/extend/ca/CaOnlineRequest.go @@ -71,13 +71,13 @@ type RemoveCloudCertRequest struct { // AddUserSignConfigRequest 添加用户签章配置 type AddUserSignConfigRequest struct { - UserId string `json:"userId"` // 用户标识信息(为云证书entityId) - ConfigKey string `json:"configKey"` // 签章配置唯一标识,一张云证书配置一个 - KeypairType string `json:"keypairType"` // 秘钥类型(3云证书) - CertSn string `json:"certSn"` // 证书序列号,使用医生身份证号即可 - SignType string `json:"signType"` // 签章方式(签章类型; 4客户端坐标签章;5客户端关键字签章;) - SignParam string `json:"authNoticeType"` // 签章配置,JSON - SealImg string `json:"sealImg"` // 签章图片,base64格式 + UserId string `json:"userId"` // 用户标识信息(为云证书entityId) + ConfigKey string `json:"configKey"` // 签章配置唯一标识,一张云证书配置一个 + KeypairType string `json:"keypairType"` // 秘钥类型(3云证书) + CertSn string `json:"certSn"` // 证书序列号,使用医生身份证号即可 + SignType string `json:"signType"` // 签章方式(签章类型; 4客户端坐标签章;5客户端关键字签章;) + SignParam string `json:"signParam"` // 签章配置,JSON + SealImg string `json:"sealImg"` // 签章图片,base64格式 SealType string `json:"sealType"` SignTemplate string `json:"signTemplate"` } diff --git a/extend/ca/caOnline.go b/extend/ca/caOnline.go index 2e05ba4..91e4cb1 100644 --- a/extend/ca/caOnline.go +++ b/extend/ca/caOnline.go @@ -352,39 +352,45 @@ func RemoveCloudCert(d *RemoveCloudCertRequest) (bool, error) { } // AddUserSignConfig 添加用户签章配置 -// func AddUserSignConfig(d *AddUserSignConfigRequest) (bool, error) { -// if d == nil { -// return false, errors.New("获取云证书失败") -// } -// -// // 获取签名 -// requestDataMap := make(map[string]interface{}) -// requestDataMap["entityId"] = d.EntityId -// requestDataMap["pin"] = d.Pin -// requestDataMap["authType"] = d.AuthType -// requestDataMap["authTime"] = d.AuthTime -// requestDataMap["authResult"] = d.AuthResult -// requestDataMap["authNoticeType"] = d.AuthNoticeType -// signature := GenerateSignature(requestDataMap) -// if signature == "" { -// return false, errors.New("云证书签名错误") -// } -// -// formData := url.Values{} -// formData.Set("entityId", d.EntityId) -// formData.Set("pin", d.Pin) -// formData.Set("authType", d.AuthType) -// formData.Set("authTime", d.AuthTime) -// formData.Set("authResult", d.AuthResult) -// formData.Set("authNoticeType", d.AuthNoticeType) -// -// // 构建请求 URL -// requestUrl := config.C.CaOnline.CaOnlineApiUrl + "/cloud-certificate-service/api/cloudCert/open/v2/cert/certRevoke" -// -// _, err := postRequest(requestUrl, formData, signature) -// if err != nil { -// return false, errors.New(err.Error()) -// } -// -// return true, nil -// } +func AddUserSignConfig(d *AddUserSignConfigRequest) (bool, error) { + if d == nil { + return false, errors.New("获取云证书失败") + } + + // 获取签名 + requestDataMap := make(map[string]interface{}) + requestDataMap["userId"] = d.UserId + requestDataMap["configKey"] = d.UserId + requestDataMap["keypairType"] = "3" + requestDataMap["certSn"] = d.CertSn + requestDataMap["signType"] = "4" + requestDataMap["signParam"] = d.SignParam + requestDataMap["sealImg"] = d.SealImg + requestDataMap["sealType"] = "4" + requestDataMap["signTemplate"] = "0" + signature := GenerateSignature(requestDataMap) + if signature == "" { + return false, errors.New("云证书签名错误") + } + + formData := url.Values{} + formData.Set("userId", d.UserId) + formData.Set("configKey", d.UserId) + formData.Set("keypairType", "3") + formData.Set("certSn", d.CertSn) + formData.Set("signType", "4") + formData.Set("signParam", d.SignParam) + formData.Set("sealImg", d.SealImg) + formData.Set("sealType", "4") + formData.Set("signTemplate", "0") + + // 构建请求 URL + requestUrl := config.C.CaOnline.CaOnlineApiUrl + "/signature-server/api/open/signature/userSignConfig" + + _, err := postRequest(requestUrl, formData, signature) + if err != nil { + return false, errors.New(err.Error()) + } + + return true, nil +}