|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
-
- namespace common\models;
-
- use Yii;
- use yii\helpers\ArrayHelper;
-
- /**
- * This is the model class for table "base_area_view".
- *
- * @property integer $AREA_ID
- * @property string $AREA_NAME
- * @property integer $TOP_AREA_ID
- * @property integer $PARENT_AREA_ID
- * @property string $PARENT_AREA_ID_LIST
- * @property string $PARENT_AREA_NAME_LIST
- * @property string $TOP_AREA_NAME
- * @property string $PARENT_AREA_NAME
- * @property string $CREATE_TIME
- * @property integer $AREA_LEVEL
- */
- class BaseAreaView extends \common\models\zModel
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'base_area_view';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['AREA_ID'], 'required'],
- [['AREA_ID', 'TOP_AREA_ID', 'PARENT_AREA_ID', 'AREA_LEVEL'], 'integer'],
- [['AREA_NAME', 'TOP_AREA_NAME', 'PARENT_AREA_NAME'], 'string', 'max' => 100],
- [['PARENT_AREA_ID_LIST', 'PARENT_AREA_NAME_LIST'], 'string', 'max' => 2000],
- [['CREATE_TIME'], 'string', 'max' => 20],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'AREA_ID' => 'Area ID',
- 'AREA_NAME' => 'Area Name',
- 'TOP_AREA_ID' => '所属顶级地区ID,BASE_AREA.ID',
- 'PARENT_AREA_ID' => '直属父地区ID,BASE_AREA_ID',
- 'PARENT_AREA_ID_LIST' => '所属父系地区ID序列,算法中使用',
- 'PARENT_AREA_NAME_LIST' => '所属父系地区名称序列',
- 'TOP_AREA_NAME' => '所属顶级地区名称',
- 'PARENT_AREA_NAME' => '直属父地区名称',
- 'CREATE_TIME' => '订单创建时间,订单创建日期距2016-01-01的天数,算法用',
- 'AREA_LEVEL' => '本地区的层级,顶级地区的层级为1,其次递增',
- ];
- }
-
- /**
- * User: wangxj
- *
- * 获取所有省份列表
- *
- */
- public static function getProvince()
- {
- $res = self::find()->where(['AREA_LEVEL'=> 1])->orderBy('CONVERT( `AREA_NAME` USING gbk ) COLLATE gbk_chinese_ci')->all();
- return ArrayHelper::map($res, 'AREA_ID', 'AREA_NAME');
- }
- }
|