| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace ghs\controllers;
- use biz\product\classes\XjClass;
- use common\components\imgUtil;
- use common\components\util;
- use Yii;
- class XjController extends BaseController
- {
- //取出所有小菊 ssh 20210904
- public function actionGetAllXj()
- {
- $where = [];
- $where['shopId'] = $this->shopId;
- $where['status'] = 1;
- $list = XjClass::getShopXj($this->shopId);
- util::success(['list' => $list]);
- }
- //取出商家上架的小菊 ssh 20210904
- public function actionGetSjXj()
- {
- $list = XjClass::getAllByCondition(['shopId' => $this->shopId, 'delStatus' => 0, 'status' => 1], null, '*');
- if (!empty($list)) {
- foreach ($list as $key => $val) {
- $shortCover = $val['cover'] ?? '';
- $cover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
- $bigCover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
- $list[$key]['cover'] = $cover;
- $list[$key]['bigCover'] = $bigCover;
- $list[$key]['shortCover'] = $shortCover;
- }
- }
- util::success(['list' => $list]);
- }
- //取出商家所有小菊 ssh 20210904
- public function actionGetFilterXj()
- {
- $list = XjClass::getAllByCondition(['shopId' => $this->shopId, 'delStatus' => 0], null, '*');
- if (!empty($list)) {
- foreach ($list as $key => $val) {
- $shortCover = $val['cover'] ?? '';
- $cover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
- $bigCover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
- $list[$key]['cover'] = $cover;
- $list[$key]['bigCover'] = $bigCover;
- $list[$key]['shortCover'] = $shortCover;
- }
- }
- util::success(['list' => $list]);
- }
- //清除全部小菊 lqh 2021.12.8
- public function actionClearAll()
- {
- XjClass::clearAll($this->shopId);
- //ShopExtClass::clearXjALl($this->shopId);
- util::complete('已删除');
- }
- //新增小菊 lqh 2021.12.8
- public function actionBatchAdd()
- {
- $post = Yii::$app->request->post();
- $xjData = $post['xjData'] ?? '';
- if (empty($xjData)) {
- util::fail('请上传图片');
- }
- $arr = json_decode($xjData, true);
- if (is_array($arr) == false) {
- util::fail('请上传图片...');
- }
- XjClass::batchAddXj($arr, $this->shop);
- util::complete('添加成功');
- }
- }
|