Skip to content

Commit

Permalink
remove all and will push source code
Browse files Browse the repository at this point in the history
  • Loading branch information
duliang123 committed Feb 8, 2017
1 parent 19a009d commit 8b9ef95
Show file tree
Hide file tree
Showing 15 changed files with 872 additions and 49 deletions.
16 changes: 8 additions & 8 deletions README.md
Expand Up @@ -20,30 +20,30 @@

修改文件: vi conf/app.conf

title = "SST运维作业平台"
culture = "-- 简单 . 高效 . 自动化 --"
title = "SST运维作业平台"
culture = "-- 简单 . 高效 . 自动化 --"

appname = SST
appname = SST
httpport = 8080
runmode = dev
runmode = dev

sessionon = true

loginuser = duliang123 #平台Web登陆账号
loginpasswd = duliang #平台登陆密码
loginuser = duliang123 #平台Web登陆账号
loginpasswd = 123456 #平台登陆密码


salt_url = https://127.0.0.1:8000/login #salt-api登陆地址
salt_username = salt_u_duliang
salt_password = DLpasswd
salt_password = DL@!(*$abc
salt_api_url = https://127.0.0.1:8000 #salt-api数据GET|POST地址

### 运行:
cd SST && ./SST &


**鸣谢:**
雨落寒冰(北京) 曦晨(苏州)
雨落寒冰(北京) 曦晨(苏州) lock(上海)


![image](https://github.com/duliang123/SST/blob/master/screenshot/screenshot.jpg)
Expand Down
Binary file modified SST 100644 → 100755
Binary file not shown.
18 changes: 12 additions & 6 deletions conf/app.conf
@@ -1,17 +1,23 @@
title = "SST运维作业平台"
title = "SST运维作业平台"
culture = "-- 简单 . 高效 . 自动化 --"

appname = SST
appname = SST
httpport = 8080
runmode = dev
runmode = dev

sessionon = true

loginuser = duliang
loginpasswd = Duliangduliang
loginuser = duliang123
loginpasswd = 123456

mysqluser =
mysqlpass =
mysqlurls = 127.0.0.1
mysqldb =
mysqltbpre =


salt_url = https://127.0.0.1:8000/login
salt_username = salt_u_duliang
salt_password = DL@@#124132-_@
salt_password = DL@!(*$abc
salt_api_url = https://127.0.0.1:8000
88 changes: 88 additions & 0 deletions controllers/admin/admin.go
@@ -0,0 +1,88 @@
package admin

import (
"fmt"
"time"
. "SST/models/admin"
"SST/controllers"
"github.com/astaxie/beego"
)

type MainController struct {
beego.Controller
}

func (c *MainController) Get() {
c.Data["Website"] = "github.com/duliang123/SST"
c.Data["Email"] = ""
c.Layout = "admin/layout.tpl"
c.TplName = "index.tpl"
}

//登录
type LoginUserController struct {
controllers.BaseController
}

func (this *LoginUserController) Get() {
check := this.BaseController.IsLogin
if check {
//this.Abort("401")
this.Redirect("/index", 302)
} else {
this.Data["title"] = beego.AppConfig.String("title")
this.Data["culture"] = beego.AppConfig.String("culture")
this.TplName = "admin/login.tpl"
}
}

func (this *LoginUserController) Post() {
username := this.GetString("username")
password := this.GetString("password")

if "" == username {
this.Data["json"] = map[string]interface{}{"code": 0, "message": "请填写用户名"}
this.ServeJSON()
}

if "" == password {
this.Data["json"] = map[string]interface{}{"code": 0, "message": "请填写密码"}
this.ServeJSON()
}
err, users := LoginUser(username, password)

if err == nil {
this.SetSession("userLogin", fmt.Sprintf("%d", users.Id)+"||"+users.Username+"||"+users.Avatar)
//this.SetSession("userPermission", GetPermissions(users.Id))
this.Data["json"] = map[string]interface{}{"code": 1, "message": "贺喜你,登录成功"}
} else {
this.Data["json"] = map[string]interface{}{"code": 0, "message": "登录失败"}
}
this.ServeJSON()
}

//退出
type LogoutUserController struct {
controllers.BaseController
}

func (this *LogoutUserController) Get() {
this.DelSession("userLogin")
//this.Ctx.WriteString("you have logout")
this.Redirect("/login", 302)

}

//首页
type AdminController struct {
controllers.BaseController
}

func (this *AdminController) Get() {
this.Data["title"] = beego.AppConfig.String("title")
this.Data["culture"] = beego.AppConfig.String("culture")
this.Data["navtitle"] = "欢迎页"
this.Data["datetime"] = time.Now().Format("2006-01-02 15:04:05")
this.Layout = "admin/layout.tpl"
this.TplName = "admin/index.tpl"
}
43 changes: 43 additions & 0 deletions controllers/base.go
@@ -0,0 +1,43 @@
package controllers

import (
//"opms/initial"

"strconv"
"strings"
//"fmt"

"github.com/astaxie/beego"
)

type BaseController struct {
beego.Controller
IsLogin bool
//UserInfo string
UserUserId int64
UserUsername string
UserAvatar string
}

func (this *BaseController) Prepare() {
userLogin := this.GetSession("userLogin")
if userLogin == nil {
this.IsLogin = false
//this.Redirect("/login", 302)
} else {
this.IsLogin = true
tmp := strings.Split((this.GetSession("userLogin")).(string), "||")

//id, _ := strconv.Atoi(tmp[0])
userid, _ := strconv.Atoi(tmp[0])
longid := int64(userid)
this.Data["LoginUserid"] = longid
this.Data["LoginUsername"] = tmp[1]
this.Data["LoginAvatar"] = tmp[2]

this.UserUserId = longid
this.UserUsername = tmp[1]
this.UserAvatar = tmp[2]
}
this.Data["IsLogin"] = this.IsLogin
}
15 changes: 15 additions & 0 deletions controllers/default.go
@@ -0,0 +1,15 @@
package controllers

import (
"github.com/astaxie/beego"
)

type MainController struct {
beego.Controller
}

func (c *MainController) Get() {
c.Data["Website"] = "beego.me"
c.Data["Email"] = "astaxie@gmail.com"
c.TplName = "index.tpl"
}

0 comments on commit 8b9ef95

Please sign in to comment.