Words.php 889 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. }