Browse Source

修改表单

li_v1
超级管理员 1 year ago
parent
commit
152a477a99
  1. 20
      api/version1/customerform/codeFormGroup.go
  2. 159
      api/version1/customerform/form.go
  3. 78
      api/version1/customerform/formTable.go
  4. 3
      api/version1/customerform/type.go
  5. 6
      api/version1/grantpowers/postpower.go
  6. 42
      api/version1/publicapi/api.go
  7. 5
      api/version1/workWechat/wechat.go
  8. 2
      apirouter/v1/customerformrouter/router.go
  9. 75
      models/modelAppPlatform/oftenApp.go

20
api/version1/customerform/codeFormGroup.go

@ -4,6 +4,7 @@ import (
"appPlatform/models/modelAppPlatform"
"appPlatform/overall"
"appPlatform/overall/publicmethod"
"sort"
"strconv"
"time"
@ -143,9 +144,28 @@ func (a *ApiMethod) CustomerFormGroupList(c *gin.Context) {
publicmethod.Result(106, err, c)
return
}
var oftenAppInfo SendFormGroupInfo
oftenAppInfo.Id = 100 //
oftenAppInfo.Title = "常用" //分组名称"`
oftenAppInfo.Superior = 0 //父级"`
oftenAppInfo.Sort = 0 //排序"`
oftenAppInfo.Ordid = 309 //归属行政组织"`
oftenAppInfo.State = 1 //显示状态(1:启用;2:禁用,3:删除)"`
oftenAppInfo.Time = 0 //创建时间"`
oftenAppInfo.Icon = "https://docu.hxgk.group/images/2024_04/ec8a4ca3c2209db1c843055c8d746945.png" //图标"`
oftenAppInfo.IdStr = "100" //
oftenAppInfo.VersionId = "" //
groupList = append(groupList, oftenAppInfo)
for i, v := range groupList {
groupList[i].IdStr = strconv.FormatInt(v.Id, 10)
if v.Title == "默认" {
groupList[i].IsTrue = true
}
}
sort.Slice(groupList, func(i, j int) bool {
return groupList[i].Sort < groupList[j].Sort
})
// publicmethod.Result(0, groupList, c)
publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(groupList)), groupList, c)
}

159
api/version1/customerform/form.go

