| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace ghs\controllers;
- use biz\product\classes\XjClass;
- use biz\shop\classes\ShopExtClass;
- use common\components\util;
- use Yii;
- class XjController extends BaseController
- {
- //取出所有小菊 shish 20210904
- public function actionGetAllXj()
- {
- $where = [];
- $where['shopId'] = $this->shopId;
- $where['status'] = 1;
- $list = XjClass::getShopXj($this->shopId);
- util::success(['list' => $list]);
- }
- //取出商家小菊 shish 20210904
- public function actionGetSjXj()
- {
- $list = XjClass::getSjXj($this->shopExt);
- util::success(['list' => $list]);
- }
- //取出所有小菊,带商家有没有标识 shish 20210904
- public function actionGetFilterXj()
- {
- $where = [];
- $where['shopId'] = $this->shopId;
- $where['status'] = 1;
- $list = XjClass::getShopXj($this->shopId);
- $ext = $this->shopExt;
- $xj = $ext->xj ?? '';
- $hasIds = [];
- if (!empty($xj)) {
- $hasIds = json_decode($xj, true);
- }
- if (!empty($list)) {
- foreach ($list as $key => $val) {
- $id = $val['id'] ?? 0;
- $list[$key]['has'] = 0;
- if (in_array($id, $hasIds)) {
- $list[$key]['has'] = 1;
- }
- }
- }
- 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 actionAdd()
- {
- $post = Yii::$app->request->post();
- $cover = $post['cover']??'';
- if(empty($cover)){
- util::fail("请上传图片");
- }
- XjClass::addXj($this->shopId,$cover,$this->shopExt);
- util::complete();
- }
- }
|