|
|
@@ -3,9 +3,9 @@
|
|
|
namespace ghs\controllers;
|
|
|
|
|
|
use biz\product\classes\XjClass;
|
|
|
-use biz\shop\classes\ShopExtClass;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
+
|
|
|
class XjController extends BaseController
|
|
|
{
|
|
|
|
|
|
@@ -29,46 +29,32 @@ class XjController extends BaseController
|
|
|
//取出所有小菊,带商家有没有标识 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;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ $list = XjClass::getAllByCondition(['shopId' => $this->shopId, 'delStatus' => 0], null, '*');
|
|
|
util::success(['list' => $list]);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//清除全部小菊 lqh 2021.12.8
|
|
|
public function actionClearAll()
|
|
|
{
|
|
|
XjClass::clearAll($this->shopId);
|
|
|
- ShopExtClass::clearXjALl($this->shopId);
|
|
|
- util::complete();
|
|
|
+ //ShopExtClass::clearXjALl($this->shopId);
|
|
|
+ util::complete('已删除');
|
|
|
}
|
|
|
|
|
|
//新增小菊 lqh 2021.12.8
|
|
|
- public function actionAdd()
|
|
|
+ public function actionBatchAdd()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- $cover = $post['cover']??'';
|
|
|
- if(empty($cover)){
|
|
|
- util::fail("请上传图片");
|
|
|
+ $xjData = $post['xjData'] ?? '';
|
|
|
+ if (empty($xjData)) {
|
|
|
+ util::fail('请上传图片');
|
|
|
}
|
|
|
- XjClass::addXj($this->shopId,$cover,$this->shopExt);
|
|
|
- util::complete();
|
|
|
+ $arr = json_decode($xjData, true);
|
|
|
+ if (is_array($arr) == false) {
|
|
|
+ util::fail('请上传图片...');
|
|
|
+ }
|
|
|
+ XjClass::batchAddXj($arr, $this->shop);
|
|
|
+ util::complete('添加成功');
|
|
|
}
|
|
|
+
|
|
|
}
|