12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace Admin\Model;
- use Common\Model\HomeSubscriptionModel as HomeSubscription;
- /**
- * 官网订阅
- * @author: linch
- * Class HomeSubscriptionModel
- * @package Common\Model
- */
- class HomeSubscriptionModel extends HomeSubscription
- {
- /**
- * 获取状态列表
- * @author: linch
- * @return array
- */
- public function get_status_list() {
- return array(
- self::flag_on => '正常',
- self::flag_off => '删除',
- );
- }
- /**
- * 获取列表
- * @author: linch
- * @param array $search 筛选条件
- * @param int $page_num 页码
- * @param int $page_size 页行数
- * @return array
- */
- public function get_list($search, $page_num, $page_size) {
- $where = array(
- 'flag' => self::flag_on,
- );
- $order = 'id desc';
- $limit = ($page_num - 1) * $page_size . ' ,' . $page_size;
- $field = '*';
- $list = $this->where($where)->order($order)->field($field)->limit($limit)->select();
- $count = $this->mod->where($where)->count();
- $page = $this->x_show($count, $page_size, array());
- $data = array(
- 'list' => $list,
- 'pager' => $page,
- );
- return $data;
- }
- /**
- * 设置删除状态
- * @author: linch
- * @param $id
- * @return bool
- */
- public function data_del($id) {
- $result = $this->where(array('id' => $id))->setField(array('flag' => self::flag_off));
- return $result;
- }
- }
|