luckycmc / webman-province-city-area
Webman plugin luckycmc/webman-province-city-area
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/luckycmc/webman-province-city-area
Requires
- php: ^7.0 || ^8.0
- guzzlehttp/guzzle: ~7.0
- guzzlehttp/psr7: ~2.0
- illuminate/container: ^12.47
- webman/cache: ^2.1
- webman/redis: ^2.1
- x2nx/webman-migrate: ^0.0.8
README
致谢
本项目基于https://github.com/9yearfish/laravel-province-city-area 修改,非常感谢原作者的贡献
安装
composer require luckycmc/webman-province-city-area
使用
执行数据库迁移
php webman migrate
获取数据
php webman pca:refreshData file|jd
清空数据
php webman pca:clearData
Demo
<?php namespace app\controller; use Luckycmc\WebmanProvinceCityArea\Facades\ProvinceCityArea; class IndexController { public function getProvinceList() { return json(ProvinceCityArea::getProvinceList()); } public function getProvince() { return json(ProvinceCityArea::getProvinceList()); } public function getCity($provinceId) { if (empty($provinceId)) { return ->json([]); } return json(ProvinceCityArea::getCityList($provinceId)); } public function getArea($cityId) { if (empty($cityId)) { return json([]); } return json(ProvinceCityArea::getAreaList($cityId)); } public function getAllProvince() { return json(ProvinceCityArea::getAllProvince()); } public function getAllCity() { return json(ProvinceCityArea::getAllCity()); } public function getAllArea() { return json(ProvinceCityArea::getAllArea()); } public function getAllStreet() { return json(ProvinceCityArea::getAllStreet()); } }