OrderEffectiveLogLists.php 2.8 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\effective;
  15. use app\adminapi\lists\BaseAdminDataLists;
  16. use app\adminapi\logic\effective\OrderEffectiveLogLogic;
  17. use app\common\model\orders\OrderEffectiveLog;
  18. use app\common\lists\ListsSearchInterface;
  19. use app\common\model\works\ServiceWork;
  20. /**
  21. * OrderEffectiveLog列表
  22. * Class OrderEffectiveLogLists
  23. * @package app\adminapi\lists
  24. */
  25. class OrderEffectiveLogLists extends BaseAdminDataLists implements ListsSearchInterface
  26. {
  27. /**
  28. * @notes 设置搜索条件
  29. * @return \string[][]
  30. * @author likeadmin
  31. * @date 2025/01/17 11:10
  32. */
  33. public function setSearch(): array
  34. {
  35. return [
  36. '=' => ['effective_id', 'sn', 'user_id', 'work_id', 'goods_id', 'effective_unit', 'effective_num', 'remark', 'end_effective_time'],
  37. ];
  38. }
  39. /**
  40. * @notes 获取列表
  41. * @return array
  42. * @throws \think\db\exception\DataNotFoundException
  43. * @throws \think\db\exception\DbException
  44. * @throws \think\db\exception\ModelNotFoundException
  45. * @author likeadmin
  46. * @date 2025/01/17 11:10
  47. */
  48. public function lists(): array
  49. {
  50. $list = OrderEffectiveLog::with(['goods'=>function ($query) {
  51. $query->with(['goodsCategory'=>function ($query1) {
  52. $query1->field(['name','picture']);
  53. }]);
  54. },'serviceWork','originalServiceWork'])->where('effective_status','>',0)->where($this->searchWhere)
  55. ->field(['*'])
  56. ->limit($this->limitOffset, $this->limitLength)
  57. ->order(['id' => 'desc'])
  58. ->select()
  59. ->toArray();
  60. foreach ($list as &$value) {
  61. $value['income_fee'] = 0;
  62. if($value['originalServiceWork']) $value['income_fee'] = OrderEffectiveLogLogic::commissionAndAssuranceDeposit($value['originalServiceWork']);
  63. }
  64. return $list;
  65. }
  66. /**
  67. * @notes 获取数量
  68. * @return int
  69. * @author likeadmin
  70. * @date 2025/01/17 11:10
  71. */
  72. public function count(): int
  73. {
  74. return OrderEffectiveLog::where($this->searchWhere)->count();
  75. }
  76. }