12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- /**
- * Created by PhpStorm.
- * User: xiaofeng
- * Date: 2018/5/21
- * Time: 下午5:18
- */
- namespace common\models;
- class PushFreshimg extends Common
- {
- public function rules()
- {
- return [
- ['url', 'url', 'defaultScheme' => 'http','message'=>'请输入正确的地址'],
- ];
- }
- public function attributeLabels()
- {
- return [
- 'url'=>'地址',
- ];
- }
- 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 getList($input)
- {
- $query = self::find();
- $query->select(['url','id','img','create_at','is_show']);
- $query->andWhere(['del'=>$this->setDel]);
- if(!empty($input['page']))
- {
- $query->limit = $input['limit'];
- $query->offset = ($input['page']-1 )* $input['limit'];
- }
- return $query->orderBy(['create_at'=>SORT_DESC])->asArray()->all();
- }
- public function WhereColumn($query)
- {
- }
- public function Total()
- {
- $query = self::find();
- $query->andWhere(['del'=>$this->setDel]);
- return $query->count();
- }
- public function Oneinfo()
- {
- $query = self::find();
- $query->select(['img','url']);
- $query->andWhere(['del'=>$this->setDel]);
- $query->andWhere(['is_show'=>1]);
- $query->limit = 1;
- return $query->asArray()->one();
- }
- }
|