LottoRecord.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace frontend\models;
  3. use Yii;
  4. use common\helpers\Utils;
  5. /**
  6. * This is the model class for table "bit_lotto_record".
  7. *
  8. * @property integer $id
  9. * @property string $mobile
  10. * @property string $lottery
  11. * @property string $activity_type
  12. * @property integer $in_time
  13. */
  14. class LottoRecord extends \yii\db\ActiveRecord
  15. {
  16. /**
  17. * @inheritdoc
  18. */
  19. public static function tableName()
  20. {
  21. return 'bit_lotto_record';
  22. }
  23. /**
  24. * @inheritdoc
  25. */
  26. public function rules()
  27. {
  28. return [
  29. [['in_time'], 'safe'],
  30. [['mobile', 'lottery', 'activity_type'], 'required'],
  31. ['mobile', function ($attribute, $params) {
  32. if (!Utils::checkPhoneNumber($this->$attribute)) {
  33. $this->addError($attribute, '手机号码不正确');
  34. }
  35. }],
  36. ];
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'mobile' => '手机号码',
  46. 'lottery' => '中奖情况',
  47. 'activity_type' => '活动类型',
  48. 'in_time' => '创建时间',
  49. ];
  50. }
  51. }