12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace common\models;
- use yii\db\ActiveRecord;
- use yii\behaviors\TimestampBehavior;
- class CategoryTel extends ActiveRecord
- {
- public $setDel = 1;
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::className(),
- 'attributes' => [
-
- ActiveRecord::EVENT_BEFORE_INSERT => ['create_at', 'update_at'],
-
- ActiveRecord::EVENT_BEFORE_UPDATE => ['update_at']
- ],
-
- 'value' => $_SERVER['REQUEST_TIME']
- ]
- ];
- }
- public function rules()
- {
- return [
- [['tel','name'],'required','message'=>'{attribute}不能为空'],
- ['del','in','range'=>[1,2]],
- ];
- }
- public function attributeLabels()
- {
- return [
- 'tel'=>'电话集合',
- 'name'=>'方案名称',
- ];
- }
- public function getList()
- {
- $query = self::find();
- $query->andWhere(['del'=>$this->setDel]);
- $query->orderBy(['create_at'=>SORT_DESC]);
- $query->asArray();
- return $query->all();
- }
- public function CitySchemeTouch()
- {
- $query = CategoryCity::find();
- }
-
- public function Authenticator($input)
- {
- $this->load($input,'');
- if(!$this->validate()) return $this->errors;
- return $this;
- }
- public function FindById($id)
- {
- return self::findOne($id);
- }
- }
|