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])); } } }