初始化项目
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: 萤火科技 <admin@yiovo.com>
|
||||
// +----------------------------------------------------------------------
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\model\Company as CompanyModel;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
use app\common\service\SybOil;
|
||||
|
||||
/**
|
||||
* 站点列表
|
||||
* Class Station
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class Station extends Controller
|
||||
{
|
||||
/**
|
||||
* 余额账单明细列表
|
||||
* @return Json
|
||||
* @throws \cores\exception\BaseException
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function list(): Json
|
||||
{
|
||||
$SybOil = new SybOil();
|
||||
$company = CompanyModel::detail('2');
|
||||
$param = $this->request->param();
|
||||
$province = Db::name('area')->where(array(
|
||||
['name', '=', $param['province']],
|
||||
['level', '=', 1],
|
||||
))->find();
|
||||
$city = Db::name('area')->where(array(
|
||||
['name', '=', $param['city']],
|
||||
['pid', '=', $province['code']],
|
||||
['level', '=', 2],
|
||||
))->find();
|
||||
$goods = Db::name('goods')->where(array(
|
||||
['oilCardType', '=', 'zsy_ticket'],
|
||||
['province', '=', $param['province']],
|
||||
['status', '=', 10],
|
||||
))->order('stock_total', 'desc')
|
||||
->find();
|
||||
$list = [];
|
||||
if($goods) {
|
||||
// 对接平台接口
|
||||
$res = $SybOil->baseGasStationList(['goodsNo' => $goods['goods_no'], 'longitude' => $param['longitude'], 'latitude' => $param['latitude'], 'province' => $province['code'], 'city' => $city['code']], $company);
|
||||
if (isset($res['data']['zsyResp']['count']) && $res['data']['zsyResp']['count'] > 0) {
|
||||
$lists = $res['data']['zsyResp']['lists'];
|
||||
foreach ($lists as $k => $array) {
|
||||
$list[] = [
|
||||
'id' => $k + 1,
|
||||
'name' => $array['name'],
|
||||
'brand' => $array['brand'] == 1 ? '中国石油' : '中国BP',
|
||||
'latitude' => $array['lat'],
|
||||
'longitude' => $array['lng'],
|
||||
'address' => '',
|
||||
'distance' => $array['nearBy'],
|
||||
'width' => 30,
|
||||
'height' => 30,
|
||||
'iconPath' => '/static/marker.png',
|
||||
'stationCode' => $array['stationCode'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->renderSuccess(compact('list'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user