117 lines
3.4 KiB
PHP
117 lines
3.4 KiB
PHP
<?php
|
||
|
||
namespace app\models;
|
||
|
||
use Yii;
|
||
|
||
/**
|
||
* This is the model class for table "{{%store}}".
|
||
*
|
||
* @property int $id
|
||
* @property string $name 门店名称
|
||
* @property string $province 省
|
||
* @property int $province_id 省ID
|
||
* @property string $city 市
|
||
* @property int $city_id 市ID
|
||
* @property string $region 区
|
||
* @property int $region_id 区ID
|
||
* @property string $location_detail 门店具体位置
|
||
* @property string|null $content 门店内容
|
||
* @property string $lat 纬度
|
||
* @property string $lng 经度
|
||
* @property int $begin_time 营业开始时间
|
||
* @property int $end_time 营业结束时间
|
||
* @property int $status 1-营业 0-停业
|
||
* @property string $sort 排序
|
||
* @property int $created_at 添加时间
|
||
* @property int|null $updated_at 修改时间
|
||
* @property int $is_delete 是否删除,0=否,1=是
|
||
* @property int $deleted_at 删除时间
|
||
* @property int $user_id 用户id
|
||
* @property string $pic_urls 轮播图
|
||
* @property int|null $ratio 收益比例
|
||
* @property int $card_id 银行卡
|
||
* @property string $content_page 店长公告
|
||
*/
|
||
class Store extends \yii\db\ActiveRecord
|
||
{
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public static function tableName()
|
||
{
|
||
return '{{%store}}';
|
||
}
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function rules()
|
||
{
|
||
return [
|
||
[['name', 'province', 'province_id', 'city', 'city_id', 'region', 'region_id', 'location_detail', 'lat', 'lng', 'begin_time', 'end_time'], 'required'],
|
||
[['province_id', 'city_id', 'region_id', 'status', 'created_at', 'updated_at', 'is_delete', 'deleted_at', 'user_id', 'ratio'], 'integer'],
|
||
[['content', 'pic_urls', 'content_page', 'sn'], 'string'],
|
||
[['name', 'sort'], 'string', 'max' => 50],
|
||
[['province', 'city', 'region', 'begin_time', 'end_time'], 'string', 'max' => 20],
|
||
[['location_detail'], 'string', 'max' => 255],
|
||
[['lat', 'lng'], 'string', 'max' => 32],
|
||
];
|
||
}
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function attributeLabels()
|
||
{
|
||
return [
|
||
'id' => 'ID',
|
||
'name' => '门店名称',
|
||
'province' => '省',
|
||
'province_id' => '省ID',
|
||
'city' => '市',
|
||
'city_id' => '市ID',
|
||
'region' => '区',
|
||
'region_id' => '区ID',
|
||
'location_detail' => '门店具体位置',
|
||
'content' => '门店内容',
|
||
'lat' => '纬度',
|
||
'lng' => '经度',
|
||
'begin_time' => '营业开始时间',
|
||
'end_time' => '营业结束时间',
|
||
'status' => '1-营业 0-停业',
|
||
'sort' => '排序',
|
||
'created_at' => '添加时间',
|
||
'updated_at' => '修改时间',
|
||
'is_delete' => '是否删除,0=否,1=是',
|
||
'deleted_at' => '删除时间',
|
||
'user_id' => '用户id',
|
||
'pic_urls' => '轮播图',
|
||
'ratio' => '收益比例',
|
||
'card_id' => '银行卡',
|
||
];
|
||
}
|
||
|
||
public static function statusLabels()
|
||
{
|
||
return [
|
||
'0' => '停业',
|
||
'1' => '营业',
|
||
];
|
||
}
|
||
|
||
public function getUser()
|
||
{
|
||
return $this->hasOne(User::className(), ['id' => 'user_id'])->where(['is_delete' => 0]);
|
||
}
|
||
|
||
public static function statusLabels1()
|
||
{
|
||
return [
|
||
'0' => '待审核',
|
||
'1' => '通过',
|
||
'2' => '拒绝',
|
||
];
|
||
}
|
||
}
|