RechargeOrderLists.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\lists\orders;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\model\orders\RechargeOrder;
  17. use app\common\lists\ListsSearchInterface;
  18. use think\db\Query;
  19. /**
  20. * RechargeOrder列表
  21. * Class RechargeOrderLists
  22. * @package app\adminapi\listsorders
  23. */
  24. class RechargeOrderLists extends BaseAdminDataLists implements ListsSearchInterface
  25. {
  26. /**
  27. * @notes 设置搜索条件
  28. * @return \string[][]
  29. * @author likeadmin
  30. * @date 2024/07/10 14:53
  31. */
  32. public function setSearch(): array
  33. {
  34. return [
  35. '=' => ['sn', 'work_id', 'user_id', 'payment_type', 'pay_sn', 'pay_way', 'pay_status', 'pay_time', 'order_terminal', 'transaction_id', 'refund_status', 'refund_transaction_id', 'create_time', 'update_time'],
  36. ];
  37. }
  38. /**
  39. * @notes 获取列表
  40. * @return array
  41. * @throws \think\db\exception\DataNotFoundException
  42. * @throws \think\db\exception\DbException
  43. * @throws \think\db\exception\ModelNotFoundException
  44. * @author likeadmin
  45. * @date 2024/07/10 14:53
  46. */
  47. public function lists(): array
  48. {
  49. return RechargeOrder::with(['orderGoods'=>function(Query $query){
  50. $query->field('id,sn,goods_id,goods_name,goods_image,goods_number,good_unit,goods_size,goods_type,goods_brand,base_service_fee,service_total,service_fee')->order(['id'=>'desc']);
  51. }])->where($this->searchWhere)
  52. ->field(['id', 'sn', 'work_id', 'user_id', 'payment_type', 'pay_sn', 'pay_way', 'pay_status', 'pay_time', 'order_total', 'order_amount', 'order_terminal', 'transaction_id', 'refund_status', 'refund_transaction_id', 'create_time', 'update_time'])
  53. ->limit($this->limitOffset, $this->limitLength)
  54. ->order(['id' => 'desc'])
  55. ->select()
  56. ->toArray();
  57. }
  58. /**
  59. * @notes 获取数量
  60. * @return int
  61. * @author likeadmin
  62. * @date 2024/07/10 14:53
  63. */
  64. public function count(): int
  65. {
  66. return RechargeOrder::where($this->searchWhere)->count();
  67. }
  68. }