request->get(); $where[] = ['g.mall_id' => $this->mall_id, 'g.is_on_sale' => 1, 'g.is_show' => 1, 'status' => StatusEnum::ENABLED]; if (!empty($params['type']) && $params['type'] == 'all') { //查询三级的所有 $goods_cate_list = GoodsCate::findAll(['parent_id' => $params['cate_id'], 'mall_id' => $this->mall_id, 'is_show' => 1]); $cate_id_arr = array_column($goods_cate_list, 'id'); $cate_id_arr[] = $params['cate_id']; } else { if (empty($params['cate_id'])) { //顶级 //$goods_cate_list = GoodsCate::findAll(['parent_id' => 0, 'mall_id' => $this->mall_id, 'is_show' => 1]); //查询所有分类的商品 $goods_cate_list = GoodsCate::findAll(['mall_id' => $this->mall_id, 'is_show' => 1]); $cate_id_arr = array_column($goods_cate_list, 'id'); } else { $goods_cate = GoodsCate::findOne(['id' => $params['cate_id'], 'mall_id' => $this->mall_id, 'is_show' => 1]); $c = [$params['cate_id']]; $cate_id_arr = []; $cate_id_arr1 = []; GoodsCate::getAllCate($this->mall_id, $c, $cate_id_arr1); if (!empty($cate_id_arr1)) { foreach ($cate_id_arr1 as $item) { if (!empty($item)) { $cats = explode(",", $item); array_push($cate_id_arr, ...$cats); } } } if (!empty($goods_cate)) { if ($goods_cate['parent_id'] == 0) { $goods_cate_list = GoodsCate::findAll(['parent_id' => $params['cate_id'], 'mall_id' => $this->mall_id, 'is_show' => 1]); $cid_arr2 = array_column($goods_cate_list, 'id'); $goods_cate_list = GoodsCate::findAll(['parent_id' => $cid_arr2, 'mall_id' => $this->mall_id, 'is_show' => 1]); $cid_arr3 = array_column($goods_cate_list, 'id'); $cate_id_arr = array_merge($cate_id_arr, $cid_arr2, $cid_arr3); } } } } //$goods_cate_relate_list = GoodsCateRelate::findAll(['cate_id' => $cate_id_arr]); //$goods_id_arr = array_column($goods_cate_relate_list, 'goods_id'); $goods_id_arr = GoodsCateRelate::find()->where(['cate_id' => $cate_id_arr])->groupBy('goods_id')->select('goods_id')->column(); $invoke_goods_ids_arr = GlobalInvoke::exec(GlobalInvoke::CATEGORY_LIST_FILTER_GOODS_ID, $this->mall_id, [ 'mall_id' => $this->mall_id, 'location_style' => $params['location_style'] ?? 1, 'goods_id' => $goods_id_arr, 'user_id' => $this->user ? $this->user->id : 0 ]); if ($invoke_goods_ids_arr) { $where[] = ['g.id' => $invoke_goods_ids_arr['goods_ids']]; } else { $where[] = ['g.id' => $goods_id_arr]; } $order = 'sort asc'; // pages/menu/index if (!empty($params['sort_type']) && in_array($params['sort_order'], ['desc', 'asc'])) { switch ($params['sort_type']) { case 'price': $order = 'price ' . $params['sort_order']; break; case 'sales': $order = 'sales_num ' . $params['sort_order']; break; case 'score': $order = 'comment_score ' . $params['sort_order']; } } // plugins4/Housekeeping/index if (!empty($params['sort'])) { switch ($params['sort']) { case 'price': $order = 'price asc'; break; case 'sales': $order = 'sales_num desc'; break; case 'score': $order = 'comment_score desc'; } } $params['where'] = $where; $params['alias'] = 'g'; //$params['select'] = 'g.id,g.goods_name,g.cover_pic,g.price,g.stock,g.attr_groups,g.attr_groups_format,g.is_attr,g.is_show_stock,g.unit,g.goods_source,g.original_price'; //$params['order'] = 'sort asc, g.id asc'; $params['select'] = 'g.id,g.goods_name,g.cover_pic,g.price,g.stock,g.attr_groups,g.attr_groups_format,g.is_attr,g.is_show_stock,g.unit,g.goods_source,g.original_price,g.goods_type'; $params['order'] = $order; $params['with'] = ['attr', 'extra']; $params['limit'] = 10; $goods_list = Goods::listPage($params); $list = Cart::getCartList($this->user_id); $goods_num_arr = []; foreach ($list as $v) { $row = json_decode($v, true); if (isset($goods_num_arr[$row['goods_id']])) { $goods_num_arr[$row['goods_id']] += $row['num']; } else { $goods_num_arr[$row['goods_id']] = $row['num']; } } if (!empty($goods_list['list'])) { $user_level = null; if (!empty($this->user)) { //基础会员等级折扣 $user_level = UserLevel::findOne(['mall_id' => $this->mall_id, 'level' => $this->user['level'], 'status' => StatusEnum::ENABLED]); } foreach ($goods_list['list'] as &$item) { $item['member_buy_limit_setting'] = empty($item['extra']['member_buy_limit_setting']) ? '' : json_decode($item['extra']['member_buy_limit_setting'], true); unset($item['extra']); $item['commission'] = 0; //最高可赚钱的佣金,预留字段 $item['num'] = !empty($goods_num_arr[$item['id']]) ? $goods_num_arr[$item['id']] : 0; $item['status'] = $item['goods_type'] == GoodsTypeEnum::GoodsTypeReserved ? 1 : (empty($item['stock']) ? 0 : 1); $item['attr_id'] = 0; foreach($item['attr'] as $val){ if($val['is_show'] == StatusEnum::ENABLED){ $item['attr_id'] = $val['id']; break; } } $smart_form_template = GlobalInvoke::exec(GlobalInvoke::GOODS_NEED_SMARTFORM, $this->mall_id, ['user_id' => $this->user_id, 'mall_id' => $this->mall_id, 'goods_id' => $item['id']]); if (!empty($smart_form_template)) $item = array_merge($item, $smart_form_template); //额外会员设置 if ($user_level && !empty($user_level['member_price_is_show'])) { $item['price'] = GoodsLogic::getMemberPriceList($this->mall_id, $item, $this->user, true); } if (!empty($item['goods_source'])) { $t_class = "\\addons\\{$item['goods_source']}\\common\\service\\ShoppingCartService"; if (is_callable([$t_class, "getCanAddToCart"])) { $item = $t_class::getCanAddToCart($item, $this->mall_id); } } } } return $this->success('操作成功', $goods_list); } /** * 商品搜索 * @return mixed|void */ public function actionList() { $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['limit', 'page', 'cate_id', 'sort_type', 'sort_price', 'keyword','province_id', 'city_id', 'district_id', 'town_id'], 'safe'] ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $where[] = ['g.mall_id' => $this->mall_id]; $where[] = ['g.status' => [StatusEnum::ENABLED]]; $where[] = ['g.is_on_sale' => 1]; $where[] = ['g.is_show' => 1]; if (isset($params['keyword'])) { $where[] = ['like', 'g.goods_name', trim($params['keyword'])]; } if (!empty($params['cate_id'])) { $goods_cate_relate_list = GoodsCateRelate::findAll(['cate_id' => $params['cate_id']]); $goods_id_arr = array_column($goods_cate_relate_list, 'goods_id'); $where[] = ['g.id' => $goods_id_arr]; } if(isset($params['province_id']) || isset($params['city_id']) || isset($params['district_id']) || isset($params['town_id'])){ $goods_id_arr = GoodsSearchAddress::getGoodsIdByAddressIds($this->mall_id, $params); if($goods_id_arr !== false){ $where[] = ['g.id' => $goods_id_arr]; } } $params['where'] = $where; $params['alias'] = 'g'; $params['select'] = 'g.id,g.goods_name,g.cover_pic,g.price,g.original_price,g.virtual_sales,g.sales_num,is_show_sales,g.original_price,g.goods_type,g.mch_id,g.check_status, g.stock,freight_type'; $params['order'] = 'g.id ASC'; // 默认按id来升序排序 if (isset($params['sort_type']) && $params['sort_type'] == 'sales') { $params['order'] = 'g.sales_num DESC'; } if (isset($params['sort_type']) && $params['sort_type'] == 'new') { $params['order'] = 'g.id DESC'; } if (isset($params['sort_type']) && $params['sort_type'] == 'price') { if (isset($params['sort_price']) && $params['sort_price'] === 'false') { $params['order'] = 'g.price DESC'; } else { $params['order'] = 'g.price'; } } // 查询商城隐藏分类 $hidden_cate_ids = GoodsCate::getAllEnabledSubCateIds(GoodsCate::getHiddenIds($this->mall_id)); if (!empty($hidden_cate_ids)) { // 获取隐藏分类下的商品ID $goods_ids = GoodsCateRelate::getGoodsIdByCateIds($hidden_cate_ids); // 如果有商品ID,则添加到查询条件中,查询时排除这些商品 $params['where'][] = ['not in', 'g.id', $goods_ids]; } $goods_list = Goods::listPage($params); if (!empty($goods_list['list'])) { $user_level = null; if (!empty($this->user)) { //基础会员等级折扣 $user_level = UserLevel::findOne(['mall_id' => $this->mall_id, 'level' => $this->user['level'], 'status' => StatusEnum::ENABLED]); } foreach ($goods_list['list'] as $key => &$item) { $item['sales_num'] += $item['virtual_sales']; unset($item['virtual_sales']); //额外会员设置 if ($user_level && !empty($user_level['member_price_is_show'])) { $item['price'] = GoodsLogic::getMemberPriceList($this->mall_id, $item, $this->user, true); } // 判断是否售盘 $item['status'] = $item['goods_type'] == GoodsTypeEnum::GoodsTypeReserved ? 1 : (empty($item['stock']) ? 0 : 1); // 删除多商户未审核商品 if ($item['mch_id'] > 0 && $item['check_status'] != 1) { unset($goods_list['list'][$key]); } if (!empty($item['goods_source'])) { $t_class = "\\addons\\{$item['goods_source']}\\common\\service\\ShoppingCartService"; if (is_callable([$t_class, "getCanAddToCart"])) { $item = $t_class::getCanAddToCart($item, $this->mall_id); } } $item['freight_type'] = explode(',', $item['freight_type']); if (MallAddons::isInstall($this->mall_id, AddonsEnum::ADDONS_NAME_YUNMENG) && (in_array(2, $item['freight_type']) || in_array(3, $item['freight_type']))) { $configs = \Yii::$app->services->setting->addons->get($this->mall_id, AddonsEnum::ADDONS_NAME_YUNMENG, 'basic'); if ($configs['is_enable'] == 1) { $info = YunmengStoreGoods::getOne([ ['mall_id' => $this->mall_id], ['goods_id' => $item['id']], ['status' => StatusEnum::ENABLED], ['is_on_sale' => 1], ['>', 'stock', 0] ], true); if (!empty($info)) { $item['stock'] = $info['stock']; $item['status'] = 1; } } } } } return $this->success('操作成功', $goods_list); } /** * 商品详情 * @return mixed|void */ public function actionDetail() { $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['goods_id'], 'integer'], [['scene'], 'string'], [['addonsFields','latitude','longitude'], 'safe'] ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $goods = GoodsLogic::GetDetail($this->mall_id, $params, $this->user); if (empty($goods)) return $this->error('商品不存在'); if ($params['addonsFields']) { if($this->platform == User::PLATFORM_MP_WX){ is_string($params['addonsFields']) && $params['addonsFields'] = json_decode($params['addonsFields'], true); }else{ $params['addonsFields'] = is_string($params['addonsFields']) ? explode(',', $params['addonsFields']) : $params['addonsFields']; } $goods = Goods::getAddonsGoodsSetting($this->mall_id, $params['addonsFields'], $goods, 'detail'); } $goods['is_bind_popups'] = UserPartitionRelationship::getIsNeedPopups($this->mall_id, $this->user_id ?? 0); //浏览 if ($goods) { $event = new ViewsEvent($this->mall_id); $data['mall_id'] = $this->mall_id; $data['user_id'] = $this->user_id; $data['goods_id'] = $params['goods_id']; \Yii::$app->services->events->dispatch($event, $data, $event->listeners); $smart_form_template = GlobalInvoke::exec(GlobalInvoke::GOODS_NEED_SMARTFORM, $this->mall_id, ['user_id' => $this->user_id, 'mall_id' => $this->mall_id, 'goods_id' => $params['goods_id']]); if (!empty($smart_form_template)) $goods = array_merge($goods, $smart_form_template); // 商品详情公共调用 $invoke_data = GlobalInvoke::exec( GlobalInvoke::API_GOODS_DETAIL, $this->mall_id, ['mall_id' => $this->mall_id, 'goods' => $goods, 'user' => $this->user,'latitude'=>$params['latitude']??0,'longitude'=>$params['longitude']??0] ); if (!empty($invoke_data['goods'])) $goods = $invoke_data['goods']; } // 首页文本命名 $home_text = Yii::$app->services->setting->mall->get($this->mall_id, "goodsdetail.home_text"); $goods['home_text'] = !empty($home_text) ? $home_text : '首页'; $res = GoodsLogic::getGoodsAssociationList($this->mall_id,$params['goods_id']); $goods['extra1_goods_list'] = $res['extra1_goods_list']??[]; $goods['extra2_goods_list'] = $res['extra2_goods_list']??[]; return $this->success('获取成功', $goods); } /** * 获取预约商品时间 * @return mixed|void */ public function actionGetReserveTime() { $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['goods_id','sku_id'], 'required'], [['goods_id','sku_id'], 'integer'], ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $reserve = GoodsReserve::findOne(['goods_id' => $params['goods_id']]); if (empty($reserve)) return $this->error('该预约商品不存在'); // $timeInfo = GoodsReserveSku::find() // ->select('id,mall_id,mch_id,name,sign_id,pic_url,goods_id,reserve_time_range_type') // ->where(['goods_id' => $params['goods_id'], 'mall_id' => $this->mall_id,'id' => $params['sku_id']]) // ->with(['reserve','times', 'times.timeSpec']) // ->asArray() // ->one(); $sku = GoodsReserveSku::getOne([['goods_id' => $params['goods_id'],'id' => $params['sku_id']]]); if (empty($sku)) return $this->error('该预约商品不存在'); $timeInfo = GoodsReserveTime::getSkuTime($this->mall_id,$sku); return $this->success('获取成功', $timeInfo); } /** * 推荐商品 * @return mixed|void */ public function actionRecommend() { $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['type'], 'required', 'message' => 'type必传'], ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $goods_list = []; $result = \Yii::$app->services->setting->mall->get($this->mall_id, $params['type'] . '.goods_list'); if (empty($result)) { return $this->success('操作成功', $goods_list); } else { $goods_list = json_decode($result, true); $gids = array_column($goods_list, 'id'); $goods_list = Goods::find()->select("id,goods_name,cover_pic,price") ->where(['id' => $gids, 'status' => StatusEnum::ENABLED, 'is_on_sale' => StatusEnum::ENABLED, 'is_show' => 1])->asArray()->all(); } return $this->success('操作成功', $goods_list); } /** * 商品评价列表 * @return mixed|void */ public function actionCommentsList() { $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['goods_id'], 'required', 'message' => 'goods_id必传'], [['limit', 'page', 'type', 'store_id'], 'safe'] ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $data['comments'] = []; $data['good_rate'] = 0; //满意度 $where = ['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED, 'store_id' => $params['store_id'] ?? 0, 'goods_id' => $params['goods_id']]; $total = OrderComments::find()->where($where)->count(); $data['comment_count'][0] = ['name' => OrderCommentEnum::OC_ALL, 'count' => $total ?? 0]; $good_num = OrderComments::find()->where($where)->andWhere(['in', 'score', OrderCommentEnum::OC_PRAISE_SCORES])->count(); $data['comment_count'][1] = ['name' => OrderCommentEnum::OC_PRAISE, 'count' => $good_num ?? 0]; $count = OrderComments::find()->where($where)->andWhere(['in', 'score', OrderCommentEnum::OC_MIDDLE_SCORES])->count(); $data['comment_count'][2] = ['name' => OrderCommentEnum::OC_MIDDLE, 'count' => $count ?? 0]; $count = OrderComments::find()->where($where)->andWhere(['in', 'score', OrderCommentEnum::OC_NEGATIVE_SCORES])->count(); $data['comment_count'][3] = ['name' => OrderCommentEnum::OC_NEGATIVE, 'count' => $count ?? 0]; $where = []; $where[] = ['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED, 'store_id' => $params['store_id'] ?? 0]; $where[] = ['goods_id' => $params['goods_id']]; if (!empty($params['type'])) { switch ($params['type']) { case OrderCommentEnum::TYPE1: //差评 $where[] = ['in', 'score', OrderCommentEnum::OC_NEGATIVE_SCORES]; break; case OrderCommentEnum::TYPE2: //中评 $where[] = ['in', 'score', OrderCommentEnum::OC_MIDDLE_SCORES]; break; case OrderCommentEnum::TYPE4: //好评 $where[] = ['in', 'score', OrderCommentEnum::OC_PRAISE_SCORES]; break; } } $params['where'] = $where; $params['select'] = '*'; $params['order'] = 'is_top desc, virtual_time desc,id desc'; $order_comments_list = OrderComments::listPage($params); if (!empty($order_comments_list['list'])) { $user_id_arr = array_column($order_comments_list['list'], 'user_id'); $user_list = User::findAll(['id' => $user_id_arr]); $user_arr = []; foreach ($user_list as $v) { $user_arr[$v['id']] = ['nickname' => $v['nickname'], 'avatar_url' => $v['avatar_url'], 'level' => $v['level']]; } foreach ($order_comments_list['list'] as &$v) { $v['pic_url'] = !empty($v['pic_url']) ? json_decode($v['pic_url'], true) : []; $comment['nickname'] = $comment['avatar_url'] = ''; if (isset($user_arr[$v['user_id']])) { $user = $user_arr[$v['user_id']]; $v['nickname'] = $user['nickname']; $v['avatar_url'] = $user['avatar_url']; $v['level'] = $user['level']; } if ($v['virtual_time'] > 0) $v['created_at'] = $v['virtual_time']; } unset($v); $data['comments'] = $order_comments_list; } // 获取会员等级 $data['level_arr'] = UserLevel::getUserLevelArr($this->mall_id); if ($total) $data['good_rate'] = number_format($good_num / $total, 2) * 100; return $this->success('操作成功', $data); } /** * 商品搜索-es * @return mixed|void */ public function actionListEs() { $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['keyword'], 'required'], [['limit', 'page', 'cate_id'], 'safe'] ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $params['mall_id'] = $this->mall_id; $goods_list = \common\models\elasticsearch\goods\Goods::getGoodsList($params); return $this->success('操作成功', $goods_list); } /** * @desc:商品收藏 * @Author: hua * @Date: 2021/11/9 * @Time: 9:12 * @Copyright: copyright (c) 2021 广东七件事集团 * @return mixed|void */ public function actionCollectAdd() { $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['goods_id', 'type'], 'required'], [['type'], 'in', 'range' => [0, 1]], ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $params['mall_id'] = $this->mall_id; $params['user_id'] = $this->user_id; $params['status'] = $params['type']; $res = GoodsCollect::setData($params); if ($res === false) return $this->error(GoodsCollect::getStaticError()); if ($params['type'] == StatusEnum::ENABLED) { $msg = "收藏成功"; } else { $msg = "取消收藏"; } return $this->success($msg, []); } /** * @name: * @msg: 根据分类获取商品列表,包括所有子级分类的所有商品 * @param {*} * @return {*} */ public function actionCategorysGoodList() { if (!\Yii::$app->request->isGet) { return $this->error('请求方式错误'); } $page = \Yii::$app->request->get('page', 1); $limit = \Yii::$app->request->get('limit', $this->pageSize); $cate_id = \Yii::$app->request->get('cate_id'); $wheres[] = ['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED, 'is_on_sale' => 1]; if (!empty($cate_id)) { $second_level_cate_ids = GoodsCate::find() ->select('id') ->where(['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED, 'parent_id' => $cate_id, 'is_show' => 1]) ->asArray() ->column(); $third_level_cate_ids = GoodsCate::find() ->select('id') ->where(['mall_id' => $this->mall_id, 'status' => StatusEnum::ENABLED, 'parent_id' => $second_level_cate_ids, 'is_show' => 1]) ->asArray() ->column(); $cate_ids = array_merge($second_level_cate_ids, $third_level_cate_ids); $cate_ids[] = $cate_id; $good_ids = GoodsCateRelate::find() ->select('goods_id') ->where(['cate_id' => $cate_ids]) ->asArray() ->column(); $wheres[] = ['id' => $good_ids]; } $params = [ 'select' => 'id,goods_name,cover_pic,price,original_price,goods_type', 'where' => $wheres, 'order' => 'sort asc,created_at desc', 'page' => $page, 'limit' => $limit, ]; $goods = Goods::listPage($params); return $this->success('success', $goods); } /** * @Description: * 1.获取指定分类数据,如果存在上下级关系,下级被包含在上级里面 * 2.获取分类以及子分类 * @Author: zsan * @DateTime 2023-10-26 18:17:54 * @return \yii\web\Response */ public function actionGetCateList() { if (!\Yii::$app->request->isGet) { return $this->error('请求方式错误'); } $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['cate_id'], 'required', 'message' => 'cate_id必传'], [['is_diy'], 'integer'] ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $is_diy = $params['is_diy'] ?? 0; if ($is_diy) { $params['cate_id'] = explode(',', $params['cate_id']); $cate_list = GoodsCate::lists([ 'where' => [['mall_id' => $this->mall_id], ['status' => StatusEnum::ENABLED], ['id' => $params['cate_id']]], 'select' => 'id, name, parent_id, mch_id, pic', 'order' => 'sort ASC', 'with' => [ 'child' => function ($query) { return $query->select('id, name, parent_id, mch_id, pic'); } ] ]); $cate_list = array_column($cate_list, null, 'id'); $third_cate = []; foreach ($cate_list as $key => $val) { if (empty($val['child'])) { !isset($third_cate[$val['parent_id']]) && $third_cate[$val['parent_id']] = []; array_push($third_cate[$val['parent_id']], $val); if (isset($cate_list[$val['parent_id']])) { // 删除三级 unset($cate_list[$key]); if (!empty($cate_list[$val['parent_id']]['child'])) { // 置空二级下三级 $cate_list[$val['parent_id']]['child'] = []; } } } } if(!empty($third_cate)){ foreach($cate_list as $key => $val){ if(isset($third_cate[$val['id']])){ $cate_list[$key]['child'] = $third_cate[$val['id']]; } } } $cate_list = array_values($cate_list); } else { $cate_list = GoodsCate::lists([ 'where' => [['mall_id' => $this->mall_id], ['status' => StatusEnum::ENABLED], ['parent_id' => $params['cate_id']]], 'select' => 'id, name, parent_id, mch_id, pic', 'order' => 'sort ASC', 'with' => [ 'child' => function ($query) { return $query->select('id, name, parent_id, mch_id, pic'); } ] ]); } return $this->success('success', $cate_list); } public function actionReserveDetail() { $params = \Yii::$app->request->get(); $res = \Yii::$app->services->validate->validate($params, [ [['goods_id'], 'required'], [['goods_id'], 'integer'], ]); if ($res === false) return $this->error(\Yii::$app->services->validate->getErrorMessage()); $data = GoodsReserve::getOne([ ['goods_id' => $params['goods_id']], ['mall_id' => $this->mall_id], ], true, [], 'id desc', 'ordering_information, information_detail'); return $this->success('获取成功', $data); } }