feat: 新增账号编码和HTTP连接功能
This commit is contained in:
@@ -28,7 +28,7 @@ func (d *account) Insert(ctx context.Context, req *dto.AddAccountReq) (id int64,
|
||||
}
|
||||
|
||||
func (d *account) Update(ctx context.Context, req *dto.UpdateAccountReq) (rows int64, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, public.TableNameAccount).Data(&req).Where(entity.AccountCol.Id, req.Id).Update()
|
||||
r, err := gfdb.DB(ctx).Model(ctx, public.TableNameAccount).Data(&req).Where(entity.AccountCol.Id, req.Id).OmitEmpty().Update()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func (d *account) Delete(ctx context.Context, req *dto.DeleteAccountReq) (rows i
|
||||
}
|
||||
|
||||
func (d *account) Count(ctx context.Context, req *dto.ListAccountReq) (count int, err error) {
|
||||
count, err = gfdb.DB(ctx).Model(ctx, public.TableNameAccount).OmitEmpty().Where(entity.AccountCol.AccountName, req.AccountName).Count()
|
||||
count, err = gfdb.DB(ctx).Model(ctx, public.TableNameAccount).OmitEmpty().Where(entity.AccountCol.AccountCode, req.AccountCode).Count()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ func (d *account) List(ctx context.Context, req *dto.ListAccountReq, fields ...s
|
||||
if !g.IsEmpty(req.Keyword) {
|
||||
model.WhereLike(entity.AccountCol.AccountName, "%"+req.Keyword+"%")
|
||||
}
|
||||
model.Where(entity.AccountCol.AccountCode, req.AccountCode)
|
||||
model.Where(entity.AccountCol.Status, req.Status)
|
||||
model.Where(entity.AccountCol.Platform, req.Platform)
|
||||
model.OrderDesc(entity.AccountCol.CreatedAt)
|
||||
@@ -79,9 +80,9 @@ func (d *account) List(ctx context.Context, req *dto.ListAccountReq, fields ...s
|
||||
return
|
||||
}
|
||||
|
||||
// GetByAccountName 根据账号名称查询客服账号(GoFrame框架原声,绕过用户信息校验)
|
||||
func (d *account) GetByAccountName(ctx context.Context, req *dto.GetByAccountNameReq, fields ...string) (res *entity.Account, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, public.TableNameAccount).NoTenantId(ctx).Where(entity.AccountCol.AccountName, req.AccountName).Fields(fields).One()
|
||||
// GetByAccountCode 根据客服账号编码查询(不带租户id)
|
||||
func (d *account) GetByAccountCode(ctx context.Context, req *dto.GetByAccountCodeReq, fields ...string) (res *entity.Account, err error) {
|
||||
r, err := gfdb.DB(ctx).Model(ctx, public.TableNameAccount).NoTenantId(ctx).Where(entity.AccountCol.AccountCode, req.AccountCode).Fields(fields).One()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user