123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package kefu
-
- import (
- base_ctl "SCRM/controllers"
- "SCRM/enums"
- "SCRM/service/tencentim_service"
- "SCRM/utils"
- "strconv"
-
- "github.com/astaxie/beego"
- )
-
- type TencentUsersigApiController struct {
- base_ctl.BaseAuthAPIController
- }
-
- func TencentUsersigApiRegistRouters() {
- beego.Router("/api/tencent/usersig", &TencentUsersigApiController{}, "get:GetUsersig")
-
- }
-
- //GetUsersig 签名
- func (c *TencentUsersigApiController) GetUsersig() {
-
- adminUserInfo := c.GetAdminUserInfo()
-
- adminId := adminUserInfo.AdminUser.Id
- Indentifier := "Org_" + strconv.FormatInt(adminUserInfo.CurrentOrgId, 10)
- appIDAt3rd := Indentifier
- sig, err := tencentim_service.CreateUserSig(Indentifier, appIDAt3rd)
- if err != nil {
- utils.ErrorLog("usersig err : %v", err)
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
-
- orgInfo := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
- IdentifierNick := ""
- HeadURL := "http://jk.kuyicloud.com/static/images/ico_gjh.png"
- if orgInfo != nil {
- if len(orgInfo.OrgName) > 0 {
- IdentifierNick = orgInfo.OrgName
- }
- if len(orgInfo.OrgLogo) > 0 {
- HeadURL = orgInfo.OrgLogo
- }
- }
-
- returnData := map[string]interface{}{
- "sig": sig,
- "adminId": adminId,
- "Indentifier": Indentifier,
- "appIDAt3rd": appIDAt3rd,
- "IdentifierNick": IdentifierNick,
- "HeadURL": HeadURL,
- "sdkAppID": tencentim_service.ThisSDKAppId,
- "accountType": tencentim_service.ThisAccType,
- "selToAdmin": "AdminKeFu",
- }
-
- c.ServeSuccessJSON(returnData)
- return
- }
-
|