Merge branch 'feature/user0812' into develop_bm
# Conflicts: # app/admin/service/UserService.php # config/route.php
This commit is contained in:
@@ -3,9 +3,10 @@
|
||||
namespace app\admin\service;
|
||||
|
||||
use app\admin\logic\UserLogic;
|
||||
use app\admin\validate\UserValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\User;
|
||||
use app\common\validate\UserValidate;
|
||||
use support\exception\BusinessException;
|
||||
use support\Request;
|
||||
|
||||
class UserService
|
||||
@@ -31,6 +32,14 @@ class UserService
|
||||
return new $this->validator;
|
||||
}
|
||||
|
||||
/** 更新 */
|
||||
public function serviceUpdate(Request $request, array $data = [])
|
||||
{
|
||||
$data = $this->preProcess('Update', $data, $request);
|
||||
$config = $this->buildQueryConfig($request, 'edit');
|
||||
$updated = $this->logicUpdateBy($config, $data);
|
||||
return $this->postProcess('Update', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造 CrudUtil 查询配置
|
||||
@@ -75,6 +84,12 @@ class UserService
|
||||
case 'destroy':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'savePassword':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'edit':
|
||||
$config['where']['id'] = $request->user->uid;
|
||||
break;
|
||||
}
|
||||
|
||||
return $config;
|
||||
@@ -103,4 +118,15 @@ class UserService
|
||||
{
|
||||
return (new UserLogic())->updateUserResources($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户密码
|
||||
*/
|
||||
public function savePassword(Request $request, array $data)
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'savePassword');
|
||||
$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
|
||||
$user = $this->logicUpdateBy($config,$data);
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user