七月迭代短暂完结,还有很多后端的关键东西没有弄,这是一版赶时间做的东西
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s
This commit is contained in:
@@ -99,6 +99,13 @@ func (s *AccountStore) Update(ctx context.Context, account *model.Account) error
|
||||
return s.db.WithContext(ctx).Save(account).Error
|
||||
}
|
||||
|
||||
// BindWeCom 更新账号的企业微信成员绑定快照。
|
||||
func (s *AccountStore) BindWeCom(ctx context.Context, accountID uint, corpID, userID, name string, updater uint) error {
|
||||
return s.db.WithContext(ctx).Model(&model.Account{}).Where("id = ?", accountID).Updates(map[string]any{
|
||||
"wecom_corp_id": corpID, "wecom_userid": userID, "wecom_name": name, "updater": updater,
|
||||
}).Error
|
||||
}
|
||||
|
||||
// Delete 软删除账号
|
||||
func (s *AccountStore) Delete(ctx context.Context, id uint) error {
|
||||
return s.db.WithContext(ctx).Delete(&model.Account{}, id).Error
|
||||
@@ -254,6 +261,22 @@ func (s *AccountStore) GetByIDs(ctx context.Context, ids []uint) ([]*model.Accou
|
||||
return accounts, nil
|
||||
}
|
||||
|
||||
// GetDisplayAccountsByIDs 批量读取历史业务记录的账号展示信息。
|
||||
// 该查询只返回 ID 和用户名,包含已软删除账号,不用于授权判定。
|
||||
func (s *AccountStore) GetDisplayAccountsByIDs(ctx context.Context, ids []uint) ([]*model.Account, error) {
|
||||
if len(ids) == 0 {
|
||||
return []*model.Account{}, nil
|
||||
}
|
||||
var accounts []*model.Account
|
||||
if err := s.db.WithContext(ctx).Unscoped().
|
||||
Select("id", "username").
|
||||
Where("id IN ?", ids).
|
||||
Find(&accounts).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return accounts, nil
|
||||
}
|
||||
|
||||
func (s *AccountStore) GetPrimaryAccountsByShopIDs(ctx context.Context, shopIDs []uint) ([]*model.Account, error) {
|
||||
if len(shopIDs) == 0 {
|
||||
return []*model.Account{}, nil
|
||||
|
||||
Reference in New Issue
Block a user