ImagesUpload.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 小虎哥 <1105415366@qq.com>
  11. * Date: 2018-4-3
  12. */
  13. namespace app\home\model;
  14. use think\Db;
  15. use think\Model;
  16. /**
  17. * 图集图片
  18. */
  19. class ImagesUpload extends Model
  20. {
  21. //初始化
  22. protected function initialize()
  23. {
  24. // 需要调用`Model`的`initialize`方法
  25. parent::initialize();
  26. }
  27. /**
  28. * 获取指定图集的所有图片
  29. * @author 小虎哥 by 2018-4-3
  30. */
  31. public function getImgUpload($aids = [], $field = '*')
  32. {
  33. $where = [];
  34. !empty($aids) && $where['aid'] = ['IN', $aids];
  35. $result = Db::name('ImagesUpload')->field($field)
  36. ->where($where)
  37. ->order('sort_order asc')
  38. ->select();
  39. !empty($result) && $result = group_same_key($result, 'aid');
  40. return $result;
  41. }
  42. }