Browse Source

处理jwt

li_v1
hreenshan112 9 months ago
parent
commit
2de2248163
  1. 2
      api/version1/customerApp/runAppControll.go
  2. 40
      api/version1/customerform/formTable.go
  3. 22
      api/version1/menus/menus.go
  4. 23
      api/version1/menus/type.go
  5. 17
      api/version1/workWechat/wechat.go
  6. 2
      models/modelAppPlatform/menus.go
  7. 11
      overall/publicmethod/technique.go
  8. 2
      overall/publicmethod/type.go

2
api/version1/customerApp/runAppControll.go

@ -831,7 +831,7 @@ func GetAppForm(appId int64, types int) (tableForm []TableInfo) {
tableFormInfo.Password = formJsonCont.Form.DataSourceConfig.DSN.Password
tableFormInfo.DataSource = formJsonCont.Form.DataSource //是不是引用外部数据源
tableFormInfo.TableName = v.Name //数据表名称
tableFormInfo.TableKey = v.TableKey
tableFormInfo.TableKey = strconv.FormatInt(v.SignCode, 10)
tableFormInfo.SourceId = formJsonCont.Form.DataSourceConfig.Id
tableForm = append(tableForm, tableFormInfo)
}

40
api/version1/customerform/formTable.go

@ -1626,35 +1626,35 @@ func (l *ListPageFields) DevelopSpecificationsSend(listData []map[string]interfa
case "datetimerange":
beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 11)
sendInfo[mi] = beginTime
endKey := fmt.Sprintf("%v_end", mi)
if v[endKey] != nil {
endTimeVal, _ := publicmethod.StringToInt64(v[endKey])
sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 11))
}
// endKey := fmt.Sprintf("%v_end", mi)
// if v[endKey] != nil {
// endTimeVal, _ := publicmethod.StringToInt64(v[endKey])
// sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 11))
// }
case "daterange":
beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 14)
sendInfo[mi] = beginTime
endKey := fmt.Sprintf("%v_end", mi)
if v[endKey] != nil {
endTimeVal, _ := publicmethod.StringToInt64(v[endKey])
sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14))
}
// endKey := fmt.Sprintf("%v_end", mi)
// if v[endKey] != nil {
// endTimeVal, _ := publicmethod.StringToInt64(v[endKey])
// sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14))
// }
case "monthrange":
beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 15)
sendInfo[mi] = beginTime
endKey := fmt.Sprintf("%v_end", mi)
if v[endKey] != nil {
endTimeVal, _ := publicmethod.StringToInt64(v[endKey])
sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 15))
}
// endKey := fmt.Sprintf("%v_end", mi)
// if v[endKey] != nil {
// endTimeVal, _ := publicmethod.StringToInt64(v[endKey])
// sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 15))
// }
default:
beginTime = publicmethod.UnixTimeToDay(timeVal/1000, 14)
sendInfo[mi] = beginTime
endKey := fmt.Sprintf("%v_end", mi)
if v[endKey] != nil {
endTimeVal, _ := publicmethod.StringToInt64(v[endKey])
sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14))
}
// endKey := fmt.Sprintf("%v_end", mi)
// if v[endKey] != nil {
// endTimeVal, _ := publicmethod.StringToInt64(v[endKey])
// sendInfo[mi] = fmt.Sprintf("%v - %v", beginTime, publicmethod.UnixTimeToDay(int64(endTimeVal)/1000, 14))
// }
}
case "timePicker":
timeVal, _ := publicmethod.StringToInt64(mv)

22
api/version1/menus/menus.go

