<?php
/**
* 渠道处理
* @author erwa<[email protected]>
*/
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层 增删改查
猜你喜欢
转载自blog.csdn.net/adminyan/article/details/79640274
今日推荐
周排行