Skip to content

Commit

Permalink
修改路径便于安装
Browse files Browse the repository at this point in the history
  • Loading branch information
郝大全 committed Oct 11, 2017
1 parent 8d121c2 commit 2d7ceb6
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 32 deletions.
Binary file added PPGo_ApiAdmin
Binary file not shown.
4 changes: 2 additions & 2 deletions controllers/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
package controllers

import (
"PPGo_ApiAdmin/libs"
"PPGo_ApiAdmin/models"
"fmt"
"strconv"
"strings"
"time"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/libs"
"github.com/george518/PPGo_ApiAdmin/models"
)

type AdminController struct {
Expand Down
2 changes: 1 addition & 1 deletion controllers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
package controllers

import (
"PPGo_ApiAdmin/models"
"strconv"
"strings"
"time"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/models"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion controllers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
package controllers

import (
"PPGo_ApiAdmin/models"
"fmt"
"strings"
"time"

"github.com/george518/PPGo_ApiAdmin/models"
)

type AuthController struct {
Expand Down
2 changes: 1 addition & 1 deletion controllers/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
package controllers

import (
"PPGo_ApiAdmin/models"
"fmt"
"strings"
"time"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/models"
)

type CodeController struct {
Expand Down
4 changes: 2 additions & 2 deletions controllers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
package controllers

import (
"PPGo_ApiAdmin/libs"
"PPGo_ApiAdmin/models"
"strconv"
"strings"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/libs"
"github.com/george518/PPGo_ApiAdmin/models"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion controllers/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
package controllers

import (
"PPGo_ApiAdmin/models"
"strings"
"time"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/models"
)

type EnvController struct {
Expand Down
2 changes: 1 addition & 1 deletion controllers/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
package controllers

import (
"PPGo_ApiAdmin/models"
"strings"
"time"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/models"
)

type GroupController struct {
Expand Down
4 changes: 2 additions & 2 deletions controllers/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
package controllers

import (
"PPGo_ApiAdmin/libs"
"PPGo_ApiAdmin/models"
"fmt"
"strconv"
"strings"
"time"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/libs"
"github.com/george518/PPGo_ApiAdmin/models"
)

type LoginController struct {
Expand Down
2 changes: 1 addition & 1 deletion controllers/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
package controllers

import (
"PPGo_ApiAdmin/models"
"fmt"
"strconv"
"strings"
"time"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/models"
)

type RoleController struct {
Expand Down
5 changes: 3 additions & 2 deletions controllers/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
package controllers

import (
"PPGo_ApiAdmin/libs"
"PPGo_ApiAdmin/models"
"strings"
"time"

"github.com/george518/PPGo_ApiAdmin/libs"
"github.com/george518/PPGo_ApiAdmin/models"
)

type UserController struct {
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
"PPGo_ApiAdmin/models"
_ "PPGo_ApiAdmin/routers"
"github.com/george518/PPGo_ApiAdmin/models"
_ "github.com/george518/PPGo_ApiAdmin/routers"

"github.com/astaxie/beego"
)
Expand Down
17 changes: 9 additions & 8 deletions models/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
package models

import (
"github.com/astaxie/beego/orm"
"fmt"

"github.com/astaxie/beego/orm"
)

type Auth struct {
Expand Down Expand Up @@ -48,25 +49,25 @@ func AuthGetList(page, pageSize int, filters ...interface{}) ([]*Auth, int64) {
return list, total
}

func AuthGetListByIds(authIds string, userId int)([]*Auth, error) {
func AuthGetListByIds(authIds string, userId int) ([]*Auth, error) {

list1 := make([]*Auth, 0)
var list []orm.Params
//list:=[]orm.Params
var err error
if(userId==1){
if userId == 1 {
//超级管理员
_, err = orm.NewOrm().Raw("select id,auth_name,auth_url,pid,icon,is_show from pp_uc_auth where status=? order by pid asc,sort asc",1).Values(&list)
}else{
_, err = orm.NewOrm().Raw("select id,auth_name,auth_url,pid,icon,is_show from pp_uc_auth where status=? order by pid asc,sort asc", 1).Values(&list)
} else {
_, err = orm.NewOrm().Raw("select id,auth_name,auth_url,pid,icon,is_show from pp_uc_auth where status=1 and id in("+authIds+") order by pid asc,sort asc", authIds).Values(&list)
}

for k,v := range list{
fmt.Println(k,v)
for k, v := range list {
fmt.Println(k, v)
}

fmt.Println(list)
return list1,err
return list1, err
}

func AuthAdd(auth *Auth) (int64, error) {
Expand Down
14 changes: 8 additions & 6 deletions models/role_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
package models

import (
"github.com/astaxie/beego/orm"
"strconv"
"bytes"
"strconv"
"strings"

"github.com/astaxie/beego/orm"
)

type RoleAuth struct {
Expand Down Expand Up @@ -41,23 +42,24 @@ func RoleAuthDelete(id int) (int64, error) {
query := orm.NewOrm().QueryTable(TableName("uc_role_auth"))
return query.Filter("role_id", id).Delete()
}

//获取多个
func RoleAuthGetByIds(RoleIds string) (Authids string, err error) {
list := make([]*RoleAuth, 0)
query := orm.NewOrm().QueryTable(TableName("uc_role_auth"))
ids:= strings.Split(RoleIds, ",")
ids := strings.Split(RoleIds, ",")
_, err = query.Filter("role_id__in", ids).All(&list, "AuthId")
if err != nil {
return "", err
}
b := bytes.Buffer{}
for _,v := range list{
if(v.AuthId!=0 && v.AuthId!=1 ){
for _, v := range list {
if v.AuthId != 0 && v.AuthId != 1 {
b.WriteString(strconv.Itoa(v.AuthId))
b.WriteString(",")
}
}
Authids=strings.TrimRight(b.String(),",")
Authids = strings.TrimRight(b.String(), ",")
return Authids, nil
}

Expand Down
3 changes: 1 addition & 2 deletions routers/router.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package routers

import (
"PPGo_ApiAdmin/controllers"

"github.com/astaxie/beego"
"github.com/george518/PPGo_ApiAdmin/controllers"
)

func init() {
Expand Down
Empty file modified run.sh
100644 → 100755
Empty file.

0 comments on commit 2d7ceb6

Please sign in to comment.