截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RecordLogic.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop开源商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | gitee下载:https://gitee.com/likeshop_gitee
  7. // | github下载:https://github.com/likeshop-github
  8. // | 访问官网:https://www.likeshop.cn
  9. // | 访问社区:https://home.likeshop.cn
  10. // | 访问手册:http://doc.likeshop.cn
  11. // | 微信公众号:likeshop技术社区
  12. // | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
  13. // | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
  14. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  15. // | likeshop团队版权所有并拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshop.cn.team
  18. // +----------------------------------------------------------------------
  19. namespace app\admin\logic\distribution;
  20. use app\common\basics\Logic;
  21. use app\common\model\distribution\DistributionOrderGoods;
  22. class RecordLogic extends Logic
  23. {
  24. public static function lists($get)
  25. {
  26. $where = [];
  27. // 搜索
  28. if(!empty($get['keyword'])) {
  29. $fieldDesc = '';
  30. switch($get['keyword_type']) {
  31. case 'order_sn':
  32. $fieldDesc = 'o.order_sn';
  33. break;
  34. case 'user_nickname':
  35. $fieldDesc = 'u.nickname';
  36. break;
  37. case 'user_sn':
  38. $fieldDesc = 'u.sn';
  39. break;
  40. case 'user_mobile':
  41. $fieldDesc = 'u.mobile';
  42. break;
  43. }
  44. $where[] = [$fieldDesc, '=', trim($get['keyword'])];
  45. }
  46. // 佣金状态
  47. if(!empty($get['status'])) {
  48. $where[] = ['dog.status', '=', $get['status']];
  49. }
  50. // 记录时间
  51. if(!empty($get['start_time'])) {
  52. $where[] = ['dog.create_time', '>=', strtotime($get['start_time'])];
  53. }
  54. if(!empty($get['end_time'])) {
  55. $where[] = ['dog.create_time', '<=', strtotime($get['end_time'])];
  56. }
  57. $lists = DistributionOrderGoods::alias('dog')
  58. ->field('dog.money, dog.status as status_desc,dog.create_time as distribution_create_time,u.nickname as user_nickname,u.sn as user_sn,u.mobile as user_mobile,og.total_pay_price,o.order_sn')
  59. ->leftJoin('user u', 'u.id=dog.user_id')
  60. ->leftJoin('order_goods og', 'og.id=dog.order_goods_id')
  61. ->leftJoin('order o', 'o.id=og.order_id')
  62. ->where($where)
  63. ->order('dog.create_time', 'desc')
  64. ->page($get['page'], $get['limit'])
  65. ->select()
  66. ->toArray();
  67. $count = DistributionOrderGoods::alias('dog')
  68. ->field('dog.money, dog.status as status_desc,dog.create_time as distribution_create_time,u.nickname as user_nickname,u.sn as user_sn,u.mobile as user_mobile,og.total_pay_price,o.order_sn')
  69. ->leftJoin('user u', 'u.id=dog.user_id')
  70. ->leftJoin('order_goods og', 'og.id=dog.order_goods_id')
  71. ->leftJoin('order o', 'o.id=og.order_id')
  72. ->where($where)
  73. ->count();
  74. return [
  75. 'count' => $count,
  76. 'lists' => $lists
  77. ];
  78. }
  79. }