|
@@ -42,16 +42,16 @@ func SignatureAdd(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
fmt.Println(err)
|
|
|
return nil, errors.New("参数错误!")
|
|
|
}
|
|
|
- ctx := apictx.CreateRepoCtx()
|
|
|
|
|
|
// if signature.UserId.IsZero() {
|
|
|
// return nil, errors.New("签名用户为空")
|
|
|
// }
|
|
|
+ signature.Format = `{"autofit":true,"print_obj":true,"lock_aspect_ratio":false,"locked":false,"positioning":"oncell"}`
|
|
|
|
|
|
signature.CreateTime = time.Now()
|
|
|
signature.UpdateTime = time.Now()
|
|
|
|
|
|
- return repo.RepoAddDoc(ctx, repo.CollectionSignature, &signature)
|
|
|
+ return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionSignature, &signature)
|
|
|
}
|
|
|
|
|
|
// 获取签名详情
|
|
@@ -95,10 +95,11 @@ func SignatureList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
func SignatureUpdate(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
var signature model.Signature
|
|
|
err := c.ShouldBindJSON(&signature)
|
|
|
+
|
|
|
if err != nil {
|
|
|
return nil, errors.New("参数错误")
|
|
|
}
|
|
|
- if signature.Id.Hex() == "" {
|
|
|
+ if signature.Id.IsZero() {
|
|
|
return nil, errors.New("id的为空")
|
|
|
}
|
|
|
signature.UpdateTime = time.Now()
|