Customar.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 Customar extends Base
  9. {
  10. public $post = "";
  11. public function __construct(App $app)
  12. {
  13. parent::__construct($app);
  14. $this->post = $this->request->post();
  15. }
  16. public function create()
  17. {
  18. $param = $this->request->filter('trim')->post();
  19. $param['uid']= $this->uid;
  20. $param['uname']= $this->uname;
  21. $userCommon = \app\admin\common\User::getIns();
  22. $rs = $userCommon->handle('cCreate',$param);
  23. return json_show($rs['code'],$rs['message'],$rs['data']);
  24. }
  25. public function list()
  26. {
  27. $param = $this->request->filter('trim')->post();
  28. $userCommon = \app\admin\common\User::getIns();
  29. $rs = $userCommon->handle('cList',$param);
  30. return json_show($rs['code'],$rs['message'],$rs['data']);
  31. }
  32. public function edit()
  33. {
  34. $param = $this->request->filter('trim')->post();
  35. $param['uid']= $this->uid;
  36. $param['uname']= $this->uname;
  37. $userCommon = \app\admin\common\User::getIns();
  38. $rs = $userCommon->handle('cEdit',$param);
  39. return json_show($rs['code'],$rs['message'],$rs['data']);
  40. }
  41. public function info()
  42. {
  43. $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !== "" ? trim($this->post['companyNo']) : "";
  44. if ($companyNo == "") return error_show(1002, "参数companyNo不能为空");
  45. $userCommon = \app\admin\common\User::getIns();
  46. $rs = $userCommon->handle('cInfo',['companyNo'=>$companyNo]);
  47. return json_show($rs['code'],$rs['message'],$rs['data']);
  48. }
  49. public function del(){
  50. $param = $this->request->only(['id' => 0], 'post', 'trim');
  51. $userCommon = \app\admin\common\User::getIns();
  52. $rs = $userCommon->handle('delete', [
  53. 'ids' => [$param['id']],
  54. 'type' => 2,
  55. 'updater' => $this->uname,
  56. 'updaterid' => $this->uid,
  57. ]);
  58. return json_show($rs['code'], $rs['message'], $rs['data']);
  59. }
  60. public function status(){
  61. $param = $this->request->only(['id', 'status'], 'post', 'trim');
  62. $param = array_merge($param, [
  63. 'type' => 2,
  64. 'updater' => $this->uname,
  65. 'updaterid' => $this->uid,
  66. ]);
  67. $userCommon = \app\admin\common\User::getIns();
  68. $rs = $userCommon->handle('status', $param);
  69. return json_show($rs['code'], $rs['message'], $rs['data']);
  70. }
  71. }