common.php 421 B

1234567891011121314151617181920
  1. <?php
  2. // 应用公共文件
  3. /**
  4. * 通用化API数据格式输出
  5. * @param $status
  6. * @param string $message
  7. * @param array $data
  8. * @param int $httpStatus
  9. * @return \think\response\Json
  10. */
  11. function show($status, $message = 'error', $data = [], $httpStatus = 200)
  12. {
  13. $result = [
  14. "status" => $status,
  15. "message" => $message,
  16. "result" => $data,
  17. ];
  18. return json($result, $httpStatus);
  19. }