AjaxsController.class.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Mobile\Controller;
  3. class AjaxsController extends MobileController
  4. {
  5. protected function _initialize()
  6. {
  7. parent::_initialize(); $allow_action=array("laverorder");
  8. if(!in_array(ACTION_NAME,$allow_action)){
  9. $this->error(L("非法操作"));
  10. }
  11. }
  12. public function laverorder($type)
  13. {
  14. $uid = userid();
  15. if($uid <= 0){
  16. $this->ajaxReturn(['code' => 3, 'data' => '', 'info' => L('未登录')]);
  17. }
  18. if ($type == 1){
  19. //委托订单
  20. $list = M("leverorder")->where(array('uid'=>$uid,'status'=>1))->order("id desc")->select();
  21. }elseif ($type == 2){
  22. //持仓订单
  23. $list = M("leverorder")->where(array('uid'=>$uid,'status'=>2))->order("id desc")->select();
  24. }elseif ($type == 3){
  25. //成交订单
  26. $list = M("leverorder")->where("uid = {$uid} and (status = 3 or status = 4)")->order("id desc")->select();
  27. }
  28. $data = [
  29. 'code' => 1,
  30. 'list' => $list,//委托
  31. 'msg' => ''
  32. ];
  33. $this->ajaxReturn($data);
  34. }
  35. }
  36. ?>