|
|
@@ -181,11 +181,9 @@ class MasterWorkerLists extends BaseAdminDataLists implements ListsSearchInterfa
|
|
|
if($this->lat && $this->lon){
|
|
|
$fields[] = Db::raw('ROUND(6371* 1000 * ACOS(COS(RADIANS('.$this->lat.')) * COS(RADIANS(mw.lat)) * COS(RADIANS(mw.lon) - RADIANS('.$this->lon.')) + SIN(RADIANS('.$this->lat.')) * SIN(RADIANS(mw.lat))), 2) AS user_distance');
|
|
|
$orders = 'user_distance';
|
|
|
- $having .= ' AND (user_distance - mw.distance) <= 0'; // 添加条件而不是覆盖
|
|
|
- if ($this->range) {
|
|
|
- $having = 'user_distance <= ' . $this->range;
|
|
|
- } else {
|
|
|
- $having .= ' AND user_distance <= ' . $this->range; // 如果 $this->range 为空,确保 $having 包含所有条件
|
|
|
+ $having = '(user_distance - mw.distance) <= 0';
|
|
|
+ if($this->range){
|
|
|
+ $having = 'user_distance <= '.$this->range;
|
|
|
}
|
|
|
}
|
|
|
return count(MasterWorker::alias('mw')
|