小程序
小游戏
企业微信
微信支付
扫描小程序码分享
- 需求的场景描述(希望解决的问题)
想用判断不同的微信号是不是来自同一个IP地址的请求
- 希望提供的能力
云函数能提供类似php一样,可以获取客户端的IP地址
3 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
go版本的云函数没有CLIENTIP字段,求解决:https://github.com/tencentyun/scf-go-lib/blob/master/functioncontext/context.go
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
// FunctionContext is the set of metadata that is passed for every Invoke.
type FunctionContext struct {
RequestID string
InvokedFunctionUnique string
ClientContext ClientContext
Namespace string
FunctionName string
FunctionVersion string
MemoryLimitInMb int32
TimeLimitInMs int32
Environment map[string]string
TencentcloudRegion string
TencentcloudAppID string
TencentcloudUin string
FunctionTrace string
}
// ClientContext is information about the client application passed by the calling application.
type ClientContext struct {
Client ClientApplication
Env map[string]string `json:"env"`
Custom map[string]string `json:"custom"`
// ClientApplication is metadata about the calling application.
type ClientApplication struct {
InstallationID string `json:"installation_id"`
AppTitle string `json:"app_title"`
AppVersionCode string `json:"app_version_code"`
AppPackageName string `json:"app_package_name"`
cloud.getWXContext() 里面有个 CLIENTIP 字段
我网上找了好久都没相关资料,还是自己试了一下,发现的
declare namespace ICloud {
// === API: getWXContext ===
export interface BaseWXContext {
OPENID?: string
APPID?: string
UNIONID?: string
ENV?: string
SOURCE?: string
CLIENTIP?: string
CLIENTIPV6?: string
// === API: logger ===
export class Logger {
log(object: Record<string, any>): void
info(object: Record<string, any>): void
warn(object: Record<string, any>): void
error(object: Record<string, any>): void
大家跳转小程序的时候有没有遇到过这个问题啊?navigateToMiniProgramAppIdList
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
go版本的云函数没有CLIENTIP字段,求解决:https://github.com/tencentyun/scf-go-lib/blob/master/functioncontext/context.go
// FunctionContext is the set of metadata that is passed for every Invoke.
type FunctionContext struct {
RequestID string
InvokedFunctionUnique string
ClientContext ClientContext
Namespace string
FunctionName string
FunctionVersion string
MemoryLimitInMb int32
TimeLimitInMs int32
Environment map[string]string
TencentcloudRegion string
TencentcloudAppID string
TencentcloudUin string
FunctionTrace string
}
// ClientContext is information about the client application passed by the calling application.
type ClientContext struct {
Client ClientApplication
Env map[string]string `json:"env"`
Custom map[string]string `json:"custom"`
}
// ClientApplication is metadata about the calling application.
type ClientApplication struct {
InstallationID string `json:"installation_id"`
AppTitle string `json:"app_title"`
AppVersionCode string `json:"app_version_code"`
AppPackageName string `json:"app_package_name"`
}
cloud.getWXContext() 里面有个 CLIENTIP 字段
我网上找了好久都没相关资料,还是自己试了一下,发现的
declare namespace ICloud {
// === API: getWXContext ===
export interface BaseWXContext {
OPENID?: string
APPID?: string
UNIONID?: string
ENV?: string
SOURCE?: string
CLIENTIP?: string
CLIENTIPV6?: string
}
// === API: logger ===
export class Logger {
log(object: Record<string, any>): void
info(object: Record<string, any>): void
warn(object: Record<string, any>): void
error(object: Record<string, any>): void
}
大家跳转小程序的时候有没有遇到过这个问题啊?navigateToMiniProgramAppIdList