@ -7,7 +7,6 @@ import (
"appPlatform/overall/publicmethod"
"encoding/json"
"fmt"
"reflect"
"strconv"
"strings"
"time"
@ -42,17 +41,36 @@ func (a *ApiMethod) CustomerFormList(c *gin.Context) {
if requestData.PageSize == 0 {
requestData.PageSize = 15
}
context, _ := c.Get(overall.MyContJwt)
var userCont modelshr.ManCont
userCont.GetLoginCont(context)
// fmt.Printf("requestData---->%v---->%v\n", requestData, ersr)
// var formList []modelAppPlatform.CustomerForm
var formList []SendCustomerForm
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&modelAppPlatform.CustomerForm{}).Where("`states` BETWEEN ? AND ?", 1, 2)
if requestData.GroupId == "100" {
var oftenAppInfo modelAppPlatform.OftenApp
oftenAppInfo.GetCont(map[string]interface{}{"`userKey`": userCont.Key}, "`appSignCode`")
if oftenAppInfo.AppSignCode != "" {
appId := strings.Split(oftenAppInfo.AppSignCode, ",")
if len(appId) > 0 {
gormDb = gormDb.Where("`signCode` IN ?", appId)
} else {
gormDb = gormDb.Where("`signCode` = ? AND `tablename` = ?", 110, "qindong")
}
} else {
gormDb = gormDb.Where("`signCode` = ? AND `tablename` = ?", 110, "qindong")
}
}
if requestData.KeyWords != "" {
gormDb = gormDb.Where("`name` LIKE ? OR `tablename` LIKE ?", "%"+requestData.KeyWords+"%", "%"+requestData.KeyWords+"%")
}
if requestData.Classify != 0 {
gormDb = gormDb.Where("`classify` = ?", requestData.Classify)
}
if requestData.GroupId != "" {
if requestData.GroupId != "" && requestData.GroupId != "100" {
gormDb = gormDb.Where("`groupid` = ?", requestData.GroupId)
}
var total int64
@ -70,25 +88,60 @@ func (a *ApiMethod) CustomerFormList(c *gin.Context) {
for i, v := range formList {
// var sendCont SendCustomerForm
// sendCont.IdStr = strconv.FormatInt(v.Id, 10)
userCont := HaveCustomerFormCreaterUs(v.TableNames)
// sendCont.CreaterName = userCont.Name
userContEs := HaveCustomerFormCreaterUs(v.TableNames)
// sendCont.CreaterName = userContEs.Name
// sendCont.CreaterTimeStr = publicmethod.UnixTimeToDay(v.CreaterTime, 1)
if v.FlowKey != 0 {
// sendCont.FlowKeyStr = strconv.FormatInt(v.FlowKey, 10)
formList[i].FlowKeyStr = strconv.FormatInt(v.FlowKey, 10)
}
formList[i].IdStr = strconv.FormatInt(v.Id, 10)
formList[i].CreaterName = userCont.Name
formList[i].CreaterName = userContEs.Name
formList[i].CreaterTimeStr = publicmethod.UnixTimeToDay(v.CreaterTime, 1)
var versionInfo modelAppPlatform.CustomerFormVersion
versionInfo.GetCont(map[string]interface{}{"`status`": 1, "`tablekey`": v.TableNames}, "`id`")
formList[i].VersionId = strconv.FormatInt(versionInfo.Id, 10)
formList[i].SignCodeStr = strconv.FormatInt(v.SignCode, 10)
formList[i].IsOften = JudgeAppOften(userCont.Key, v.SignCode)
if v.States == 1 {
formList[i].IsOpen = true
} else {
formList[i].IsOpen = false
}
// sendList = append(sendList, sendCont)
}
publicmethod.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(formList)), formList, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2024-07-23 16:20:59
@ 功能: 判断App是不是经常使用
@ 参数
#userkey 当前人员
#appCode 应用识别
@ 返回值
#
@ 方法原型
#
*/
func JudgeAppOften(userkey, appCode int64) bool {
var oftenAppInfo modelAppPlatform.OftenApp
oftenAppInfo.GetCont(map[string]interface{}{"`userKey`": userkey}, "`appSignCode`")
appId := strings.Split(oftenAppInfo.AppSignCode, ",")
if len(appId) > 0 {
appCodeStr := strconv.FormatInt(appCode, 10)
return publicmethod.IsInTrue[string](appCodeStr, appId)
}
return false
}
/*
*
@ 作者: 秦东
@ -700,7 +753,7 @@ func (c *CustomerFormMaster) DisassembleForm() (relevance string, err error) {
#
*/
func CreateFormFiled(formName, formNotes string, isMasters bool, sqlList interface{}) {
fmt.Printf("函数类型----%v---%T\n", reflect.TypeOf(sqlList), sqlList)
// fmt.Printf("函数类型----%v---%T\n", reflect.TypeOf(sqlList), sqlList)
if sql, isOk := sqlList.([]string); isOk {
for k, v := range sql {
@ -717,10 +770,12 @@ func CreateFormFiled(formName, formNotes string, isMasters bool, sqlList interfa
// 协程执行mysql语句
func CoroutineExecuteSql(k int, sql string) {
// fmt.Printf("%v---------->%v\n", k, sql)
defer syncSeting.Done()
overall.CONSTANT_DB_CustomerForm.Exec(sql)
// err := overall.CONSTANT_DB_CustomerForm.Exec(sql).Error
// overall.CONSTANT_DB_CustomerForm.Raw(sql)
// fmt.Printf("协程执行mysql语句---:---%v---------->%v---------->%v\n", k, sql, err)
}
@ -1294,3 +1349,93 @@ func PublicUnitJieXi(list []MasterStruct) (isSubmit, isCancel bool) {
return
}
/*
*
@ 作者: 秦东
@ 时间: 2024-07-23 16:33:50
@ 功能: 编辑常用自定义App
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
func (a *ApiMethod) SetOftenApp(c *gin.Context) {
var requestData publicmethod.PublicId
err := c.ShouldBindJSON(&requestData)
if err != nil {
publicmethod.Result(100, err, c)
return
}
if requestData.Id == "" {
publicmethod.Result(1, requestData.Id, c, "未知App!")
return
}
context, _ := c.Get(overall.MyContJwt)
var userCont modelshr.ManCont
userCont.GetLoginCont(context)
var oftenAppInfo modelAppPlatform.OftenApp
err = oftenAppInfo.GetCont(map[string]interface{}{"`userKey`": userCont.Key})
if err != nil {
oftenAppInfo.UserKey = userCont.Key //所有者"`
oftenAppInfo.Time = time.Now().Unix() //编辑时间"`
var signCode []string
signCode = append(signCode, requestData.Id)
oftenAppInfo.AppSignCode = strings.Join(signCode, ",") //节点名称"`
err = overall.CONSTANT_DB_AppPlatform.Create(&oftenAppInfo).Error
if err != nil {
publicmethod.Result(104, requestData.Id, c)
return
}
} else {
if oftenAppInfo.AppSignCode != "" {
appId := strings.Split(oftenAppInfo.AppSignCode, ",")
if len(appId) > 0 {
editInfo := publicmethod.MapOut[string]()
if publicmethod.IsInTrue[string](requestData.Id, appId) {
var newAppid []string
for _, v := range appId {
if v != requestData.Id {
newAppid = append(newAppid, v)
}
}
editInfo["appSignCode"] = strings.Join(newAppid, ",")
} else {
appId = append(appId, requestData.Id)
editInfo["appSignCode"] = strings.Join(appId, ",")
}
editInfo["time"] = time.Now().Unix()
var editContApp modelAppPlatform.OftenApp
err = editContApp.EiteCont(map[string]interface{}{"`id`": oftenAppInfo.Id}, editInfo)
} else {
editInfo := publicmethod.MapOut[string]()
editInfo["time"] = time.Now().Unix()
var signCode []string
signCode = append(signCode, requestData.Id)
editInfo["appSignCode"] = strings.Join(signCode, ",") //节点名称"`
var editContApp modelAppPlatform.OftenApp
err = editContApp.EiteCont(map[string]interface{}{"`id`": oftenAppInfo.Id}, editInfo)
}
} else {
editInfo := publicmethod.MapOut[string]()
editInfo["time"] = time.Now().Unix()
var signCode []string
signCode = append(signCode, requestData.Id)
editInfo["appSignCode"] = strings.Join(signCode, ",") //节点名称"`
var editContApp modelAppPlatform.OftenApp
err = editContApp.EiteCont(map[string]interface{}{"`id`": oftenAppInfo.Id}, editInfo)
}
}
if err != nil {
publicmethod.Result(106, requestData.Id, c)
return
}
publicmethod.Result(0, err, c)
}

78
api/version1/customerform/formTable.go

@ -273,9 +273,12 @@ func (c *CustomerFormMaster) CreateFormTable() (relevance string, err error) {
// for _, v := range c.List {
// }
tableFieldList, _ := GainFormTableField(c.Form.Name)
var tableFormSqlAry FormTableSql
tableFormSqlAry.TableSubUnitAnalysis(c.Form.Name, c.List, true)
// jsonStr, _ := json.Marshal(tableFormSqlAry)
tableFormSqlAry.TableSubUnitAnalysis(c.Form.Name, c.List, true, tableFieldList)
// jsonStr, _ := json.Marshal(tableFieldList)
// fmt.Printf("数据表-----》%v\n", string(jsonStr))
isSunForm := false
if len(tableFormSqlAry.MasterSql) <= 0 {
@ -288,6 +291,7 @@ func (c *CustomerFormMaster) CreateFormTable() (relevance string, err error) {
} else {
err = CreateForm(c.Form.Name, c.Form.FormName, "MyISAM", true)
}
// fmt.Printf("数据表--1---》%v\n", tableFormSqlAry.MasterSql)
CreateFormFiled(c.Form.Name, c.Form.FormName, true, tableFormSqlAry.MasterSql) //添加主表字段
sunFormNameAry := make(map[string]string)
var sunTableNameAry []string
@ -335,7 +339,7 @@ func (c *CustomerFormMaster) CreateFormTable() (relevance string, err error) {
#
*/
func (f *FormTableSql) TableSubUnitAnalysis(tablename string, subUnitAry []MasterStruct, isMaster bool) {
func (f *FormTableSql) TableSubUnitAnalysis(tablename string, subUnitAry []MasterStruct, isMaster bool, fieldList []Result) {
if len(subUnitAry) > 0 {
var sqlAllAry []string
// fmt.Printf("tablename--->%v===>%v\n", tablename, isMaster)
@ -344,21 +348,27 @@ func (f *FormTableSql) TableSubUnitAnalysis(tablename string, subUnitAry []Maste
switch wordClass.UnitName {
case "flex", "table":
if len(v.List) > 0 {
f.TableSubUnitAnalysis(v.Name, v.List, false)
f.TableSubUnitAnalysis(v.Name, v.List, false, fieldList)
}
case "grid", "tabs":
if len(v.Columns) > 0 {
for _, mv := range v.Columns {
f.TableSubUnitAnalysis(tablename, mv.List, isMaster)
f.TableSubUnitAnalysis(tablename, mv.List, isMaster, fieldList)
}
}
case "card", "div":
if len(v.List) > 0 {
f.TableSubUnitAnalysis(tablename, v.List, isMaster)
f.TableSubUnitAnalysis(tablename, v.List, isMaster, fieldList)
}
default:
masterSql := MakeSql(tablename, wordClass)
sqlAllAry = append(sqlAllAry, masterSql...)
if isMaster {
masterSql := MakeSql(tablename, wordClass, fieldList)
sqlAllAry = append(sqlAllAry, masterSql...)
} else {
fieldList, _ := GainFormTableField(tablename)
masterSql := MakeSql(tablename, wordClass, fieldList)
sqlAllAry = append(sqlAllAry, masterSql...)
}
// if len(masterSql) > 0 {
// if isMaster {
@ -420,7 +430,7 @@ func (f *FormTableSql) TableSubUnitAnalysis(tablename string, subUnitAry []Maste
#
*/
func MakeSql(tablename string, fieldCont AnalysisFormSubUnitClass) (sql []string) {
func MakeSql(tablename string, fieldCont AnalysisFormSubUnitClass, fieldList []Result) (sql []string) {
if tablename == "" || fieldCont.WordName == "" {
return
}
@ -428,26 +438,40 @@ func MakeSql(tablename string, fieldCont AnalysisFormSubUnitClass) (sql []string
if !fieldCont.Signed {
unsigned = "unsigned"
}
// fmt.Printf("%v------->%v------->%v\n", fieldCont.WordName, fieldCont.FieldType, fieldCont.ValIsAry)
switch fieldCont.FieldType {
case "int":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v) %v NOT NULL DEFAULT %v COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, unsigned, fieldCont.MinVal, fieldCont.Describe))
case "bigint":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v) %v NOT NULL DEFAULT %v COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, unsigned, fieldCont.MinVal, fieldCont.Describe))
if fieldCont.ValIsAry {
endField := fmt.Sprintf("%v_end", fieldCont.WordName)
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v) %v NOT NULL DEFAULT %v COMMENT '%v'", tablename, endField, fieldCont.FieldType, fieldCont.MaxVal, unsigned, fieldCont.MinVal, fieldCont.Describe))
isNew := true
if len(fieldList) > 0 {
for _, v := range fieldList {
if v.Field == fieldCont.WordName {
isNew = false
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` MODIFY COLUMN %v %v COMMENT '%v'", tablename, fieldCont.WordName, v.Type, fieldCont.Describe))
}
}
case "float":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v,%v) %v NOT NULL DEFAULT 0 COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, fieldCont.MinVal, unsigned, fieldCont.Describe))
case "decimal":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v,%v) %v NOT NULL DEFAULT 0 COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, fieldCont.MinVal, unsigned, fieldCont.Describe))
case "mediumtext", "longtext":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.Describe))
case "varchar":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, fieldCont.Describe))
default:
} else {
isNew = true
}
if isNew {
switch fieldCont.FieldType {
case "int":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v) %v NOT NULL DEFAULT %v COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, unsigned, fieldCont.MinVal, fieldCont.Describe))
case "bigint":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v) %v NOT NULL DEFAULT %v COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, unsigned, fieldCont.MinVal, fieldCont.Describe))
if fieldCont.ValIsAry {
endField := fmt.Sprintf("%v_end", fieldCont.WordName)
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v) %v NOT NULL DEFAULT %v COMMENT '%v'", tablename, endField, fieldCont.FieldType, fieldCont.MaxVal, unsigned, fieldCont.MinVal, fieldCont.Describe))
}
case "float":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v,%v) %v NOT NULL DEFAULT 0 COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, fieldCont.MinVal, unsigned, fieldCont.Describe))
case "decimal":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v,%v) %v NOT NULL DEFAULT 0 COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, fieldCont.MinVal, unsigned, fieldCont.Describe))
case "mediumtext", "longtext":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.Describe))
case "varchar":
sql = append(sql, fmt.Sprintf("ALTER TABLE `%v` ADD COLUMN `%v` %v(%v) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '%v'", tablename, fieldCont.WordName, fieldCont.FieldType, fieldCont.MaxVal, fieldCont.Describe))
default:
}
}
// fmt.Printf("%v------->%v------->%v\n", fieldCont.WordName, fieldCont.FieldType, fieldCont.ValIsAry)
return
}

3
api/version1/customerform/type.go

@ -195,6 +195,8 @@ type SendCustomerForm struct {
FlowKeyStr string `json:"flowkeyStr" gorm:"-"`
VersionId string `json:"versionId" gorm:"-"`
SignCodeStr string `json:"signCodeStr" gorm:"-"`
IsOften bool `json:"isoften" gorm:"-"`
IsOpen bool `json:"isOpen" gorm:"-"`
}
// 输出自定义表格基础信息
@ -390,6 +392,7 @@ type SendFormGroupInfo struct {
modelAppPlatform.CustomerFormGroup
IdStr string `json:"idStr" gorm:"-"`
VersionId string `json:"versionId" gorm:"-"`
IsTrue bool `json:"isTrue" gorm:"-"`
}
// 自定义表单字段(解析对照用)

6
api/version1/grantpowers/postpower.go

@ -57,6 +57,7 @@ func (a *ApiMethod) GetPostGrantPowers(c *gin.Context) {
publicmethod.Result(0, powerList, c)
return
}
fmt.Printf(" empowerCont.PointId--->%v--->%v\n", requestData.SystemName, empowerCont.PointId)
switch requestData.SystemName {
case "kpi":
if empowerCont.PointId != "" || empowerCont.Operation != "" {
@ -93,11 +94,14 @@ func GetSysAppMenuPower(menusPower []string) (powersList []string) {
return
}
for _, v := range permList {
permStr := strconv.FormatInt(v, 10)
permStr := strconv.FormatInt(int64(v), 10)
// permStr := strconv.Itoa(v.Id)
if publicmethod.IsInTrue[string](permStr, menusPower) {
powersList = append(powersList, fmt.Sprintf("m_%v", permStr))
}
}
fmt.Printf("------------>%v\n", powersList)
return
}

42
api/version1/publicapi/api.go

@ -181,8 +181,34 @@ func (a *ApiMethod) ChineseToPinyin(c *gin.Context) {
publicmethod.Result(1, requestData, c, "未知中文语句!")
return
}
str := StringToPinYin(requestData.Types, requestData.Title, requestData.Connector, requestData.FormJson)
publicmethod.Result(0, str, c)
}
/*
*
@ 作者: 秦东
@ 时间: 2024-07-24 08:48:33
@ 功能: 字符串转拼音
@ 参数
#Title string `json:"title"` //中文语句
#Types int `json:"types"` //转换风格 0:普通风格,不带声调(默认风格)。如: zhong guo;1:声调风格1,拼音声调在韵母第一个字母上。如: zhōng guó;2:声调风格2,即拼音声调在各个韵母之后,用数字 [1-4] 进行表示。如: zho1ng guo2;3:声母风格,只返回各个拼音的声母部分。如: zh g 。注意:不是所有的拼音都有声母;4:首字母风格,只返回拼音的首字母部分。如: z g;5: 韵母风格,只返回各个拼音的韵母部分,不带声调。如: ong uo;6:韵母风格1,带声调,声调在韵母第一个字母上。如: ōng uó;7:韵母风格2,带声调,声调在各个韵母之后,用数字 [1-4] 进行表示。如: o1ng uo2;8:声调风格3,即拼音声调在各个拼音之后,用数字 [1-4] 进行表示。如: zhong1 guo2;9:韵母风格3,带声调,声调在各个拼音之后,用数字 [1-4] 进行表示。如: ong1 uo2;
#Connector string `json:"connector"` // Join 所用的分隔符
#FormJson string `json:"formJson"` //当前表单内容
@ 返回值
#
@ 方法原型
#
*/
func StringToPinYin(types int, title, connector, formJson string) string {
pyObject := pinyin.NewArgs()
switch requestData.Types {
switch types {
case 1:
pyObject.Style = pinyin.Tone
case 2:
@ -204,12 +230,12 @@ func (a *ApiMethod) ChineseToPinyin(c *gin.Context) {
default:
pyObject.Style = pinyin.Normal
}
pyObject.Separator = requestData.Connector
str := pinyin.Slug(requestData.Title, pyObject)
pyObject.Separator = connector
str := pinyin.Slug(title, pyObject)
if requestData.FormJson != "" {
if formJson != "" {
var formCont map[string]interface{}
json.Unmarshal([]byte(requestData.FormJson), &formCont)
json.Unmarshal([]byte(formJson), &formCont)
// taskflow.RecursionFormUnit
var formUnit taskflow.RecursionFormUnit
if list, ok := formCont["list"]; ok {
@ -225,8 +251,10 @@ func (a *ApiMethod) ChineseToPinyin(c *gin.Context) {
str = oneName.Name
}
}
publicmethod.Result(0, str, c)
if len(str) > 25 {
str = StringToPinYin(4, title, connector, formJson)
}
return str
}
/*

5
api/version1/workWechat/wechat.go

@ -154,10 +154,13 @@ func (a *ApiMethod) LookOnePeopleArchives(c *gin.Context) {
if surverManInfo.Role != "" {
roleList = strings.Split(surverManInfo.Role, ",")
}
// fmt.Printf("人员信息--->%v\n", surverManInfo)
//获取权限
var orgList []string
sendData.Purview, _, orgList, sendData.Level = user.GetUserPower("appsystem", surverManInfo.Position, roleList)
fmt.Printf("人员信息--->Purview:%v--->orgList:%v--->Level:%v\n", sendData.Purview, orgList, sendData.Level)
if publicmethod.IsInTrue[string]("210700510225772544", sendData.Purview) {
//获取被查看人行政组织
var lookManInfo modelshr.PersonArchives

2
apirouter/v1/customerformrouter/router.go

@ -56,6 +56,8 @@ func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) {
apiRouter.POST("gainCalendarList", methodBinding.GainCalendarList) //日历视图数据处理
apiRouter.POST("setOftenApp", methodBinding.SetOftenApp) //编辑常用自定义App
}
appApiRouter := router.Group("app")

75
models/modelAppPlatform/oftenApp.go

@ -0,0 +1,75 @@
package modelAppPlatform
import (
"appPlatform/overall"
"strings"
)
/*
*
@ 作者: 秦东
@ 时间: 2024-07-23 15:55:28
@ 功能: 常用App表
@ 参数
#
@ 返回值
#
@ 方法原型
#
*/
type OftenApp struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"`
UserKey int64 `json:"userKey" gorm:"column:userKey;type:bigint(20) unsigned;default:0;not null;comment:所有者"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
AppSignCode string `json:"appSignCode" gorm:"column:appSignCode;type:longtext;comment:节点名称"`
}
func (OftenApp *OftenApp) TableName() string {
return "oftenApp"
}
// 编辑内容
func (cont *OftenApp) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取内容
func (cont *OftenApp) GetCont(whereMap interface{}, field ...string) (err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
gormDb = gormDb.Where(whereMap)
err = gormDb.First(&cont).Error
return
}
// 根据条件获取总数
func (cont *OftenApp) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 读取全部信息
func (cont *OftenApp) ContMap(whereMap interface{}, field ...string) (countAry []OftenApp, err error) {
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont)
if len(field) > 0 {
fieldStr := strings.Join(field, ",")
gormDb = gormDb.Select(fieldStr)
}
err = gormDb.Where(whereMap).Find(&countAry).Error
return
}
// 删除内容
func (cont *OftenApp) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error
return
}
Loading…
Cancel
Save