ExpressModel.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace addons\QiJuhe\common\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%addons_qijuhe_express}}".
  6. *
  7. * @property int $id
  8. * @property int $express_id
  9. * @property int $type
  10. * @property string $name
  11. * @property string $code
  12. */
  13. class ExpressModel extends \yii\db\ActiveRecord
  14. {
  15. /**
  16. * {@inheritdoc}
  17. */
  18. public static function tableName()
  19. {
  20. return '{{%addons_qijuhe_express}}';
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function rules()
  26. {
  27. return [
  28. [['express_id', 'name', 'code'], 'required'],
  29. [['express_id', 'type'], 'integer'],
  30. [['name', 'code'], 'string', 'max' => 64],
  31. ];
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function attributeLabels()
  37. {
  38. return [
  39. 'id' => 'ID',
  40. 'express_id' => 'Express ID',
  41. 'name' => 'Name',
  42. 'code' => 'Code',
  43. ];
  44. }
  45. /**
  46. * 获取快递ID
  47. *
  48. * @param string $code
  49. * @return self
  50. */
  51. public static function getExpress($code)
  52. {
  53. return self::find()->where(['code' => $code])->one();
  54. }
  55. }