ginfomodel.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: sicilon_IT
  5. * Date: 2020/1/13
  6. * Time: 15:37
  7. */
  8. namespace app\index\model;
  9. use think\Model;
  10. class ginfomodel extends Model{
  11. protected $table='t_ginfo';
  12. public function getpidbygid($gid){
  13. $record=$this->where('id',$gid)->find();
  14. if (empty($record)){
  15. return 0;
  16. }else{
  17. return $record['pid'];
  18. }
  19. }
  20. public function addnewgroup($arr){
  21. $res=$this->save($arr);
  22. return $res;
  23. }
  24. public function getglistbypid($pid){
  25. $rlist=$this->where('pid',$pid)->select();
  26. return $rlist;
  27. }
  28. /*
  29. * 20200310
  30. * 获取班组名称
  31. */
  32. public function selginfobygid($gid){
  33. $rec=$this->where('id',$gid)->find();
  34. return $rec;
  35. }
  36. /*
  37. * 20200331
  38. * 更新班组名称
  39. */
  40. public function updatenamebyid($arr){
  41. $where_arr['id']=$arr['id'];
  42. $updatearr['gname']=$arr['gname'];
  43. $updatearr['gworkclass']=$arr['gworkclass'];
  44. $rid=$this->where($where_arr)->update($updatearr);
  45. return $rid;
  46. }
  47. }