12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/3/4
- * Time: 上午9:34
- */
- namespace common\models;
- use Yii;
- class NewsIprecord extends Common
- {
- public function rules()
- {
- return [
- // [['ip','nid','region','city','','','',]],
- // ['phone_sales', 'string','max'=>'15'],
- // ['main_units','string','max'=>80],
- // ['longitude_latitude','string','max'=>50],
- // ['info','string'],
- // [['open_time','launch_time'],'string', 'max'=>50],
- //
- // [['address','sales_address','land_agent'],'string','max'=>100],
- // ['house_cx','string','max'=>50],
- ];
- }
- public function Authenticator($input)
- {
- $this->load($input,'');
- if(!$this->validate()) return $this->errors;
- return $this;
- }
- public function FindById($id)
- {
- return self::findOne($id);
- }
- public function FindByIp()
- {
- $query = self::find();
- $query->andWhere(['ip'=>$this->ip]);
- $query->andWhere(['nid'=>$this->nid]);
- return $query->one();
- }
- }
|