Skip to content

Commit

Permalink
final refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MickMake committed Feb 17, 2022
1 parent d6a95ce commit d1eb8b4
Show file tree
Hide file tree
Showing 265 changed files with 802 additions and 26,682 deletions.
212 changes: 101 additions & 111 deletions .idea/workspace.xml

Large diffs are not rendered by default.

59 changes: 24 additions & 35 deletions cmd/cmd_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ package cmd

import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/sungro/AppService/getPowerDevicePointNames"
"GoSungro/iSolarCloud/sungro/AppService/login"
"fmt"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -89,39 +87,30 @@ func cmdApiGetFunc(cmd *cobra.Command, args []string) {
args[1] = "AppService"
}

// foo := AppService.Init()
// bar := foo.GetEndPoints()
// fmt.Printf("%v\n", bar)

hey1 := SunGro.GetEndpoint(args[1], args[0])
_ = hey1.SetRequest(login.Request {
Appkey: Cmd.ApiAppKey,
SysCode: "600",
UserAccount: "",
UserPassword: "",
})
a := SunGro.ApiRoot.Get(hey1)
fmt.Printf("resp: %v\n", a)

hey := SunGro.GetEndpoint(args[1], args[0])
_ = hey.SetRequest(getPowerDevicePointNames.Request {
RequestCommon: api.RequestCommon {
Appkey: Cmd.ApiAppKey,
Lang: "_en_US",
SysCode: "200",
Token: SunGro.GetToken(),
UserID: "",
ValidFlag: "",
},
DeviceType: "",
})
r := SunGro.ApiRoot.Get(hey1)
fmt.Printf("resp: %v\n", r)

fmt.Printf("HEY:%v\n", hey)
fmt.Printf("HEY:%v\n", hey.GetError())
fmt.Printf("HEY:%s\n", hey.GetRequestJson())
fmt.Printf("HEY:%s\n", hey.GetData())
hey1 := SunGro.GetEndpoint("AppService", "getPowerDevicePointNames")
if hey1.IsError() {
Cmd.Error = hey1.GetError()
break
}

hey1 = hey1.SetRequest(getPowerDevicePointNames.RequestData{ DeviceType: "1" })
if hey1.IsError() {
Cmd.Error = hey1.GetError()
break
}

hey1 = hey1.Call()
if hey1.IsError() {
Cmd.Error = hey1.GetError()
break
}
fmt.Printf("resp: %v\n", hey1)


fmt.Printf("HEY:%v\n", hey1)
fmt.Printf("HEY:%v\n", hey1.GetError())
fmt.Printf("HEY:%s\n", hey1.GetRequestJson())
fmt.Printf("HEY:%s\n", hey1.GetData())
if Cmd.Error != nil {
break
}
Expand Down
21 changes: 0 additions & 21 deletions cmd/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,6 @@ func (ca *CommandArgs) ProcessArgs(cmd *cobra.Command, args []string) error {
break
}

// auth := login.Request {
// Appkey: Cmd.ApiAppKey,
// SysCode: "600",
// UserAccount: ca.ApiUsername,
// UserPassword: ca.ApiPassword,
// }
// // auth := login.SunGroAuth {
// // Expiry: ca.ApiTokenExpiry,
// // AppKey: ca.ApiAppKey,
// // UserAccount: ca.ApiUsername,
// // UserPassword: ca.ApiPassword,
// // }
// hey1 := SunGro.GetEndpoint(AppService.GetAreaName(), "login")
// hey1 = hey1.SetRequest(auth)
// ca.Error = hey1.GetError()
// if ca.Error != nil {
// break
// }
// r, _ := SunGro.ApiRoot.Get(hey1)
// fmt.Printf("resp: %v\n", r)

if SunGro.HasTokenChanged() {
ca.ApiTokenExpiry = SunGro.GetTokenExpiry()
ca.ApiToken = SunGro.GetToken()
Expand Down
2 changes: 1 addition & 1 deletion google/sheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *Sheet) getClient() (*http.Client, error) {
return ret, err
}

// Request a token from the web, then returns the retrieved token.
// RequestCommon a token from the web, then returns the retrieved token.
func (s *Sheet) getTokenFromWeb() error {
var err error

Expand Down
123 changes: 0 additions & 123 deletions iSolarCloud/OLD/agent/agent.go

This file was deleted.

0 comments on commit d1eb8b4

Please sign in to comment.