AdminCountry.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace backendApi\modules\v1\models;
  3. use common\components\ActiveRecord;
  4. /**
  5. * This is the model class for table "{{%ADMIN_COUNTRY}}".
  6. *
  7. * @property string $ID
  8. * @property string $ADMIN_ID 管理ID
  9. * @property string $COUNTRY_ID 国家ID
  10. */
  11. class AdminCountry extends ActiveRecord
  12. {
  13. /**
  14. * @inheritdoc
  15. */
  16. public static function tableName()
  17. {
  18. return '{{%ADMIN_COUNTRY}}';
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function rules()
  24. {
  25. return [
  26. [['ADMIN_ID', 'COUNTRY_ID',], 'required'],
  27. [['ID', 'COUNTRY_ID'], 'string', 'max' => 32],
  28. [['ID'], 'unique'],
  29. ];
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function attributeLabels()
  35. {
  36. return [
  37. 'ID' => 'ID',
  38. 'ADMIN_ID' => '管理ID',
  39. 'COUNTRY_ID' => '国家ID',
  40. ];
  41. }
  42. /**
  43. * @param $adminId
  44. * @return array
  45. */
  46. public static function getCountry($adminId): array
  47. {
  48. return self::find()->select('COUNTRY_ID')->where(['ADMIN_ID' => $adminId])->column();
  49. }
  50. }