XjController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\product\classes\XjClass;
  4. use common\components\util;
  5. class XjController extends BaseController
  6. {
  7. //取出所有小菊 shish 20210904
  8. public function actionGetAllXj()
  9. {
  10. $where = [];
  11. $where['shopId'] = $this->shopId;
  12. $where['status'] = 1;
  13. $list = XjClass::getAllXj();
  14. util::success(['list' => $list]);
  15. }
  16. //取出商家小菊 shish 20210904
  17. public function actionGetSjXj()
  18. {
  19. $list = XjClass::getSjXj($this->shopExt);
  20. util::success(['list' => $list]);
  21. }
  22. //取出所有小菊,带商家有没有标识 shish 20210904
  23. public function actionGetFilterXj()
  24. {
  25. $where = [];
  26. $where['shopId'] = $this->shopId;
  27. $where['status'] = 1;
  28. $list = XjClass::getAllXj();
  29. $ext = $this->shopExt;
  30. $xj = $ext->xj ?? '';
  31. $hasIds = [];
  32. if (!empty($xj)) {
  33. $hasIds = json_decode($xj, true);
  34. }
  35. if (!empty($list)) {
  36. foreach ($list as $key => $val) {
  37. $id = $val['id'] ?? 0;
  38. $list[$key]['has'] = 0;
  39. if (in_array($id, $hasIds)) {
  40. $list[$key]['has'] = 1;
  41. }
  42. }
  43. }
  44. util::success(['list' => $list]);
  45. }
  46. }