Complain.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\api\controller\screen;
  3. use app\hander\HelpHander;
  4. use think\Db;
  5. class Complain extends Index
  6. {
  7. public function monthData(){
  8. $month = [];
  9. $y = [];
  10. for ($i=11;$i>=0;$i--){
  11. $month[11-$i] = date('Ym',strtotime('-'.$i.'month'));
  12. $y[] = date('m',strtotime('-'.$i.'month'));
  13. }
  14. $list = [];
  15. foreach ($month as $k=>$v){
  16. $list[] = Db::name('complain')->where('org_id',$this->orgId)->where('del',0)->where('create_yyyymm',$v)->count();
  17. }
  18. foreach ($y as $k=>$v){
  19. if($v < 10){
  20. $n = substr($v,1,1);
  21. }else{
  22. $n = $v;
  23. }
  24. $y[$k] = $n;
  25. }
  26. HelpHander::success(['month'=>$y,'list'=>$list]);
  27. }
  28. public function complainList(){
  29. $list = Db::name('complain')->where('org_id',$this->orgId)->where('del',0)->where('create_yyyymmdd',date('Ymd'))->order('id desc')->select();
  30. $data = [];
  31. foreach ($list as $k=>$v){
  32. $data[$k][] = date('m-d H:i',strtotime($v['create_time']));
  33. $data[$k][] = $v['content'];
  34. $data[$k][] = model('Complain')->formatStatus($v['status'],$v['order_id'],$v['id']);
  35. $data[$k][] = date('m-d H:i',strtotime($v['update_time']));
  36. }
  37. HelpHander::success($data);
  38. }
  39. }