新增UserService物件
This commit is contained in:
@@ -0,0 +1,17 @@
|
|||||||
|
package com.ray650128.service
|
||||||
|
|
||||||
|
import com.ray650128.model.User
|
||||||
|
import com.ray650128.repository.UserRepository
|
||||||
|
|
||||||
|
class UserService {
|
||||||
|
val userRepository = UserRepository()
|
||||||
|
|
||||||
|
suspend fun addUser(data: User): Boolean {
|
||||||
|
return if (userRepository.get(data.account) == null) {
|
||||||
|
userRepository.add(data)
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user