1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 数据层模型
- */
- class Upload extends BaseModel
- {
- public function getUploadList($condition, $field = '*')
- {
- $result = Db::name('upload')->field($field)->order('upload_id asc')->where($condition)->select()->toArray();
- return $result;
- }
- /**
- * 取单个内容
- * @access public
- * @author csdeshang
- * @param int $id 分类ID
- * @return array 数组类型的返回结果
- */
- public function getOneUpload($id)
- {
- $data['upload_id'] = intval($id);
- $result = Db::name('upload')->where($data)->find();
- return $result;
- }
- /**
- * 新增
- * @access public
- * @author csdeshang
- * @param array $data 参数内容
- * @return bool 布尔类型的返回结果
- */
- public function addUpload($data)
- {
- $result = Db::name('upload')->insertGetId($data);
- return $result;
- }
- /**
- * 更新信息
- * @access public
- * @author csdeshang
- * @param array $data 数据
- * @param array $condition 条件
- * @return bool
- */
- public function editUpload($data, $condition)
- {
- $result = Db::name('upload')->where($condition)->update($data);
- return $result;
- }
- /**
- * 删除分类
- * @access public
- * @author csdeshang
- * @param int $condition 记录ID
- * @return bool
- */
- public function delUpload($condition)
- {
- return Db::name('upload')->where($condition)->delete();
- }
- }
|