| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace app\service\model;
- use think\Model;
- /**
- * 快捷语模型
- */
- class Words extends Model
- {
- /**
- * 数据筛选
- *
- * @access public
- * @param mixed $field 字段
- * @param mixed $where 条件
- * @return array 返回类型
- */
- public function selectWords($field, $where=[])
- {
- $result = $this->field($field);
- if (empty($where) === false) {
- $result = $result->where($where);
- }
- $result = $result->select();
- return $result;
- }//end selectWords()
- /**
- * 数据修改
- *
- * @access public
- * @param mixed $data 数据
- * @param mixed $where 条件
- * @return array 返回类型
- */
- public function updateWords($where, $data)
- {
- $result = $this->where($where)->update($data);
- return $result;
- }//end updateWords()
- /**
- * 数据删除
- *
- * @access public
- * @param mixed $where 条件
- * @return array 返回类型
- */
- public function deleteWords($where)
- {
- $result = $this->where($where)->delete();
- return $result;
- }//end deleteWords()
- /**
- * 数据增加
- *
- * @access public
- * @param mixed $data 数据
- * @return array 返回类型
- */
- public function addWords($data)
- {
- $result = $this->insertGetId($data);
- return $result;
- }//end addWords()
- /**
- * 数据增加
- *
- * @access public
- * @param mixed $where 条件
- * @return array 返回类型
- */
- public function findHas($where)
- {
- $result = $this->field('id')->where($where)->find();
- return $result;
- }//end findHas()
- }
|