UserRn.php 796 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/3/3
  6. * Time: 下午2:25
  7. */
  8. namespace common\models;
  9. //use yii\db\ActiveRecord;
  10. class UserRn extends Common
  11. {
  12. public function rules()
  13. {
  14. return [
  15. [['rid','nid','type'],'required','message'=>'请输入完整的信息'],
  16. ['type','in','range'=>[1,2]],
  17. ];
  18. }
  19. public function FindId()
  20. {
  21. return self::find()->andFilterWhere(['rid'=>$this->rid])
  22. ->andFilterWhere(['type'=>$this->type])
  23. ->one();
  24. }
  25. public function FindRid()
  26. {
  27. return self::find()->andWhere(['rid'=>$this->rid,'type'=>$this->type])->asArray()->all();
  28. }
  29. }