PartLib.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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('产品_部件库')->whereNull('mod_rq')->where($where)->page($pages)->limit($limit)->order('id desc')->select();
  53. $total = Db::name('产品_部件库')->whereNull('mod_rq')->where($where)->count();
  54. $data['list'] = $list;
  55. $data['total'] = $total;
  56. $this->success('获取工艺库列表',$data);
  57. }
  58. /**
  59. * 修改产品部件库
  60. */
  61. public function ParEdit(){
  62. }
  63. /**
  64. * 删除产品部件库
  65. */
  66. public function ParDelete(){
  67. }
  68. }