zoie 1 tahun lalu
induk
melakukan
a405af8d03
6 mengubah file dengan 49 tambahan dan 2 penghapusan
  1. 2 1
      Menu/Menu.go
  2. 33 0
      Nats/NatsERP_user.go
  3. 1 1
      Nats/NatsQiniu.go
  4. 1 0
      go.mod
  5. 4 0
      go.sum
  6. 8 0
      lib/libString.go

+ 2 - 1
Menu/Menu.go

@@ -19,6 +19,7 @@ type Menu struct {
 	T_name       string `orm:"size(256);null"`      // 菜单标题
 	T_permission string `orm:"size(256);null"`      // 权限表示
 	T_icon       string `orm:"size(256);null"`      // 图标
+	T_uri        string `orm:"size(256);null"`      // 路径
 	T_type       string `orm:"size(2);null"`        // 菜单类型
 	T_sort       int    `orm:"size(11);default(0)"` // 排序 越小的越靠前,可以为负数
 	T_State      int    `orm:"size(2);default(1)"`  // 0删除 1正常 2共有菜单
@@ -51,7 +52,7 @@ func (m MenuDaoImpl) Read_Menu_List() ([]Menu, error) {
 // 获取权限绑定菜单列表
 func (m *MenuDaoImpl) Read_Menu_List_ByPower_T_Menu(T_menu string) (maps []Menu, err error) {
 	if len(T_menu) == 0 {
-		return 
+		return
 	}
 
 	// 也可以直接使用 Model 结构体作为表名

+ 33 - 0
Nats/NatsERP_user.go

@@ -68,6 +68,39 @@ func (m *NatsImpl) Read_User_List_All() (list []userlibs.User, err error) {
 	return t_R.Data, nil
 }
 
+func (m *NatsImpl) Read_User_List_T_uuid(T_name string, T_uuid_list []string, page, page_z int) (list []userlibs.User, cnt int64, err error) {
+
+	type T_S struct {
+		T_uuid []string
+		T_name string
+		Page   int
+		Page_z int
+	}
+	b, _ := msgpack.Marshal(&T_S{T_uuid: T_uuid_list, T_name: T_name, Page: page, Page_z: page_z})
+
+	msg, err := m.nats.Request("ERP_User_Read_User_List_T_uuid", b, 3*time.Second)
+	if err != nil {
+		return list, cnt, err
+	}
+	type T_R struct {
+		Code      int16           `xml:"Code"`
+		Msg       string          `xml:"Msg"`
+		Data      []userlibs.User `xml:"Data"`
+		Num       int64           `xml:"Num"`
+	}
+	var t_R T_R
+
+	err = msgpack.Unmarshal(msg.Data, &t_R)
+	if err != nil {
+		return list, cnt, err
+	}
+	if t_R.Code != 200 {
+		return list, cnt, errors.New(t_R.Msg)
+	}
+
+	return t_R.Data, t_R.Num, nil
+}
+
 func (m *NatsImpl) Read_Power_List_All() (list []powerlibs.Power_R, err error) {
 	msg, err := m.nats.Request("ERP_User_Read_Power_List_All", []byte(""), 3*time.Second)
 	if err != nil {

+ 1 - 1
Nats/NatsQiniu.go

@@ -73,6 +73,6 @@ func (m *NatsImpl) Qiniu_UploadFile(localFile string, name string) (string, bool
 	if err != nil {
 		return "", false
 	}
-	return Qiniu_Url + name, true
+	return Qiniu_Url + "/" + name, true
 
 }

+ 1 - 0
go.mod

@@ -30,6 +30,7 @@ require (
 	github.com/prometheus/common v0.37.0 // indirect
 	github.com/prometheus/procfs v0.8.0 // indirect
 	github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
+	github.com/shopspring/decimal v1.3.1 // indirect
 	golang.org/x/crypto v0.5.0 // indirect
 	golang.org/x/net v0.5.0 // indirect
 	golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect

+ 4 - 0
go.sum

@@ -271,6 +271,8 @@ github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6po
 github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
 github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 h1:DAYUYH5869yV94zvCES9F51oYtN5oGlwjxJJz7ZCnik=
 github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
+github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
+github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
 github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
 github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
 github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
@@ -290,6 +292,8 @@ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PK
 github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
 github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
 github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
+github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
+github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
 github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
 github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
 github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

+ 8 - 0
lib/libString.go

@@ -3,6 +3,7 @@ package lib
 import (
 	"crypto/md5"
 	"encoding/hex"
+	"github.com/shopspring/decimal"
 	"math/rand"
 	"strconv"
 	"strings"
@@ -122,3 +123,10 @@ func SplitString(str string, cutset string) (r []string) {
 
 	return list
 }
+
+// string转float64保留2位小数
+func StringToFloat64TwoDecimal(str string) float64 {
+	temp, _ := strconv.ParseFloat(str, 64)
+	f, _ := decimal.NewFromFloat(temp).Round(2).Float64()
+	return f
+}