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 }