作者 唐旭辉

日常提交存储

... ... @@ -3,7 +3,7 @@ module oppmg
go 1.13
require (
github.com/360EntSecGroup-Skylar/excelize v1.4.1
github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.2
github.com/astaxie/beego v1.11.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/go-redis/redis v6.15.6+incompatible
... ...
github.com/360EntSecGroup-Skylar/excelize v1.4.1 h1:l55mJb6rkkaUzOpSsgEeKYtS6/0gHwBYyfo5Jcjv/Ks=
github.com/360EntSecGroup-Skylar/excelize v1.4.1/go.mod h1:vnax29X2usfl7HHkBrX5EvSCJcmH3dT9luvxzu8iGAE=
github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.2 h1:StMrA6UQ5Cm6206DxXGuV/NMqSIOIDoMXMYt8JPe1lE=
github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.2/go.mod h1:EfRHD2k+Kd7ijnqlwOrH1IifwgWB9yYJ0pdXtBZmlpU=
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/astaxie/beego v1.11.1 h1:6DESefxW5oMcRLFRKi53/6exzup/IR6N4EzzS1n6CnQ=
github.com/astaxie/beego v1.11.1/go.mod h1:i69hVzgauOPSw5qeyF4GVZhn7Od0yG5bbCGzmhbWxgQ=
... ... @@ -13,6 +13,7 @@ github.com/couchbase/go-couchbase v0.0.0-20181122212707-3e9b6e1258bb/go.mod h1:T
github.com/couchbase/gomemcached v0.0.0-20181122193126-5125a94a666c/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ=
... ... @@ -61,8 +62,9 @@ github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z
github.com/sony/sonyflake v1.0.0 h1:MpU6Ro7tfXwgn2l5eluf9xQvQJDROTBImNCfRXn/YeM=
github.com/sony/sonyflake v1.0.0/go.mod h1:Jv3cfhf/UFtolOTTRd3q4Nl6ENqM+KfyZ5PseKfZGF4=
github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
github.com/stretchr/testify v1.2.3-0.20181224173747-660f15d67dbb h1:cRItZejS4Ok67vfCdrbGIaqk86wmtQNOjVD7jSyS2aw=
github.com/stretchr/testify v1.2.3-0.20181224173747-660f15d67dbb/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85 h1:et7+NAX3lLIk5qUCTA9QelBjGE/NkhzYw/mhnr0s7nI=
... ... @@ -70,6 +72,8 @@ golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnf
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba h1:9bFeDpN3gTqNanMVqNcoR/pJQuP5uroC3t1D7eXozTE=
golang.org/x/crypto v0.0.0-20191119213627-4f8c1d86b1ba/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a h1:gHevYm0pO4QUbwy8Dmdr01R5r1BuKtfYqRqF0h/Cbh0=
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
... ...
... ... @@ -2,8 +2,8 @@ package protocol
//RequestPageInfo 分页获取数据
type RequestPageInfo struct {
PageIndex int `json:"page"`
PageSize int `json:"pageSize"`
PageIndex int `json:"page_index"`
PageSize int `json:"page_size"`
}
//ResponsePageInfo 分页信息
... ...
... ... @@ -85,3 +85,24 @@ type RequestUserEdit struct {
ID int64 `json:"id"`
RequestUserAdd
}
//RequestUserList 获取用户列表
type RequestUserList struct {
RequestPageInfo
NickName string `json:"nick_name"`
}
//ResponseUserList 响应的用户列表
type ResponseUserList struct {
ResponsePageInfo
List []UserListItem `json:"list"`
}
type UserListItem struct {
Id int64 `json:"id"`
NickName string `json:"nick_name"`
Position string `json:"position"`
Role string `json:"role"`
Department string `json:"department"`
Status int8 `json:"status"`
}
... ...
... ... @@ -307,12 +307,12 @@ func UserEdit(param protocol.RequestUserEdit) error {
}
o := orm.NewOrm()
o.Begin()
err = registUser(userm, param.CompanyId, o)
if err != nil {
o.Rollback()
log.Error("registUser err:%s", err)
return protocol.NewErrWithMessage("1")
}
// err = registUser(userm, param.CompanyId, o)
// if err != nil {
// o.Rollback()
// log.Error("registUser err:%s", err)
// return protocol.NewErrWithMessage("1")
// }
//添加角色
err = editUserRole(userm.Id, param.CompanyId, param.Roles, o)
if err != nil {
... ... @@ -341,3 +341,7 @@ func UserEdit(param protocol.RequestUserEdit) error {
func UserDelete(param protocol.RequestUserAdd) error {
return nil
}
func UserList() error {
return nil
}
... ...
... ... @@ -6,7 +6,7 @@ import (
"math/rand"
"time"
"github.com/360EntSecGroup-Skylar/excelize"
excelize "github.com/360EntSecGroup-Skylar/excelize/v2"
"github.com/astaxie/beego/orm"
)
... ... @@ -39,14 +39,16 @@ func (e *ExcelMaker) MakeListExcel(sourData []map[string]string, xlsxHeader [][]
}
headEn = append(headEn, xlsxHeader[key][0])
headCn = append(headCn, xlsxHeader[key][1])
alpha := excelize.ToAlphaString(key)
alpha, err := excelize.ColumnNumberToName(key)
if err != nil {
return err
}
alphaSlice = append(alphaSlice, alpha)
}
//设置excel文档第一行的字段中文描述
for index, _ := range headCn {
//索引转列名,索引从0开始
cellAlpha := fmt.Sprintf("%s%d", alphaSlice[index], 1) // 单元格行坐标从1开始,如:a1,指第一行a列。
e.Xlsx.SetCellStr("Sheet1", cellAlpha, headCn[index])
... ... @@ -78,7 +80,10 @@ func (e *ExcelMaker) MakeListExcelForBeego(sourData []orm.Params, xlsxHeader [][
}
headEn = append(headEn, xlsxHeader[key][0])
headCn = append(headCn, xlsxHeader[key][1])
alpha := excelize.ToAlphaString(key)
alpha, err := excelize.ColumnNumberToName(key)
if err != nil {
return err
}
alphaSlice = append(alphaSlice, alpha)
}
... ...