mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	
		
			
	
	
		
			34 lines
		
	
	
		
			762 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			34 lines
		
	
	
		
			762 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package node
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
									"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
							 | 
						||
| 
								 | 
							
									"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
							 | 
						||
| 
								 | 
							
									"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type SyncDomainAction struct {
							 | 
						||
| 
								 | 
							
									actionutils.ParentAction
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func (this *SyncDomainAction) RunPost(params struct {
							 | 
						||
| 
								 | 
							
									DomainId int64
							 | 
						||
| 
								 | 
							
								}) {
							 | 
						||
| 
								 | 
							
									// 记录日志
							 | 
						||
| 
								 | 
							
									defer this.CreateLog(oplogs.LevelInfo, "同步DNS域名数据 %d", params.DomainId)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									// 执行同步
							 | 
						||
| 
								 | 
							
									resp, err := this.RPC().DNSDomainRPC().SyncDNSDomainData(this.AdminContext(), &pb.SyncDNSDomainDataRequest{DnsDomainId: params.DomainId})
							 | 
						||
| 
								 | 
							
									if err != nil {
							 | 
						||
| 
								 | 
							
										this.ErrorPage(err)
							 | 
						||
| 
								 | 
							
										return
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
									if resp.IsOk {
							 | 
						||
| 
								 | 
							
										this.Success()
							 | 
						||
| 
								 | 
							
									} else {
							 | 
						||
| 
								 | 
							
										this.Data["shouldFix"] = resp.ShouldFix
							 | 
						||
| 
								 | 
							
										this.Fail(resp.Error)
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									this.Success()
							 | 
						||
| 
								 | 
							
								}
							 |