支付宝记账本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
604 B

5 months ago
  1. <?php
  2. use Illuminate\Http\JsonResponse;
  3. function success(array $data, ?string $sign = null, string $msg = 'SUCCESS'): JsonResponse
  4. {
  5. return response()->json(
  6. [
  7. 'code' => 0,
  8. 'msg' => $msg,
  9. 'data' => $data,
  10. 'sign' => $sign
  11. ],
  12. options: JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
  13. );
  14. }
  15. function error(string $msg = 'ERROR'): JsonResponse
  16. {
  17. return response()->json(
  18. [
  19. 'code' => 9999,
  20. 'msg' => $msg,
  21. ],
  22. options: JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
  23. );
  24. }