42 lines
757 B
Go
42 lines
757 B
Go
package utility
|
|
|
|
import "github.com/gin-gonic/gin"
|
|
|
|
const (
|
|
ACCOUNT_ID_KEY = "X-Consumer-Custom-ID"
|
|
SDK_KEY_SIGNAL = "mop-sdk-key"
|
|
SDKKEY_VER_HEADER_KEY = "mop-sdk-version"
|
|
)
|
|
|
|
const (
|
|
MenuCreatedKey = "mop_app_manage_menu_has_created_key"
|
|
MenuCreatedValue = "ok"
|
|
)
|
|
|
|
//工具函数
|
|
|
|
func GetUserId(c *gin.Context) string {
|
|
userId := c.GetHeader("x-mop-fcid")
|
|
if userId == "" {
|
|
userId = c.GetHeader("X-Consumer-Custom-ID")
|
|
}
|
|
return userId
|
|
}
|
|
|
|
func GetSdkKey(c *gin.Context) string {
|
|
return c.GetHeader(SDK_KEY_SIGNAL)
|
|
}
|
|
|
|
func GetSdkKeyVer(c *gin.Context) string {
|
|
return c.GetHeader(SDKKEY_VER_HEADER_KEY)
|
|
}
|
|
|
|
func InArry(s string, arry []string) bool {
|
|
for _, v := range arry {
|
|
if v == s {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|