| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M240612084212InsertQimallLinkCategory
- */
- class M240612084212InsertQimallLinkCategory extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $f_sql = "SELECT * FROM qimall_link_category where name = 'wechat_video_account';";
- $res = \Yii::$app->db->createCommand($f_sql)->queryOne();
- if(!$res){
- $sql = "INSERT INTO `qimall_link_category` ( `name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES ( 'wechat_video_account', '微信视频号跳转', 9, 0, '此功能仅支持小程序端跳转。直播类型需要小程序和视频号的主体相关联', 1, 1630564778, 1630564778);";
- $this->execute($sql);
- }
- $res = \Yii::$app->db->createCommand($f_sql)->queryOne();
- $cat_id = $res['id'];
- $sql = "INSERT INTO `qimall_link` ( `name`, `title`, `cat_id`, `open_type`, `route`, `icon`, `remark`, `status`, `created_at`, `updated_at`) VALUES ( 'jumpType', '跳转类型', {$cat_id}, 'wechat_video_account', 'channelsUserProfile', NULL, '', 1, 1718248695, 1718248695);
- INSERT INTO `qimall_link` ( `name`, `title`, `cat_id`, `open_type`, `route`, `icon`, `remark`, `status`, `created_at`, `updated_at`) VALUES ( 'finderUserName', '视频号id', {$cat_id}, 'wechat_video_account', '', NULL, '以\'sph\'开头的id,登录视频号助手,在首页可以查看自己的视频号ID', 1, 1718248695, 1718248695);
- INSERT INTO `qimall_link` ( `name`, `title`, `cat_id`, `open_type`, `route`, `icon`, `remark`, `status`, `created_at`, `updated_at`) VALUES ( 'feedId', '视频id', {$cat_id}, 'wechat_video_account', '', NULL, '跳转类型为\'视频\'时必填。\\n获取视频的feedId需要登录视频号助手,在「内容管理」模块可以复制自己发表的每个视频对应的feedId。', 1, 1718248695, 1718248695);
- ";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240612084212InsertQimallLinkCategory cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240612084212InsertQimallLinkCategory cannot be reverted.\n";
- return false;
- }
- */
- }
|