fix: delete

master
howell 4 years ago
parent ee15a99b9e
commit e439ada75a

@ -164,7 +164,7 @@ func (e *enterprise) Verfiy(info *EnterpriseInfo) (err error) {
if info.LegalPerson == "" { if info.LegalPerson == "" {
return errors.New("请填写法人证明") return errors.New("请填写法人证明")
} }
if !tools.VerfiyIdCard(info.LegalPersonCode) { if !tools.VerifyIdCard(info.LegalPersonCode) {
return errors.New("请正确填写法人身份证号") return errors.New("请正确填写法人身份证号")
} }
if info.LegalPersonUrl == "" { if info.LegalPersonUrl == "" {

@ -120,7 +120,7 @@ func Phone(c *gin.Context) {
key, _ := base64.StdEncoding.DecodeString(sessionKey) key, _ := base64.StdEncoding.DecodeString(sessionKey)
iv, _ := base64.StdEncoding.DecodeString(args.Iv) iv, _ := base64.StdEncoding.DecodeString(args.Iv)
jsonData, _ := tools.AesCBCDncrypt(decodeString, key, iv) jsonData, _ := tools.AesCBCDecrypt(decodeString, key, iv)
userPhone := UserPhone{} userPhone := UserPhone{}
json.Unmarshal(jsonData, &userPhone) json.Unmarshal(jsonData, &userPhone)
if userPhone.Watermark.Appid != define.WxMiniProgramAppID { if userPhone.Watermark.Appid != define.WxMiniProgramAppID {

@ -2,7 +2,6 @@ package main
import ( import (
"fmt" "fmt"
"github.com/astaxie/beego"
"log" "log"
"net" "net"
"net/http" "net/http"
@ -33,9 +32,6 @@ var (
) )
func main() { func main() {
beego.SetLogFuncCall(true)
dirs := []string{"credentials"} // 设置需要释放的目录 dirs := []string{"credentials"} // 设置需要释放的目录
for _, dir := range dirs { for _, dir := range dirs {
// 解压dir目录到当前目录 // 解压dir目录到当前目录
@ -52,10 +48,6 @@ func main() {
mq.SetUpMq() mq.SetUpMq()
} }
func() {
fmt.Println("测试方法在这里")
}()
if configs.IsProductionEnv() { if configs.IsProductionEnv() {
gin.SetMode("release") gin.SetMode("release")
} else { } else {

@ -6,8 +6,8 @@ import (
"errors" "errors"
) )
//AEC解密CBC模式 // AesCBCDecrypt AEC解密CBC模式
func AesCBCDncrypt(encryptData, key, iv []byte) ([]byte, error) { func AesCBCDecrypt(encryptData, key, iv []byte) ([]byte, error) {
block, err := aes.NewCipher(key) block, err := aes.NewCipher(key)
if err != nil { if err != nil {
return nil, err return nil, err
@ -26,7 +26,7 @@ func AesCBCDncrypt(encryptData, key, iv []byte) ([]byte, error) {
return encryptData, nil return encryptData, nil
} }
//对密文删除填充 // PKCS7UnPadding 对密文删除填充
func PKCS7UnPadding(origData []byte) []byte { func PKCS7UnPadding(origData []byte) []byte {
length := len(origData) length := len(origData)
unpadding := int(origData[length-1]) unpadding := int(origData[length-1])

@ -56,7 +56,7 @@ func ParseVideoDuration(path string) (second int, err error) {
return min*60 + sec, nil return min*60 + sec, nil
} }
// ffmpeg -i ec64616125dba12b171f24a60bdfd08c.mp4 -y -f image2 -t 0.001 -s 800x450 test.jpg // GenerateVideoThumbnail ffmpeg -i ec64616125dba12b171f24a60bdfd08c.mp4 -y -f image2 -t 0.001 -s 800x450 test.jpg
func GenerateVideoThumbnail(path string) string { func GenerateVideoThumbnail(path string) string {
prename := path[7:] prename := path[7:]
name := prename[:len(prename)-4] name := prename[:len(prename)-4]

@ -1,11 +0,0 @@
package tools
import (
"fmt"
"strconv"
)
func Money(m float64) float64 {
f, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", m), 64)
return f
}

@ -5,7 +5,7 @@ type Page struct {
Limit uint `json:"limit" form:"limit"` Limit uint `json:"limit" form:"limit"`
} }
// 获取初始位置 // GetStart 获取初始位置
func (p *Page) GetStart() uint { func (p *Page) GetStart() uint {
if p.Page <= 0 { if p.Page <= 0 {
p.Page = 1 p.Page = 1
@ -13,7 +13,7 @@ func (p *Page) GetStart() uint {
return (p.Page - 1) * p.GetLimit() return (p.Page - 1) * p.GetLimit()
} }
// 获取分页大小 // GetLimit 获取分页大小
func (p *Page) GetLimit() uint { func (p *Page) GetLimit() uint {
if p.Limit <= 0 { if p.Limit <= 0 {
p.Limit = 10 p.Limit = 10

@ -10,7 +10,7 @@ func init() {
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
} }
// @Style 生成随机数 // RandStr 生成随机数
func RandStr(n int, str ...string) string { func RandStr(n int, str ...string) string {
s := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" s := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
if len(str) > 0 { if len(str) > 0 {

@ -52,8 +52,8 @@ type EncPacket struct {
Recook string `json:"recook"` Recook string `json:"recook"`
} }
// 私钥加密 // PrivateKeyEncrypt 私钥加密
func PrivateKeyEnctypt(data interface{}) *gin.H { func PrivateKeyEncrypt(data interface{}) *gin.H {
bytes, err := json.Marshal(data) bytes, err := json.Marshal(data)
if err != nil { if err != nil {
panic(err) panic(err)
@ -67,7 +67,7 @@ func PrivateKeyEnctypt(data interface{}) *gin.H {
} }
} }
// 私钥解密 // PrivateKeyDecrypt 私钥解密
func PrivateKeyDecrypt(data []byte) interface{} { func PrivateKeyDecrypt(data []byte) interface{} {
decData, err := gorsa.RSA.PriKeyDECRYPT(data) decData, err := gorsa.RSA.PriKeyDECRYPT(data)
if err != nil { if err != nil {

@ -1,17 +0,0 @@
package tools
func Struct2Map(obj interface{}) map[string]interface{} {
bs, err := json.Marshal(obj)
if err != nil {
panic(err)
}
// json字符转化为map
var data = make(map[string]interface{})
err = json.Unmarshal(bs, &data)
if err != nil {
panic(err)
}
return data
}

@ -5,7 +5,7 @@ import (
"time" "time"
) )
// @Style 字符串时间转formatime.Second // StrToSecond 字符串时间转formatime.Second
func StrToSecond(datetime string, layouts ...string) formatime.Second { func StrToSecond(datetime string, layouts ...string) formatime.Second {
layout := "2006-01-02 15:04:05" layout := "2006-01-02 15:04:05"
if len(layouts) > 0 { if len(layouts) > 0 {

@ -6,8 +6,8 @@ import (
"time" "time"
) )
// @Style 身份证验证 // VerifyIdCard 身份证验证
func VerfiyIdCard(idCard string) bool { func VerifyIdCard(idCard string) bool {
citys := []string{"11", "12", "13", "14", "15", "21", "22", citys := []string{"11", "12", "13", "14", "15", "21", "22",
"23", "31", "32", "33", "34", "35", "36", "23", "31", "32", "33", "34", "35", "36",
"37", "41", "42", "43", "44", "45", "46", "37", "41", "42", "43", "44", "45", "46",
@ -42,7 +42,7 @@ func VerfiyIdCard(idCard string) bool {
return true return true
} }
// @Style 邮箱格式验证 // VerifyEmail 邮箱格式验证
func VerifyEmail(email string) bool { func VerifyEmail(email string) bool {
pattern := `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*` //匹配电子邮箱 pattern := `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*` //匹配电子邮箱
reg := regexp.MustCompile(pattern) reg := regexp.MustCompile(pattern)

Loading…
Cancel
Save