<?php
namespace App\Utils;

/**
 * app页面返回api
 * 推断1是成功
 */
class ApiResponseApp
{
    public static function success($data = [], $message = '请求成功')
    {
        $code = 1;
        return json([
            'code' => $code,
            'data' => $data,
            'msg' => $message,
            'time' => time()
        ]);
    }

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