fix
This commit is contained in:
parent
360c19a8f5
commit
d6a25673bc
|
@ -4,16 +4,15 @@ import (
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// casbin_rule 后台--权限规则表
|
// casbin_rule
|
||||||
type CasbinRule struct {
|
type CasbinRule struct {
|
||||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 序号
|
PType *string `gorm:"default:'';" json:"p_type"` //
|
||||||
PType *string `gorm:"default:'';" json:"p_type"` //
|
V0 *string `gorm:"default:'';" json:"v0"` //
|
||||||
V0 *string `gorm:"default:'';" json:"v0"` //
|
V1 *string `gorm:"default:'';" json:"v1"` //
|
||||||
V1 *string `gorm:"default:'';" json:"v1"` //
|
V2 *string `gorm:"default:'';" json:"v2"` //
|
||||||
V2 *string `gorm:"default:'';" json:"v2"` //
|
V3 *string `gorm:"default:'';" json:"v3"` //
|
||||||
V3 *string `gorm:"default:'';" json:"v3"` //
|
V4 *string `gorm:"default:'';" json:"v4"` //
|
||||||
V4 *string `gorm:"default:'';" json:"v4"` //
|
V5 *string `gorm:"default:'';" json:"v5"` //
|
||||||
V5 *string `gorm:"default:'';" json:"v5"` //
|
|
||||||
}
|
}
|
||||||
type CasbinRuleModel struct {
|
type CasbinRuleModel struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
|
33
model/gmodel/fs_message_log_gen.go
Normal file
33
model/gmodel/fs_message_log_gen.go
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// fs_message_log 消息记录表
|
||||||
|
type FsMessageLog struct {
|
||||||
|
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||||
|
Type *string `gorm:"default:'';" json:"type"` //
|
||||||
|
Channel *string `gorm:"default:'';" json:"channel"` // 发送途径:sm=短信 email=邮件 feishu=飞书
|
||||||
|
Module *string `gorm:"default:'';" json:"module"` //
|
||||||
|
Source *string `gorm:"default:'';" json:"source"` //
|
||||||
|
Sender *string `gorm:"default:'';" json:"sender"` //
|
||||||
|
Receiver *string `gorm:"default:'';" json:"receiver"` //
|
||||||
|
TemplateSn *string `gorm:"default:'';" json:"template_sn"` //
|
||||||
|
Title *string `gorm:"default:'';" json:"title"` //
|
||||||
|
Content *[]byte `gorm:"default:'';" json:"content"` //
|
||||||
|
Status *int64 `gorm:"default:0;" json:"status"` // 状态:0=未发送 1=已发送
|
||||||
|
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
|
||||||
|
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除
|
||||||
|
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||||
|
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||||
|
}
|
||||||
|
type FsMessageLogModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFsMessageLogModel(db *gorm.DB) *FsMessageLogModel {
|
||||||
|
return &FsMessageLogModel{db: db, name: "fs_message_log"}
|
||||||
|
}
|
2
model/gmodel/fs_message_log_logic.go
Normal file
2
model/gmodel/fs_message_log_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
|
@ -113,8 +113,11 @@ func (s *FsShoppingCartModel) Create(ctx context.Context, data *FsShoppingCart)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
func (s *FsShoppingCartModel) Delete(ctx context.Context, userId, id int64) error {
|
func (s *FsShoppingCartModel) Delete(ctx context.Context, userId int64, ids []int64) error {
|
||||||
return s.db.WithContext(ctx).Model(&FsShoppingCart{}).Where("user_id = ? and id = ?", userId, id).Delete(&FsShoppingCart{}).Error
|
if len(ids) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return s.db.WithContext(ctx).Model(&FsShoppingCart{}).Where("user_id = ? and id in (?)", userId, ids).Delete(&FsShoppingCart{}).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
|
|
25
model/gmodel/ldap_apis_gen.go
Normal file
25
model/gmodel/ldap_apis_gen.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_apis
|
||||||
|
type LdapApis struct {
|
||||||
|
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||||
|
Method *string `gorm:"default:'';" json:"method"` //
|
||||||
|
Path *string `gorm:"default:'';" json:"path"` //
|
||||||
|
Category *string `gorm:"default:'';" json:"category"` //
|
||||||
|
Remark *string `gorm:"default:'';" json:"remark"` //
|
||||||
|
Creator *string `gorm:"default:'';" json:"creator"` //
|
||||||
|
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||||
|
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||||
|
Dtime *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"dtime"` //
|
||||||
|
}
|
||||||
|
type LdapApisModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapApisModel(db *gorm.DB) *LdapApisModel { return &LdapApisModel{db: db, name: "ldap_apis"} }
|
2
model/gmodel/ldap_apis_logic.go
Normal file
2
model/gmodel/ldap_apis_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
25
model/gmodel/ldap_casbin_rule_gen.go
Normal file
25
model/gmodel/ldap_casbin_rule_gen.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_casbin_rule 规则权限表
|
||||||
|
type LdapCasbinRule struct {
|
||||||
|
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||||
|
Ptype *string `gorm:"default:'';" json:"ptype"` //
|
||||||
|
V0 *string `gorm:"default:'';" json:"v0"` //
|
||||||
|
V1 *string `gorm:"default:'';" json:"v1"` //
|
||||||
|
V2 *string `gorm:"default:'';" json:"v2"` //
|
||||||
|
V3 *string `gorm:"default:'';" json:"v3"` //
|
||||||
|
V4 *string `gorm:"default:'';" json:"v4"` //
|
||||||
|
V5 *string `gorm:"default:'';" json:"v5"` //
|
||||||
|
}
|
||||||
|
type LdapCasbinRuleModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapCasbinRuleModel(db *gorm.DB) *LdapCasbinRuleModel {
|
||||||
|
return &LdapCasbinRuleModel{db: db, name: "ldap_casbin_rule"}
|
||||||
|
}
|
2
model/gmodel/ldap_casbin_rule_logic.go
Normal file
2
model/gmodel/ldap_casbin_rule_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
22
model/gmodel/ldap_department_gen.go
Normal file
22
model/gmodel/ldap_department_gen.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_department 部门表
|
||||||
|
type LdapDepartment struct {
|
||||||
|
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||||
|
Source *string `gorm:"default:'';" json:"source"` //
|
||||||
|
AppId *string `gorm:"default:'';" json:"app_id"` //
|
||||||
|
Name *string `gorm:"default:'';" json:"name"` //
|
||||||
|
DepartmentId *string `gorm:"default:'';" json:"department_id"` //
|
||||||
|
}
|
||||||
|
type LdapDepartmentModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapDepartmentModel(db *gorm.DB) *LdapDepartmentModel {
|
||||||
|
return &LdapDepartmentModel{db: db, name: "ldap_department"}
|
||||||
|
}
|
2
model/gmodel/ldap_department_logic.go
Normal file
2
model/gmodel/ldap_department_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
19
model/gmodel/ldap_group_users_gen.go
Normal file
19
model/gmodel/ldap_group_users_gen.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_group_users
|
||||||
|
type LdapGroupUsers struct {
|
||||||
|
GroupId *int64 `gorm:"default:0;" json:"group_id"` // 分组id
|
||||||
|
UserId *int64 `gorm:"default:0;" json:"user_id"` // user表id
|
||||||
|
}
|
||||||
|
type LdapGroupUsersModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapGroupUsersModel(db *gorm.DB) *LdapGroupUsersModel {
|
||||||
|
return &LdapGroupUsersModel{db: db, name: "ldap_group_users"}
|
||||||
|
}
|
2
model/gmodel/ldap_group_users_logic.go
Normal file
2
model/gmodel/ldap_group_users_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
32
model/gmodel/ldap_groups_gen.go
Normal file
32
model/gmodel/ldap_groups_gen.go
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_groups
|
||||||
|
type LdapGroups struct {
|
||||||
|
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||||
|
GroupName *string `gorm:"default:'';" json:"group_name"` //
|
||||||
|
Remark *string `gorm:"default:'';" json:"remark"` //
|
||||||
|
Creator *string `gorm:"default:'';" json:"creator"` //
|
||||||
|
GroupType *string `gorm:"default:'';" json:"group_type"` //
|
||||||
|
ParentId *int64 `gorm:"default:0;" json:"parent_id"` //
|
||||||
|
SourceDeptId *string `gorm:"default:'';" json:"source_dept_id"` //
|
||||||
|
Source *string `gorm:"default:'';" json:"source"` //
|
||||||
|
SourceDeptParentId *string `gorm:"default:'';" json:"source_dept_parent_id"` //
|
||||||
|
GroupDn *string `gorm:"default:'';" json:"group_dn"` //
|
||||||
|
SyncState *int64 `gorm:"default:0;" json:"sync_state"` //
|
||||||
|
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||||
|
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||||
|
Dtime *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"dtime"` //
|
||||||
|
}
|
||||||
|
type LdapGroupsModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapGroupsModel(db *gorm.DB) *LdapGroupsModel {
|
||||||
|
return &LdapGroupsModel{db: db, name: "ldap_groups"}
|
||||||
|
}
|
2
model/gmodel/ldap_groups_logic.go
Normal file
2
model/gmodel/ldap_groups_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
29
model/gmodel/ldap_menus_gen.go
Normal file
29
model/gmodel/ldap_menus_gen.go
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_menus
|
||||||
|
type LdapMenus struct {
|
||||||
|
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||||
|
Name *string `gorm:"default:'';" json:"name"` //
|
||||||
|
Title *string `gorm:"default:'';" json:"title"` //
|
||||||
|
Icon *string `gorm:"default:'';" json:"icon"` //
|
||||||
|
Path *string `gorm:"default:'';" json:"path"` //
|
||||||
|
Sort *int64 `gorm:"default:999;" json:"sort"` //
|
||||||
|
Status *int64 `gorm:"default:1;" json:"status"` //
|
||||||
|
Creator *string `gorm:"default:'';" json:"creator"` //
|
||||||
|
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||||
|
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||||
|
Dtime *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"dtime"` //
|
||||||
|
}
|
||||||
|
type LdapMenusModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapMenusModel(db *gorm.DB) *LdapMenusModel {
|
||||||
|
return &LdapMenusModel{db: db, name: "ldap_menus"}
|
||||||
|
}
|
2
model/gmodel/ldap_menus_logic.go
Normal file
2
model/gmodel/ldap_menus_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
19
model/gmodel/ldap_role_menus_gen.go
Normal file
19
model/gmodel/ldap_role_menus_gen.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_role_menus
|
||||||
|
type LdapRoleMenus struct {
|
||||||
|
MenuId *int64 `gorm:"default:0;" json:"menu_id"` // 菜单id
|
||||||
|
RoleId *int64 `gorm:"default:0;" json:"role_id"` // 角色id
|
||||||
|
}
|
||||||
|
type LdapRoleMenusModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapRoleMenusModel(db *gorm.DB) *LdapRoleMenusModel {
|
||||||
|
return &LdapRoleMenusModel{db: db, name: "ldap_role_menus"}
|
||||||
|
}
|
2
model/gmodel/ldap_role_menus_logic.go
Normal file
2
model/gmodel/ldap_role_menus_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
28
model/gmodel/ldap_roles_gen.go
Normal file
28
model/gmodel/ldap_roles_gen.go
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_roles
|
||||||
|
type LdapRoles struct {
|
||||||
|
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||||
|
Name *string `gorm:"unique_key;default:'';" json:"name"` //
|
||||||
|
Keyword *string `gorm:"unique_key;default:'';" json:"keyword"` //
|
||||||
|
Remark *string `gorm:"default:'';" json:"remark"` //
|
||||||
|
Status *int64 `gorm:"default:1;" json:"status"` //
|
||||||
|
Sort *int64 `gorm:"default:999;" json:"sort"` //
|
||||||
|
Creator *string `gorm:"default:'';" json:"creator"` //
|
||||||
|
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||||
|
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||||
|
Dtime *time.Time `gorm:"index;default:'0000-00-00 00:00:00';" json:"dtime"` //
|
||||||
|
}
|
||||||
|
type LdapRolesModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapRolesModel(db *gorm.DB) *LdapRolesModel {
|
||||||
|
return &LdapRolesModel{db: db, name: "ldap_roles"}
|
||||||
|
}
|
2
model/gmodel/ldap_roles_logic.go
Normal file
2
model/gmodel/ldap_roles_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
19
model/gmodel/ldap_user_roles_gen.go
Normal file
19
model/gmodel/ldap_user_roles_gen.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_user_roles
|
||||||
|
type LdapUserRoles struct {
|
||||||
|
RoleId *int64 `gorm:"default:0;" json:"role_id"` // 角色id
|
||||||
|
UserId *int64 `gorm:"default:0;" json:"user_id"` // 用户id
|
||||||
|
}
|
||||||
|
type LdapUserRolesModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapUserRolesModel(db *gorm.DB) *LdapUserRolesModel {
|
||||||
|
return &LdapUserRolesModel{db: db, name: "ldap_user_roles"}
|
||||||
|
}
|
2
model/gmodel/ldap_user_roles_logic.go
Normal file
2
model/gmodel/ldap_user_roles_logic.go
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
package gmodel
|
||||||
|
// TODO: 使用model的属性做你想做的
|
46
model/gmodel/ldap_users_gen.go
Normal file
46
model/gmodel/ldap_users_gen.go
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ldap_users
|
||||||
|
type LdapUsers struct {
|
||||||
|
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
|
||||||
|
Source *int64 `gorm:"default:0;" json:"source"` // 来源 1飞书
|
||||||
|
AppId *string `gorm:"default:'';" json:"app_id"` //
|
||||||
|
OpenId *string `gorm:"default:'';" json:"open_id"` //
|
||||||
|
UnionId *string `gorm:"default:'';" json:"union_id"` //
|
||||||
|
Name *string `gorm:"default:'';" json:"name"` //
|
||||||
|
EnName *string `gorm:"default:'';" json:"en_name"` //
|
||||||
|
Nickname *string `gorm:"default:'';" json:"nickname"` //
|
||||||
|
Email *string `gorm:"default:'';" json:"email"` //
|
||||||
|
EnterpriseEmail *string `gorm:"default:'';" json:"enterprise_email"` //
|
||||||
|
JobTitle *string `gorm:"default:'';" json:"job_title"` //
|
||||||
|
Mobile *string `gorm:"default:'';" json:"mobile"` //
|
||||||
|
Gender *int64 `gorm:"default:0;" json:"gender"` // 性别 0未知 1男 2女
|
||||||
|
Avatar *string `gorm:"default:'';" json:"avatar"` //
|
||||||
|
IsFrozen *int64 `gorm:"default:0;" json:"is_frozen"` // 是否冻结 0否1是
|
||||||
|
IsResigned *int64 `gorm:"default:0;" json:"is_resigned"` // 是否离职 0否 1是
|
||||||
|
IsActivated *int64 `gorm:"default:0;" json:"is_activated"` // 是否激活 0否1是
|
||||||
|
IsExited *int64 `gorm:"default:0;" json:"is_exited"` // 是否退出 0否1是
|
||||||
|
IsUnjoin *int64 `gorm:"default:0;" json:"is_unjoin"` // 是否未加入 0否1是
|
||||||
|
Departmentids *string `gorm:"default:'';" json:"departmentIds"` //
|
||||||
|
WorkStation *string `gorm:"default:'';" json:"work_station"` //
|
||||||
|
EmployeeNo *string `gorm:"default:'';" json:"employee_no"` //
|
||||||
|
EmployeeType *int64 `gorm:"default:0;" json:"employee_type"` // 1:正式员工 2:实习生 3:外包4:劳务 5:顾问
|
||||||
|
UserDn *string `gorm:"default:'';" json:"user_dn"` //
|
||||||
|
JoinTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"join_time"` //
|
||||||
|
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
||||||
|
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||||
|
Dtime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"dtime"` //
|
||||||
|
}
|
||||||
|
type LdapUsersModel struct {
|
||||||
|
db *gorm.DB
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLdapUsersModel(db *gorm.DB) *LdapUsersModel {
|
||||||
|
return &LdapUsersModel{db: db, name: "ldap_users"}
|
||||||
|
}
|
21
model/gmodel/ldap_users_logic.go
Normal file
21
model/gmodel/ldap_users_logic.go
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
package gmodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO: 使用model的属性做你想做的
|
||||||
|
|
||||||
|
func (u *LdapUsersModel) CreateOrUpdate(ctx context.Context, appId string, openId string, data *LdapUsers) error {
|
||||||
|
var info LdapUsers
|
||||||
|
err := u.db.WithContext(ctx).Where("app_id = ? and open_id = ?", appId, openId).Take(&info).Error
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return u.db.WithContext(ctx).Create(&data).Error
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return u.db.WithContext(ctx).Where("app_id = ? and open_id = ?", appId, openId).Updates(&data).Error
|
||||||
|
}
|
|
@ -58,6 +58,7 @@ type AllModelsGen struct {
|
||||||
FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库
|
FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库
|
||||||
FsMenu *FsMenuModel // fs_menu 后台菜单
|
FsMenu *FsMenuModel // fs_menu 后台菜单
|
||||||
FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表
|
FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表
|
||||||
|
FsMessageLog *FsMessageLogModel // fs_message_log 消息记录表
|
||||||
FsMigration *FsMigrationModel // fs_migration 版本库
|
FsMigration *FsMigrationModel // fs_migration 版本库
|
||||||
FsOrder *FsOrderModel // fs_order 订单表
|
FsOrder *FsOrderModel // fs_order 订单表
|
||||||
FsOrderAffiliateOld *FsOrderAffiliateOldModel // fs_order_affiliate_old 订单附属表-流程控制时间等
|
FsOrderAffiliateOld *FsOrderAffiliateOldModel // fs_order_affiliate_old 订单附属表-流程控制时间等
|
||||||
|
@ -118,6 +119,16 @@ type AllModelsGen struct {
|
||||||
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
|
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
|
||||||
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
|
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
|
||||||
FsZipCode *FsZipCodeModel // fs_zip_code 邮编表
|
FsZipCode *FsZipCodeModel // fs_zip_code 邮编表
|
||||||
|
LdapApis *LdapApisModel // ldap_apis
|
||||||
|
LdapCasbinRule *LdapCasbinRuleModel // ldap_casbin_rule 规则权限表
|
||||||
|
LdapDepartment *LdapDepartmentModel // ldap_department 部门表
|
||||||
|
LdapGroupUsers *LdapGroupUsersModel // ldap_group_users
|
||||||
|
LdapGroups *LdapGroupsModel // ldap_groups
|
||||||
|
LdapMenus *LdapMenusModel // ldap_menus
|
||||||
|
LdapRoleMenus *LdapRoleMenusModel // ldap_role_menus
|
||||||
|
LdapRoles *LdapRolesModel // ldap_roles
|
||||||
|
LdapUserRoles *LdapUserRolesModel // ldap_user_roles
|
||||||
|
LdapUsers *LdapUsersModel // ldap_users
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +188,7 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||||
FsMapLibrary: NewFsMapLibraryModel(gdb),
|
FsMapLibrary: NewFsMapLibraryModel(gdb),
|
||||||
FsMenu: NewFsMenuModel(gdb),
|
FsMenu: NewFsMenuModel(gdb),
|
||||||
FsMerchantCategory: NewFsMerchantCategoryModel(gdb),
|
FsMerchantCategory: NewFsMerchantCategoryModel(gdb),
|
||||||
|
FsMessageLog: NewFsMessageLogModel(gdb),
|
||||||
FsMigration: NewFsMigrationModel(gdb),
|
FsMigration: NewFsMigrationModel(gdb),
|
||||||
FsOrder: NewFsOrderModel(gdb),
|
FsOrder: NewFsOrderModel(gdb),
|
||||||
FsOrderAffiliateOld: NewFsOrderAffiliateOldModel(gdb),
|
FsOrderAffiliateOld: NewFsOrderAffiliateOldModel(gdb),
|
||||||
|
@ -237,6 +249,16 @@ func NewAllModels(gdb *gorm.DB) *AllModelsGen {
|
||||||
FsUserStock: NewFsUserStockModel(gdb),
|
FsUserStock: NewFsUserStockModel(gdb),
|
||||||
FsWebSet: NewFsWebSetModel(gdb),
|
FsWebSet: NewFsWebSetModel(gdb),
|
||||||
FsZipCode: NewFsZipCodeModel(gdb),
|
FsZipCode: NewFsZipCodeModel(gdb),
|
||||||
|
LdapApis: NewLdapApisModel(gdb),
|
||||||
|
LdapCasbinRule: NewLdapCasbinRuleModel(gdb),
|
||||||
|
LdapDepartment: NewLdapDepartmentModel(gdb),
|
||||||
|
LdapGroupUsers: NewLdapGroupUsersModel(gdb),
|
||||||
|
LdapGroups: NewLdapGroupsModel(gdb),
|
||||||
|
LdapMenus: NewLdapMenusModel(gdb),
|
||||||
|
LdapRoleMenus: NewLdapRoleMenusModel(gdb),
|
||||||
|
LdapRoles: NewLdapRolesModel(gdb),
|
||||||
|
LdapUserRoles: NewLdapUserRolesModel(gdb),
|
||||||
|
LdapUsers: NewLdapUsersModel(gdb),
|
||||||
}
|
}
|
||||||
return models
|
return models
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||||
Path: "/api/feishu/webhook",
|
Path: "/api/feishu/webhook",
|
||||||
Handler: WebhookHandler(serverCtx),
|
Handler: WebhookHandler(serverCtx),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Method: http.MethodGet,
|
|
||||||
Path: "/api/feishu/sync_feishu_departments",
|
|
||||||
Handler: SyncFeiShuGroupsHandler(serverCtx),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
package handler
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
"reflect"
|
|
||||||
|
|
||||||
"fusenapi/utils/basic"
|
|
||||||
|
|
||||||
"fusenapi/server/feishu-sync/internal/logic"
|
|
||||||
"fusenapi/server/feishu-sync/internal/svc"
|
|
||||||
"fusenapi/server/feishu-sync/internal/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
func SyncFeiShuGroupsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
|
|
||||||
var req types.Request
|
|
||||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建一个业务逻辑层实例
|
|
||||||
l := logic.NewSyncFeiShuGroupsLogic(r.Context(), svcCtx)
|
|
||||||
|
|
||||||
rl := reflect.ValueOf(l)
|
|
||||||
basic.BeforeLogic(w, r, rl)
|
|
||||||
|
|
||||||
resp := l.SyncFeiShuGroups(&req, userinfo)
|
|
||||||
|
|
||||||
if !basic.AfterLogic(w, r, rl, resp) {
|
|
||||||
basic.NormalAfterLogic(w, r, resp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package logic
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fusenapi/utils/auth"
|
|
||||||
"fusenapi/utils/basic"
|
|
||||||
|
|
||||||
"fusenapi/server/feishu-sync/internal/svc"
|
|
||||||
"fusenapi/server/feishu-sync/internal/types"
|
|
||||||
|
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SyncFeiShuGroupsLogic struct {
|
|
||||||
logx.Logger
|
|
||||||
ctx context.Context
|
|
||||||
svcCtx *svc.ServiceContext
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewSyncFeiShuGroupsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SyncFeiShuGroupsLogic {
|
|
||||||
return &SyncFeiShuGroupsLogic{
|
|
||||||
Logger: logx.WithContext(ctx),
|
|
||||||
ctx: ctx,
|
|
||||||
svcCtx: svcCtx,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理进入前逻辑w,r
|
|
||||||
// func (l *SyncFeiShuGroupsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
|
||||||
// }
|
|
||||||
|
|
||||||
func (l *SyncFeiShuGroupsLogic) SyncFeiShuGroups(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
|
|
||||||
return resp.SetStatus(basic.CodeOK)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
|
||||||
// func (l *SyncFeiShuGroupsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
|
||||||
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
|
||||||
// }
|
|
|
@ -1,5 +1,13 @@
|
||||||
package logic
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fusenapi/model/gmodel"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type UserWebhookMsg struct {
|
type UserWebhookMsg struct {
|
||||||
Schema string `json:"schema"`
|
Schema string `json:"schema"`
|
||||||
Header struct {
|
Header struct {
|
||||||
|
@ -76,12 +84,10 @@ type UserWebhookMsg struct {
|
||||||
|
|
||||||
// 员工增删改信息
|
// 员工增删改信息
|
||||||
func (l *WebhookLogic) OnUserChange(data []byte) error {
|
func (l *WebhookLogic) OnUserChange(data []byte) error {
|
||||||
return nil
|
var msg UserWebhookMsg
|
||||||
/*var msg UserWebhookMsg
|
|
||||||
if err := json.Unmarshal(data, &msg); err != nil {
|
if err := json.Unmarshal(data, &msg); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
avatar, _ := json.Marshal(msg.Event.Object.Avatar)
|
|
||||||
isFrozen := int64(0)
|
isFrozen := int64(0)
|
||||||
if msg.Event.Object.Status.IsFrozen {
|
if msg.Event.Object.Status.IsFrozen {
|
||||||
isFrozen = 1
|
isFrozen = 1
|
||||||
|
@ -102,14 +108,16 @@ func (l *WebhookLogic) OnUserChange(data []byte) error {
|
||||||
if msg.Event.Object.Status.IsUnjoin {
|
if msg.Event.Object.Status.IsUnjoin {
|
||||||
isUnjoin = 1
|
isUnjoin = 1
|
||||||
}
|
}
|
||||||
departmentIds, _ := json.Marshal(msg.Event.Object.DepartmentIds)
|
|
||||||
orders, _ := json.Marshal(msg.Event.Object.Orders)
|
|
||||||
feiShuMsgCreateTimeInt64, err := strconv.ParseInt(msg.Header.CreateTime, 10, 64)
|
feiShuMsgCreateTimeInt64, err := strconv.ParseInt(msg.Header.CreateTime, 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
feiShuMsgCreateTime := time.UnixMilli(feiShuMsgCreateTimeInt64)
|
feiShuMsgCreateTime := time.UnixMilli(feiShuMsgCreateTimeInt64)
|
||||||
return l.svcCtx.AllModels.FsFeishuUser.CreateOrUpdate(l.ctx, msg.Header.AppId, msg.Event.Object.OpenId, &gmodel.FsFeishuUser{
|
departmentIds := strings.Join(msg.Event.Object.DepartmentIds, ",")
|
||||||
|
joinTime := time.Unix(msg.Event.Object.Joint64ime, 0)
|
||||||
|
source := int64(1)
|
||||||
|
return l.svcCtx.AllModels.LdapUsers.CreateOrUpdate(l.ctx, msg.Header.AppId, msg.Event.Object.OpenId, &gmodel.LdapUsers{
|
||||||
|
Source: &source,
|
||||||
AppId: &msg.Header.AppId,
|
AppId: &msg.Header.AppId,
|
||||||
OpenId: &msg.Event.Object.OpenId,
|
OpenId: &msg.Event.Object.OpenId,
|
||||||
UnionId: &msg.Event.Object.UnionId,
|
UnionId: &msg.Event.Object.UnionId,
|
||||||
|
@ -121,18 +129,18 @@ func (l *WebhookLogic) OnUserChange(data []byte) error {
|
||||||
JobTitle: &msg.Event.Object.JobTitle,
|
JobTitle: &msg.Event.Object.JobTitle,
|
||||||
Mobile: &msg.Event.Object.Mobile,
|
Mobile: &msg.Event.Object.Mobile,
|
||||||
Gender: &msg.Event.Object.Gender,
|
Gender: &msg.Event.Object.Gender,
|
||||||
Avatar: &avatar,
|
Avatar: &msg.Event.Object.Avatar.AvatarOrigin,
|
||||||
IsFrozen: &isFrozen,
|
IsFrozen: &isFrozen,
|
||||||
IsResigned: &isResigned,
|
IsResigned: &isResigned,
|
||||||
IsActivated: &isActivated,
|
IsActivated: &isActivated,
|
||||||
IsExited: &isExited,
|
IsExited: &isExited,
|
||||||
IsUnjoin: &isUnjoin,
|
IsUnjoin: &isUnjoin,
|
||||||
DepartmentIds: &departmentIds,
|
Departmentids: &departmentIds,
|
||||||
WorkStation: &msg.Event.Object.WorkStation,
|
WorkStation: &msg.Event.Object.WorkStation,
|
||||||
EmployeeNo: &msg.Event.Object.EmployeeNo,
|
EmployeeNo: &msg.Event.Object.EmployeeNo,
|
||||||
EmployeeType: &msg.Event.Object.EmployeeType,
|
EmployeeType: &msg.Event.Object.EmployeeType,
|
||||||
Orders: &orders,
|
JoinTime: &joinTime,
|
||||||
Ctime: &feiShuMsgCreateTime,
|
Ctime: &feiShuMsgCreateTime,
|
||||||
Utime: &feiShuMsgCreateTime,
|
Utime: &feiShuMsgCreateTime,
|
||||||
})*/
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (l *DeleteCartLogic) DeleteCart(req *types.DeleteCartReq, userinfo *auth.Us
|
||||||
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in")
|
return resp.SetStatusWithMessage(basic.CodeUnAuth, "please sign in")
|
||||||
}
|
}
|
||||||
//删除购物车
|
//删除购物车
|
||||||
if err := l.svcCtx.AllModels.FsShoppingCart.Delete(l.ctx, userinfo.UserId, req.Id); err != nil {
|
if err := l.svcCtx.AllModels.FsShoppingCart.Delete(l.ctx, userinfo.UserId, req.IdList); err != nil {
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to delete shopping cart")
|
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to delete shopping cart")
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ type DiyInfo struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteCartReq struct {
|
type DeleteCartReq struct {
|
||||||
Id int64 `json:"id"` //购物车id
|
IdList []int64 `json:"id"` //购物车id
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetCartsReq struct {
|
type GetCartsReq struct {
|
||||||
|
|
|
@ -13,7 +13,4 @@ service feishu-sync {
|
||||||
//飞书ticket webhook事件接口
|
//飞书ticket webhook事件接口
|
||||||
@handler WebhookHandler
|
@handler WebhookHandler
|
||||||
post /api/feishu/webhook(request) returns (response);
|
post /api/feishu/webhook(request) returns (response);
|
||||||
//同步飞书分组(现在是get请求)
|
|
||||||
@handler SyncFeiShuGroupsHandler
|
|
||||||
get /api/feishu/sync_feishu_departments(request) returns (response);
|
|
||||||
}
|
}
|
|
@ -55,7 +55,7 @@ type DiyInfo {
|
||||||
}
|
}
|
||||||
//删除购物车
|
//删除购物车
|
||||||
type DeleteCartReq {
|
type DeleteCartReq {
|
||||||
Id int64 `json:"id"` //购物车id
|
IdList []int64 `json:"id"` //购物车id
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取购物车列表
|
//获取购物车列表
|
||||||
|
|
Loading…
Reference in New Issue
Block a user