123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 数据层模型
- */
- class Snsalbum extends BaseModel
- {
- public $page_info;
- /**
- * 获取默认相册分类
- * @access public
- * @author csdeshang
- * @param type $member_id 会员id
- * @return bool
- */
- public function getSnsAlbumClassDefault($member_id)
- {
- if (empty($member_id)) {
- return '0';
- }
- $info = Db::name('snsalbumclass')->where('member_id', $member_id)->where('ac_isdefault', 1)->find();
- if (!empty($info)) {
- return $info['ac_id'];
- } else {
- return '0';
- }
- }
- /**
- * 获取会员相册分类列表
- * @param type $condition
- * @param type $pagesize
- * @param type $field
- * @return type
- */
- public function getSnsalbumclassList($condition, $pagesize, $field)
- {
- if ($pagesize) {
- $result = Db::name('snsalbumclass')->alias('a')->field('a.*,m.member_name')->join('member m', 'a.member_id=m.member_id', 'LEFT')->where($condition)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
- $this->page_info = $result;
- return $result->items();
- } else {
- return Db::name('snsalbumclass')->alias('a')->field('a.*,m.member_name')->join('member m', 'a.member_id=m.member_id', 'LEFT')->where($condition)->select()->toArray();
- }
- }
- /**
- * 获取会员相册数量列表
- * @param type $condition
- * @param type $field
- * @param type $group
- * @return type
- */
- public function getSnsalbumpicCountList($condition, $field, $group)
- {
- return Db::name('snsalbumpic')->field($field)->where($condition)->group($group)->select()->toArray();
- }
- /**
- * 获取图片列表
- * @param type $condition
- * @return type
- */
- public function getSnsalbumpicList($condition, $pagesize = '')
- {
- if ($pagesize) {
- $pic_list = Db::name('snsalbumpic')->where($condition)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
- $this->page_info = $pic_list;
- return $pic_list->items();
- } else {
- $pic_list = Db::name('snsalbumpic')->where($condition)->select()->toArray();
- return $pic_list;
- }
- }
- /**
- * 删除图片
- * @param type $condition
- * @return type
- */
- public function delSnsalbumpic($condition)
- {
- return Db::name('snsalbumpic')->where($condition)->delete();
- }
- /**
- * 获取单个图片
- * @param type $id
- * @return type
- */
- public function getOneSnsalbumpic($id)
- {
- return Db::name('snsalbumpic')->find($id);
- }
- /**
- * 根据ID删除图片
- * @param type $id
- * @return type
- */
- public function delPic($id)
- {
- return Db::name('snsalbumpic')->delete($id);
- }
- }
|