Commit 8c094d6b authored by luhongguang's avatar luhongguang

update:拼单查询

parent 63c82645
......@@ -15,6 +15,7 @@ use \Validate\GoodsOnlineOfflineValidate;
use \Validate\PaySuccessGoodsCallbackValidate;
use \Validate\GoodsInitShopValidate;
use \App\Services\goods\ElasticGoodService;
use \App\Services\goods\MarketingPindanGoodsService;
class GoodsController extends Base
......@@ -246,10 +247,6 @@ class GoodsController extends Base
$this->success(["result" => $data]);
}
/**
* 支付回调商品接口
* @throws \App\Exception\custom\GoodsException
......@@ -276,4 +273,15 @@ class GoodsController extends Base
$shopId = GoodsService::initShop($params);
$this->success(["result" => ["shop_id" => $shopId]]);
}
/**
* 拼单商品后台搜商品
* @throws Exception
*/
public function pindan_goodsAction()
{
$params = $this->params;
$list = MarketingPindanGoodsService::getPindanGoodsList($params);
$this->success($list);
}
}
\ No newline at end of file
......@@ -336,4 +336,37 @@ class MarketingPindanGoodsService
$data["price"] = $goodsSnapshot["price"] / 100;
return $data;
}
/**
* 拼单商品后台搜商品
* @param $params
* @return array
*/
public static function getPindanGoodsList($params)
{
$params['page'] = !empty($params['page']) ? $params['page'] : 1;
$limit = !empty($params['page_size']) ? $params['page_size'] : 20;
$page = ($params['page'] - 1) * $limit;
$where = $data = [];
if (!empty($params["ota_id"])) {
$where["ota_id"] = $params["ota_id"];
}
if (!empty($params["goods_name"])) {
$where["goods_name[~]"] = $params["goods_name"];
}
$where['LIMIT'] = [$page, $limit];
$where['ORDER'] = ["update_time" => "DESC"];
$list = PindanGoodsSku::select("*", $where);
$count = PindanGoodsSku::count("*", $where);
if (!empty($list)) {
foreach ($list as $key => $item) {
$list[$key]["original_price"] = $item["original_price"] / 100;
$list[$key]["price"] = $item["price"] / 100;
}
}
return ["list" => $list, "count" => $count];
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment