forked from golang/hotime
增加限制条件
This commit is contained in:
parent
8cf54ce25b
commit
9ba182d65c
4
code.go
4
code.go
@ -44,7 +44,9 @@ var TptProject = Proj{
|
|||||||
}
|
}
|
||||||
|
|
||||||
link := strings.Replace(column.GetString("name"), "_id", "", -1)
|
link := strings.Replace(column.GetString("name"), "_id", "", -1)
|
||||||
|
if link == "parent" {
|
||||||
|
link = that.RouterString[1]
|
||||||
|
}
|
||||||
re[link] = that.Db.Get(column.GetString("link"), seStr, Map{"id": v})
|
re[link] = that.Db.Get(column.GetString("link"), seStr, Map{"id": v})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,12 @@ package app
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"code.hoteas.com/golang/hotime/common"
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
//高级加密标准(Adevanced Encryption Standard ,AES)
|
//高级加密标准(Adevanced Encryption Standard ,AES)
|
||||||
@ -56,12 +58,21 @@ func AesEcrypt(origData []byte, key []byte) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//实现解密
|
//实现解密
|
||||||
func AesDeCrypt(cypted []byte, key []byte) ([]byte, error) {
|
func AesDeCrypt(cypted []byte, key []byte) (bytes []byte, err error) {
|
||||||
|
//异常处理
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
//that.SetError(errors.New(fmt.Sprint(err)), LOG_FMT)
|
||||||
|
fmt.Println(err)
|
||||||
|
err = errors.New(common.ObjToStr(e))
|
||||||
|
}
|
||||||
|
}()
|
||||||
//创建加密算法实例
|
//创建加密算法实例
|
||||||
block, err := aes.NewCipher(key)
|
block, err := aes.NewCipher(key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取块大小
|
//获取块大小
|
||||||
blockSize := block.BlockSize()
|
blockSize := block.BlockSize()
|
||||||
//创建加密客户端实例
|
//创建加密客户端实例
|
||||||
@ -91,6 +102,7 @@ func DePwdCode(pwd string) ([]byte, error) {
|
|||||||
//解密base64字符串
|
//解密base64字符串
|
||||||
pwdByte, err := base64.StdEncoding.DecodeString(pwd)
|
pwdByte, err := base64.StdEncoding.DecodeString(pwd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
//执行AES解密
|
//执行AES解密
|
||||||
|
@ -44,6 +44,7 @@ var UpanCtr = Ctr{
|
|||||||
re, e := DePwdCode(sn)
|
re, e := DePwdCode(sn)
|
||||||
|
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
fmt.Println(e)
|
||||||
that.Display(3, "数据异常")
|
that.Display(3, "数据异常")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user