<?php
/**
* 渠道处理
* @author erwa<erwa@qingjinju.net>
*/
namespace Home\Model;
use Think\Model;
class ApiPlanModel extends BaseModel {
/**
* 根据属性获取一行记录
* @param array $where
* @param string $fileds
* @return array 返回一维数组,未找到记录则返回空数组
*/
public function findByAttributes($where = array(),$fileds="*")
{
return $this->field($fileds)->where( $where )->find();
}
/**
* 根据条件查询获得数据
* @param array $where
* @param string $fileds
* @return array 返回一维数组,未找到记录则返回空数组
*/
public function findAllByWhere($where = array(),$fileds="*")
{
return $this->field($fileds)->where( $where )->select();
}
/**
* 添加数据
* @param array $data
* @return int id值
*/
public function insert($data)
{
return $this ->add($data);
}
/**
* 根据条件修改
* @param array $where
* @param array $data
* @return id id值
*/
public function updateByWhere($where,$data)
{
return $this->where( $where )->save($data);
}
/**
* 根据条件修改
* @param array $where
* @return id id值
*/
public function deleteByWhere($where)
{
return $this->where( $where )->delete();
}
}tp Model层 增删改查
最新推荐文章于 2023-01-05 18:58:54 发布
本文介绍了一个渠道处理模型,该模型提供了多种数据库操作方法,包括根据属性获取记录、查询数据、添加和更新数据等。通过这些方法可以高效地进行数据管理。
1万+

被折叠的 条评论
为什么被折叠?



