Files
p_ysk/app/common/controller/ApiController.php
2025-12-03 09:21:34 +08:00

29 lines
646 B
PHP

<?php
namespace app\common\controller;
use app\exception\MyBusinessException;
use extend\chat\model\Base;
use support\exception\BusinessException;
class ApiController
{
public $uid;
public $user_type;
public function __construct()
{
$user_info = Base::getUser(request()->header('token'));
$this->uid = $user_info['uid'];
$this->user_type = $user_info['user_type'];
}
public function success($data = [])
{
return json(['code' => 1, 'msg' => 'success', 'data' => $data]);
}
public function error($msg = 'fail')
{
return json(['code' => 0, 'msg' => $msg]);
}
}