1, 'uri' => 'companyStrength/index', 'auth_name' => '公司实力', 'is_menu' => 1, 'sort' => 50, 'relation' => 'companyStrength/index' ]; $id = Permission::insertGetId($menu); //建表 $table = $this->table('company_strength')->setComment('公司实力'); $table->addColumn('root_id', 'integer', ['limit' => 10, 'comment' => '店面id', 'null' => true, 'default' => 0]) ->addColumn('cate', 'string', ['limit' => 250, 'comment' => '分类', 'null' => true, 'default' => '']) ->addColumn('title', 'string', ['limit' => 255, 'comment' => '标题', 'null' => true, 'default' => '']) ->addColumn('media_ids', 'string', ['limit' => 255, 'comment' => '媒体链接', 'null' => true, 'default' => '']) ->addColumn('pics', 'string', ['limit' => 255, 'comment' => '图片/视频地址', 'null' => true, 'default' => '']) ->addColumn('cover', 'string', ['limit' => 255, 'comment' => '图片/视频封面图', 'null' => true, 'default' => '']) ->addColumn('desc', 'text', ['comment'=> '描述', 'null'=> true]) ->addColumn('shared_times', 'integer', ['limit' => 10, 'comment' => '分享次数', 'null' => true, 'default' => 0]) ->addColumn('addtime', 'timestamp', ['comment' => '添加时间', 'default' => 'CURRENT_TIMESTAMP', 'null' => true]) ->addColumn('updatetime', 'timestamp', ['comment' => '修改时间', 'default' => 'CURRENT_TIMESTAMP', 'null' => true]) ->addColumn('del', 'integer', ['limit' => 10, 'comment' => '1删除', 'null' => true, 'default' => 0]) ->addColumn('publish', 'integer', ['limit' => 10, 'comment' => '1上架,0下架', 'null' => true, 'default' => 1]) ->addColumn('view_times', 'integer', ['limit' => 10, 'comment' => '浏览次数', 'null' => true, 'default' => 0]) ->addColumn('employee_id', 'integer', ['limit' => 10, 'comment' => '上传人员', 'null' => true, 'default' => 0]) ->addColumn('difference', 'integer', ['limit' => 10, 'comment' => '1视频,2图文', 'null' => true, 'default' => 2]) ->create(); $table = $this->table('company_strength_cate')->setComment('公司实力分类'); $table->addColumn('root_id', 'integer', ['limit' => 10, 'comment' => '店面id', 'null' => true, 'default' => 0]) ->addColumn('name', 'string', ['limit' => 250, 'comment' => '分类', 'null' => true, 'default' => '']) ->addColumn('addtime', 'timestamp', ['comment' => '添加时间', 'default' => 'CURRENT_TIMESTAMP', 'null' => true]) ->create(); //菜单权限 $info = Grant::where('id',1)->find(); $pids = (array)$info->permission; $pids[] = (int)$id; $info->permission = array_values($pids); $info->save(); //权限 $per = ',companyStrength/list,companyStrength/apipublish,companyStrength/add,companyStrength/adding,companyStrength/edit,companyStrength/editing,companyStrength/del,companyStrength/imgUpload'; $w[] = ['auth_name', '=', '公司实力']; $w[] = ['pid', '>', 0]; $w[] = ['is_menu', '=', 1]; $info = Permission::where($w)->find(); $per = $info->relation . $per; $info->relation = $per; $info->save(); } }