|
@@ -372,7 +372,12 @@ func (s *webForwardingService) AddWebForwarding(ctx context.Context, req *v1.Web
|
|
|
|
|
|
|
|
|
// 添加网站
|
|
|
- webId, err := s.cdn.CreateWebsite(ctx, formData)
|
|
|
+ formDataSend, err := s.BulidFormData(ctx, formData)
|
|
|
+ if err != nil {
|
|
|
+ return err
|
|
|
+ }
|
|
|
+
|
|
|
+ webId, err := s.cdn.CreateWebsite(ctx, formDataSend)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -1073,3 +1078,36 @@ func (s *webForwardingService) EditCcConfig(ctx context.Context,webId int64, req
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+func (s *webForwardingService) BulidFormData(ctx context.Context,formData v1.Website) (v1.WebsiteSend, error) {
|
|
|
+ httpJSON, err := json.Marshal(formData.HttpJSON)
|
|
|
+ if err != nil {
|
|
|
+ return v1.WebsiteSend{},err
|
|
|
+ }
|
|
|
+ httpsJSON, err := json.Marshal(formData.HttpsJSON)
|
|
|
+ if err != nil {
|
|
|
+ return v1.WebsiteSend{},err
|
|
|
+ }
|
|
|
+ formDataSend := v1.WebsiteSend{
|
|
|
+ UserId: formData.UserId,
|
|
|
+ AdminId: formData.AdminId,
|
|
|
+ Type: formData.Type,
|
|
|
+ Name: formData.Name,
|
|
|
+ Description: formData.Description,
|
|
|
+ ServerNamesJSON: formData.ServerNamesJSON,
|
|
|
+ HttpJSON: httpJSON,
|
|
|
+ HttpsJSON: httpsJSON,
|
|
|
+ TcpJSON: formData.TcpJSON,
|
|
|
+ TlsJSON: formData.TlsJSON,
|
|
|
+ UdpJSON: formData.UdpJSON,
|
|
|
+ WebId: formData.WebId,
|
|
|
+ ReverseProxyJSON: formData.ReverseProxyJSON,
|
|
|
+ ServerGroupIds: formData.ServerGroupIds,
|
|
|
+ UserPlanId: formData.UserPlanId,
|
|
|
+ NodeClusterId: formData.NodeClusterId,
|
|
|
+ IncludeNodesJSON: formData.IncludeNodesJSON,
|
|
|
+ ExcludeNodesJSON: formData.ExcludeNodesJSON,
|
|
|
+ }
|
|
|
+ return formDataSend, nil
|
|
|
+}
|