李昊 4 years ago
parent
commit
f91c84367c

+ 9 - 6
gx_api/GxPress/Service/GxPress.Service.Implement/AddressBookGroup/AddressBookGroupService.cs

@@ -32,12 +32,15 @@ namespace GxPress.Service.Implement.AddressBookGroup
                     /// </summary>
                     /// <returns></returns>
                     var addressBookGroup = await addressBookGroupRepository.InsertAsync(request);
-                    //添加
-                    await addressBookGroupUserRepository.InsertAsync(new AddressBookGroupUserInRequest
+                    if (request.UserIds != null)
                     {
-                        AddressBookGroupId = addressBookGroup.Id,
-                        UserId = request.UserIds
-                    });
+                        //添加
+                        await addressBookGroupUserRepository.InsertAsync(new AddressBookGroupUserInRequest
+                        {
+                            AddressBookGroupId = addressBookGroup.Id,
+                            UserId = request.UserIds
+                        });
+                    }
                     transactionScope.Complete();
                     return addressBookGroup;
                 }
@@ -46,7 +49,7 @@ namespace GxPress.Service.Implement.AddressBookGroup
             {
                 return new Entity.AddressBookGroup();
             }
-            return new Entity.AddressBookGroup();
+
         }
     }
 }