<?php
/**
* 城市编码读取
**/
namespace app\ais\event;
use app\ais\model\AisCity;
use think\facade\Request;
use think\Validate;

class City{

    /**
     * 查看城市编码
     * @param integer $id 用户ID
     */
    public static function read(){
        $province = Request::param('province/s');
        $city     = Request::param('city/s');
        $district = Request::param('district/s');
        if(empty($province) || empty($city) || empty($district)){
            return;
        }
        $city = AisCity::where(['code' => $district])->field('code')->find();
        if ($city){
            return $city->code;
        }  
    }
}