| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- use app\jobs\SyncMdGoodsJob;
- use yii\db\ActiveRecord;
- use yii\behaviors\TimestampBehavior;
- use Yii;
- /**
- * This is the model class for table "{{%md}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property integer $user_id
- * @property string $contact
- * @property string $name
- * @property string $mobile
- * @property string $address
- * @property integer $is_delete
- * @property integer $created_at
- * @property string $longitude
- * @property string $latitude
- * @property string $cover_url
- * @property string $pic_url
- * @property string $start_time
- * @property string $end_time
- * @property int|null $province
- * @property int|null $city
- * @property int|null $district
- * @property int|null $shop_audit 审核状态(-1未通过,0待审核,1通过)
- * @property string|null $refuse_desc 拒接原因
- * @property string $delivery_type 配送方式
- * @property string $self_delivery_type 自己选择的配送方式
- * @property int $open_status
- * @property int $shop_time_type
- * @property int $is_time_forbid
- * @property integer $updated_at
- * @property int $rate
- * @property int $total_profit
- * @property int $cash_profit
- * @property int $clerk_profit
- * @property int $clerk_rate
- * @property int $is_single
- * @property int $manager
- * @property int $is_set_distance
- * @property int $distance
- * @property int $audit_time
- * @property string $food_payment
- * @property int $food_pay_type
- * @property string $user_name
- * @property string $password
- */
- class Md extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%md}}';
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
- ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at']
- ]
- ]
- ];
- }
- const IS_DELETE_YES = 1;//已删除
- const IS_DELETE_NO = 0;//未删除
- const SHOP_AUDIT_YES = 1;// 审核通过
- const SHOP_AUDIT_NO = 2;// 审核拒绝
- const SHOP_AUDIT_WAIT = 0;// 等待审核
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['audit_time', 'store_id', 'is_delete', 'province', 'city', 'district', 'user_id', 'shop_audit',
- 'open_status', 'shop_time_type', 'is_time_forbid', 'updated_at', 'manager', 'is_single', 'is_set_distance', 'food_pay_type'], 'integer'],
- [['longitude', 'latitude', 'cover_url', 'pic_url', 'delivery_type', 'contact', 'start_time',
- 'end_time', 'self_delivery_type', 'food_payment', 'user_name', 'password'], 'string'],
- [['rate', 'total_profit', 'cash_profit', 'clerk_rate', 'clerk_profit', 'distance'], 'number'],
- [['name', 'mobile', 'address', 'refuse_desc'], 'string', 'max' => 255],
- [['created_at', 'delivery_type'], 'safe']
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'user_id' => '用户id',
- 'name' => 'Name',
- 'mobile' => 'Mobile',
- 'address' => 'Address',
- 'is_delete' => 'Is Delete',
- 'created_at' => '添加时间',
- 'longitude' => 'Longitude',
- 'latitude' => 'Latitude',
- 'cover_url' => '自提点大图',
- 'pic_url' => '自提点小图',
- 'province' => '省份',
- 'city' => '城市',
- 'district' => '区县',
- 'shop_audit' => '审核状态(-1未通过,0待审核,1通过)',
- 'refuse_desc' => '拒接原因',
- 'user_name' => '登陆账户',
- 'password' => '密码',
- ];
- }
- // public function getShopPic()
- // {
- // return $this->hasMany(ShopPic::className(), ['shop_id'=>'id'])->where(['is_delete'=>0]);
- // }
- public function afterSave($insert, $changedAttributes)
- {
- parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
- if (1 || $insert) {
- $goods_id = Goods::find()->where(['store_id' => $this->store_id, 'is_delete' => 0])->select('id')->column();
- queue_push(new SyncMdGoodsJob(['goods_ids' => $goods_id, 'md_id' => $this->id]));
- }
- }
- }
|