* @version : HUOSDK 7.2 */ namespace api\promotion\controller\v8; use Think\Config; use think\Controller; use think\Db; use Think\Log; use think\exception\HttpResponseException; use think\Response; use think\Session; class BaseController extends Controller { function _initialize() { parent::_initialize(); } public static function hs_api_responce($code = 200, $msg = '', $data = array(), $type = "json") { if (empty($data)) { $data = null; } $rdata = array( 'code' => $code, 'msg' => $msg, 'data' => $data ); $response = Response::create($rdata, $type)->code(200); if ($code >= 300) { throw new HttpResponseException($response); } else { return $response; } } }