Commit 242e36b2 authored by liuyuzhen's avatar liuyuzhen

经纬度信息调整

parent 4daa83ec
...@@ -174,9 +174,9 @@ class GoodsClassServiceModel extends \Business\AbstractModel{ ...@@ -174,9 +174,9 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
$position['lat'] = $where['lat']; $position['lat'] = $where['lat'];
$position['lng'] = $where['lng']; $position['lng'] = $where['lng'];
$position['cityCode'] = $where['cityCode']; $position['cityCode'] = $where['cityCode'];
ksort($position);
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$serviceStoreKey = \Our\NameConst::serviceStoreIdsPrefix.crc32(serialize(ksort($position))); $serviceStoreKey = \Our\NameConst::serviceStoreIdsPrefix.crc32(serialize($position));
$storeRedis->update($serviceStoreKey,$serviceStoreIds,\Our\ApiConst::oneHour); $storeRedis->update($serviceStoreKey,$serviceStoreIds,\Our\ApiConst::oneHour);
return $serviceStoreIds; return $serviceStoreIds;
} }
...@@ -217,9 +217,10 @@ class GoodsClassServiceModel extends \Business\AbstractModel{ ...@@ -217,9 +217,10 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
$position['lat'] = $where['lat']; $position['lat'] = $where['lat'];
$position['lng'] = $where['lng']; $position['lng'] = $where['lng'];
$position['cityCode'] = $where['cityCode']; $position['cityCode'] = $where['cityCode'];
ksort($position);
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
if($signStoreIds){ if($signStoreIds){
$signStoreKey = \Our\NameConst::signStoreIdsPrefix.crc32(serialize(ksort($position))); $signStoreKey = \Our\NameConst::signStoreIdsPrefix.crc32(serialize($position));
$storeRedis->update($signStoreKey,$signStoreIds,\Our\ApiConst::oneHour); $storeRedis->update($signStoreKey,$signStoreIds,\Our\ApiConst::oneHour);
} }
return array( return array(
......
...@@ -711,8 +711,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -711,8 +711,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
public function getAllNearbyGoods($position){ public function getAllNearbyGoods($position){
ksort($position);
$redisSuffix = crc32(serialize(ksort($position))); $redisSuffix = crc32(serialize($position));
$nearbyStoreKey = \Our\NameConst::nearbyStoreKeyPrefix . $redisSuffix; $nearbyStoreKey = \Our\NameConst::nearbyStoreKeyPrefix . $redisSuffix;
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
...@@ -752,7 +752,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -752,7 +752,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$position['lat'] = $where['lat']; $position['lat'] = $where['lat'];
$position['lng'] = $where['lng']; $position['lng'] = $where['lng'];
$position['cityCode'] = $where['cityCode']; $position['cityCode'] = $where['cityCode'];
$redisSuffix = crc32(serialize(ksort($position))); ksort($position);
$redisSuffix = crc32(serialize($position));
$nearbyGoodsListKey = \Our\NameConst::nearbyStoreGoodsPrefix . $redisSuffix; $nearbyGoodsListKey = \Our\NameConst::nearbyStoreGoodsPrefix . $redisSuffix;
......
...@@ -399,8 +399,8 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -399,8 +399,8 @@ class StoreServiceModel extends \Business\AbstractModel{
$position['lat'] = $where['lat']; $position['lat'] = $where['lat'];
$position['lng'] = $where['lng']; $position['lng'] = $where['lng'];
$position['cityCode'] = $where['cityCode']; $position['cityCode'] = $where['cityCode'];
$readisSuffix = crc32(serialize(ksort($position))); ksort($position);
$readisSuffix = crc32(serialize($position));
$nearbyStoreIds = $this->getNearbyStoreIds($position); $nearbyStoreIds = $this->getNearbyStoreIds($position);
//没有得到任何附近的店铺 //没有得到任何附近的店铺
if(!$nearbyStoreIds){ if(!$nearbyStoreIds){
...@@ -452,7 +452,8 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -452,7 +452,8 @@ class StoreServiceModel extends \Business\AbstractModel{
* @param $position * @param $position
*/ */
private function getNearbyStoreIds($position){ private function getNearbyStoreIds($position){
$readisSuffix = crc32(serialize(ksort($position))); ksort($position);
$readisSuffix = crc32(serialize($position));
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$signStoreKey = \Our\NameConst::signStoreIdsPrefix . $readisSuffix; $signStoreKey = \Our\NameConst::signStoreIdsPrefix . $readisSuffix;
$signStoreIds =$storeRedis->find($signStoreKey, \Our\ApiConst::oneHour); $signStoreIds =$storeRedis->find($signStoreKey, \Our\ApiConst::oneHour);
...@@ -489,7 +490,8 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -489,7 +490,8 @@ class StoreServiceModel extends \Business\AbstractModel{
$position['lat'] = $where['lat']; $position['lat'] = $where['lat'];
$position['lng'] = $where['lng']; $position['lng'] = $where['lng'];
$position['cityCode'] = $where['cityCode']; $position['cityCode'] = $where['cityCode'];
$readisSuffix = crc32(serialize(ksort($position))); ksort($position);
$readisSuffix = crc32(serialize($position));
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$nearbyStoreKey = \Our\NameConst::nearbyStoreKeyPrefix . $readisSuffix; $nearbyStoreKey = \Our\NameConst::nearbyStoreKeyPrefix . $readisSuffix;
...@@ -623,10 +625,10 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -623,10 +625,10 @@ class StoreServiceModel extends \Business\AbstractModel{
* @param $position * @param $position
*/ */
public function getSignClassStores($gcId,$position){ public function getSignClassStores($gcId,$position){
ksort($position);
//第一步:获取当前地址对应店铺是否包含当前分类(签约) //第一步:获取当前地址对应店铺是否包含当前分类(签约)
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$signStoreKey = \Our\NameConst::signStoreIdsPrefix.crc32(serialize(ksort($position))); $signStoreKey = \Our\NameConst::signStoreIdsPrefix.crc32(serialize($position));
$signStoreIds = $storeRedis->find($signStoreKey, \Our\ApiConst::oneHour); $signStoreIds = $storeRedis->find($signStoreKey, \Our\ApiConst::oneHour);
//签约店铺存在 //签约店铺存在
if($signStoreIds){ if($signStoreIds){
...@@ -643,10 +645,10 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -643,10 +645,10 @@ class StoreServiceModel extends \Business\AbstractModel{
* @return array|bool * @return array|bool
*/ */
public function getServiceClassStores($gcId,$position){ public function getServiceClassStores($gcId,$position){
ksort($position);
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$signStoreKey = \Our\NameConst::signStoreIdsPrefix.crc32(serialize(ksort($position))); $signStoreKey = \Our\NameConst::signStoreIdsPrefix.crc32(serialize($position));
$serviceStoreKey = \Our\NameConst::serviceStoreIdsPrefix.crc32(serialize(ksort($position))); $serviceStoreKey = \Our\NameConst::serviceStoreIdsPrefix.crc32(serialize($position));
$signStoreIds = $storeRedis->find($signStoreKey, \Our\ApiConst::oneHour); $signStoreIds = $storeRedis->find($signStoreKey, \Our\ApiConst::oneHour);
$serviceStoreIds = $storeRedis->find($serviceStoreKey, \Our\ApiConst::oneHour); $serviceStoreIds = $storeRedis->find($serviceStoreKey, \Our\ApiConst::oneHour);
if($signStoreIds&&$serviceStoreIds){ if($signStoreIds&&$serviceStoreIds){
...@@ -661,10 +663,11 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -661,10 +663,11 @@ class StoreServiceModel extends \Business\AbstractModel{
} }
public function getExpressStores($gcId,$position){ public function getExpressStores($gcId,$position){
ksort($position);
$storeDao = \DAO\StoreModel::getInstance(); $storeDao = \DAO\StoreModel::getInstance();
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance(); $storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$signStoreKey = \Our\NameConst::signStoreIdsPrefix.crc32(serialize(ksort($position))); $signStoreKey = \Our\NameConst::signStoreIdsPrefix.crc32(serialize($position));
$serviceStoreKey = \Our\NameConst::serviceStoreIdsPrefix.crc32(serialize(ksort($position))); $serviceStoreKey = \Our\NameConst::serviceStoreIdsPrefix.crc32(serialize($position));
$signStoreIds = $storeRedis->find($signStoreKey, \Our\ApiConst::oneHour); $signStoreIds = $storeRedis->find($signStoreKey, \Our\ApiConst::oneHour);
$serviceStoreIds = $storeRedis->find($serviceStoreKey, \Our\ApiConst::oneHour); $serviceStoreIds = $storeRedis->find($serviceStoreKey, \Our\ApiConst::oneHour);
$expressStores = $storeDao->getExpressStores('store_id'); $expressStores = $storeDao->getExpressStores('store_id');
......
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