更新拼音
This commit is contained in:
parent
20c959aa98
commit
6d387471fc
@ -42,6 +42,7 @@ use crmeb\services\WechatService;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Joypack\Tencent\Map\Bundle\Location;
|
use Joypack\Tencent\Map\Bundle\Location;
|
||||||
use Joypack\Tencent\Map\Bundle\LocationOption;
|
use Joypack\Tencent\Map\Bundle\LocationOption;
|
||||||
|
use Overtrue\Pinyin\Pinyin;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
use think\facade\Cache;
|
use think\facade\Cache;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@ -485,7 +486,20 @@ class Common extends BaseController
|
|||||||
//街道 乡镇数据
|
//街道 乡镇数据
|
||||||
public function get_street($area_code){
|
public function get_street($area_code){
|
||||||
$select=Db::name('geo_street')->where('area_code',$area_code)->field('street_id id,street_code code,street_name name')->select();
|
$select=Db::name('geo_street')->where('area_code',$area_code)->field('street_id id,street_code code,street_name name')->select();
|
||||||
return app('json')->success($select);
|
$arr=$select?$select->toArray():[];
|
||||||
|
foreach ($arr as $k=>$item){
|
||||||
|
$first_char = mb_str_split($item['name']);
|
||||||
|
if($first_char[0]){
|
||||||
|
$pinyin=new Pinyin();
|
||||||
|
$string=$first_char[0];
|
||||||
|
$pinyin = $pinyin->abbr($string);
|
||||||
|
$arr[$k]['pinyin']=$pinyin;
|
||||||
|
}else{
|
||||||
|
$arr[$k]['pinyin']='';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return app('json')->success($arr);
|
||||||
}
|
}
|
||||||
//村数据
|
//村数据
|
||||||
public function get_village($street_code){
|
public function get_village($street_code){
|
||||||
|
32
app/controller/api/Demo.php
Normal file
32
app/controller/api/Demo.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
namespace app\controller\api;
|
||||||
|
|
||||||
|
|
||||||
|
use crmeb\basic\BaseController;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Auth
|
||||||
|
* @package app\controller\api
|
||||||
|
* @author xaboy
|
||||||
|
* @day 2020-05-06
|
||||||
|
*/
|
||||||
|
class Demo extends BaseController
|
||||||
|
{
|
||||||
|
public function index(){
|
||||||
|
halt(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -21,6 +21,7 @@ use think\facade\Route;
|
|||||||
|
|
||||||
Route::group('api/', function () {
|
Route::group('api/', function () {
|
||||||
Route::any('test', 'api.Auth/test');
|
Route::any('test', 'api.Auth/test');
|
||||||
|
Route::any('demo_ceshi', 'api.Demo/index');
|
||||||
Route::any('dotest', 'api.Auth/dotest');
|
Route::any('dotest', 'api.Auth/dotest');
|
||||||
Route::any('caiji', 'api.Auth/caiji');
|
Route::any('caiji', 'api.Auth/caiji');
|
||||||
Route::any('parse/token', 'api.Auth/parseToken');
|
Route::any('parse/token', 'api.Auth/parseToken');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user