where(['store_id' => $store_id])->asArray()->one(); $catInfo = NewIntegralCat::find()->where(['store_id' => $store_id,'is_enable'=>1,'is_delete'=>0])->select('id,name')->orderBy('sort')->asArray()->all(); $data = []; $data['polling'] = (isset($settingInfo['polling_img']) && $settingInfo['polling_img']) ? json_decode($settingInfo['polling_img'],true) : null; $data['explain'] = (isset($settingInfo['explain']) && $settingInfo['explain']) ? $settingInfo['explain'] : null; $data['catInfo'] = $catInfo; if ($store_id <= 0) { $data['integral'] = get_saas_user()->integral; } else { $data['integral'] = get_user()->integral; } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => $data ]); } //商品列表 public function actionGoodsInfo(){ $store_id = get_store_id(); if ($store_id <= 0) { $store_id = 0; } $level = get_params('level',0); $catId = get_params('cat_id',0); $keyword = get_params('keyword'); $query = Goods::find()->alias('g')->where(['g.store_id' => $store_id, 'g.product_type'=>Goods::GOODS_TYPE_INTEGRAL, 'g.status' => 1, 'g.is_delete' => 0]); if($level == 1){ $query->andWhere(['<=','g.integral_price',100]); } if($level == 2){ $query->andWhere(['>','g.integral_price',100]); $query->andWhere(['<=','g.integral_price',500]); } if($level == 3){ $query->andWhere(['>','g.integral_price',500]); $query->andWhere(['<=','g.integral_price',1000]); } if($level == 4){ $query->andWhere(['>','g.integral_price',1000]); } if($catId){ $query->leftJoin(['gc' => GoodsCat::tableName()], 'gc.goods_id=g.id')->andWhere(['gc.cat_id' => $catId]); } if ($keyword) { $query->andWhere([ 'or', ['like', 'g.name', $this->keyword], ['like', 'g.key_word', $this->keyword], ]); } $query->select('g.id,g.name,g.price,g.original_price,g.integral_price,g.cover_pic,g.virtual_sales'); $list = pagination_make($query); return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ] ]); } }