1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * BaseController.php UTF-8
- * 百度信息流对接
- *
- * @date : 2018/7/6 11:46
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : ouzhongfu <ozf@huosdk.com>
- * @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;
- }
- }
- }
|