partybusinessmodel.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /*
  3. * @Author: wang jun
  4. * @Date: 2021-10-29 16:06:41
  5. * @Last Modified by: wang jun
  6. * @Last Modified time: 2021-10-29 16:15:16
  7. */
  8. namespace app\index\model;
  9. use think\Model;
  10. class partybusinessmodel extends Model
  11. {
  12. protected $table = 't_partybusiness';
  13. public function insertData($data)
  14. {
  15. $id = $this->insertGetId($data);
  16. return empty($id) ? false : $id;
  17. }
  18. public function getInfo($where, $field = "*", $row = true)
  19. {
  20. $info = $this->field($field)->where($where);
  21. if ($row) {
  22. $info = $info->find();
  23. } else {
  24. $info = $info->select();
  25. }
  26. return empty($info) ? false : $info;
  27. }
  28. public function updateinfo($where, $updateData)
  29. {
  30. $row = $this->where($where)->update($updateData);
  31. return empty($row) ? false : $row;
  32. }
  33. public function deleteinfo($where)
  34. {
  35. $row = $this->where($where)->delete();
  36. return empty($row) ? false : $row;
  37. }
  38. public function getList($where = [], $field = "*", $page = 1, $size = 10, $order = "id desc", $group = "", $row = false)
  39. {
  40. $sqlObj = $this->where($where);
  41. if ("count" != $field) {
  42. $sqlObj = $sqlObj->field($field)->order($order)->group($group)->page($page, $size);
  43. if ($row) {
  44. $data = $sqlObj->find();
  45. } else {
  46. $data = $sqlObj->select();
  47. }
  48. } else {
  49. $data = $sqlObj = $sqlObj->count();
  50. }
  51. return $data;
  52. }
  53. }