feat : config
This commit is contained in:
39
app/Service/Api/User/UnBindPhoneService.php
Normal file
39
app/Service/Api/User/UnBindPhoneService.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Api\User;
|
||||
|
||||
use App\Exception\ErrException;
|
||||
use App\Model\User;
|
||||
use App\Service\Api\BaseService;
|
||||
|
||||
class UnBindPhoneService extends BaseService
|
||||
{
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
protected User $userModel;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$userInfo = $this->userModel->find($this->userId);
|
||||
|
||||
if ($userInfo->isEmpty()) throw new ErrException('用户不存在');
|
||||
|
||||
$userInfo->phone = '';
|
||||
|
||||
if (!$userInfo->save()) throw new ErrException('解绑失败');
|
||||
|
||||
return $this->return->success('解绑成功');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user