Custom.php 829 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use \think\Request;
  5. use \think\Db;
  6. /**
  7. * 客户管理接口
  8. */
  9. class Custom extends Api
  10. {
  11. protected $noNeedLogin = ['*'];
  12. protected $noNeedRight = ['*'];
  13. /**
  14. * 首页
  15. *
  16. */
  17. public function index()
  18. {
  19. $this->success('请求成功');
  20. }
  21. /**
  22. * 获取客户信息
  23. *
  24. * @ApiMethod GET
  25. *
  26. */
  27. public function getCustom(){
  28. if (Request::instance()->isGet() == false){
  29. $this->error('非法请求');
  30. }
  31. $field = 'rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称';
  32. $list = Db::name('产品_基本资料')->distinct(true)->field($field)->order('客户编号 asc')->select();
  33. $this->success('请求成功',$list);
  34. }
  35. }