InputService.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace app\service;
  3. use app\model\Enterprises;
  4. use app\model\Input;
  5. use app\validate\Qydm;
  6. use think\facade\Db;
  7. use think\db\exception\DataNotFoundException;
  8. use think\db\exception\DbException;
  9. use think\db\exception\ModelNotFoundException;
  10. use think\Model;
  11. class InputService
  12. {
  13. /**
  14. * @throws ModelNotFoundException
  15. * @throws DataNotFoundException
  16. * @throws DbException
  17. */
  18. public static function getInputList($page,$qydm){
  19. // return (new Input)->where("qydm",$qydm)->page($page["page"],$page["size"])->select();
  20. $res["row"] =(new Input)->where("qydm",$qydm)->page($page["page"],$page["size"])->select();
  21. $res["count"]= (new Input)->where($qydm=="qydm")->count();
  22. return $res;
  23. }
  24. /**
  25. * @throws ModelNotFoundException
  26. * @throws DataNotFoundException
  27. * @throws DbException
  28. */
  29. public static function getInputById($id){
  30. return Db::name("input")->field("t_input.*,t_enterprises.enterprises_name")->where("t_input.id","=",$id)->leftJoin("t_enterprises","t_input.qydm=t_enterprises.qydm")->select();
  31. }
  32. public static function eidtInputInfo($info,$id): Input{
  33. return Input::update($info,["id"=>$id]);
  34. }
  35. public static function addInput($info):bool{
  36. $input =new Input();
  37. return $input->save($info);
  38. }
  39. public static function delInputById($id):bool{
  40. return Input::destroy($id);
  41. }
  42. }