Ver código fonte

开码时判断项目状态是否可用

lifa 1 ano atrás
pai
commit
0bd6a9e56b

+ 18 - 0
src/platform/ZhonTai.Admin/Services/DiTuiAPI/ProjectsService.cs

@@ -336,6 +336,24 @@ namespace ZhonTai.Admin.Services.DiTuiAPI
         [NoOprationLog]
         public async Task<string> BindQrcodeAsync(BindQrcodeInput input)
         {
+            var project = await _projectRepository.Select.DisableGlobalFilter().Where(a => a.Id == input.ProjectId).FirstAsync(a => new {a.Status});
+            if(project.Status == 4)
+            {
+                throw ResultOutput.Exception($"项目暂停");
+            }
+            if(project.Status == 5)
+            {
+                throw ResultOutput.Exception($"项目名额已满");
+            }
+            if (project.Status == 3)
+            {
+                throw ResultOutput.Exception($"项目已下架");
+            }
+            if (project.Status == 1)
+            {
+                throw ResultOutput.Exception($"项目未上架");
+            }
+
             // 判断用户是否已经 开码  同租户 同项目 手机号唯一
             var doubleUser = await _ProjectLinkRepository.Select.Where(a => a.SalesmanPhone == input.SalesmanPhone && a.ProjectId == input.ProjectId)
                 .FirstAsync(a => new { a.Salesman, a.SalesmanPhone, a.Id });