|
|
@@ -8,6 +8,7 @@ use app\middleware\AuthMiddleware;
|
|
|
use app\model\saas\SaasUserOpen;
|
|
|
use DI\Attribute\Inject;
|
|
|
use LinFly\Annotation\Attributes\Route\Controller;
|
|
|
+use LinFly\Annotation\Attributes\Route\GetMapping;
|
|
|
use LinFly\Annotation\Attributes\Route\Middleware;
|
|
|
use LinFly\Annotation\Attributes\Route\PostMapping;
|
|
|
use Shopwwi\WebmanAuth\Facade\Auth as AuthFacade;
|
|
|
@@ -25,6 +26,20 @@ class Auth extends Base
|
|
|
protected SaasUserOpen $model;
|
|
|
|
|
|
|
|
|
+ #[GetMapping("data")]
|
|
|
+ public function getUserData(Request $request): Response
|
|
|
+ {
|
|
|
+ try {
|
|
|
+ $data = $this->model->where("openid",$request->user['openid'])->field("openid,nickname,avatar,mobile")->findOrEmpty();
|
|
|
+ if ($data->isEmpty()) return errorTrans("error.data");
|
|
|
+ if (empty($data['avatar'])) $data['avatar'] = sConf("service.logo");
|
|
|
+ $data['mobile'] = hide_mobile($data['mobile']);
|
|
|
+ return success("ok",$data->toArray());
|
|
|
+ } catch (\Throwable $th) {
|
|
|
+ return error($th->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 手机号码
|
|
|
* @param Request $request
|