fix: 订阅模式登录验证、永久会员类型区分、动态代码HTTP返回值修复、侧边栏滚动位置保持
- 修复订阅模式登录时错误检查余额的问题 - 区分无限余额和永久订阅两种永久会员类型 - 修复动态代码HTTP请求返回值在JS中无法正确访问的问题 - 添加侧边栏滚动位置保持功能 - 移除developer角色相关代码,统一使用admin - 添加缺失的i18n翻译key
This commit is contained in:
@@ -250,19 +250,35 @@ func handleExecuteDynamicCode(c *gin.Context) {
|
||||
|
||||
httpClient := httputil.NewHTTPClient(10 * time.Second)
|
||||
httpObj := map[string]interface{}{
|
||||
"get": func(url string, headers map[string]interface{}) *httputil.HTTPResponse {
|
||||
"get": func(url string, headers map[string]interface{}) map[string]interface{} {
|
||||
convertedHeaders := make(map[string]string)
|
||||
for k, v := range headers {
|
||||
convertedHeaders[k] = fmt.Sprintf("%v", v)
|
||||
}
|
||||
return httpClient.Get(url, convertedHeaders)
|
||||
resp := httpClient.Get(url, convertedHeaders)
|
||||
return map[string]interface{}{
|
||||
"statusCode": resp.StatusCode,
|
||||
"status": resp.Status,
|
||||
"headers": resp.Headers,
|
||||
"body": resp.Body,
|
||||
"json": resp.JSON,
|
||||
"error": resp.Error,
|
||||
}
|
||||
},
|
||||
"post": func(url string, headers map[string]interface{}, body interface{}) *httputil.HTTPResponse {
|
||||
"post": func(url string, headers map[string]interface{}, body interface{}) map[string]interface{} {
|
||||
convertedHeaders := make(map[string]string)
|
||||
for k, v := range headers {
|
||||
convertedHeaders[k] = fmt.Sprintf("%v", v)
|
||||
}
|
||||
return httpClient.Post(url, convertedHeaders, body)
|
||||
resp := httpClient.Post(url, convertedHeaders, body)
|
||||
return map[string]interface{}{
|
||||
"statusCode": resp.StatusCode,
|
||||
"status": resp.Status,
|
||||
"headers": resp.Headers,
|
||||
"body": resp.Body,
|
||||
"json": resp.JSON,
|
||||
"error": resp.Error,
|
||||
}
|
||||
},
|
||||
}
|
||||
if err := vm.Set("http", httpObj); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user