feat: show own withdrawal account details and enable avatar upload
This commit is contained in:
@@ -30,6 +30,8 @@ type PaymentAccount struct {
|
||||
QRAttachmentID int64 `db:"qr_attachment_id"`
|
||||
WechatQRAttachmentID int64 `db:"wechat_qr_attachment_id"`
|
||||
AlipayQRAttachmentID int64 `db:"alipay_qr_attachment_id"`
|
||||
WechatQRURL string `db:"wechat_qr_url"`
|
||||
AlipayQRURL string `db:"alipay_qr_url"`
|
||||
VerifyStatus int `db:"verify_status"`
|
||||
IsDefault int `db:"is_default"`
|
||||
CreatedAt string `db:"created_at"`
|
||||
@@ -154,6 +156,29 @@ func (s *Store) PaymentAccounts(ctx context.Context, tenantID, memberID int64) (
|
||||
return items, err
|
||||
}
|
||||
|
||||
// PaymentAccountDetails returns encrypted fields only for the authenticated account owner.
|
||||
func (s *Store) PaymentAccountDetails(ctx context.Context, tenantID, memberID int64) ([]PaymentAccount, error) {
|
||||
items := make([]PaymentAccount, 0)
|
||||
err := s.db.SelectContext(ctx, &items, `SELECT a.id,a.account_type,a.bank_code,a.bank_name,
|
||||
COALESCE(a.holder_cipher,'') AS holder_cipher,
|
||||
COALESCE(a.identity_no_cipher,'') AS identity_no_cipher,
|
||||
COALESCE(a.account_no_cipher,'') AS account_no_cipher,
|
||||
COALESCE(a.digital_rmb_code_cipher,'') AS digital_rmb_code_cipher,
|
||||
COALESCE(a.wechat_qr_attachment_id,0) AS wechat_qr_attachment_id,
|
||||
COALESCE(a.alipay_qr_attachment_id,0) AS alipay_qr_attachment_id,
|
||||
COALESCE(wechat.file_url,'') AS wechat_qr_url,
|
||||
COALESCE(alipay.file_url,'') AS alipay_qr_url,
|
||||
a.verify_status,a.is_default
|
||||
FROM hg_app_member_payment_account a
|
||||
LEFT JOIN hg_sys_attachment wechat ON wechat.id=a.wechat_qr_attachment_id
|
||||
AND wechat.member_id=a.member_id AND wechat.app_id='olons_server' AND wechat.status=1
|
||||
LEFT JOIN hg_sys_attachment alipay ON alipay.id=a.alipay_qr_attachment_id
|
||||
AND alipay.member_id=a.member_id AND alipay.app_id='olons_server' AND alipay.status=1
|
||||
WHERE a.tenant_id=? AND a.member_id=? AND a.deleted_at IS NULL
|
||||
ORDER BY a.is_default ASC,a.id DESC`, tenantID, memberID)
|
||||
return items, err
|
||||
}
|
||||
|
||||
func (s *Store) CreatePaymentAccount(ctx context.Context, input PaymentAccountCreation) (*PaymentAccount, error) {
|
||||
tx, err := s.db.BeginTxx(ctx, nil)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user