PartLib.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use Monolog\Handler\IFTTTHandler;
  5. use Overtrue\Socialite\Providers\WeWorkProvider;
  6. use think\Db;
  7. use think\Request;
  8. use function fast\e;
  9. /**
  10. *
  11. * 产品部件库
  12. */
  13. class PartLib extends Api
  14. {
  15. protected $noNeedLogin = ['*'];
  16. protected $noNeedRight = ['*'];
  17. public function index(){
  18. $this->success('产品_部件资料库');
  19. }
  20. /**
  21. * 新增产品部件库
  22. */
  23. public function ParAdd(){
  24. if (Request::instance()->isPost() == false){
  25. $this->error('非法请求');
  26. }
  27. $params = Request::instance()->param();
  28. echo "<pre>";
  29. print_r($params);
  30. echo "<pre>";die;
  31. }
  32. /**
  33. * 获取产品部件库
  34. */
  35. public function ParList(){
  36. if (Request::instance()->isGet() == false){
  37. $this->error('非法请求');
  38. }
  39. $params = Request::instance()->param();
  40. $where = [];
  41. if (!empty($params['search'])){
  42. $where['part_code|part_name|part_type'] = array('like','%'.$params['search'].'%');
  43. }
  44. $limit = $params['limit'];
  45. if (empty($limit)){
  46. $limit = 30;
  47. }
  48. $pages = $params['page'];
  49. if (empty($pages)){
  50. $pages = 1;
  51. }
  52. $list = Db::name('产品_部件库')
  53. ->field('
  54. id,
  55. part_code as 部件编码,
  56. part_name as 部件名称,
  57. sys_id,
  58. sys_rq as 创建时间,
  59. updatetime as 修改时间
  60. ')
  61. ->whereNull('mod_rq')->where($where)->page($pages)->limit($limit)->order('id desc')->select();
  62. $total = Db::name('产品_部件库')->whereNull('mod_rq')->where($where)->count();
  63. $data['list'] = $list;
  64. $data['total'] = $total;
  65. $this->success('获取成功',$data);
  66. }
  67. /**
  68. * 修改产品部件库
  69. */
  70. public function ParEdit(){
  71. }
  72. /**
  73. * 删除产品部件库
  74. */
  75. public function ParDelete(){
  76. }
  77. }