St_country.php 624 B

1234567891011121314151617181920212223242526272829303132
  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_country extends Model
  10. {
  11. protected $table = 'st_country';
  12. //根据国家id 获取国家名称
  13. public static function getName($countryId = ''){
  14. $where = [];
  15. //拼装查询条件
  16. if(!empty($countryId)){
  17. $where = [
  18. ['country_id','=',$countryId]
  19. ];
  20. }
  21. $name = self::select('country_id','name_chinese')
  22. ->where($where)
  23. ->get()
  24. ->toArray();
  25. return $name;
  26. }
  27. }