| 
					
				 | 
			
			
				@@ -0,0 +1,108 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using Microsoft.AspNetCore.Authorization; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using Microsoft.AspNetCore.Http; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using Microsoft.AspNetCore.Mvc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using NPOI.SS.Formula.PTG; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Collections.Generic; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Diagnostics; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Linq; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Text; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.Threading.Tasks; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Core.Attributes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Core.Configs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Core.Consts; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Core.Dto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Domain.KuaKe; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Domain.Org; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Domain.Platform; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Domain.Tenant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Repositories.Platform; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Repositories; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Services.Auth.Dto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Services.DiTuiAPI.Dto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Common.Helpers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.DynamicApi; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.DynamicApi.Attributes; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Domain.Project; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using System.ComponentModel.DataAnnotations; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Services.DiTuiAPI.KuaKe.Dto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Domain.Banner; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Repositories.Banner; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Services.Banner.Dto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using ZhonTai.Admin.Core.Auth; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+namespace ZhonTai.Admin.Services.DiTuiAPI.KuaKe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public interface IKuaKeService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /// 夸克服务 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    [DynamicApi(Area = AdminConsts.DiTuiName)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public class KuaKeService : BaseService, IKuaKeService, IDynamicApi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private readonly AppConfig _appConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private readonly IKuaKeRepository _kuaKeRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private readonly IProjectRepository _projectRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public KuaKeService(IKuaKeRepository kuaKeRepository, IProjectRepository projectRepository, AppConfig appConfig) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _kuaKeRepository = kuaKeRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _projectRepository = projectRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            _appConfig = appConfig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 推广详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="ProjectId"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <exception cref="NotImplementedException"></exception>         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpGet] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<KuakeDetailOutput> Detail([Required]long ProjectId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var project = await _projectRepository.Select.Where(m => m.Id == ProjectId && m.ProjectType == 2).ToOneAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (project?.Id <= 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw ResultOutput.Exception("项目不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            KuakeDetailOutput output = new KuakeDetailOutput(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            output.SignUrl = _appConfig.KuaKeSet.SignUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            output.FirstImg = _appConfig.KuaKeSet.FirstImg;             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var list=Newtonsoft.Json.JsonConvert.DeserializeObject<List<KuakeDetailOutput_Indeustry>>(_appConfig.KuaKeSet.Industry); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            output.Indeustry = list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return output; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 推广申请 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="input"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <exception cref="NotImplementedException"></exception>         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<long> AddAsync(KuaKeInput input) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+           var count=await _kuaKeRepository.Select.Where(m => m.KuaKeID == input.KuaKeID).CountAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (count > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw ResultOutput.Exception("夸克ID已使用"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var entity = Mapper.Map<KuaKeEntity>(input); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //创建用户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            entity.UserId = User.Id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            await _kuaKeRepository.InsertAsync(entity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return entity.Id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// 推广资料 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="id"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns>             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<KuaKeGetOutput> GetAsync(long id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var result = await _kuaKeRepository.GetAsync<KuaKeGetOutput>(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |