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.
32 lines
624 B
32 lines
624 B
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use think\Controller;
|
|
|
|
class Base extends Controller
|
|
{
|
|
protected $ERROR_CODE = 0;
|
|
protected $SUCCESS_CODE = 1;
|
|
|
|
protected function jsonError($msg = '失败',$data = [])
|
|
{
|
|
$arr = [
|
|
'code' => $this->ERROR_CODE,
|
|
'msg' => $msg,
|
|
'data' => $data
|
|
];
|
|
return json_encode($arr);
|
|
}
|
|
|
|
public function jsonSuccess($msg = '成功',$data = [])
|
|
{
|
|
$arr = [
|
|
'code' => $this->SUCCESS_CODE,
|
|
'msg' => $msg,
|
|
'data' => $data
|
|
];
|
|
return json_encode($arr);
|
|
}
|
|
|
|
}
|