123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 数据层模型
- */
- class Storemsg extends BaseModel
- {
- public $page_info;
- /**
- * 新增店铺消息
- * @access public
- * @author csdeshang
- * @param array $data 参数内容
- * @return type
- */
- public function addStoremsg($data)
- {
- $data['storemsg_addtime'] = TIMESTAMP;
- $storemsg_id = Db::name('storemsg')->insertGetId($data);
- return $storemsg_id;
- }
- /**
- * 更新店铺消息表
- * @access public
- * @author csdeshang
- * @param array $condition 条件
- * @param array $update 更新数据
- * @return bool
- */
- public function editStoremsg($condition, $update)
- {
- return Db::name('storemsg')->where($condition)->update($update);
- }
- /**
- * 查看店铺消息详细
- * @access public
- * @author csdeshang
- * @param unknown $condition 条件
- * @param string $field 字段
- * @return bool
- */
- public function getStoremsgInfo($condition, $field = '*')
- {
- return Db::name('storemsg')->field($field)->where($condition)->find();
- }
- /**
- * 店铺消息列表
- * @access public
- * @author csdeshang
- * @param type $condition 条件
- * @param type $field 字段
- * @param type $pagesize 分页
- * @param type $order 排序
- * @return type
- */
- public function getStoremsgList($condition, $field = '*', $pagesize = '0', $order = 'storemsg_id desc')
- {
- $return = Db::name('storemsg')->field($field)->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
- $this->page_info = $return;
- return $return->items();
- }
- /**
- * 计算消息数量
- * @access public
- * @author csdeshang
- * @param array $condition 条件
- * @return int
- */
- public function getStoremsgCount($condition)
- {
- return Db::name('storemsg')->where($condition)->count();
- }
- /**
- * 删除店铺消息
- * @access public
- * @author csdeshang
- * @param type $condition 条件
- * @return bool
- */
- public function delStoremsg($condition)
- {
- Db::name('storemsg')->where($condition)->delete();
- }
- }
|