Userordermoneysum.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\admin\controller\auth;
  3. use app\main\constants\AdminConstants;
  4. use app\main\service\AppGuideService;
  5. use think\Log;
  6. class Userordermoneysum extends UserDetailBase
  7. {
  8. public function _initialize()
  9. {
  10. parent::_initialize();
  11. }
  12. public function index()
  13. {
  14. $params = $this->request->param();
  15. $ids = $params['ids'];
  16. $pay = $params['pay'] ?? 0;
  17. if ($this->request->isAjax()) {
  18. list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  19. if ($this->group == AdminConstants::ADMIN_GROUP_ID_CUSTOMER_SERVICE) {
  20. $where = ['user_id' => $ids];
  21. }else{
  22. $where = ['user_id' => $ids, 'deduct' => '0'];
  23. }
  24. if ($pay == 1) {
  25. $where['state'] = '0';
  26. }elseif($pay == 2){
  27. $where['state'] = '1';
  28. }
  29. $Czjl = model('Orders')->where($where)->order('id desc')->limit($offset, $limit)->select();
  30. $total = model('Orders')->where($where)->order('id desc')->count();
  31. if($Czjl){
  32. foreach($Czjl as $key=>$val){
  33. $Czjl[$key]['createtime'] = date('Y-m-d H:i:s', $val['createtime']);
  34. $Czjl[$key]['finishtime'] = date('Y-m-d H:i:s', $val['finishtime']);
  35. }
  36. }
  37. $result = array("total" => $total, "rows" => $Czjl);
  38. return json($result);
  39. }
  40. $this->view->assign('title', '订单记录');
  41. $this->view->assign('ids', $ids);
  42. $this->view->assign('pay', $pay);
  43. $this->view->assign('type', 'userordermoneysum');
  44. $this->assignconfig('ids', $ids);
  45. $this->assignconfig('pay', $pay);
  46. $isShowBusinessLine = true;
  47. if (in_array($this->group, [3, 4, 7, 8])) {
  48. $isShowBusinessLine = false;
  49. if (AppGuideService::instance()->isShowAdminMenu($this->auth->id)) {
  50. $isShowBusinessLine = true;
  51. }
  52. }
  53. $this->assignconfig('isShowBusinessLine', $isShowBusinessLine);
  54. return $this->view->fetch();
  55. }
  56. }