Go+PHP+Arco Design组合开发的多企业账号、多个网站管理后台、在线制作网站的网站管理系统平台

根据多年做网站和最近客户需求,要求我们有个CMS网站内容管理后台可以管理多个网站,由于客户有多个公司,开发多个网站,可是按照传统CMS管理系统只能是一个后台管理一个网站,而且还需要独立部署;对我们开发和维护也麻烦,用户后期管理网站也麻烦(需要管理对个后台账号密码)。还有我们之前用户用的后台是php开发的,政府性网站经常遭到同行攻击,主要还是和php不可编译有关。所以我们综合以上种种,思考再三,最后决定结合Go和PHP各自优点开发一套CMS内容管理后台,支持多个企业账号、多个站点、在线编辑网站,无需每次建站都部署,一次部署即可一直新增网站和开客户账号即可(不再像以前一个家一家单独部署),目前CMS已经用于实际企业网站管理,并在维护中比以前要省心,一套系统要做运行正常,所有网站都正常,您可以根据需要二次开发,例如:域名到期提醒,SSL证书到期提醒,用户维护未到期提醒等等。

下面是项目开发思路和主要核心部分代码,希望您或您的公司可以受到启发,应用到项目生产中,减少开发成本,让您及公司在开发定制网站时候可以做到和模板网站相近价格,让您公司可以在网站项目中获得更多收益,也让企业单位可以用最少得钱获得性价比更高的服务。

重点来了,GoFly团队不仅是分享一个思路或宣传自己产品,而是为大家提供整套项目免费的私有部署代码。您可以安装说明文档下载代码安装在自己的服务器上使用,不担心我们限制您。本文将提供示例demo在线体验,符不符合您需求提了看看您就知道!

1、思路简述

现在企业网只占企业信息化一小部分,企业还有其他信息要数字化,需要线上手机端展示、交易,触达、办理等,为了系统的稳定性我们使用Go语言做,PHP语言仅用于网站这块,用php负责网站业务,网站开发是的改动即时生效,及静态页面生成,伪静态等提高了网站开发效率、SEO收录和访问速度。

2.管理网站管理端账号后台(简称A端)

用于创建和管理B端账号,比如有新一下企业或者政府单位单子来,您只需创建一个B端账号,就可以在B端开发网站,不需要部署代码。不是比您以前要省心时间呀!在线体验A端:立即体验

3、截图演示B端

在线体验:立即体验

2.1 管理网站

2.2 制作网站编辑器

2.3 管理网站内容-点击切换网站可以对不同完整管理

2.4 编辑网站栏目

2.5 管理网站留言-并可以发送邮箱回复

3、php核心代码

(1)、能实现多网站管理核心技术是采用thinkphp5.1版本 域名路由支持完整域名、子域名和IP部署的路由和绑定功能,路由绑定域名代码如下:

//前台路由部分
$sitelist= Db::name('website_site')
    ->field('id,domain')
    ->where("status",0)
    ->where("step",1)
    ->select();
foreach ($sitelist as$site){
   if($site["domain"]){
       Route::domain($site["domain"], 'home')->append(['site_id'=>$site["id"]]);
   }
}

(2)、网站页面路由配置

//前台路由部分
$cate = Db::name('website_article_cate')
    ->alias('a')
    ->leftJoin('website_module m','a.module_id = m.id')
    ->field('a.id,a.catname,a.catdir,m.name as modulename,m.model_name as moduleurl')
    ->order('a.weigh ASC,a.id ASC')
    ->select();
$home_rote=[];
foreach ($cate as $k=>$v){
    //只有设置了栏目目录的栏目才配置路由
    if($v['catdir']){
        if($v['moduleurl']=='page'){
            //单页模型
            //1.1公司官网
            $home_rote[''.$v['catdir'].'-:catId'] = 'home/'.$v['catdir'].'/index';
            //Mobile
            $home_rote['mobile/'.$v['catdir'].'-:catId'] = 'mobile/'.$v['catdir'].'/index';
        }else{
            //列表+详情模型
            //1.1公司官网
            $home_rote[''.$v['catdir'].'-:catId/:id'] = 'home/'.$v['catdir'].'/info';
            $home_rote[''.$v['catdir'].'-:catId'] = 'home/'.$v['catdir'].'/index';
            //Mobile
            $home_rote['mobile/'.$v['catdir'].'-:catId/:id'] = 'mobile/'.$v['catdir'].'/info';
            $home_rote['mobile/'.$v['catdir'].'-:catId'] = 'mobile/'.$v['catdir'].'/index';
        }
    }
}
``````php
//前台路由部分
$cate = Db::name('website_article_cate')
    ->alias('a')
    ->leftJoin('website_module m','a.module_id = m.id')
    ->field('a.id,a.catname,a.catdir,m.name as modulename,m.model_name as moduleurl')
    ->order('a.weigh ASC,a.id ASC')
    ->select();
$home_rote=[];
foreach ($cate as $k=>$v){
    //只有设置了栏目目录的栏目才配置路由
    if($v['catdir']){
        if($v['moduleurl']=='page'){
            //单页模型
            //1.1公司官网
            $home_rote[''.$v['catdir'].'-:catId'] = 'home/'.$v['catdir'].'/index';
            //Mobile
            $home_rote['mobile/'.$v['catdir'].'-:catId'] = 'mobile/'.$v['catdir'].'/index';
        }else{
            //列表+详情模型
            //1.1公司官网
            $home_rote[''.$v['catdir'].'-:catId/:id'] = 'home/'.$v['catdir'].'/info';
            $home_rote[''.$v['catdir'].'-:catId'] = 'home/'.$v['catdir'].'/index';
            //Mobile
            $home_rote['mobile/'.$v['catdir'].'-:catId/:id'] = 'mobile/'.$v['catdir'].'/info';
            $home_rote['mobile/'.$v['catdir'].'-:catId'] = 'mobile/'.$v['catdir'].'/index';
        }
    }
}
``````php
//前台路由部分
$cate = Db::name('website_article_cate')
    ->alias('a')
    ->leftJoin('website_module m','a.module_id = m.id')
    ->field('a.id,a.catname,a.catdir,m.name as modulename,m.model_name as moduleurl')
    ->order('a.weigh ASC,a.id ASC')
    ->select();
$home_rote=[];
foreach ($cate as $k=>$v){
    //只有设置了栏目目录的栏目才配置路由
    if($v['catdir']){
        if($v['moduleurl']=='page'){
            //单页模型
            //1.1公司官网
            $home_rote[''.$v['catdir'].'-:catId'] = 'home/'.$v['catdir'].'/index';
            //Mobile
            $home_rote['mobile/'.$v['catdir'].'-:catId'] = 'mobile/'.$v['catdir'].'/index';
        }else{
            //列表+详情模型
            //1.1公司官网
            $home_rote[''.$v['catdir'].'-:catId/:id'] = 'home/'.$v['catdir'].'/info';
            $home_rote[''.$v['catdir'].'-:catId'] = 'home/'.$v['catdir'].'/index';
            //Mobile
            $home_rote['mobile/'.$v['catdir'].'-:catId/:id'] = 'mobile/'.$v['catdir'].'/info';
            $home_rote['mobile/'.$v['catdir'].'-:catId'] = 'mobile/'.$v['catdir'].'/index';
        }
    }
}
本作品采用《CC 协议》,转载必须注明作者和本文链接
GoFly全栈开发社区
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!
未填写
文章
13
粉丝
4
喜欢
7
收藏
8
排名:1405
访问:2578
私信
所有博文
社区赞助商