City.php 650 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * 城市编码读取
  4. **/
  5. namespace app\ais\event;
  6. use app\ais\model\AisCity;
  7. use think\facade\Request;
  8. use think\Validate;
  9. class City{
  10. /**
  11. * 查看城市编码
  12. * @param integer $id 用户ID
  13. */
  14. public static function read(){
  15. $province = Request::param('province/s');
  16. $city = Request::param('city/s');
  17. $district = Request::param('district/s');
  18. if(empty($province) || empty($city) || empty($district)){
  19. return;
  20. }
  21. $city = AisCity::where(['code' => $district])->field('code')->find();
  22. if ($city){
  23. return $city->code;
  24. }
  25. }
  26. }