| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use Yii;
- use yii\behaviors\TimestampBehavior;
- /**
- * This is the model class for table "{{%mch}}".
- *
- * @property string $id
- * @property integer $store_id
- * @property integer $user_id
- * @property integer $is_delete
- * @property integer $is_open
- * @property integer $is_recommend
- * @property integer $is_lock
- * @property string $realname
- * @property string $tel
- * @property string $name
- * @property integer $province_id
- * @property integer $city_id
- * @property integer $district_id
- * @property string $address
- * @property integer $mch_common_cat_id
- * @property string $service_tel
- * @property string $logo
- * @property string $header_bg
- * @property integer $transfer_rate
- * @property string $account_money
- * @property integer $sort
- * @property integer $wechat_name
- * @property string $longitude
- * @property string $latitude
- * @property string $main_content
- * @property string $summary
- * @property string $business
- * @property string $card_front
- * @property string $card_obverse
- * @property string $business_hours
- * @property string $created_at
- * @property string $updated_at
- */
- class Mch extends \yii\db\ActiveRecord
- {
- /**
- * 商户店铺状态:开启
- */
- const IS_OPEN_TRUE = 1;
- /**
- * 商户店铺状态:关闭
- */
- const IS_OPEN_FALSE = 0;
- /**
- * 好店推荐:推荐
- */
- const IS_RECOMMEND_TRUE = 1;
- /**
- * 好店推荐:不推荐
- */
- const IS_RECOMMEND_FALSE = 0;
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%mch}}';
- }
- public function behaviors()
- {
- return [
- [
- // 自动更新创建和更新时间
- 'class' => TimestampBehavior::class,
- 'value' => time()
- ]
- ];
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- // [['store_id', 'user_id', 'realname', 'tel', 'mch_common_cat_id'], 'required'],
- [['store_id', 'user_id', 'saas_user_id','is_recommend',
- 'province_id', 'city_id', 'district_id', 'mch_common_cat_id',
- 'transfer_rate', 'sort', 'created_at', 'updated_at', 'province_id', 'city_id', 'district_id','is_open', 'is_lock'], 'integer'],
- [['logo', 'header_bg', 'name', 'address'], 'string'],
- [['account_money'], 'number'],
- [['realname', 'tel', 'name', 'wechat_name', 'longitude', 'latitude', 'main_content', 'summary',
- 'business', 'card_front', 'card_obverse', 'business_hours'], 'string', 'max' => 255],
- [['address', 'service_tel'], 'string', 'max' => 1000],
- [['is_delete', 'account_money', 'longitude', 'latitude'], 'default', 'value'=>0],
- [['main_content'], 'default', 'value'=>''],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'user_id' => 'User ID',
- 'is_delete' => 'Is Delete',
- 'is_open' => '是否营业:0=否,1=是',
- 'is_recommend' => '是否推荐:0=否,1=是',
- 'is_lock' => '是否被系统关闭:0=否,1=是',
- 'realname' => 'Realname',
- 'tel' => 'Tel',
- 'name' => 'Name',
- 'province_id' => 'Province ID',
- 'city_id' => 'City ID',
- 'district_id' => 'District ID',
- 'address' => 'Address',
- 'mch_common_cat_id' => '所售类目',
- 'service_tel' => '客服电话',
- 'logo' => 'logo',
- 'header_bg' => '背景图',
- 'transfer_rate' => '商户手续费',
- 'account_money' => '商户余额',
- 'sort' => '排序:升序',
- 'wechat_name' => '微信号',
- 'longitude' => '经度',
- 'latitude' => '纬度',
- 'main_content' => '主营内容',
- 'summary' => '简介',
- 'business' => '营业执照',
- 'card_front' => '身份证正面',
- 'card_obverse' => '身份证反面',
- 'business_hours' => '营业时间',
- 'created_at' => '创建时间',
- 'updated_at' => '更新时间',
- ];
- }
- public function getSetting()
- {
- return $this->hasOne(MchSetting::className(), ['mch_id' => 'id']);
- }
- //
- // public function getPlugin()
- // {
- // return $this->hasOne(MchPlugin::className(), ['mch_id' => 'id']);
- // }
- public function getUser()
- {
- return $this->hasOne(User::className(), ['id' => 'user_id']);
- }
- public function getOrder()
- {
- return $this->hasMany(Order::className(), ['mch_id' => 'id']);
- }
- public function getGoods()
- {
- return $this->hasMany(Goods::className(), ['mch_id' => 'id']);
- }
- }
|