37 lines
969 B
Go
37 lines
969 B
Go
|
|
package gas
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/url"
|
||
|
|
|
||
|
|
"git.apinb.com/bsm-sdk/core/infra"
|
||
|
|
"git.apinb.com/heqiapp/platforms/backend/api/internal/config"
|
||
|
|
"github.com/gin-gonic/gin"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ListMenu 返回 admin 角色的静态菜单。
|
||
|
|
func ListMenu(ctx *gin.Context) {
|
||
|
|
account, _, ok := CurrentGasAccount(ctx)
|
||
|
|
if !ok {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
list := MenusForRole(account.RoleCode)
|
||
|
|
infra.Response.Success(ctx, gin.H{"total": len(list), "list": list})
|
||
|
|
}
|
||
|
|
|
||
|
|
// InvitationQRCode 返回根据当前气站 identity 动态生成的注册链接数据。
|
||
|
|
func InvitationQRCode(ctx *gin.Context) {
|
||
|
|
_, station, ok := CurrentGasAccount(ctx)
|
||
|
|
if !ok {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
registerURL, _ := url.Parse(config.Spec.Global.UserRegisterURL)
|
||
|
|
query := registerURL.Query()
|
||
|
|
query.Set("gas_identity", station.Identity)
|
||
|
|
registerURL.RawQuery = query.Encode()
|
||
|
|
infra.Response.Success(ctx, gin.H{
|
||
|
|
"gas_basic_identity": station.Identity,
|
||
|
|
"gas_basic_name": station.Name,
|
||
|
|
"register_url": registerURL.String(),
|
||
|
|
})
|
||
|
|
}
|