1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /**
- * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
- * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
- * @author pillar<ltmn@qq.com>
- * 小程序公共API服务
- */
- namespace app\ais\controller\api;
- use app\common\controller\Api;
- use app\ais\model\AisStore;
- use app\ais\model\AisCity;
- use think\facade\Request;
- class Base extends Api{
- protected $header;
- protected $lbs;
- protected $citycode;
- /**
- * 初始化API并读取城市或你的经纬度
- * @return void
- */
- public function initialize() {
- parent::initialize();
- $header_lbs = Request::header('request-lbs');
- if(!empty($header_lbs)){
- $lbs = explode('/',$header_lbs);
- $location = new \stdClass();
- $location->lng = $lbs[0] ?: 0;
- $location->lat = $lbs[1] ?: 0;
- $this->lbs = $location;
- }
- }
- }
|