| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /**
- * @Author: zou.yingbin
- * @Create : 2021/3/30 14:51
- * @Modify : 2021/3/30 14:51
- * @Note : Ermcp定义一些公共的方法或变量
- */
- package models
- import (
- "encoding/hex"
- "mtp2_if/utils"
- )
- type ReportType int
- // IErmcp 通用接口
- type IErmcp interface {
- calc() // 相关计算和数据处理
- buildSql() string // 生成sql语句
- GetDataEx() (interface{}, error) // 获取数据接口
- }
- // DecryptField 解密字段
- func DecryptField(oriStr string) string {
- key := "0d299ce2d4105282f7471074cb0f9f9d"
- key2, _ := hex.DecodeString(key)
- if oriStr == "" {
- return oriStr
- }
- d, _ := hex.DecodeString(oriStr)
- if dst, err := utils.AESDecrypt(d, key2); err == nil {
- return string(dst)
- }
- return oriStr
- }
- // DecodeStr 类似于问号表达式, true返回第1个 false返回第2个
- func DecodeStr(condition bool, strTrue, strFalse string) string {
- if condition {
- return strTrue
- }
- return strFalse
- }
|