123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\service;
- use app\model\Qkjb;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\DbException;
- use think\db\exception\ModelNotFoundException;
- use think\Model;
- class QkjbService
- {
- public static function addQkjb($info): bool
- {
- $qkjb =new Qkjb();
- return $qkjb->save($info);
- }
- public static function deleteQkjb($info): bool
- {
- return Qkjb::destroy($info['id']);
- }
- public static function editQkjbInfo($info,$id): Qkjb
- {
- return Qkjb::update($info,["id"=>$id]);
- }
- /**
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- */
- public static function getQkjbList($page, $xzqdm)
- {
- switch (strlen($xzqdm) ){
- case 4:
- $map[]=["xzqdm","like",'%'.$xzqdm.'%'];
- break;
- case 6:
- $map[] = ["xzqdm","like",'%'.$xzqdm.'%'];
- break;
- case 9:
- $map[] = ["xzqdm","like",'%'.$xzqdm.'%'];
- break;
- default:
- $map[]=[];
- }
- return (new Qkjb())->where($map)->page($page["page"],$page["size"])->select();
- }
- }
|