St_area.php 588 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Sports\Model;
  3. use \System\Model;
  4. /**
  5. * Class St_country
  6. * @package App\Sports\Model
  7. * 地区 洲
  8. */
  9. class St_area extends Model
  10. {
  11. protected $table = 'st_area';
  12. //根据地区id获取地区名称
  13. public static function getName($areaId = ''){
  14. $where = [];
  15. //拼装查询条件
  16. if(!empty($areaId)){
  17. $where = [
  18. ['id','=',$areaId]
  19. ];
  20. }
  21. $name = self::select('id','title')
  22. ->where($where)
  23. ->get()
  24. ->toArray();
  25. return $name;
  26. }
  27. }