商城退款 例項

2022-06-24 04:45:07 字數 1708 閱讀 4934

1.一站式支付退款引數:

,

]}

2. 查詢所有的未支付的賬單結算單id  sql 

select

distinct

a.id

asaccountid,

a.settlement_id,

c.settlement_no

from

thc_rcm.`mall_account_bill` a

join thc_rcm.`mall_account_bill_detail` b on a.id =

b.`account_id`

join thc_rcm.`mall_settlement_detail` d on d.`account_detail_id` = b.id and d.`account_id` =

a.id

join thc_rcm.`mall_settlement` c on c.id =

d.`settlement_id`

inner

join `thc_passport`.`patient` p on a.`patient_id` =

p.id

where a.`refund_no` =

'54702249603099

'and a.status in (0,1) and c.status in (0,1

)order

by a.id

3. 正向單的查詢:

select

p.name,

a.id

asaccountid,

a.settlement_id,

c.settlement_no,

b.id

asaccountdetailid,

d.id

assettlementdetailid,

a.status

asaccountstatus,

c.status

assettlementstatus,

a.isdelete

asaccountdelete,

c.isdelete

assettlementdelete

from

thc_rcm.`mall_account_bill` a

join thc_rcm.`mall_account_bill_detail` b on a.id =

b.`account_id`

join thc_rcm.`mall_settlement_detail` d on d.`account_detail_id` = b.id and d.`account_id` =

a.id

join thc_rcm.`mall_settlement` c on c.id =

d.`settlement_id`

inner

join `thc_passport`.`patient` p on a.`patient_id` =

p.id

where a.`order_no` in ('

54702249603099

') --

and a.status in (0,1) -- 0 新建 1待處理 2已處理 3部分退款 4全部退款

order

by a.id

**賬單裡回寫了結算單id欄位

PHP實現微信申請退款流程例項原始碼

目錄 2 安全考慮,涉及到支付涉及到金錢,必須要非常安全。官方sdk雖然我也吐槽,但至少會相對比較安全,再次重寫,雖然暫時沒看出問題,但是萬一有漏洞就不好了。本篇還是使用到官方提供的sdk中的最重要的乙個類檔案wxpay.api.php中提供的refund 方法來實現,此方法在wxpay.api.p...