groupusermodel.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: sicilon_IT
  5. * Date: 2021/10/7
  6. * Time: 22:55
  7. */
  8. namespace app\index\model;
  9. use think\Model;
  10. class groupusermodel extends Model
  11. {
  12. protected $table = 't_groupuser';
  13. /*
  14. * 20211007
  15. */
  16. public function insinfo($arr)
  17. {
  18. $this->setAttr('id', null)->isUpdate(false)->allowField(true)->save($arr);
  19. return $this->id;
  20. }
  21. public function getinfo($where)
  22. {
  23. $info = $this->where($where)->find();
  24. return $info;
  25. }
  26. /***
  27. * 获取列表数据
  28. * 20211012
  29. * wj
  30. */
  31. public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
  32. {
  33. $sqlObj = $this->where($where);
  34. if ("count" != $field) {
  35. $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size);
  36. if ($row) {
  37. $data = $sqlObj->find();
  38. } else {
  39. $data = $sqlObj->select();
  40. }
  41. } else {
  42. $data = $sqlObj = $sqlObj->count();
  43. }
  44. return $data;
  45. }
  46. public function updateinfo($where, $updateData)
  47. {
  48. $row = $this->where($where)->update($updateData);
  49. return empty($row) ? false : $row;
  50. }
  51. }