GoodsCommunityQrCode.php 2.5 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 GoodsCommunityQrCode extends BaseModel
  16. {
  17. /**
  18. * 添加商品社群二维码
  19. * @param array $data
  20. */
  21. public function addQrCode($data)
  22. {
  23. if (!empty($data[ 'qr_id' ])) {
  24. $qr_id = model('goods_community_qrcode')->update($data, [ [ 'qr_id', '=', $data[ 'qr_id' ] ], [ 'site_id', '=', $data[ 'site_id' ] ] ]);
  25. } else {
  26. $qr_id = model('goods_community_qrcode')->add($data);
  27. }
  28. return $this->success($qr_id);
  29. }
  30. /**
  31. * 删除社群二维码记录
  32. * @param int $id
  33. * @param int $member_id
  34. */
  35. public function deleteQrCode($qr_id, $site_id)
  36. {
  37. $res = model('goods_community_qrcode')->delete([ [ 'qr_id', '=', $qr_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 getQrInfo($qr_id, $site_id)
  46. {
  47. $res = model('goods_community_qrcode')->getInfo([ [ 'qr_id', '=', $qr_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 getQrPageList($condition = [], $page = 1, $page_size = PAGE_LIST_ROWS, $order = 'create_time desc', $field = '*', $alias = 'a', $join = [])
  59. {
  60. $list = model('goods_community_qrcode')->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 getQrList($condition = [], $field = '*', $order = 'qr_id asc', $limit = null)
  72. {
  73. $list = model('goods_community_qrcode')->getList($condition, $field, $order, '', '', '', $limit);
  74. return $this->success($list);
  75. }
  76. }