123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 数据层模型
- */
- class Presellquota extends BaseModel
- {
- public $page_info;
- /**
- * 读取预售套餐列表
- * @access public
- * @author csdeshang
- * @param array $condition 查询条件
- * @param int $pagesize 分页数
- * @param string $order 排序
- * @param string $field 所需字段
- * @return array 预售套餐列表
- *
- */
- public function getPresellquotaList($condition, $pagesize = null, $order = '', $field = '*')
- {
- if ($pagesize) {
- $result = Db::name('presellquota')->field($field)->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
- $this->page_info = $result;
- $result = $result->items();
- } else {
- $result = Db::name('presellquota')->field($field)->where($condition)->order($order)->select()->toArray();
- }
- return $result;
- }
- /**
- * 读取单条记录
- * @access public
- * @author csdeshang
- * @param array $condition 查询条件
- * @return array
- */
- public function getPresellquotaInfo($condition)
- {
- $result = Db::name('presellquota')->where($condition)->find();
- return $result;
- }
- /**
- * 获取当前可用套餐
- * @access public
- * @author csdeshang
- * @param int $store_id 店铺id
- * @return array
- */
- public function getPresellquotaCurrent($store_id)
- {
- $condition = array();
- $condition[] = array('store_id', '=', $store_id);
- $condition[] = array('presellquota_endtime', '>', TIMESTAMP);
- return $this->getPresellquotaInfo($condition);
- }
- /**
- * 增加
- * @access public
- * @author csdeshang
- * @param array $data 参数内容
- * @return bool
- */
- public function addPresellquota($data)
- {
- return Db::name('presellquota')->insertGetId($data);
- }
- /**
- * 编辑更新预售套餐
- * @access public
- * @author csdeshang
- * @param type $update 更新数据
- * @param type $condition 检索条件
- * @return bool
- */
- public function editPresellquota($update, $condition)
- {
- return Db::name('presellquota')->where($condition)->update($update);
- }
- /*
- * 删除
- * @access public
- * @author csdeshang
- * @param array $condition 检索条件
- * @return bool
- */
- public function delPresellquota($condition)
- {
- return Db::name('presellquota')->where($condition)->delete();
- }
- }
|