db->createCommand($sql)->execute(); if(!empty($res)) return ''; $this->createTable($table, [ 'id' => $this->primaryKey(), 'mall_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('商城id'), 'store_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('门店id'), 'from_type' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('类型:1:平台优惠券;2:门店优惠券'), 'user_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('用户id'), 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'), 'coupon_status' => $this->tinyInteger(1)->notNull()->defaultValue(2)->comment('优惠券状态,2:领取中,3:已过期,4:已失效(后台操作失效、转赠被领取后、使用之后)'), 'start_time' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券开始生效时间'), 'end_time' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券过期时间'), 'is_use' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否已使用:0=未使用,1=已使用'), 'is_giving' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否已赠送:0-否;1-是;'), 'giving_status' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('转赠状态,0:未转赠,1:转赠中,2:已被领取(转赠完成)'), 'receive_type' => $this->string(255)->notNull()->defaultValue('')->comment('获取方式,如"商品详情页领取'), 'receive_platform' => $this->string(25)->notNull()->defaultValue('')->comment('领取来源,从哪个平台领取的,wechat:微信,mp-wx:微信小程序,h5,app,work-wx:企业微信'), 'is_force_failure' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否强制失效,后台操作用户已领取的优惠券失效'), 'is_send_reward' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否已经发放优惠券奖励,1:是,0:否'), 'status' => $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('状态[-1:删除;0:禁用;1启用]'), 'created_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('添加时间'), 'updated_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('修改时间'), ]); $this->addCommentOnTable($table,'用户优惠券表'); } /** * {@inheritdoc} */ public function safeDown() { echo "M220906034921QimallAddonsStoreCouponUserRelate cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M220906034921QimallAddonsStoreCouponUserRelate cannot be reverted.\n"; return false; } */ }