2 Star 8 Fork 6

地球仪 / go-tenancy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

GoTenancy

Build Status Code Coverage Go Report Card GoDoc Licenses
多商户管理平台

项目介绍

本来采用此项目是从 IrisAdminApi 升级而来。在开发过程中遇到一个问题:gorm 的多对多关系中间表中自定义字段。 在搜索的过程中无意间发现了 gorm 作者团队的 CMS 框架 Qor-Admin ,文档请见 https://doc.getqor.com/。 一见到 Qor-Admin 框架,我就决定使用它重构我的项目了,它有很多值得我去深入了解的地方。 —— 不想偷懒的程序员无法成为一个优秀的程序员。 Qor-Admin 可以单独使用,也可以和其他框架结合使用。本项目采用 Iris 结合 Qor-Admin 形式开发,其他框架大同小异。 参考项目:qor-example

qor-example 是一个购物商城实例,目前已经使用 iris 重构了路由 (有部分问题未修复),详细代码位于 devForQor 分支。 devForGoTenancy 分支 , 是一次更换 qor-admin 前端模版的尝试,因为前端水平有限,目前没有完成,暂停更新....。

qor 整体框架组件十分的完善,实现了大部分的功能。当然,框架做了太多事情,随之而来的问题也会很多。我在使用过程中总结了一些问题都集中记录在 问题记录 中。


项目进度 - 基本完成 iris 和 qor 的结合,踩了一遍坑,详情都记录在 问题记录

注意:因为将原本的认证路由 auth/* 修改为 admin/*,导致认证 auth 包的 assets/* 资源路径和 admin 包的 assets/* 资源路径重叠 导致只能用 iris 代理其中之一,为了解决这个问题我将 auth 包的前端文件都复制到了 admin 包中。

iris + qor-admin 使用案例 【 代码由 iris 的作者 @kataras 提供】

提供一个 iris'wiki 中文文档,方便大家学习 iris :

qor 文档地址


也欢迎加入 Iris-go 学习交流QQ群,一起交流学习心得 :676717248

Iris-go

package main

import (
    "github.com/kataras/iris/v12"
    "github.com/qor/admin"
)

func main() {
    app := iris.New()

    qorPrefix := "/admin"
    // create a new qor admin instance.
    q := admin.New(&admin.AdminConfig{DB: yourDB})
    // create a qor handler and convert it to an iris one with `iris.FromStd`.
    handler := iris.FromStd(q.NewServeMux(qorPrefix))
    // register routes for "/admin" and "/admin/:xxx/..."
    app.Any(qorPrefix, handler)
    app.Any(qorPrefix+"/{p:path}", handler)

    // start the server.
    app.Listen(":8080")
}

项目目录结构

  • 项目重构中....

更新日志

UPDATE


问题总结

ERRORS


项目初始化

拉取项目


git clone https://github.com/snowlyg/go-tenancy.git

// github 克隆太慢可以用 gitee 地址:

git clone https://gitee.com/dtouyu/go-tenancy.git

加载依赖管理包 (解决国内下载依赖太慢问题) golang 1.13 可以直接执行:


go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

修改 go-tenancy/config 下的配置文件 : application.yml - 应用配置 database.yml - 数据配置 smtp.yml - 邮箱配置

加载数据

#第一次启动执行
go run config/db/seeds/main.go config/db/seeds/seeds.go

打包模版文件和静态文件

# 模版文件 - 仅部署到生产环境使用,开发跳过此步骤
go run main.go -compile-templates=true 

# windows 环境如果安装失败,请尝试运行:
# npm install -g node-gyp
# npm install --global --production windows-build-tools

#安装 npm 依赖
npm install  

#打包静态文件
npm run build  

运行项目

gowatch


go get github.com/silenceper/gowatch

#安装 gowatch 后才可以使用
gowatch 

当然你也可以直接使用,此方法无法热加载


go run main.go

账号密码

dev@getqor.com/testing


演示

登录页: http://localhost:8080/admin/login

控制面板: http://localhost:8080/admin

MIT License Copyright (c) 2020 snowlyg Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

快速实现 SaaS 多租户平台项目 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/diqiuyi/go-tenancy.git
git@gitee.com:diqiuyi/go-tenancy.git
diqiuyi
go-tenancy
go-tenancy
master

搜索帮助