代码拉取完成,页面将自动刷新
package wxapp
import (
"errors"
"gitee.com/taotechip/modules/database"
"gorm.io/gorm"
)
type wxappRepo struct {
database.GeneralRepo
}
func WxappRepo(transactionalConn *gorm.DB) (repo *wxappRepo) {
repo = database.NewRepo(transactionalConn, &wxappRepo{})
return
}
func (repo *wxappRepo) FindWechatAccountByOpenId(openId string) (account *WechatAccount, err error) {
account = &WechatAccount{}
err = repo.GetConn().Where("open_id = ?", openId).First(account).Error
return
}
func (repo *wxappRepo) FindWechatAccountByUnionId(unionId string) (account *WechatAccount, err error) {
account = &WechatAccount{}
err = repo.GetConn().Where("union_id = ?", unionId).First(account).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, nil
}
return
}
func (repo *wxappRepo) FindWechatAccountByAccountId(accountId string) (account *WechatAccount, err error) {
account = &WechatAccount{}
err = repo.GetConn().Where("account_id = ?", accountId).First(account).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, nil
}
return
}
func (repo *wxappRepo) CreateWechatAccount(account *WechatAccount) error {
return repo.GetConn().Create(account).Error
}
func (repo *wxappRepo) UpdateWechatAccount(account *WechatAccount, columns ...string) error {
return repo.GetConn().Model(account).Select(columns).Updates(account).Error
}
func (repo *wxappRepo) DeleteWechatAccount(id string) error {
return repo.GetConn().Delete(&WechatAccount{}, id).Error
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。