|
@@ -3,6 +3,7 @@ package NatsServer
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
+ powerlibs "git.baozhida.cn/ERP_libs/Power"
|
|
|
userlibs "git.baozhida.cn/ERP_libs/User"
|
|
|
"github.com/vmihailenco/msgpack/v5"
|
|
|
"time"
|
|
@@ -67,6 +68,30 @@ func (m *NatsImpl) Read_User_List_All() (list []userlibs.User, err error) {
|
|
|
return t_R.Data, 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 {
|
|
|
+ return list, err
|
|
|
+ }
|
|
|
+ type T_R struct {
|
|
|
+ Code int16 `xml:"Code"`
|
|
|
+ Msg string `xml:"Msg"`
|
|
|
+ Data []powerlibs.Power_R `xml:"Data"` // 泛型
|
|
|
+ }
|
|
|
+
|
|
|
+ var t_R T_R
|
|
|
+
|
|
|
+ err = msgpack.Unmarshal(msg.Data, &t_R)
|
|
|
+ if err != nil {
|
|
|
+ return list, err
|
|
|
+ }
|
|
|
+ if t_R.Code != 200 {
|
|
|
+ return list, errors.New(t_R.Msg)
|
|
|
+ }
|
|
|
+
|
|
|
+ return t_R.Data, nil
|
|
|
+}
|
|
|
+
|
|
|
// 添加系统日志
|
|
|
func (m *NatsImpl) AddSysLogs(T_class, T_title string, T_txt interface{}) {
|
|
|
|