You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/common/models/SysIpT.php

69 lines
1.2 KiB

5 years ago
<?php
namespace common\models;
use Yii;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "sys_ip_t".
*
* @property integer $id
* @property string $ip
* @property string $city_name
*/
class SysIpT extends \common\models\Base
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'sys_ip_t';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['ip', 'city_name'], 'string', 'max' => 200],
[['city_name'], 'required','message'=>'城市名称不能为空'],
[['city_name'], 'unique','message'=>'城市不能重复'],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'ip' => 'Ip',
'city_name' => '城市名称',
];
}
/**
* 返回ip数组
* 返回ip数组
* @param 参数
* @return 返回类型
* @author liukangle
*
*/
static public function getIpArray(){
$list = self::find()
->where('status = 1')
->orderBy('id ASC')
->all();
$array = ArrayHelper::getColumn($list,'ip');
return $array;
}
}