我有一个事务表,其结构如下:
| transaction_id | customer_id | amount | transaction_type_id | status |
transaction_id => is the id of the transaction
customer_id => is the customer id who did the transaction
amount => Total transaction amount
transaction_type_id => Type of transaction
status => status of the transaction => pending, complete, canceled
我想为我的程序创建一个拆分账单功能,该功能的工作原理如下:
客户输入要拆分的账单的总金额。
客户添加另一个客户(n个客户)以拆分账单,并指定金额。
将为状态为“挂起”并指定金额的拆分账单中的所有客户进行交易。
拆分账单请求将被其他客户接收以拒绝或接受
如果其中一个客户拒绝拆分账单请求,则交易将被取消,但如果所有客户都接受该请求,则交易状态将为“完成”
到目前为止,我已经找到了解决这个问题的方法,通过创建主split\u bill表和split\u bill\u请求,如下所示:
split_bill
split_bill_id|transaction_ids | initiator | total_amount
split_bill_id => id of the split bill
transaction_ids => All the customer transaction id separated by comma
initiator => the customer_id who initiate split bill
total_amount => total of the bill
split_bill_request
split_bill_request_id | split_bill_id | customer_id | status
split_bill_request_id => id of split bill request
split_bill_id => id of the split bill
customer_id => id of the customer who receive split bill request from initiator
status => status of the request pending,accept,reject
我不知道这样做是否正确,您能建议另一种方法吗,因为我对拆分账单表中的事务ID或有效的方法有疑问,并且因为我没有修改事务表的权限?
暂无答案!
目前还没有任何答案,快来回答吧!