全局:
/**
* @OA\SecurityScheme(type="http",securityScheme="Authorization-Bearer",name="Authorization",in="header",scheme="Bearer",bearerFormat="JWT"),
* @OA\Info(
* title="接口文档",
* version="1.0",
* description="部门管理接口",
* ),
* @OA\Server(
* url="http://erp-dev.basissource.com"
* )
* Class CommonController
* @package app\controller
*/
//类的注释
/** * @OA\Info(title="My API", version="0.1") * @OA\Schemes(format="http") * @OA\SecurityScheme( * securityScheme="bearerAuth", * in="header", * name="Authorization", * type="http", * scheme="Bearer", * bearerFormat="JWT", * ), * @OA\Tag( * name="Auth", * description="Auth endpoints", * ) * @OA\Tag( * name="Users", * description="Users endpoints", * ) */ class Controller extends BaseController
//方法的注释
/** * * @OA\Get( * path="/users", * operationId="getListOfUsers", * tags={"Users"}, * description="Get list of users", * security={{"bearerAuth":{}}}, * @OA\Parameter( * name="Authorization", * in="header", * required=true, * description="Bearer {access-token}", * @OA\Schema( * type="bearerAuth" * ) * ), * @OA\Response( * response=200, * description="Get list of users.", * @OA\JsonContent(type="object", * @OA\Property(property="message", type="string"), * @OA\Property(property="data", type="array", * @OA\Items(type="object", * @OA\Property(property="id", type="integer"), * @OA\Property(property="name", type="string"), * @OA\Property(property="email", type="string"), * ), * ), * ), * ), * @OA\Response(response=401, description="Unauthorized"), * @OA\Response(response=404, description="Not Found"), * ) * * @return JsonResponse */ public function users()
//关于使用数组格式示例:
/**
* @OA\Post(
* tags={"订单"},
* description="制单操作",
* summary="制单操作",
* security={{"Authorization-Bearer"={}}},
* path="/order/make/create",
* @OA\Parameter(name="order_id",in="query",@OA\Schema(type="integer"),required=true,description="申请单ID",example="1"),
* @OA\RequestBody(required=true,description="商品备注",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(
* property="remark",
* type="array",
* @OA\Items(type="string",example ="'aaa','bbbb','cccc',1")
* )
* )
* )
* ),
* @OA\Response(
* response=200,
* description="",
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* example={}
* )
* )
* )
* )
*/
/** * @OA\Post( * tags={"返款"}, * description="返劳务款操作", * summary="返劳务款操作", * security={{"Authorization-Bearer"={}}}, * path="/refund/apply/work", * @OA\RequestBody(required=true,description="返劳务款操作参数", * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * @OA\Property(property="order_id",type="integer",description="申请单ID",example=195), * @OA\Property( * property="work_list", * type="array", * @OA\Items( * @OA\Property(property="2",type="object", * @OA\Property(property="worker_id",type="integer",description="劳务人员ID",example="2"), * @OA\Property(property="rebate_amount",type="integer",description="本次抵扣金额",example="55"), * @OA\Property(property="bank",type="string",description="开户行",example="齐鲁银行"), * @OA\Property(property="bank_card",type="string",description="开户行卡号",example="2222666665544"), * @OA\Property(property="mobile",type="string",description="联系电话",example="18611111111"), * @OA\Property(property="approve_content",type="string",description="审批内容",example="同意"), * ) * ), * ) * ) * ) * ), * @OA\Response( * response=200, * description="", * @OA\MediaType( * mediaType="application/json", * @OA\Schema( * example={} * ) * ) * ) * ) */