GoodsPoster.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com
  8. * =========================================================
  9. */
  10. namespace app\model\goods;
  11. use app\model\BaseModel;
  12. /**
  13. * 商品海报
  14. */
  15. class GoodsPoster extends BaseModel
  16. {
  17. /**
  18. * 添加商品海报
  19. * @param array $data
  20. */
  21. public function addPoster($data)
  22. {
  23. if (!empty($data[ 'poster_id' ])) {
  24. $poster_id = model('goods_poster')->update($data, [ [ 'poster_id', '=', $data[ 'poster_id' ], [ 'site_id', '=', $data[ 'site_id' ] ] ] ]);
  25. } else {
  26. $poster_id = model('goods_poster')->add($data);
  27. }
  28. return $this->success($poster_id);
  29. }
  30. /**
  31. * 删除海报
  32. * @param int $id
  33. * @param int $member_id
  34. */
  35. public function deletePoster($poster_id, $site_id)
  36. {
  37. $res = model('goods_poster')->delete([ [ 'poster_id', '=', $poster_id ], [ 'site_id', '=', $site_id ] ]);
  38. return $this->success($res);
  39. }
  40. /**
  41. * 获取海报信息
  42. * @param int $id
  43. * @param int $member_id
  44. */
  45. public function getPosterInfo($poster_id, $site_id)
  46. {
  47. $res = model('goods_poster')->getInfo([ [ 'poster_id', '=', $poster_id ], [ 'site_id', '=', $site_id ] ]);
  48. return $this->success($res);
  49. }
  50. /**
  51. * 获取海报分页列表
  52. * @param array $condition
  53. * @param number $page
  54. * @param string $page_size
  55. * @param string $order
  56. * @param string $field
  57. */
  58. public function getPosterPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = 'poster_id asc', $field = '*', $alias = 'a', $join = [])
  59. {
  60. $list = model('goods_poster')->pageList($condition, $field, $order, $page, $page_size, $alias, $join);
  61. return $this->success($list);
  62. }
  63. /**
  64. * 获取社群二维码列表
  65. * @param array $condition
  66. * @param string $field
  67. * @param string $order
  68. * @param null $limit
  69. * @return array
  70. */
  71. public function getPosterList($condition = [], $field = '*', $order = 'poster_id asc', $limit = null)
  72. {
  73. $list = model('goods_poster')->getList($condition, $field, $order, '', '', '', $limit);
  74. return $this->success($list);
  75. }
  76. }