Words.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace app\service\model;
  3. use think\Model;
  4. /**
  5. * 快捷语模型
  6. */
  7. class Words extends Model
  8. {
  9. /**
  10. * 数据筛选
  11. *
  12. * @access public
  13. * @param mixed $field 字段
  14. * @param mixed $where 条件
  15. * @return array 返回类型
  16. */
  17. public function selectWords($field, $where=[])
  18. {
  19. $result = $this->field($field);
  20. if (empty($where) === false) {
  21. $result = $result->where($where);
  22. }
  23. $result = $result->select();
  24. return $result;
  25. }//end selectWords()
  26. /**
  27. * 数据修改
  28. *
  29. * @access public
  30. * @param mixed $data 数据
  31. * @param mixed $where 条件
  32. * @return array 返回类型
  33. */
  34. public function updateWords($where, $data)
  35. {
  36. $result = $this->where($where)->update($data);
  37. return $result;
  38. }//end updateWords()
  39. /**
  40. * 数据删除
  41. *
  42. * @access public
  43. * @param mixed $where 条件
  44. * @return array 返回类型
  45. */
  46. public function deleteWords($where)
  47. {
  48. $result = $this->where($where)->delete();
  49. return $result;
  50. }//end deleteWords()
  51. /**
  52. * 数据增加
  53. *
  54. * @access public
  55. * @param mixed $data 数据
  56. * @return array 返回类型
  57. */
  58. public function addWords($data)
  59. {
  60. $result = $this->insert($data);
  61. return $result;
  62. }//end addWords()
  63. }