2025-07-17 10:05:47 +09:00
|
|
|
<?php
|
|
|
|
|
|
2025-07-18 11:37:07 +09:00
|
|
|
namespace App\Http\Controllers\Api\V1;
|
2025-07-17 10:05:47 +09:00
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Services\MemberService;
|
|
|
|
|
use App\Helpers\ApiResponse;
|
|
|
|
|
|
|
|
|
|
class MemberController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
2025-07-18 11:37:07 +09:00
|
|
|
* path="/api/v1/member/index",
|
2025-07-17 10:05:47 +09:00
|
|
|
* summary="회원 목록 조회",
|
|
|
|
|
* description="회원 목록을 조회합니다.",
|
|
|
|
|
* tags={"Member"},
|
2025-07-24 09:20:39 +09:00
|
|
|
* security={
|
|
|
|
|
* {"ApiKeyAuth": {}},
|
|
|
|
|
* {"BearerAuth": {}}
|
|
|
|
|
* },
|
2025-07-26 06:21:58 +09:00
|
|
|
* @OA\Parameter(
|
|
|
|
|
* name="page",
|
|
|
|
|
* in="query",
|
|
|
|
|
* required=false,
|
|
|
|
|
* description="페이지 번호 (기본값: 1)",
|
|
|
|
|
* @OA\Schema(type="integer", example=1)
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Parameter(
|
|
|
|
|
* name="size",
|
|
|
|
|
* in="query",
|
|
|
|
|
* required=false,
|
|
|
|
|
* description="페이지당 항목 수 (기본값: 20)",
|
|
|
|
|
* @OA\Schema(type="integer", example=20)
|
|
|
|
|
* ),
|
2025-07-17 10:05:47 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="회원 목록 조회 성공",
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* type="object",
|
|
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="회원목록 조회 성공"),
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="data",
|
|
|
|
|
* type="object",
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="1",
|
|
|
|
|
* type="object",
|
|
|
|
|
* @OA\Property(property="mb_num", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="tn_num", type="string", example=null),
|
|
|
|
|
* @OA\Property(property="mb_id", type="string", example="admin"),
|
|
|
|
|
* @OA\Property(property="mb_name", type="string", example="권혁성"),
|
|
|
|
|
* @OA\Property(property="mb_phone", type="string", example="010-4820-9104"),
|
|
|
|
|
* @OA\Property(property="mb_mail", type="string", example="shine1324@gmail.com"),
|
|
|
|
|
* @OA\Property(property="email_verified_at", type="string", format="date-time", example=null),
|
|
|
|
|
* @OA\Property(property="mb_type", type="string", example=null),
|
|
|
|
|
* @OA\Property(property="mb_level", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="last_login", type="string", format="date-time", example=null),
|
|
|
|
|
* @OA\Property(property="reg_date", type="string", format="date-time", example="2025-07-16T09:28:41.000000Z"),
|
|
|
|
|
* @OA\Property(property="created_at", type="string", format="date-time", example=null),
|
|
|
|
|
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-16T09:30:56.000000Z")
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패"),
|
|
|
|
|
* @OA\Response(response=403, description="권한 없음")
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function index(Request $request)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
$type = $request->input('type', 'default');
|
|
|
|
|
$userToken = $request->input('user_token', '');
|
|
|
|
|
$debug = $request->boolean('debug', false);
|
|
|
|
|
$result = MemberService::getMembers($userToken, $type, $debug);
|
|
|
|
|
|
|
|
|
|
return ApiResponse::success($result['data'], '회원목록 조회 성공',$result['query']);
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return ApiResponse::error('회원목록 조회 실패', 500, [
|
|
|
|
|
'details' => $e->getMessage(),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show the form for creating a new resource.
|
|
|
|
|
*/
|
|
|
|
|
public function create()
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
|
*/
|
|
|
|
|
public function store(Request $request)
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(function () use ($request) {
|
|
|
|
|
return MemberService::setMember($request->all());
|
|
|
|
|
}, '회원등록 성공', '회원등록 실패');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get (
|
2025-07-26 06:21:58 +09:00
|
|
|
* path="/api/v1/member/show/{user_no}",
|
2025-07-17 10:05:47 +09:00
|
|
|
* summary="회원 상세조회",
|
|
|
|
|
* description="user_no 기준으로 회원 상세 정보를 조회합니다.",
|
|
|
|
|
* tags={"Member"},
|
2025-07-24 09:20:39 +09:00
|
|
|
* security={
|
|
|
|
|
* {"ApiKeyAuth": {}},
|
|
|
|
|
* {"BearerAuth": {}}
|
|
|
|
|
* },
|
2025-07-17 10:05:47 +09:00
|
|
|
*
|
|
|
|
|
* @OA\Parameter(
|
|
|
|
|
* name="user_no",
|
|
|
|
|
* in="path",
|
|
|
|
|
* required=true,
|
|
|
|
|
* description="회원 번호 (USER_NO)",
|
|
|
|
|
* @OA\Schema(type="integer", example=1)
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="조회 성공",
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* type="object",
|
|
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="회원 상세조회 성공"),
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="data",
|
|
|
|
|
* type="object",
|
|
|
|
|
* @OA\Property(property="mb_num", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="tn_num", type="string", example=null),
|
|
|
|
|
* @OA\Property(property="mb_id", type="string", example="admin"),
|
|
|
|
|
* @OA\Property(property="mb_name", type="string", example="권혁성"),
|
|
|
|
|
* @OA\Property(property="mb_phone", type="string", example="010-4820-9104"),
|
|
|
|
|
* @OA\Property(property="mb_mail", type="string", example="shine1324@gmail.com"),
|
|
|
|
|
* @OA\Property(property="email_verified_at", type="string", format="date-time", example=null),
|
|
|
|
|
* @OA\Property(property="mb_type", type="string", example=null),
|
|
|
|
|
* @OA\Property(property="mb_level", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="last_login", type="string", format="date-time", example=null),
|
|
|
|
|
* @OA\Property(property="reg_date", type="string", format="date-time", example="2025-07-16T09:28:41.000000Z"),
|
|
|
|
|
* @OA\Property(property="created_at", type="string", format="date-time", example=null),
|
|
|
|
|
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-16T09:30:56.000000Z")
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
*
|
|
|
|
|
* @OA\Response(response=404, description="회원 정보 없음"),
|
|
|
|
|
* @OA\Response(response=401, description="인증 실패")
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function show(Request $request, $userNo)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
$debug = $request->boolean('debug', false);
|
|
|
|
|
$result = MemberService::getMember($userNo, $debug);
|
|
|
|
|
|
|
|
|
|
return ApiResponse::success($result['data'], '회원 상세조회 성공',$result['query']);
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
return ApiResponse::error('회원 상세조회 실패', 500, [
|
|
|
|
|
'details' => $e->getMessage(),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-22 16:45:11 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @OA\Get(
|
2025-07-24 09:20:39 +09:00
|
|
|
* path="/api/v1/member/me",
|
2025-07-22 16:45:11 +09:00
|
|
|
* summary="내 정보 조회",
|
2025-07-24 11:49:01 +09:00
|
|
|
* description="내정보와 테넌트 정보를 전달 합니다.",
|
2025-07-22 16:45:11 +09:00
|
|
|
* tags={"Member"},
|
|
|
|
|
* security={
|
|
|
|
|
* {"ApiKeyAuth":{}},
|
|
|
|
|
* {"BearerAuth":{}}
|
|
|
|
|
* },
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=200,
|
|
|
|
|
* description="성공: 회원/회사 정보 반환",
|
|
|
|
|
* @OA\JsonContent(
|
|
|
|
|
* type="object",
|
|
|
|
|
* @OA\Property(property="success", type="boolean", example=true),
|
|
|
|
|
* @OA\Property(property="message", type="string", example="나의 정보 조회 성공"),
|
|
|
|
|
* @OA\Property(property="data", type="object",
|
|
|
|
|
* @OA\Property(property="member", type="object",
|
|
|
|
|
* @OA\Property(property="mb_num", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="tn_num", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="mb_id", type="string", example="hamss"),
|
|
|
|
|
* @OA\Property(property="mb_name", type="string", example="권혁성"),
|
|
|
|
|
* @OA\Property(property="mb_phone", type="string", example="010-4820-9104"),
|
|
|
|
|
* @OA\Property(property="mb_mail", type="string", example="shine1324@gmail.com"),
|
|
|
|
|
* @OA\Property(property="email_verified_at", type="string", example=null, nullable=true),
|
|
|
|
|
* @OA\Property(property="mb_type", type="string", example=null, nullable=true),
|
|
|
|
|
* @OA\Property(property="mb_level", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="last_login", type="string", example=null, nullable=true),
|
|
|
|
|
* @OA\Property(property="reg_date", type="string", format="date-time", example="2025-07-16T09:28:41.000000Z"),
|
|
|
|
|
* @OA\Property(property="created_at", type="string", example=null, nullable=true),
|
|
|
|
|
* @OA\Property(property="updated_at", type="string", format="date-time", example="2025-07-22T07:16:16.000000Z")
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Property(property="company", type="object",
|
|
|
|
|
* @OA\Property(property="mc_num", type="integer", example=1),
|
|
|
|
|
* @OA\Property(property="mc_name", type="string", example="(주)경동기업"),
|
|
|
|
|
* @OA\Property(property="mc_code", type="string", example="KDCOM"),
|
|
|
|
|
* @OA\Property(property="mc_business_num", type="string", example="1398700333"),
|
|
|
|
|
* @OA\Property(property="mc_owner_name", type="string", example="이경호"),
|
|
|
|
|
* @OA\Property(property="mc_phone", type="string", example="01083935130"),
|
|
|
|
|
* @OA\Property(property="mc_mail", type="string", example="kd5130@naver.com"),
|
|
|
|
|
* @OA\Property(property="mc_addr", type="string", example="경기도 김포시 통진읍 옹정로 45-22"),
|
|
|
|
|
* @OA\Property(property="use_yn", type="string", example="Y"),
|
|
|
|
|
* @OA\Property(property="reg_date", type="string", example="2025-07-08 14:25:16")
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response=401,
|
|
|
|
|
* description="인증 실패 (헤더 누락, 유효하지 않은 토큰/키 등)"
|
|
|
|
|
* )
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
public function me(Request $request)
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(function () use ($request) {
|
|
|
|
|
return MemberService::getMyInfo($request);
|
|
|
|
|
}, '나의 정보 조회 성공', '나의 정보 조회 실패');
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-17 10:05:47 +09:00
|
|
|
/**
|
|
|
|
|
* Show the form for editing the specified resource.
|
|
|
|
|
*/
|
|
|
|
|
public function edit(string $id)
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update the specified resource in storage.
|
|
|
|
|
*/
|
|
|
|
|
public function update(Request $request, string $id)
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Remove the specified resource from storage.
|
|
|
|
|
*/
|
|
|
|
|
public function delAdmin($userNo, Request $request)
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(function () use ($userNo, $request) {
|
|
|
|
|
return MemberService::delAdmin($userNo);
|
|
|
|
|
}, '관리자 제외 성공', '관리자 제외 실패');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 관리자 설정
|
|
|
|
|
*/
|
|
|
|
|
public function setAdmin($userNo, Request $request)
|
|
|
|
|
{
|
|
|
|
|
return ApiResponse::handle(function () use ($userNo, $request) {
|
|
|
|
|
return MemberService::setAdmin($userNo);
|
|
|
|
|
}, '관리자 설정 성공', '관리자 설정 실패');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|