<?php

namespace App\Utils;

class ApiResponse
{
    public static function success($code = 200, $data = [], $message = '操作成功')
    {
        return json([
            'status' => 'success',
            'code' => $code,
            'data' => $data,
            'message' => $message
        ]);
    }

    public static function error($code = 400, $data = [], $message = '操作失败')
    {
        return json([
            'status' => 'error',
            'code' => $code,
            'message' => $message,
            'data' => $data
        ]);
    }
}
