Skip to content

Commit

Permalink
refactor(js): correct initialization of Config in GetConfig method
Browse files Browse the repository at this point in the history
- Removed redundant initialization of the Config variable and ensured it is instantiated correctly before use.
- This change improves code clarity and maintains the intended functionality of the GetConfig method.
  • Loading branch information
mahongran committed Jan 14, 2025
1 parent 0828c2c commit df83b1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion officialaccount/js/js.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func (js *Js) SetJsTicketHandle(ticketHandle credential.JsTicketHandle) {
// GetConfig 获取jssdk需要的配置参数
// uri 为当前网页地址
func (js *Js) GetConfig(uri string) (config *Config, err error) {
config = new(Config)
var accessToken string
accessToken, err = js.GetAccessToken()
if err != nil {
Expand All @@ -54,6 +53,7 @@ func (js *Js) GetConfig(uri string) (config *Config, err error) {
timestamp := util.GetCurrTS()
str := fmt.Sprintf("jsapi_ticket=%s&noncestr=%s&timestamp=%d&url=%s", ticketStr, nonceStr, timestamp, uri)
sigStr := util.Signature(str)
config = new(Config)
config.AppID = js.AppID
config.NonceStr = nonceStr
config.Timestamp = timestamp
Expand Down

0 comments on commit df83b1b

Please sign in to comment.