XjController.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace ghs\controllers;
  3. use biz\product\classes\XjClass;
  4. use common\components\imgUtil;
  5. use common\components\util;
  6. use Yii;
  7. class XjController extends BaseController
  8. {
  9. //取出所有小菊 shish 20210904
  10. public function actionGetAllXj()
  11. {
  12. $where = [];
  13. $where['shopId'] = $this->shopId;
  14. $where['status'] = 1;
  15. $list = XjClass::getShopXj($this->shopId);
  16. util::success(['list' => $list]);
  17. }
  18. //取出商家小菊 shish 20210904
  19. public function actionGetSjXj()
  20. {
  21. $list = XjClass::getSjXj($this->shopExt);
  22. util::success(['list' => $list]);
  23. }
  24. //取出所有小菊,带商家有没有标识 shish 20210904
  25. public function actionGetFilterXj()
  26. {
  27. $list = XjClass::getAllByCondition(['shopId' => $this->shopId, 'delStatus' => 0], null, '*');
  28. if (!empty($list)) {
  29. foreach ($list as $key => $val) {
  30. $shortCover = $val['cover'] ?? '';
  31. $cover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
  32. $bigCover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
  33. $list[$key]['cover'] = $cover;
  34. $list[$key]['bigCover'] = $bigCover;
  35. $list[$key]['shortCover'] = $shortCover;
  36. }
  37. }
  38. util::success(['list' => $list]);
  39. }
  40. //清除全部小菊 lqh 2021.12.8
  41. public function actionClearAll()
  42. {
  43. XjClass::clearAll($this->shopId);
  44. //ShopExtClass::clearXjALl($this->shopId);
  45. util::complete('已删除');
  46. }
  47. //新增小菊 lqh 2021.12.8
  48. public function actionBatchAdd()
  49. {
  50. $post = Yii::$app->request->post();
  51. $xjData = $post['xjData'] ?? '';
  52. if (empty($xjData)) {
  53. util::fail('请上传图片');
  54. }
  55. $arr = json_decode($xjData, true);
  56. if (is_array($arr) == false) {
  57. util::fail('请上传图片...');
  58. }
  59. XjClass::batchAddXj($arr, $this->shop);
  60. util::complete('添加成功');
  61. }
  62. }