|
|
@@ -4,13 +4,30 @@ namespace SixShop\WechatPay\Entity;
|
|
|
|
|
|
|
|
|
use SixShop\Core\Entity\BaseEntity;
|
|
|
+use think\Paginator;
|
|
|
|
|
|
+/**
|
|
|
+ * @mixin \SixShop\WechatPay\Model\WechatpayTransferBillModel
|
|
|
+ */
|
|
|
class WechatpayTransferBillEntity extends BaseEntity
|
|
|
{
|
|
|
- protected function getOptions(): array
|
|
|
+ public function getTransferBillList(array $params, array $page): Paginator
|
|
|
{
|
|
|
- return [
|
|
|
- 'name' => 'wechatpay_transfer_bill',
|
|
|
- ];
|
|
|
+ $query = $this->withSearch(['state', 'out_bill_no'], $params);
|
|
|
+ return $query->order('id', 'desc')->paginate($page);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getTransferBillStats(array $params): array
|
|
|
+ {
|
|
|
+ return $this->field('state, count(*) as count, sum(transfer_amount) as amount')
|
|
|
+ ->group('state')
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ public function refreshTransferBill(int $id): array
|
|
|
+ {
|
|
|
+ // todo: 刷新转账单状态
|
|
|
+ return $this->find($id)->toArray();
|
|
|
}
|
|
|
}
|