cxgj/modules/api/controllers/MapController.php
2023-11-27 09:45:13 +08:00

70 lines
3.1 KiB
PHP

<?php
/**
* @author Any
* @description KISS
* @date 2021年6月30日
* @version 1.0.0
*
* _____LOG_____
*
*/
namespace app\modules\api\controllers;
use app\modules\api\behaviors\LoginBehavior;
use app\modules\api\models\BallCartForm;
use app\modules\api\models\MapForm;
class MapController extends Controller
{
public function behaviors() {
return array_merge(parent::behaviors(),[
'login' => [
'class' => LoginBehavior::className(),
'ignore' => [
'api/map/index',
'api/map/ball',
]
]
]);
}
/**
* showdoc
* @catalog 门店
* @title 地图门店区域经纬度
* @description 提供地图组件门店区域经纬度
* @method get
* @url /api/map/index
* @return {"code":0,"msg":"ok","data":{"areas":[[{"lat":24.50636204232464,"lng":118.13841913657495,"height":0},{"lat":24.506674067111746,"lng":118.15007832590607,"height":0},{"lat":24.492944218757817,"lng":118.15007832590607,"height":0},{"lat":24.492944218757817,"lng":118.1370474682434,"height":0},{"lat":24.50636204232464,"lng":118.1391049700859,"height":0}],[{"lat":24.501278511521654,"lng":118.10341999000025,"height":0},{"lat":24.498315213008215,"lng":118.1044265457997,"height":0},{"lat":24.500712796325505,"lng":118.10717977288789,"height":0},{"lat":24.502356057412566,"lng":118.10522587079959,"height":0},{"lat":24.501332389117852,"lng":118.10350880358772,"height":0},{"lat":24.501278511521654,"lng":118.10344959407723,"height":0},{"lat":24.501253141165428,"lng":118.1034463124256,"height":0},{"lat":24.501240464715558,"lng":118.10343238154326,"height":0}]],"dots":[{"title":"富赛体育高尔夫厦门思明店","lat":24.50636204232464,"lng":118.14294566814839},{"title":"富赛体育高尔夫厦门湖里店","lat":24.501278511521654,"lng":118.1042611599737}]}}
* @remark
*/
public function actionIndex()
{
$form = new MapForm();
$form->attributes = \Yii::$app->request->get();
$data = $form->index();
return $this->responseHandler($data);
}
/**
* showdoc
* @catalog 门店
* @title 地图球车经纬度坐标
* @description 提供地图组件地图球车经纬度
* @method get
* @url /api/map/ball
* @return {"code":0,"msg":"ok","data":[{"id":"0300","title":"0300","latitude":"24.468126","longitude":"118.166156"},{"id":"0200","title":"0200","latitude":"24.479394","longitude":"118.17355"},{"id":"0201","title":"0201","latitude":"24.508341","longitude":"118.115605"},{"id":"11111","title":"11111","latitude":"24.470787","longitude":"118.109243"}]}
* @remark
*/
public function actionBall()
{
$form = new MapForm();
$form->attributes = \Yii::$app->request->get();
$form->user_type = \Yii::$app->user->identity->type ? \Yii::$app->user->identity->type : 0;
$form->user_id = \Yii::$app->user->identity->id ? \Yii::$app->user->identity->id : 0;
$data = $form->ball();
return $this->responseHandler($data);
}
}