Explorar el Código

lint: interface{} 换 any

kvii hace 1 mes
padre
commit
c8626c0e5d

+ 4 - 3
common/converter.go

@@ -2,11 +2,12 @@ package common
 
 import (
 	"fmt"
-	"github.com/shopspring/decimal"
 	"math"
 	"reflect"
 	"strconv"
 	"strings"
+
+	"github.com/shopspring/decimal"
 )
 
 // string to int
@@ -113,7 +114,7 @@ func DecimalAddFF(v1 float64, v2 float64) float64 {
 	return r
 }
 
-func InterfaceToFloat(unk interface{}) float64 {
+func InterfaceToFloat(unk any) float64 {
 	var floatType = reflect.TypeOf(float64(0))
 	var stringType = reflect.TypeOf("")
 	switch i := unk.(type) {
@@ -160,7 +161,7 @@ func FloatToFloat(f float64) float64 {
 }
 
 // string to Float
-func StrToFloat4(str string) interface{} {
+func StrToFloat4(str string) any {
 	if strings.Contains(str, `*`) {
 		return str
 	} else {

+ 2 - 2
common/login-js/vm.go

@@ -6,7 +6,7 @@ import (
 	"github.com/robertkrimen/otto"
 )
 
-func Js(fn string, args ...interface{}) interface{} {
+func Js(fn string, args ...any) any {
 	vm := otto.New()
 	fullCode := jsCrypto + LoginJs
 	value, err := vm.Run(fullCode)
@@ -22,7 +22,7 @@ func Js(fn string, args ...interface{}) interface{} {
 	return res
 }
 
-func Test2(fn string) interface{} {
+func Test2(fn string) any {
 	vm := otto.New()
 	//fullCode := jsCrypto + Test
 	value, err := vm.Run(Test1)

+ 4 - 3
common/lxhttp/http.go

@@ -6,14 +6,15 @@ import (
 	"crypto/tls"
 	"encoding/base64"
 	"encoding/json"
-	"git.listensoft.net/tool/jspkit/taxerr"
-	"golang.org/x/net/publicsuffix"
 	"io"
 	"net/http"
 	"net/http/cookiejar"
 	"net/url"
 	"strings"
 	"time"
+
+	"git.listensoft.net/tool/jspkit/taxerr"
+	"golang.org/x/net/publicsuffix"
 )
 
 // POSTForm 发送Form表单请求
@@ -71,7 +72,7 @@ func GZIPDecode(in []byte) ([]byte, error) {
 }
 
 // POSTJson 发送json请求
-func POSTJson1(c *http.Client, requrl string, params map[string]interface{}, headers map[string]string) ([]byte, error) {
+func POSTJson1(c *http.Client, requrl string, params map[string]any, headers map[string]string) ([]byte, error) {
 	bytesData, _ := json.Marshal(params)
 	request, err := http.NewRequest("POST", requrl, bytes.NewReader(bytesData))
 	if err != nil {

+ 5 - 5
common/lxhttp/http_tax.go

@@ -148,7 +148,7 @@ func AutoHttp(client *http.Client, uri string, Method string, bytesData []byte,
 	return
 }
 
-func Get_etax_clientId_redirectUri(C *http.Client, Api string, fuc func(url string) (ck []*http.Cookie, uri string)) map[string]interface{} {
+func Get_etax_clientId_redirectUri(C *http.Client, Api string, fuc func(url string) (ck []*http.Cookie, uri string)) map[string]any {
 	Location := ""
 	f := 0
 begin:
@@ -199,7 +199,7 @@ n:
 		goto begin
 	}
 	res := login_js.Js("clientId", Location)
-	return res.(map[string]interface{})
+	return res.(map[string]any)
 }
 
 func VerifyLogin(c *http.Client, area, BaseIndex string, client_id, redirect_uri, new_key16 string, header map[string]string, fuc func(url string) (ck []*http.Cookie, uri string)) string {
@@ -211,7 +211,7 @@ func VerifyLogin(c *http.Client, area, BaseIndex string, client_id, redirect_uri
 		u, _ := url.Parse(uri)
 		c.Jar.SetCookies(u, ck)
 	}
-	n := map[string]interface{}{
+	n := map[string]any{
 		"data": map[string]string{
 			"client_id":    client_id,
 			"redirect_uri": redirect_uri,
@@ -229,10 +229,10 @@ func VerifyLogin(c *http.Client, area, BaseIndex string, client_id, redirect_uri
 		}
 	}
 	/// {"code" : 1000,"msg" : "处理成功!","zipCode" : "0","encryptCode" : "2","datagram" : "610695f2eb65a0eb961cf80c3a69f9777b8282c41fbecf238500d3c670fb8d5298fdcd4929f62c6c601d1a4c07563073","signtype" : "HMacSHA256", "signature" : "8B0CF4EE45C7FF0398BDB0D3946D91960E26017448DC91BE928256DC417307E8","timestamp" : "20241004114508","requestId" : "f551b69773a75535"}
-	var jsonAny2 map[string]interface{}
+	var jsonAny2 map[string]any
 	json.Unmarshal([]byte(jsonAny), &jsonAny2)
 	responseJson := login_js.Js("responseParse", jsonAny2, new_key16)
 	//{"code":"","datagram":"{\"code\":\"3D384374310C458E8DFF9B979E3D8FFB\"}","encryptCode":"2","msg":"处理成功!","requestId":"86ba5db97beff424","signature":"DE3ECA4D94F8C293CDB1695E5648904CACCABCBF998AD2F6188DF2988F67F4D9","signtype":"HMacSHA256","timestamp":"20241004120553","zipCode":"0"}
-	responseJson2 := responseJson.(map[string]interface{})
+	responseJson2 := responseJson.(map[string]any)
 	return gjson.Get(responseJson2["datagram"].(string), "code").String()
 }

+ 13 - 13
common/models/collect.go

@@ -1,8 +1,8 @@
 package models
 
 type CollectionData struct {
-	Err  string      `json:"err"`
-	Data interface{} `json:"data"`
+	Err  string `json:"err"`
+	Data any    `json:"data"`
 }
 
 // 注册信息
@@ -536,17 +536,17 @@ type KJCyqybdb struct {
 
 // 申报清册信息||当月应申报信息
 type Sbqc struct {
-	ZsxmMc string      `json:"zsxmMc"` // 征收项目名称
-	ZspmMc string      `json:"zspmMc"` // 征收品目名称
-	SkssqQ string      `json:"skssqQ"` // 税款所属期起
-	SkssqZ string      `json:"skssqZ"` // 税款所属期止
-	Sbrq   string      `json:"sbrq"`   // 申报日期
-	Sbqx   string      `json:"sbqx"`   // 申报期限
-	Sbzt   SbStatus    `json:"sbzt"`   // 申报状态
-	Jkzt   JkStatus    `json:"jkzt"`   // 缴款状态
-	Pdf    string      `json:"pdf"`    // 采集的pdf路径
-	Data   interface{} `json:"data"`   // 集成的申报数据
-	Error  string      `json:"error"`  // 集成的申报数据的错误信息
+	ZsxmMc string   `json:"zsxmMc"` // 征收项目名称
+	ZspmMc string   `json:"zspmMc"` // 征收品目名称
+	SkssqQ string   `json:"skssqQ"` // 税款所属期起
+	SkssqZ string   `json:"skssqZ"` // 税款所属期止
+	Sbrq   string   `json:"sbrq"`   // 申报日期
+	Sbqx   string   `json:"sbqx"`   // 申报期限
+	Sbzt   SbStatus `json:"sbzt"`   // 申报状态
+	Jkzt   JkStatus `json:"jkzt"`   // 缴款状态
+	Pdf    string   `json:"pdf"`    // 采集的pdf路径
+	Data   any      `json:"data"`   // 集成的申报数据
+	Error  string   `json:"error"`  // 集成的申报数据的错误信息
 }
 
 type SbStatus int //业务状态

+ 105 - 105
common/models/history.go

@@ -192,120 +192,120 @@ type EmInfo1 struct {
 			Sort     int    `json:"sort"`
 		} `json:"departmentList"`
 		StaffList map[string][]struct {
-			StaffId              int         `json:"staff_id"`
-			StaffName            string      `json:"staff_name"`
-			CustomerId           int         `json:"customer_id"`
-			DepartmentId         int         `json:"department_id"`
-			Sex                  int         `json:"sex"`
-			Position             string      `json:"position"`
-			Mobile               string      `json:"mobile"`
-			Email                string      `json:"email"`
-			RegisteredResidence  int         `json:"registered_residence"`
-			IdCard               string      `json:"id_card"`
-			StaffStatus          int         `json:"staff_status"`
-			InductionTime        string      `json:"induction_time"`
-			DepartureTime        string      `json:"departure_time"`
-			TrialStartTime       string      `json:"trial_start_time"`
-			TrialEndTime         string      `json:"trial_end_time"`
-			WagesCardBank        int         `json:"wages_card_bank"`
-			WagesCardBankName    string      `json:"wages_card_bank_name"`
-			WagesCardNumber      string      `json:"wages_card_number"`
-			AuxId                int         `json:"aux_id"`
-			DelFlag              int         `json:"del_flag"`
-			IsAssistant          int         `json:"is_assistant"`
-			UpUser               int         `json:"up_user"`
-			IdentityType         int         `json:"identity_type"`
-			IdentityNumber       string      `json:"identity_number"`
-			IsDisability         int         `json:"is_disability"`
-			IsMartyr             int         `json:"is_martyr"`
-			IsChildless          int         `json:"is_childless"`
-			DisabilityNumber     string      `json:"disability_number"`
-			MartyrNumber         string      `json:"martyr_number"`
-			Passport             string      `json:"passport"`
-			EmployeeNumber       string      `json:"employee_number"`
-			EmploymentType       int         `json:"employment_type"`
-			Nationality          int         `json:"nationality"`
-			EntryTime            string      `json:"entry_time"`
-			LeaveTime            string      `json:"leave_time"`
-			PermanentAddress     string      `json:"permanent_address"`
-			ContactAddress       string      `json:"contact_address"`
-			BirthAddress         string      `json:"birth_address"`
-			TaxpayerIdNumber     string      `json:"taxpayer_id_number"`
-			PayWagesUnit         string      `json:"pay_wages_unit"`
-			PayWagesUnitCode     string      `json:"pay_wages_unit_code"`
-			SpouseSituation      int         `json:"spouse_situation"`
-			SpouseName           string      `json:"spouse_name"`
-			SpouseIdType         int         `json:"spouse_id_type"`
-			SpouseIdNumber       string      `json:"spouse_id_number"`
-			SpecialDeductionYear interface{} `json:"special_deduction_year"`
-			DepartmentName       string      `json:"department_name"`
-			PositionName         string      `json:"position_name"`
-			DeleteStaff          int         `json:"deleteStaff"`
+			StaffId              int    `json:"staff_id"`
+			StaffName            string `json:"staff_name"`
+			CustomerId           int    `json:"customer_id"`
+			DepartmentId         int    `json:"department_id"`
+			Sex                  int    `json:"sex"`
+			Position             string `json:"position"`
+			Mobile               string `json:"mobile"`
+			Email                string `json:"email"`
+			RegisteredResidence  int    `json:"registered_residence"`
+			IdCard               string `json:"id_card"`
+			StaffStatus          int    `json:"staff_status"`
+			InductionTime        string `json:"induction_time"`
+			DepartureTime        string `json:"departure_time"`
+			TrialStartTime       string `json:"trial_start_time"`
+			TrialEndTime         string `json:"trial_end_time"`
+			WagesCardBank        int    `json:"wages_card_bank"`
+			WagesCardBankName    string `json:"wages_card_bank_name"`
+			WagesCardNumber      string `json:"wages_card_number"`
+			AuxId                int    `json:"aux_id"`
+			DelFlag              int    `json:"del_flag"`
+			IsAssistant          int    `json:"is_assistant"`
+			UpUser               int    `json:"up_user"`
+			IdentityType         int    `json:"identity_type"`
+			IdentityNumber       string `json:"identity_number"`
+			IsDisability         int    `json:"is_disability"`
+			IsMartyr             int    `json:"is_martyr"`
+			IsChildless          int    `json:"is_childless"`
+			DisabilityNumber     string `json:"disability_number"`
+			MartyrNumber         string `json:"martyr_number"`
+			Passport             string `json:"passport"`
+			EmployeeNumber       string `json:"employee_number"`
+			EmploymentType       int    `json:"employment_type"`
+			Nationality          int    `json:"nationality"`
+			EntryTime            string `json:"entry_time"`
+			LeaveTime            string `json:"leave_time"`
+			PermanentAddress     string `json:"permanent_address"`
+			ContactAddress       string `json:"contact_address"`
+			BirthAddress         string `json:"birth_address"`
+			TaxpayerIdNumber     string `json:"taxpayer_id_number"`
+			PayWagesUnit         string `json:"pay_wages_unit"`
+			PayWagesUnitCode     string `json:"pay_wages_unit_code"`
+			SpouseSituation      int    `json:"spouse_situation"`
+			SpouseName           string `json:"spouse_name"`
+			SpouseIdType         int    `json:"spouse_id_type"`
+			SpouseIdNumber       string `json:"spouse_id_number"`
+			SpecialDeductionYear any    `json:"special_deduction_year"`
+			DepartmentName       string `json:"department_name"`
+			PositionName         string `json:"position_name"`
+			DeleteStaff          int    `json:"deleteStaff"`
 		} `json:"staffList"`
-		FeeType      []string      `json:"feeType"`
-		CompanyName  string        `json:"companyName"`
-		PositionList []interface{} `json:"positionList"`
+		FeeType      []string `json:"feeType"`
+		CompanyName  string   `json:"companyName"`
+		PositionList []any    `json:"positionList"`
 	} `json:"data"`
 	Code    int    `json:"code"`
 	Message string `json:"message"`
 }
 type EmInfo struct {
 	Data struct {
-		DepartmentList []interface{} `json:"departmentList"`
+		DepartmentList []any `json:"departmentList"`
 		StaffList      [][]struct {
-			StaffId              int         `json:"staff_id"`
-			StaffName            string      `json:"staff_name"`
-			CustomerId           int         `json:"customer_id"`
-			DepartmentId         int         `json:"department_id"`
-			Sex                  int         `json:"sex"`
-			Position             string      `json:"position"`
-			Mobile               string      `json:"mobile"`
-			Email                string      `json:"email"`
-			RegisteredResidence  int         `json:"registered_residence"`
-			IdCard               string      `json:"id_card"`
-			StaffStatus          int         `json:"staff_status"`
-			InductionTime        string      `json:"induction_time"`
-			DepartureTime        string      `json:"departure_time"`
-			TrialStartTime       string      `json:"trial_start_time"`
-			TrialEndTime         string      `json:"trial_end_time"`
-			WagesCardBank        int         `json:"wages_card_bank"`
-			WagesCardBankName    string      `json:"wages_card_bank_name"`
-			WagesCardNumber      string      `json:"wages_card_number"`
-			AuxId                int         `json:"aux_id"`
-			DelFlag              int         `json:"del_flag"`
-			IsAssistant          int         `json:"is_assistant"`
-			UpUser               int         `json:"up_user"`
-			IdentityType         int         `json:"identity_type"`
-			IdentityNumber       string      `json:"identity_number"`
-			IsDisability         int         `json:"is_disability"`
-			IsMartyr             int         `json:"is_martyr"`
-			IsChildless          int         `json:"is_childless"`
-			DisabilityNumber     string      `json:"disability_number"`
-			MartyrNumber         string      `json:"martyr_number"`
-			Passport             string      `json:"passport"`
-			EmployeeNumber       string      `json:"employee_number"`
-			EmploymentType       int         `json:"employment_type"`
-			Nationality          int         `json:"nationality"`
-			EntryTime            string      `json:"entry_time"`
-			LeaveTime            string      `json:"leave_time"`
-			PermanentAddress     string      `json:"permanent_address"`
-			ContactAddress       string      `json:"contact_address"`
-			BirthAddress         string      `json:"birth_address"`
-			TaxpayerIdNumber     string      `json:"taxpayer_id_number"`
-			PayWagesUnit         string      `json:"pay_wages_unit"`
-			PayWagesUnitCode     string      `json:"pay_wages_unit_code"`
-			SpouseSituation      int         `json:"spouse_situation"`
-			SpouseName           string      `json:"spouse_name"`
-			SpouseIdType         int         `json:"spouse_id_type"`
-			SpouseIdNumber       string      `json:"spouse_id_number"`
-			SpecialDeductionYear interface{} `json:"special_deduction_year"`
-			DepartmentName       string      `json:"department_name"`
-			PositionName         string      `json:"position_name"`
-			DeleteStaff          int         `json:"deleteStaff"`
+			StaffId              int    `json:"staff_id"`
+			StaffName            string `json:"staff_name"`
+			CustomerId           int    `json:"customer_id"`
+			DepartmentId         int    `json:"department_id"`
+			Sex                  int    `json:"sex"`
+			Position             string `json:"position"`
+			Mobile               string `json:"mobile"`
+			Email                string `json:"email"`
+			RegisteredResidence  int    `json:"registered_residence"`
+			IdCard               string `json:"id_card"`
+			StaffStatus          int    `json:"staff_status"`
+			InductionTime        string `json:"induction_time"`
+			DepartureTime        string `json:"departure_time"`
+			TrialStartTime       string `json:"trial_start_time"`
+			TrialEndTime         string `json:"trial_end_time"`
+			WagesCardBank        int    `json:"wages_card_bank"`
+			WagesCardBankName    string `json:"wages_card_bank_name"`
+			WagesCardNumber      string `json:"wages_card_number"`
+			AuxId                int    `json:"aux_id"`
+			DelFlag              int    `json:"del_flag"`
+			IsAssistant          int    `json:"is_assistant"`
+			UpUser               int    `json:"up_user"`
+			IdentityType         int    `json:"identity_type"`
+			IdentityNumber       string `json:"identity_number"`
+			IsDisability         int    `json:"is_disability"`
+			IsMartyr             int    `json:"is_martyr"`
+			IsChildless          int    `json:"is_childless"`
+			DisabilityNumber     string `json:"disability_number"`
+			MartyrNumber         string `json:"martyr_number"`
+			Passport             string `json:"passport"`
+			EmployeeNumber       string `json:"employee_number"`
+			EmploymentType       int    `json:"employment_type"`
+			Nationality          int    `json:"nationality"`
+			EntryTime            string `json:"entry_time"`
+			LeaveTime            string `json:"leave_time"`
+			PermanentAddress     string `json:"permanent_address"`
+			ContactAddress       string `json:"contact_address"`
+			BirthAddress         string `json:"birth_address"`
+			TaxpayerIdNumber     string `json:"taxpayer_id_number"`
+			PayWagesUnit         string `json:"pay_wages_unit"`
+			PayWagesUnitCode     string `json:"pay_wages_unit_code"`
+			SpouseSituation      int    `json:"spouse_situation"`
+			SpouseName           string `json:"spouse_name"`
+			SpouseIdType         int    `json:"spouse_id_type"`
+			SpouseIdNumber       string `json:"spouse_id_number"`
+			SpecialDeductionYear any    `json:"special_deduction_year"`
+			DepartmentName       string `json:"department_name"`
+			PositionName         string `json:"position_name"`
+			DeleteStaff          int    `json:"deleteStaff"`
 		} `json:"staffList"`
-		FeeType      []string    `json:"feeType"`
-		CompanyName  string      `json:"companyName"`
-		PositionList interface{} `json:"positionList"`
+		FeeType      []string `json:"feeType"`
+		CompanyName  string   `json:"companyName"`
+		PositionList any      `json:"positionList"`
 	} `json:"data"`
 	Code    int    `json:"code"`
 	Message string `json:"message"`

+ 3 - 2
common/models/task.go

@@ -2,9 +2,10 @@ package models
 
 import (
 	"context"
+	"net/http"
+
 	variable2 "git.listensoft.net/tool/jspkit/common/variable"
 	"github.com/go-rod/rod"
-	"net/http"
 )
 
 type Result struct {
@@ -18,7 +19,7 @@ type Result struct {
 	BusinessLog    string              `json:"b·usinessLog"`   //业务有错误时返回的提示语
 	Amount         float64             `json:"amount"`         //申报金额
 	AmountPaid     float64             `json:"amountPaid"`     //已扣款金额
-	Data           interface{}         `json:"data"`           //采集的数据
+	Data           any                 `json:"data"`           //采集的数据
 	RobotName      string              `json:"robotName"`      // 执行的机器人名称
 	CwbbDb         bool                // 财报代办已申报过
 }

+ 1 - 1
logger/logger.go

@@ -116,7 +116,7 @@ func Debug(msg string, fields ...zap.Field) {
 //	func Info(msg string, fields ...zap.Field) {
 //		logger.Info(msg, fields...)
 //	}
-func Info(args ...interface{}) {
+func Info(args ...any) {
 	logger.Info(strings.Join([]string{fmt.Sprintf("%v", args...)}, " "))
 }
 

+ 3 - 3
login/base.go

@@ -58,9 +58,9 @@ type SessionInfo struct {
 		Mobile     string `json:"mobile"`
 		Creditcode string `json:"creditcode"`
 		Logininfo  struct {
-			Cookies      map[string]string      `json:"cookies"`
-			LocalStorage map[string]string      `json:"localStorage"`
-			UserInfo     map[string]interface{} `json:"userInfo"`
+			Cookies      map[string]string `json:"cookies"`
+			LocalStorage map[string]string `json:"localStorage"`
+			UserInfo     map[string]any    `json:"userInfo"`
 		} `json:"logininfo"`
 		Status    string `json:"status"`
 		Inuse     string `json:"inuse"`

+ 5 - 4
login/ckLogin.go

@@ -5,6 +5,10 @@ import (
 	"encoding/base64"
 	"encoding/json"
 	"fmt"
+	"log"
+	"strings"
+	"time"
+
 	"git.listensoft.net/tool/jspkit/common"
 	"git.listensoft.net/tool/jspkit/common/models"
 	"git.listensoft.net/tool/jspkit/logger"
@@ -14,9 +18,6 @@ import (
 	"github.com/go-rod/rod/lib/proto"
 	"github.com/go-rod/rod/lib/utils"
 	"github.com/tidwall/gjson"
-	"log"
-	"strings"
-	"time"
 )
 
 func CheckSessionAndLogin(ctx context.Context, p *rod.Page, BaseUri string, info models.CompanyInfo) (err error) {
@@ -375,7 +376,7 @@ func AutoCheckSessionAndLogin(ctx context.Context, p *rod.Page, BaseUri string,
 	return
 }
 
-func AesECBEncrypt(data map[string]interface{}) []byte {
+func AesECBEncrypt(data map[string]any) []byte {
 	jsonData, _ := json.Marshal(data)
 	fmt.Println(string(jsonData))
 	padded := make([]byte, 16)

+ 7 - 6
login/method.go

@@ -4,6 +4,11 @@ import (
 	"context"
 	"crypto/tls"
 	"fmt"
+	"net/http"
+	"net/url"
+	"strings"
+	"time"
+
 	"git.listensoft.net/tool/jspkit/common"
 	"git.listensoft.net/tool/jspkit/common/lxhttp"
 	"git.listensoft.net/tool/jspkit/common/models"
@@ -13,14 +18,10 @@ import (
 	"github.com/go-rod/rod/lib/proto"
 	"github.com/go-rod/rod/lib/utils"
 	"github.com/tidwall/gjson"
-	"net/http"
-	"net/url"
-	"strings"
-	"time"
 )
 
 // MakeLoginData 生成登录信息
-func MakeLoginData(ctx context.Context, info models.CompanyInfo) (jsonData map[string]interface{}) {
+func MakeLoginData(ctx context.Context, info models.CompanyInfo) (jsonData map[string]any) {
 	loginMethod := "QRCODE"
 	TaxNo := info.TaxNo
 	if info.Dlfs == "代理登录" {
@@ -54,7 +55,7 @@ func MakeLoginData(ctx context.Context, info models.CompanyInfo) (jsonData map[s
 		loginType = "DAILI"
 		TaxNo = info.IdNo
 	}
-	jsonData = map[string]interface{}{
+	jsonData = map[string]any{
 		"userInfo": map[string]string{
 			"ComName":          info.ComName,
 			"Name":             info.Area + ".pro",