From efdd0b5fc2ebf458df46b573342b4e2c4a47c31f Mon Sep 17 00:00:00 2001 From: hreenshan112 Date: Tue, 5 Nov 2024 08:48:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/shiyan/maptostruct/shiyan.go | 26 +++ api/version1/customerApp/runAppControll.go | 212 ++++++++++++++++++ api/version1/customerApp/type.go | 45 ++++ .../taskplatform/taskflow/appTaskFlow.go | 1 + api/version1/taskplatform/taskflow/types.go | 1 + api/version1/workWechat/type.go | 17 ++ api/version1/workWechat/wechat.go | 201 +++++++++++++++++ apirouter/apishiyan/maptostruct.go | 2 + apirouter/v1/customerformrouter/router.go | 46 ++-- apirouter/v1/workWechatRouter/router.go | 2 + config/configApp/server.go | 2 + 11 files changed, 533 insertions(+), 22 deletions(-) diff --git a/api/shiyan/maptostruct/shiyan.go b/api/shiyan/maptostruct/shiyan.go index 8c58cfc..88b49f6 100644 --- a/api/shiyan/maptostruct/shiyan.go +++ b/api/shiyan/maptostruct/shiyan.go @@ -3,6 +3,7 @@ package maptostruct import ( "appPlatform/api/version1/customerform" "appPlatform/api/version1/taskplatform/taskflow" + "appPlatform/api/version1/workWechat" "appPlatform/models/modelAppPlatform" "appPlatform/models/modelshr" "appPlatform/models/modelsschool" @@ -815,3 +816,28 @@ func (a *ApiMethod) DelZhuanXiang(c *gin.Context) { } publicmethod.Result(0, delKey, c) } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-10-23 16:51:30 +@ 功能: 测试通过企业微信获取人员 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) SetUpWorkWatch(c *gin.Context) { + wechatCont, err := workWechat.SetUpWechatInfo("KaiXinGuo") + send := publicmethod.MapOut[string]() + send["err"] = err + send["wechatCont"] = wechatCont + publicmethod.Result(0, send, c) +} diff --git a/api/version1/customerApp/runAppControll.go b/api/version1/customerApp/runAppControll.go index c7fa33c..38626a2 100644 --- a/api/version1/customerApp/runAppControll.go +++ b/api/version1/customerApp/runAppControll.go @@ -1,10 +1,13 @@ package customerApp import ( + "appPlatform/models/customerForm" "appPlatform/models/modelAppPlatform" "appPlatform/models/modelshr" "appPlatform/overall" "appPlatform/overall/publicmethod" + "fmt" + "sort" "strconv" "strings" @@ -224,3 +227,212 @@ func (t *TreeJwtPower) JwtRoleViewsIsTrue(jwpRoel, userRole string) { } } } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-10-31 13:33:16 +@ 功能: 获取此应用的所有表单 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) GetAllAppTableForm(c *gin.Context) { + var requestData GainAppForm + c.ShouldBindJSON(&requestData) + if requestData.Id == "" { + publicmethod.Result(102, requestData, c) + return + } + if requestData.Types == 0 { + requestData.Types = 1 + } + if requestData.Page == 0 { + requestData.Page = 1 + } + if requestData.PageSize == 0 { + if requestData.Types != 2 { + requestData.PageSize = 20 + } else { + requestData.PageSize = 6 + } + } + var appMenusList []SendAppForm + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.Appmenus{}).Where("`state` = 1 AND `type` = 2 AND `isLock` = 2 AND `appkey` = ?", requestData.Id) + if requestData.Types == 2 { + gormDb = gormDb.Where("`wapIsShow` = ?", 1) + } else { + gormDb = gormDb.Where("`pcIsShow` = ?", 1) + } + var total int64 + totalErr := gormDb.Count(&total).Error + if totalErr != nil { + total = 0 + } + gormDb = publicmethod.PageTurningSettings(gormDb, requestData.Page, requestData.PageSize) + gormDb.Order("`sort` DESC").Find(&appMenusList) + for i, v := range appMenusList { + + appMenusList[i].IdStr = strconv.FormatInt(v.Id, 10) + appMenusList[i].AppkStr = strconv.FormatInt(v.Appkey, 10) + appMenusList[i].ParentStr = strconv.FormatInt(v.Parent, 10) + appMenusList[i].CreaterStr = strconv.FormatInt(v.Creater, 10) + + var tableFormInfo modelAppPlatform.CustomerFormView + err := tableFormInfo.GetCont(map[string]interface{}{"`status`": 1, "`signCode`": v.Id}, "`id`", "`cfid`", "`time`", "`icon`", "`listjson`") + if err == nil { + if tableFormInfo.ListJson != "" { + appMenusList[i].IsList = true + } else { + appMenusList[i].IsList = false + } + appMenusList[i].VersionId = strconv.FormatInt(tableFormInfo.Id, 10) + appMenusList[i].TableId = strconv.FormatInt(tableFormInfo.CfId, 10) + var usInfo modelshr.PersonArchives //获取创建人 + usInfo.GetCont(map[string]interface{}{"`key`": v.Creater}, "`name`", "`number`") + appMenusList[i].Founder = fmt.Sprintf("%v(%v)", usInfo.Name, usInfo.Number) + appMenusList[i].CreateDate = publicmethod.UnixTimeToDay(tableFormInfo.CreaterTime, 14) + appMenusList[i].Icon = tableFormInfo.Icon + } + } + + publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(appMenusList)), appMenusList, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-10-31 15:38:32 +@ 功能: 计算待办事宜,已办事宜,我创建的,抄送我的数量 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) CalculateQuantityOption(c *gin.Context) { + var requestData AppIdType + err := c.ShouldBindJSON(&requestData) + if err != nil { + publicmethod.Result(100, err, c) + return + } + if requestData.Id == "" { + publicmethod.Result(102, err, c) + return + } + context, _ := c.Get(overall.MyContJwt) + var userCont modelshr.ManCont + userCont.GetLoginCont(context) //当前操作人 + var taskItem []modelAppPlatform.Appmenus + gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.Appmenus{}).Where("`isLock` = 1 AND `type` = 2 AND `state` = 1 AND `appkey` = ?", requestData.Id) + if requestData.Types == 2 { + gormDb = gormDb.Where("`wapIsShow` = 1") + } else { + gormDb = gormDb.Where("`pcIsShow` = 1") + } + gormDb.Order("`sort` ASC").Find(&taskItem) + var StatisTaskPage StatisTaskCount + StatisTaskPage.userCont = userCont + for _, v := range taskItem { + StatisTaskPage.Types = v.IsMain + syncSeting.Add(1) + go StatisTaskPage.GetTotalPAge(requestData.Id, v.IsMain) + } + syncSeting.Wait() + var sendData []SendStatisInfo + for i, v := range taskItem { + var sendInfo SendStatisInfo + sendInfo.Lable = v.Label + sendInfo.Icon = v.Svg + sendInfo.Sort = v.IsMain + switch v.IsMain { + case 1: //待办事宜 + sendInfo.Count = StatisTaskPage.ToDoCount + case 2: //已办事宜 + sendInfo.Count = StatisTaskPage.AlreadyDoneCount + case 5: //草稿箱 + sendInfo.Count = StatisTaskPage.DraftsCount + case 3: //抄送我的 + sendInfo.Count = StatisTaskPage.CopyForCount + default: //我的请求 + sendInfo.Count = StatisTaskPage.MyCreateCount + } + if i < 4 { + sendData = append(sendData, sendInfo) + } + + } + sort.Slice(sendData, func(i, j int) bool { + return sendData[i].Sort < sendData[j].Sort + }) + publicmethod.Result(0, sendData, c) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-10-31 15:48:44 +@ 功能: 协程处理数据 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (s *StatisTaskCount) GetTotalPAge(appk string, types int) { + defer syncSeting.Done() + // fmt.Printf("s.Types:%v\n", types) + gormDb := overall.CONSTANT_DB_CustomerForm.Model(&customerForm.RunFlowTask{}).Select("`id`").Where("appKey = ?", appk) + gormDbEs := overall.CONSTANT_DB_CustomerForm.Model(&customerForm.TaskRecord{}).Select("`id`").Where("appKey = ?", appk) + switch types { + case 1: //待办事宜 + gormDb = gormDb.Where("`status` = 3 AND FIND_IN_SET(?,`next_executor`)", s.userCont.Key) + case 2: //已办事宜 + gormDb = gormDb.Where("`status` IN (2,3,4) AND FIND_IN_SET(?,`participants`) AND NOT FIND_IN_SET(?,`next_executor`) AND `creater` <> ?", s.userCont.Key, s.userCont.Key, s.userCont.Key) + case 5: //草稿箱 + gormDb = gormDb.Where("`status` = 1 AND `creater` = ?", s.userCont.Key) + gormDbEs = gormDbEs.Where("`status` = 1 AND `creater` = ?", s.userCont.Key) + case 3: //抄送我的 + // gormDb = gormDb.Where("`status` IN (2,3,4) AND FIND_IN_SET(?,`makeCopy`)", s.userCont.Key) + default: //我的请求 + // gormDb = gormDb.Where("`status` IN (1,2,3,4) AND `creater` = ?", s.userCont.Key) + gormDbEs = gormDbEs.Where("`status` IN (1,2,3,4) AND `creater` = ?", s.userCont.Key) + } + var total int64 + var totales int64 + gormDb.Count(&total) + gormDbEs.Count(&totales) + switch types { + case 1: //待办事宜 + s.ToDoCount = total + case 2: //已办事宜 + s.AlreadyDoneCount = total + case 5: //草稿箱 + s.DraftsCount = totales + case 3: //抄送我的 + s.CopyForCount = total + default: //我的请求 + s.MyCreateCount = totales + } +} diff --git a/api/version1/customerApp/type.go b/api/version1/customerApp/type.go index 0335c63..1a0d943 100644 --- a/api/version1/customerApp/type.go +++ b/api/version1/customerApp/type.go @@ -3,6 +3,7 @@ package customerApp import ( "appPlatform/api/version1/publicapi" "appPlatform/models/modelAppPlatform" + "appPlatform/models/modelshr" "appPlatform/overall/publicmethod" "sync" @@ -177,3 +178,47 @@ type TreeJwtPower struct { Org bool People bool } + +type AppIdType struct { + publicmethod.PublicId + Types int `json:"type"` // 1:pc,2:web +} + +// 获取应用表单 +type GainAppForm struct { + publicmethod.PagesTurn + AppIdType +} +type SendAppForm struct { + modelAppPlatform.Appmenus + Founder string `json:"founder" gorm:"-"` //创始人 + CreateDate string `json:"createDate" gorm:"-"` //创建时间 + VersionId string `json:"versionId" gorm:"-"` //当前激活版本ID + Icon string `json:"icon" gorm:"-"` //图标 + TableId string `json:"tableId" gorm:"-"` // + + IdStr string `json:"idStr" gorm:"-"` // + AppkStr string `json:"appKeyStr" gorm:"-"` // + ParentStr string `json:"parentKeyStr" gorm:"-"` // + CreaterStr string `json:"createrStr" gorm:"-"` // + IsList bool `json:"isList" gorm:"-"` // +} + +// 统计任务数量 +type StatisTaskCount struct { + userCont modelshr.ManCont + Types int // 1:代办事宜;2:已办事宜;3:抄送我的;4:我创建的;5:草稿箱 + MyCreateCount int64 //我创建 + ToDoCount int64 //待办事项 + AlreadyDoneCount int64 //已办事项 + CopyForCount int64 //抄送我的 + DraftsCount int64 //草稿箱 +} + +// 输出任务统计蓝 +type SendStatisInfo struct { + Lable string `json:"lable"` + Icon string `json:"icon"` + Count int64 `json:"count"` + Sort int `json:"sort"` +} diff --git a/api/version1/taskplatform/taskflow/appTaskFlow.go b/api/version1/taskplatform/taskflow/appTaskFlow.go index a9f3e2e..987b3e9 100644 --- a/api/version1/taskplatform/taskflow/appTaskFlow.go +++ b/api/version1/taskplatform/taskflow/appTaskFlow.go @@ -177,6 +177,7 @@ func (a *ApiMethod) GainAppAllTaskList(c *gin.Context) { } overall.CONSTANT_DB_CustomerForm.Model(&customerForm.TaskRecord{}).Where("`id` IN ?", idAry).Order("`id` desc").Find(&userList) for i := 0; i < len(userList); i++ { + userList[i].States = userList[i].Status userList[i].IdStr = strconv.FormatInt(userList[i].Id, 10) userList[i].CreaterTimeStr = publicmethod.UnixTimeToDay(userList[i].CreaterTime, 27) userList[i].RunFlowIdStr = strconv.FormatInt(userList[i].RunFlowId, 10) diff --git a/api/version1/taskplatform/taskflow/types.go b/api/version1/taskplatform/taskflow/types.go index 9fe145d..da38da9 100644 --- a/api/version1/taskplatform/taskflow/types.go +++ b/api/version1/taskplatform/taskflow/types.go @@ -359,4 +359,5 @@ type SendTaskInfo struct { AppKeyStr string `json:"appKeyStr" gorm:"-"` IsRetract bool `json:"isRetract" gorm:"-"` RunFlowIdStr string `json:"runFlowIdStr" gorm:"-"` + States int `json:"statesing" gorm:"-"` } diff --git a/api/version1/workWechat/type.go b/api/version1/workWechat/type.go index c0fdba4..2a5f9f8 100644 --- a/api/version1/workWechat/type.go +++ b/api/version1/workWechat/type.go @@ -1,6 +1,7 @@ package workWechat import ( + "appPlatform/models/modelshr" "appPlatform/overall/publicmethod" "github.com/gin-gonic/gin" @@ -41,3 +42,19 @@ type SendPower struct { Level int `json:"level"` //调查人权限范围 Purview []string `json:"purview"` //被调查人 } + +// 企业微信身份认证 +type WorkWechatUserAuter struct { + RevokeMsgSendCallBack + Userid string `json:"userid"` // 成员UserID。若需要获得用户详情信息,可调用通讯录接口:读取成员。如果是互联企业/企业互联/上下游,则返回的UserId格式如:CorpId/userid + UserTicket string `json:"user_ticket"` //成员票据,最大为512字节,有效期为1800s。scope为snsapi_privateinfo,且用户在应用可见范围之内时返回此参数。后续利用该参数可以获取用户信息或敏感信息,参见"获取访问用户敏感信息"。暂时不支持上下游或/企业互联场景 + OpenId string `json:"openid"` //非企业成员的标识,对当前企业唯一。不超过64字节 + ExternalUserid string `json:"external_userid"` //外部联系人id,当且仅当用户是企业的客户,且跟进人在应用的可见范围内时返回。如果是第三方应用调用,针对同一个客户,同一个服务商不同应用获取到的id相同 +} + +// 身份认证返回 +type WechatVerifyIdentity struct { + UserKey string `json:"userkey"` + Token string `json:"token"` + UserInfo modelshr.ManCont `json:"userinfo"` +} diff --git a/api/version1/workWechat/wechat.go b/api/version1/workWechat/wechat.go index d971861..2819ff5 100644 --- a/api/version1/workWechat/wechat.go +++ b/api/version1/workWechat/wechat.go @@ -9,6 +9,9 @@ import ( "encoding/json" "errors" "fmt" + "net/http" + "net/url" + "reflect" "strconv" "strings" @@ -46,6 +49,9 @@ func GainWechatToken(systemApp, key string, isAgain int) (token string, err erro case "school": redisFileKey = fmt.Sprintf("%v_%v_%v", redisFileKey, systemApp, overall.CONSTANT_CONFIG.WechatSchool.Agentid) secretStr = overall.CONSTANT_CONFIG.WechatSchool.Secret + case "stzl": + redisFileKey = fmt.Sprintf("%v_%v_%v", redisFileKey, systemApp, overall.CONSTANT_CONFIG.ShuTongZhiLian.Agentid) + secretStr = overall.CONSTANT_CONFIG.ShuTongZhiLian.Secret default: redisFileKey = fmt.Sprintf("%v_%v", redisFileKey, systemApp) } @@ -202,3 +208,198 @@ func (a *ApiMethod) LookOnePeopleArchives(c *gin.Context) { } publicmethod.Result(0, sendData, c) } + +/* +* +@ 作者: 秦东 +@ 时间: 2024-10-23 15:04:38 +@ 功能: 构造企业微信网页授权code +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) ObtainAuthorization(c *gin.Context) { + //保障获取渠道一致 + md5Token := GainTokenKey(c) + + //来源于哪个系统 + systemApp := c.Query("systemapp") + if systemApp == "" { + systemApp = "stzl" + } + isAgain := c.Query("isagain") //是否强制重新授权 + isAgainInt, _ := strconv.Atoi(isAgain) + if isAgainInt == 0 { + isAgainInt = 1 + } + //获取token + token, err := GainWechatToken(systemApp, md5Token, isAgainInt) + if err != nil { + publicmethod.Result(1, err, c, "身份认证失败") + return + } + //组装企业微信重定向地址参数 + var urlRedirectKey []string + urlRedirectKey = append(urlRedirectKey, fmt.Sprintf("systemapp=%v", systemApp)) + urlRedirectKey = append(urlRedirectKey, fmt.Sprintf("isagain=%v", isAgainInt)) + userNum := c.Query("userid") + if userNum != "" { + urlRedirectKey = append(urlRedirectKey, fmt.Sprintf("userid=%v", userNum)) + } + urlParameter := strings.Join(urlRedirectKey, "&") //合并成参数字符串 + //企业微信重定向地址 + watchWorkCallBackUrl := url.QueryEscape(fmt.Sprintf("%v/systemapi/wechat/wechatCallBack?%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, urlParameter)) + redirectUrl := fmt.Sprintf("https://open.weixin.qq.com/connect/oauth2/authorize?appid=%v&redirect_uri=%v&response_type=code&scope=snsapi_base&state=%v#wechat_redirect", overall.CONSTANT_CONFIG.WechatCompany.CompanyId, watchWorkCallBackUrl, token) + c.Redirect(http.StatusMovedPermanently, redirectUrl) +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-10-23 14:41:12 +@ 功能: 企业微信参数地址重定向回调 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func (a *ApiMethod) WechatCallBack(c *gin.Context) { + code := c.Query("code") + state := c.Query("state") + if code == "" || state == "" { + publicmethod.Result(0, code, c, "未能查询到您的信息!企业微信授权失败!") + return + } + systemApp := c.Query("systemapp") + if systemApp == "" { + systemApp = "stzl" + } + isAgain := c.Query("isagain") + isAgainInt, _ := strconv.Atoi(isAgain) + userNum := c.Query("userid") + md5Token := GainTokenKey(c) //保障获取渠道一致 + token, _ := GainWechatToken(systemApp, md5Token, isAgainInt) + gainWechatInfo := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=%v&code=%v", token, code) + wechatInfoByte := publicmethod.CurlGet(gainWechatInfo) + var callBackWechatInfo WorkWechatUserAuter + err := json.Unmarshal(wechatInfoByte, &callBackWechatInfo) + if err != nil { + publicmethod.Result(0, err, c, "未能查询到您的信息!企业微信授权失败!2") + return + } + if callBackWechatInfo.Errcode != 0 { + + if callBackWechatInfo.Errcode == 42001 { + a.ObtainAuthorization(c) + return + } + publicmethod.Result(12, callBackWechatInfo, c, "未能查询到您的信息!企业微信授权失败!3") + return + } + var userWechatId string + if callBackWechatInfo.OpenId != "" { + userWechatId = callBackWechatInfo.OpenId + } + if callBackWechatInfo.Userid != "" { + userWechatId = callBackWechatInfo.Userid + } + if userWechatId == "" { + publicmethod.Result(1, err, c, "未能查询到您的信息!企业微信授权失败!") + return + } + wechatCont, err := SetUpWechatInfo(userWechatId) + if err != nil { + publicmethod.Result(13, err, c, "未能查询到您的信息!企业微信授权失败!") + return + } + // callBackLoginUrl := fmt.Sprintf("%v/#/?callback=1&usernum=%v&openid=%v&userkey=%v&token=%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, userNum, wechatCont.UserInfo.Number, wechatCont.UserKey, wechatCont.Token) + callBackLoginUrl := fmt.Sprintf("%v?callback=1&usernum=%v&openid=%v&userkey=%v&token=%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, userNum, wechatCont.UserInfo.Number, wechatCont.UserKey, wechatCont.Token) + c.Redirect(http.StatusMovedPermanently, callBackLoginUrl) +} + +// 获取token Key +func GainTokenKey(c *gin.Context) (md5Token string) { + host := c.Request.Header.Get("Host") + userAgent := c.Request.Header.Get("User-Agent") + wechatTokenStr := fmt.Sprintf("%v_%v", host, userAgent) + var md5JiaMi publicmethod.Md5Encryption + md5JiaMi.Md5EncryptionInit(wechatTokenStr) + md5Token = md5JiaMi.Md5EncryptionAlgorithm() + return +} + +/* +* +@ 作者: 秦东 +@ 时间: 2024-01-20 14:06:00 +@ 功能: 获取登陆人员信息 +@ 参数 + + # + +@ 返回值 + + # + +@ 方法原型 + + # +*/ +func SetUpWechatInfo(wechatOpenId string) (sendData WechatVerifyIdentity, err error) { + err = overall.CONSTANT_DB_HR.Where("`wechat` = ? OR `work_wechat` = ?", wechatOpenId, wechatOpenId).First(&sendData.UserInfo).Error + if err != nil { + return + } + if !publicmethod.IsInTrue[int](sendData.UserInfo.EmpType, []int{1, 3, 4, 5, 6, 7, 8, 9, 10}) { + err = errors.New("对不起!你没有权限进入!") + return + } + // uuIdVal := overallhandle.OnlyOneNumber(3) + userAgent := overall.CONSTANT_CONFIG.Appsetup.AppKey + var md5JiaMi publicmethod.Md5Encryption + md5JiaMi.Md5EncryptionInit(userAgent) + md5Token := md5JiaMi.Md5EncryptionAlgorithm() + //工号MD5加密 + var md5JiaMiNumber publicmethod.Md5Encryption + md5JiaMiNumber.Md5EncryptionInit(sendData.UserInfo.Number) + sendData.UserKey = md5JiaMiNumber.Md5EncryptionAlgorithm() + + sha1Str := fmt.Sprintf("%v%v%v%v", sendData.UserKey, sendData.UserInfo.Number, sendData.UserInfo.Password, md5Token) + sendData.Token = publicmethod.Sha1Encryption(sha1Str) + //组成Token字符串进行 + + wechatUserToken := fmt.Sprintf("%v%v", sendData.UserKey, sendData.Token) + var md5JiaMiWechat publicmethod.Md5Encryption + md5JiaMiWechat.Md5EncryptionInit(wechatUserToken) + wechatRedisKey := md5JiaMiWechat.Md5EncryptionAlgorithm() + wechatRedisToekn := fmt.Sprintf("Wechat:UserToken:%v_%v", wechatRedisKey, overall.CONSTANT_CONFIG.RedisPrefixStr.Alias) + + saveInfo := publicmethod.MapOut[string]() + structValue := reflect.ValueOf(sendData.UserInfo) + structType := structValue.Type() + for i := 0; i < structValue.NumField(); i++ { + fieldValue := structValue.Field(i) + fieldType := structType.Field(i) + // fmt.Printf("%s: %v\n", fieldType.Name, fieldValue.Interface()) + saveInfo[fieldType.Name] = fieldValue.Interface() + } + redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4) //设定redis库 + redisClient.SetRedisTime(7200) + redisClient.HashMsetAdd(wechatRedisToekn, saveInfo) + return +} diff --git a/apirouter/apishiyan/maptostruct.go b/apirouter/apishiyan/maptostruct.go index 98bffc9..c01d8eb 100644 --- a/apirouter/apishiyan/maptostruct.go +++ b/apirouter/apishiyan/maptostruct.go @@ -44,6 +44,8 @@ func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) { apiRouter.POST("appSm4", methodBinding.AppSm4) //测试过密加解密(SM4) + apiRouter.POST("setUpWorkWatch", methodBinding.SetUpWorkWatch) //测试通过企业微信获取人员 + } } func (a *ApiRouter) RouterGroupVerify(router *gin.RouterGroup) { diff --git a/apirouter/v1/customerformrouter/router.go b/apirouter/v1/customerformrouter/router.go index 2343282..6f0f84d 100644 --- a/apirouter/v1/customerformrouter/router.go +++ b/apirouter/v1/customerformrouter/router.go @@ -71,27 +71,29 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { appApiRouter.GET("", methodAppHand.Index) //入口 appApiRouter.POST("", methodAppHand.Index) //入口 - appApiRouter.POST("createApp", methodAppHand.CreateApp) //创建APP - appApiRouter.POST("gainAppEditPsge", methodAppHand.GainAppEditPsge) //获取应用编辑页面信息 - appApiRouter.POST("ginOthenMenuTree", methodAppHand.GinOthenMenuTree) //获取除固定菜单以外的数据 - appApiRouter.POST("saveAppMenu", methodAppHand.SaveAppMenu) //新增菜单 - appApiRouter.POST("gainAllAppMenu", methodAppHand.GainAllAppMenu) //获取完整APP菜单树 - appApiRouter.POST("editAppMenuCont", methodAppHand.EditAppMenuCont) //修改App菜单结构 - appApiRouter.POST("editAppMenuLable", methodAppHand.EditAppMenuLable) //修改菜单名称 - appApiRouter.POST("appMenuShowOrHide", methodAppHand.AppMenuShowOrHide) //显示和隐藏菜单 - appApiRouter.POST("delAppMenu", methodAppHand.DelAppMenu) //删除app菜单 - appApiRouter.POST("createAppForm", methodAppHand.CreateAppForm) //写入app表单菜单 - appApiRouter.POST("gainAppPageInfo", methodAppHand.GainAppPageInfo) //获取app页面综合信息 - appApiRouter.POST("editAppPageInfo", methodAppHand.EditAppPageInfo) //编辑App表单数据 - appApiRouter.POST("saveOtherVersion", methodAppHand.SaveOtherVersion) //保存新版本 - appApiRouter.POST("previewAppFormVersion", methodAppHand.PreviewAppFormVersion) //预览App多版本表单页面 - appApiRouter.POST("appBasicSettings", methodAppHand.AppBasicSettings) //设置App基础 - appApiRouter.POST("gainLookViews", methodAppHand.GainLookViews) //获取可见范围数据及应用管理 - appApiRouter.POST("setLookViews", methodAppHand.SetLookViews) //设置可见范围 - appApiRouter.POST("setAppManagerInfo", methodAppHand.SetAppManagerInfo) //设置管理使用人员 - appApiRouter.POST("gianAppFormTable", methodAppHand.GianAppFormTable) //获取应用下属表单 - appApiRouter.POST("setCustomerFormState", methodAppHand.SetCustomerFormState) //设置自定义表单状态 - appApiRouter.POST("appJwtPower", methodAppHand.AppJwtPower) //鉴定当权人员是否有权限使用 - appApiRouter.POST("editAppMenusIcon", methodAppHand.EditAppMenusIcon) //编辑APP菜单图标 + appApiRouter.POST("createApp", methodAppHand.CreateApp) //创建APP + appApiRouter.POST("gainAppEditPsge", methodAppHand.GainAppEditPsge) //获取应用编辑页面信息 + appApiRouter.POST("ginOthenMenuTree", methodAppHand.GinOthenMenuTree) //获取除固定菜单以外的数据 + appApiRouter.POST("saveAppMenu", methodAppHand.SaveAppMenu) //新增菜单 + appApiRouter.POST("gainAllAppMenu", methodAppHand.GainAllAppMenu) //获取完整APP菜单树 + appApiRouter.POST("editAppMenuCont", methodAppHand.EditAppMenuCont) //修改App菜单结构 + appApiRouter.POST("editAppMenuLable", methodAppHand.EditAppMenuLable) //修改菜单名称 + appApiRouter.POST("appMenuShowOrHide", methodAppHand.AppMenuShowOrHide) //显示和隐藏菜单 + appApiRouter.POST("delAppMenu", methodAppHand.DelAppMenu) //删除app菜单 + appApiRouter.POST("createAppForm", methodAppHand.CreateAppForm) //写入app表单菜单 + appApiRouter.POST("gainAppPageInfo", methodAppHand.GainAppPageInfo) //获取app页面综合信息 + appApiRouter.POST("editAppPageInfo", methodAppHand.EditAppPageInfo) //编辑App表单数据 + appApiRouter.POST("saveOtherVersion", methodAppHand.SaveOtherVersion) //保存新版本 + appApiRouter.POST("previewAppFormVersion", methodAppHand.PreviewAppFormVersion) //预览App多版本表单页面 + appApiRouter.POST("appBasicSettings", methodAppHand.AppBasicSettings) //设置App基础 + appApiRouter.POST("gainLookViews", methodAppHand.GainLookViews) //获取可见范围数据及应用管理 + appApiRouter.POST("setLookViews", methodAppHand.SetLookViews) //设置可见范围 + appApiRouter.POST("setAppManagerInfo", methodAppHand.SetAppManagerInfo) //设置管理使用人员 + appApiRouter.POST("gianAppFormTable", methodAppHand.GianAppFormTable) //获取应用下属表单 + appApiRouter.POST("setCustomerFormState", methodAppHand.SetCustomerFormState) //设置自定义表单状态 + appApiRouter.POST("appJwtPower", methodAppHand.AppJwtPower) //鉴定当权人员是否有权限使用 + appApiRouter.POST("editAppMenusIcon", methodAppHand.EditAppMenusIcon) //编辑APP菜单图标 + appApiRouter.POST("getAllAppTableForm", methodAppHand.GetAllAppTableForm) //获取此应用的所有表单 + appApiRouter.POST("calculateQuantityOption", methodAppHand.CalculateQuantityOption) //计算待办事宜,已办事宜,我创建的,抄送我的数量 } } diff --git a/apirouter/v1/workWechatRouter/router.go b/apirouter/v1/workWechatRouter/router.go index 8a066c1..756b159 100644 --- a/apirouter/v1/workWechatRouter/router.go +++ b/apirouter/v1/workWechatRouter/router.go @@ -15,5 +15,7 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { apiRouter.GET("", methodBinding.Index) //入口 apiRouter.POST("", methodBinding.Index) //入口 apiRouter.POST("lookOnePeopleArchives", methodBinding.LookOnePeopleArchives) //获取人员信息单页(手机)查看权限 + apiRouter.GET("obtainAuthorization", methodBinding.ObtainAuthorization) //构造企业微信网页授权code + apiRouter.GET("wechatCallBack", methodBinding.WechatCallBack) //企业微信参数地址重定向回调 } } diff --git a/config/configApp/server.go b/config/configApp/server.go index 60d50e8..7d77b23 100644 --- a/config/configApp/server.go +++ b/config/configApp/server.go @@ -9,6 +9,7 @@ type Server struct { WechatCompany wechatCompany `mapstructure:"wechatcompany" json:"wechatcompany" yaml:"wechatcompany"` //企业ID WechatSchool wechatConfig `mapstructure:"wechatschool" json:"wechatschool" yaml:"wechatschool"` //知行学院 WechatKpi wechatConfig `mapstructure:"wechatkpi" json:"wechatkpi" yaml:"wechatkpi"` //绩效考核 + ShuTongZhiLian wechatConfig `mapstructure:"szzlypt" json:"szzlypt" yaml:"szzlypt"` //数通智联化工云平台 } //服务配置详情 @@ -21,6 +22,7 @@ type appsetup struct { PreFix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` WebUrl string `mapstructure:"weburl" json:"weburl" yaml:"weburl"` PcbUrl string `mapstructure:"pcurl" json:"pcurl" yaml:"pcurl"` + WebKpiUrl string `mapstructure:"webKpiUrl" json:"webKpiUrl" yaml:"webKpiUrl"` } //日志配置