diff --git a/catch/system/controller/Developer.php b/catch/system/controller/Developer.php index 17b5246..27da34c 100644 --- a/catch/system/controller/Developer.php +++ b/catch/system/controller/Developer.php @@ -11,7 +11,8 @@ namespace catchAdmin\system\controller; -use catcher\base\CatchRequest as Request; +use think\Request as Request; +use catcher\CatchAuth; use catcher\CatchResponse; use catcher\base\CatchController; use catchAdmin\system\model\Developers as DevelopersModel; @@ -36,7 +37,20 @@ class Developer extends CatchController { return CatchResponse::paginate($this->model->getList()); } - + + /** + * 开发者认证 + * + * @time 2020年07月13日 + * @param Request $request + * @param CatchAuth $auth + * @return mixed + */ + public function authenticate(Request $request, CatchAuth $auth) + { + return CatchResponse::success($auth->guard('developer')->username('username')->attempt($request->post())); + } + /** * 保存 * diff --git a/catch/system/model/Developers.php b/catch/system/model/Developers.php index 899b850..a8de5d0 100644 --- a/catch/system/model/Developers.php +++ b/catch/system/model/Developers.php @@ -15,20 +15,25 @@ use catcher\base\CatchModel as Model; class Developers extends Model { - protected $name = 'developers'; + protected $name = 'developers'; protected $field = [ - 'id', // - 'username', // 用户名 - 'password', // 密码 - 'mobile', // 手机号 - 'id_card', // 身份证 - 'alipay_account', // 支付宝账户 - 'status', // 1 待认证 1 已认证 - 'created_at', // 创建时间 - 'updated_at', // 更新时间 + 'id', // + 'username', // 用户名 + 'password', // 密码 + 'mobile', // 手机号 + 'id_card', // 身份证 + 'alipay_account', // 支付宝账户 + 'status', // 1 待认证 1 已认证 + 'created_at', // 创建时间 + 'updated_at', // 更新时间 'deleted_at', // 软删除 ]; - + + + public function setPasswordAttr($value) + { + return password_hash($value, PASSWORD_DEFAULT); + } } \ No newline at end of file diff --git a/catch/system/route.php b/catch/system/route.php index 0966ddc..484bf1f 100644 --- a/catch/system/route.php +++ b/catch/system/route.php @@ -33,4 +33,6 @@ $router->group(function () use ($router){ })->middleware('auth'); //developer路由 -$router->resource('developer', '\catchAdmin\system\controller\Developer')->middleware('auth'); \ No newline at end of file +$router->resource('developer', '\catchAdmin\system\controller\Developer')->middleware('auth'); +// 开发者认证 +$router->post('developer/authenticate', '\catchAdmin\system\controller\Developer@authenticate'); \ No newline at end of file