@ -41,7 +41,7 @@ var allRulesLog teamlog.TeamsLog
*/
func (a *ApiMethod) GetMenusThree(c *gin.Context) {
var menusList []modelAppPlatform.Menus
err := overall.CONSTANT_DB_AppPlatform.Where("`type` IN ? AND `visible` = ? AND `outside` IN ?", []int{1, 2, 3}, 1, []int{1, 3}).Order("sort ASC").Find(&menusList).Error
err := overall.CONSTANT_DB_AppPlatform.Where("`type` IN ? AND `visible` = ? AND `outside` IN ?", []int{1, 2, 3, 5}, 1, []int{1, 3}).Order("sort ASC").Find(&menusList).Error
if err != nil && len(menusList) < 1 {
publicmethod.Result(1, err, c, "没有路由!")
return
@ -169,10 +169,16 @@ func (a *ApiMethod) AddNewMenu(c *gin.Context) {
menuCont.Component = "public/index" //组件路径(vue页面完整路径,省略.vue后缀)"`
}
} else if types == 5 {
menuCont.Path = "myapptable"
menuCont.Component = "sysworkflow/lowCodeTasks/index"
} else {
menuCont.Component = requestData.Component //组件路径(vue页面完整路径,省略.vue后缀)"`
}
menuCont.AppId, _ = strconv.ParseInt(requestData.AppKey, 10, 64)
menuCont.TableId = requestData.SdatableKey
menuCont.Perm = publicmethod.GetUUid(3) //权限标识"`
menuCont.Visible = requestData.Visible //显示状态(1:显示;2:隐藏,3:删除)"`
menuCont.Sort = requestData.Sort //排序(数字越小排名越靠前))"`
@ -303,6 +309,9 @@ func (a *ApiMethod) EditMenusCont(c *gin.Context) {
} else {
editCont["component"] = "Layout"
}
} else if types == 5 {
editCont["path"] = "myapptable"
editCont["component"] = "sysworkflow/lowCodeTasks/index"
} else {
editCont["component"] = requestData.Component
}
@ -314,6 +323,17 @@ func (a *ApiMethod) EditMenusCont(c *gin.Context) {
if requestData.Visible != menuCont.Visible {
editCont["visible"] = requestData.Visible
}
editCont["appId"] = requestData.AppKey
editCont["tableId"] = requestData.SdatableKey
// if int64(requestData.AppKey) != menuCont.AppId {
// editCont["appId"] = requestData.AppKey
// }
// if menuCont.TableId != requestData.SdatableKey {
// editCont["tableId"] = requestData.SdatableKey
// }
if requestData.Sort == 0 {
requestData.Sort = 50
}

23
api/version1/menus/type.go

@ -44,16 +44,19 @@ type ShearMenu struct {
// 新增菜单
type AddNewMenuCont struct {
ParentId int `json:"parentId"` //父菜单ID
Name string `json:"name"` //菜单名称
Visible int `json:"visible"` //菜单是否可见(1:是;2:否;)
Icon string `json:"icon"` //菜单图标
Sort int `json:"sort"` //排序
Component string `json:"component"` //组件路径
Path string `json:"path"` //路由路径
Redirect string `json:"redirect"` //跳转路由路径
Types string `json:"type"` //菜单类型
Outside int `json:"outside"` //排序
ParentId int `json:"parentId"` //父菜单ID
Name string `json:"name"` //菜单名称
Visible int `json:"visible"` //菜单是否可见(1:是;2:否;)
Icon string `json:"icon"` //菜单图标
Sort int `json:"sort"` //排序
Component string `json:"component"` //组件路径
Path string `json:"path"` //路由路径
Redirect string `json:"redirect"` //跳转路由路径
Types string `json:"type"` //菜单类型
Outside int `json:"outside"` //排序
AppKey string `json:"appKey"` //排序
SignCode string `json:"signCode"` //表单唯一标识符
SdatableKey string `json:"sdatableKey"` //排序
}
// 边界菜单

17
api/version1/workWechat/wechat.go

@ -427,9 +427,14 @@ func (a *ApiMethod) ObtaOnePage(c *gin.Context) {
//来源于哪个系统
systemApp := c.Query("systemapp")
if systemApp == "" {
systemApp = "stzl"
}
callBackType := c.Query("call_back_type")
if callBackType == "" {
callBackType = "work_wechat"
}
isAgain := c.Query("isagain") //是否强制重新授权
isAgainInt, _ := strconv.Atoi(isAgain)
if isAgainInt == 0 {
@ -455,6 +460,7 @@ func (a *ApiMethod) ObtaOnePage(c *gin.Context) {
urlRedirectKey = append(urlRedirectKey, fmt.Sprintf("taskTitle=%v", c.Query("taskTitle")))
urlRedirectKey = append(urlRedirectKey, fmt.Sprintf("taskId=%v", c.Query("taskId")))
urlRedirectKey = append(urlRedirectKey, fmt.Sprintf("taskKey=%v", c.Query("taskKey")))
urlRedirectKey = append(urlRedirectKey, fmt.Sprintf("call_back_type=%v", callBackType))
urlRedirectKey = append(urlRedirectKey, fmt.Sprintf("masters_key=%v", c.Query("masters_key")))
@ -551,6 +557,17 @@ func (a *ApiMethod) WechatCallBackPage(c *gin.Context) {
urlParameter := strings.Join(urlRedirectKey, "&") //合并成参数字符串
// 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)
callBackType := c.Query("call_back_type")
if callBackType == "" {
callBackType = "work_wechat"
}
callBackLoginUrl := fmt.Sprintf("%v/#/work_wechat?%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, urlParameter)
switch callBackType {
case "login":
callBackLoginUrl = fmt.Sprintf("%v/#/login?%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, urlParameter)
default:
callBackLoginUrl = fmt.Sprintf("%v/#/work_wechat?%v", overall.CONSTANT_CONFIG.Appsetup.WebKpiUrl, urlParameter)
}
c.Redirect(http.StatusMovedPermanently, callBackLoginUrl)
}

2
models/modelAppPlatform/menus.go

@ -20,6 +20,8 @@ type Menus struct {
ParentId int `json:"parentId" gorm:"column:parentId;type:int(5) unsigned;default:0;not null;comment:父菜单ID"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
Outside int `json:"outside" gorm:"column:outside;type:int(1) unsigned;default:0;not null;comment:1:内部使用;2:外部使用;3:内外使用"`
AppId int64 `json:"appId" gorm:"column:appId;type:bigint(20) unsigned;default:0;not null;comment:关联得APP"`
TableId string `json:"tableId" gorm:"column:tableId;type:varchar(255) ;default:'';comment:跳转路径"`
}
func (menus *Menus) TableName() string {

11
overall/publicmethod/technique.go

@ -2343,7 +2343,12 @@ func GetMenuRouterThree(parentId int, threeData []modelAppPlatform.Menus) []Menu
if v.ParentId == parentId {
child := GetMenuRouterThree(v.Id, threeData)
var node MenusRouterThree
node.Path = v.Path //路由路径
node.Path = v.Path //路由路径
if v.Types == 5 {
// node.Path = fmt.Sprintf("%v?appid=%v&tableid=%v", v.Path, v.AppId, v.TableId)
}
node.AppId = v.AppId
node.TableId = v.TableId
node.Component = v.Component //组件路径
node.Redirect = v.Redirect //跳转链接
node.Name = v.Name //路由名称
@ -2424,6 +2429,8 @@ func MenuType(class int) string {
return "EXTLINK"
case 4:
return "BUTTON"
case 5:
return "MyApp"
default:
return "CATALOG"
}
@ -2439,6 +2446,8 @@ func MenuTypeToInt(class string) int {
return 3
case "BUTTON":
return 4
case "MyApp":
return 5
default:
return 2
}

2
overall/publicmethod/type.go

@ -312,6 +312,8 @@ type MenusRouterThree struct {
Redirect string `json:"redirect"` //跳转链接
Name string `json:"name"` //路由名称
Meta MenusRouterThreeMet `json:"meta"` //路由属性类型
AppId int64 `json:"appId"` //
TableId string `json:"tableId"` //
Children []MenusRouterThree `json:"children"` //子路由列表
}

Loading…
Cancel
Save