部分前台接口
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CollectionService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class CollectionController extends BaseController
|
||||
{
|
||||
@@ -15,4 +16,20 @@ class CollectionController extends BaseController
|
||||
$this->service = CollectionService::getInstance();
|
||||
$this->insertField = ['project_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function unCollection(): JsonResponse
|
||||
{
|
||||
$projectId = request()->post('project_id');
|
||||
if (empty($projectId)) {
|
||||
return jerr('参数错误');
|
||||
}
|
||||
return jok(
|
||||
$this->service->unCollection($projectId),
|
||||
'取消成功'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,11 +28,16 @@ class UserController extends BaseController
|
||||
*/
|
||||
public function changePassword(): JsonResponse
|
||||
{
|
||||
$this->insertField = ['password', 'new_password'];
|
||||
$this->insertField = ['old_password', 'new_password', 'confirm_password'];
|
||||
$params = $this->checkRequiredFields(request()->post());
|
||||
|
||||
if ($params['old_password'] === $params['new_password']) {
|
||||
return jerr('新密码不能与旧密码相同');
|
||||
} elseif ($params['new_password'] !== $params['confirm_password']) {
|
||||
return jerr('新密码与确认密码不一致');
|
||||
}
|
||||
return jok(
|
||||
$this->service->changePassword($params['password'], $params['new_password']),
|
||||
$this->service->changePassword($params['old_password'], $params['new_password']),
|
||||
'重置密码成功'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user