1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\service;
- use app\model\Enterprises;
- use app\model\Input;
- use app\validate\Qydm;
- use think\facade\Db;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\DbException;
- use think\db\exception\ModelNotFoundException;
- use think\Model;
- class InputService
- {
- /**
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- */
- public static function getInputList($page,$qydm){
- // return (new Input)->where("qydm",$qydm)->page($page["page"],$page["size"])->select();
- $res["row"] =(new Input)->where("qydm",$qydm)->page($page["page"],$page["size"])->select();
- $res["count"]= (new Input)->where($qydm=="qydm")->count();
- return $res;
- }
- /**
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- */
- public static function getInputById($id){
- 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();
- }
- public static function eidtInputInfo($info,$id): Input{
- return Input::update($info,["id"=>$id]);
- }
- public static function addInput($info):bool{
- $input =new Input();
- return $input->save($info);
- }
- public static function delInputById($id):bool{
- return Input::destroy($id);
- }
- }
|