DouyinOrderLists.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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\external;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\common\model\external\DouyinOrder;
  17. use app\common\lists\ListsSearchInterface;
  18. /**
  19. * DouyinOrder列表
  20. * Class DouyinOrderLists
  21. * @package app\adminapi\lists
  22. */
  23. class DouyinOrderLists extends BaseAdminDataLists implements ListsSearchInterface
  24. {
  25. /**
  26. * @notes 设置搜索条件
  27. * @return \string[][]
  28. * @author likeadmin
  29. * @date 2025/05/23 13:40
  30. */
  31. public function setSearch(): array
  32. {
  33. return [
  34. '=' => ['user_id', 'order_number', 'order_status', 'transaction_id', 'pay_status', 'consultation_id', 'work_id'],
  35. '%like%' => ['mobile', 'remark'],
  36. ];
  37. }
  38. public function queryWhere(): array
  39. {
  40. $where = [];
  41. if(isset($this->params['refund_pay_status']) && !empty($this->params['refund_pay_status'])){
  42. $where[] = ['pay_status', 'in', [3,4,5,6]];
  43. }
  44. /*if(isset($this->params['create_time_range']) && !empty($this->params['create_time_range'][0]) && !empty($this->params['create_time_range'][1])){
  45. $time = [strtotime($this->params['create_time_range'][0]), strtotime($this->params['create_time_range'][1])+86400-1];
  46. $where[] = ['create_time', 'between', $time];
  47. }*/
  48. return $where;
  49. }
  50. /**
  51. * @notes 获取列表
  52. * @return array
  53. * @throws \think\db\exception\DataNotFoundException
  54. * @throws \think\db\exception\DbException
  55. * @throws \think\db\exception\ModelNotFoundException
  56. * @author likeadmin
  57. * @date 2025/05/23 13:40
  58. */
  59. public function lists(): array
  60. {
  61. return DouyinOrder::with(['goods', 'serviceWork','douyinRefundOrder'])->where($this->searchWhere)->where($this->queryWhere())
  62. ->field(['*'])
  63. ->append(['order_status_text','pay_status_text'])
  64. ->limit($this->limitOffset, $this->limitLength)
  65. ->order(['id' => 'desc'])
  66. ->select()
  67. ->toArray();
  68. }
  69. /**
  70. * @notes 获取数量
  71. * @return int
  72. * @author likeadmin
  73. * @date 2025/05/23 13:40
  74. */
  75. public function count(): int
  76. {
  77. return DouyinOrder::where($this->searchWhere)->where($this->queryWhere())->count();
  78. }
  79. }