Customer.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\model\ChangeLog;
  4. use app\BaseController;
  5. use think\App;
  6. use think\facade\Db;
  7. //客户的组织架构
  8. class Customer extends Base
  9. {
  10. public function __construct(App $app)
  11. {
  12. parent::__construct($app);
  13. }
  14. /*列表*/
  15. public function list()
  16. {
  17. $param = $this->request->filter('trim')->post();
  18. $userCommon = \app\admin\common\User::getIns();
  19. $rs = $userCommon->handle('customer_org_list', $param);
  20. return json_show($rs['code'], $rs['message'], $rs['data']);
  21. }
  22. /*新建*/
  23. public function create()
  24. {
  25. $param = $this->request->filter('trim')->post();
  26. $param['uid'] = $this->uid;
  27. $param['uname'] = $this->uname;
  28. $userCommon = \app\admin\common\User::getIns();
  29. $rs = $userCommon->handle('customer_org_create', $param);
  30. return json_show($rs['code'], $rs['message'], $rs['data']);
  31. }
  32. /*更新*/
  33. public function update()
  34. {
  35. $param = $this->request->filter('trim')->post();
  36. $param['uid'] = $this->uid;
  37. $param['uname'] = $this->uname;
  38. $userCommon = \app\admin\common\User::getIns();
  39. $rs = $userCommon->handle('customer_org_update', $param);
  40. return json_show($rs['code'], $rs['message'], $rs['data']);
  41. }
  42. /*查询*/
  43. public function info()
  44. {
  45. $id = isset($this->post['id']) && $this->post['id'] !== "" ? intval($this->post['id']) : "";
  46. if ($id == "") {
  47. return error_show(1004, "公司客户不存在");
  48. }
  49. $userCommon = \app\admin\common\User::getIns();
  50. $rs = $userCommon->handle('customer_org_info', ['id' => $id]);
  51. return json_show($rs['code'], $rs['message'], $rs['data']);
  52. }
  53. /*删除*/
  54. public function delete()
  55. {
  56. $id = $this->request->post('id/d', 0, 'trim');
  57. if ($id === 0) return json_show(1004, 'id不能为空');
  58. $userCommon = \app\admin\common\User::getIns();
  59. $rs = $userCommon->handle('customer_org_delete', ['id' => $id]);
  60. return json_show($rs['code'], $rs['message'], $rs['data']);
  61. }
  62. public function status()
  63. {
  64. $param = $this->request->filter('trim')->post();
  65. $userCommon = \app\admin\common\User::getIns();
  66. $rs = $userCommon->handle('customer_org_status', $param);
  67. return json_show($rs['code'], $rs['message'], $rs['data']);
  68. }
  69. }