迁移并重构项目,优化了执行流程
This commit is contained in:
		
							
								
								
									
										42
									
								
								internal/class/SafeLine/Cert.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								internal/class/SafeLine/Cert.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,42 @@
 | 
			
		||||
package SafeLine
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type UpdateReq struct {
 | 
			
		||||
	Acme struct {
 | 
			
		||||
		Domains []string `json:"domains"`
 | 
			
		||||
		Email   string   `json:"email"`
 | 
			
		||||
	} `json:"acme"`
 | 
			
		||||
	Id     int `json:"id"`
 | 
			
		||||
	Manual struct {
 | 
			
		||||
		Crt string `json:"crt"`
 | 
			
		||||
		Key string `json:"key"`
 | 
			
		||||
	} `json:"manual"`
 | 
			
		||||
	Type int `json:"type"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (updateReq *UpdateReq) Create(Certificate, PrivateKey []byte, domains []string, email string, id, Type int) {
 | 
			
		||||
	updateReq.Acme.Domains = domains
 | 
			
		||||
	updateReq.Acme.Email = email
 | 
			
		||||
	updateReq.Manual.Crt = string(Certificate)
 | 
			
		||||
	updateReq.Manual.Key = string(PrivateKey)
 | 
			
		||||
	updateReq.Id = id
 | 
			
		||||
	updateReq.Type = Type
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (updateReq *UpdateReq) Marshal() []byte {
 | 
			
		||||
	data, _ := json.Marshal(updateReq)
 | 
			
		||||
	return data
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type UpdateResp struct {
 | 
			
		||||
	Data int         `json:"data"`
 | 
			
		||||
	Err  interface{} `json:"err"`
 | 
			
		||||
	Msg  string      `json:"msg"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (updateResp *UpdateResp) Unmarshal(data []byte) {
 | 
			
		||||
	_ = json.Unmarshal(data, &updateResp)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user