Merge branch 'main'

wechat
lqmac 6 months ago
commit c8ab7b9a7c
  1. 2
      app/api/controller/GoodsNew.php
  2. 24
      app/common/library/elasticsearch/Client.php
  3. 3
      app/common/service/GoodsEs.php
  4. 4
      app/store/model/Order.php

@ -27,7 +27,7 @@ class GoodsNew extends Controller
$goodsService = new GoodsEs();
$list = $goodsService->list($params, $page, $limit);
$data['list'] = $list;
$data['total'] = $goodsService->count();
$data['total'] = $goodsService->count($params);
return $this->renderSuccess($data);
}

@ -233,8 +233,8 @@ class Client
];*/
$must[] = [
// 'match' => [$filed => $value]
'match_phrase' => [$filed => $value]
'match' => [$filed => $value]
// 'match_phrase' => [$filed => $value]
];
}
}
@ -281,7 +281,7 @@ class Client
public function query($isTotal = false)
{
// try {
try {
$this->parseQueryParams();
// dd($this->queryParams);
@ -333,15 +333,15 @@ class Client
}
// } catch (\Exception $e) {
//
// $msg = $e->getMessage();
//
// $msg = '服务器开小差了~';
//
// throw new Exception($msg);
//
// }
} catch (\Exception $e) {
$msg = $e->getMessage();
$msg = '服务器开小差了~';
throw new Exception($msg);
}
}
/**

@ -10,6 +10,8 @@ class GoodsEs
private string $index_name = 'goods_list';
private string $field = 'goods_id,goods_type,goods_no,goods_name';
public function __construct()
{
$this->esService = Client::setEs($this->index_name);
@ -23,6 +25,7 @@ class GoodsEs
public function list($params = [],$page = 1, $limit = 10)
{
return $this->esService
->select($this->field)
// ->setDebug()
->like($params)
->from($page)

@ -105,7 +105,7 @@ class Order extends OrderModel
$query = $query->whereOr($filterOr);
}
$list = $query->order(['order.create_time' => 'desc'])
->paginate(10);
->paginate($param['pageSize'] ?? 15);
return $list;
}
@ -161,7 +161,7 @@ class Order extends OrderModel
}
// 加载关联订单数据
$list = $query->order(['order.create_time' => 'desc'])
->paginate(10);
->paginate($param['pageSize'] ?? 15);
$list = static::preload($list, ['goods.image', 'user.avatar', 'address', 'delivery'], true);
return $list;
}

Loading…
Cancel
Save