|
|
@ -1,9 +1,12 @@ |
|
|
<?php |
|
|
<?php |
|
|
|
|
|
|
|
|
namespace App\Service\v3\Implementations; |
|
|
namespace App\Service\v3\Implementations; |
|
|
|
|
|
use App\Model\v3\Market; |
|
|
|
|
|
use App\Model\v3\Store; |
|
|
use App\Service\v3\Interfaces\CollectStoreServiceInterface; |
|
|
use App\Service\v3\Interfaces\CollectStoreServiceInterface; |
|
|
use App\Constants\v3\SsdbKeys; |
|
|
use App\Constants\v3\SsdbKeys; |
|
|
use App\TaskWorker\SSDBTask; |
|
|
use App\TaskWorker\SSDBTask; |
|
|
|
|
|
use Hyperf\DbConnection\Db; |
|
|
use Hyperf\Utils\ApplicationContext; |
|
|
use Hyperf\Utils\ApplicationContext; |
|
|
|
|
|
|
|
|
class CollectStoreService implements CollectStoreServiceInterface |
|
|
class CollectStoreService implements CollectStoreServiceInterface |
|
|
@ -51,4 +54,16 @@ class CollectStoreService implements CollectStoreServiceInterface |
|
|
$count = $ssdb->exec('get',SsdbKeys::COUNT_COLLECT_STORE.$storeId); |
|
|
$count = $ssdb->exec('get',SsdbKeys::COUNT_COLLECT_STORE.$storeId); |
|
|
return $count; |
|
|
return $count; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function getListByUser($userId) |
|
|
|
|
|
{ |
|
|
|
|
|
$marketIds = Db::table('lanzu_user_collection')->where('user_id',$userId)->pluck('market_id')->toArray(); |
|
|
|
|
|
$storeIds = Db::table('lanzu_user_collection')->where('user_id',$userId)->pluck('store_id')->toArray(); |
|
|
|
|
|
$res = Market::query()->with(['stores' => function($query) use ($storeIds) { |
|
|
|
|
|
$query->whereIn('lanzu_store.id',$storeIds); |
|
|
|
|
|
}]) |
|
|
|
|
|
->whereIn('id',$marketIds) |
|
|
|
|
|
->get(); |
|
|
|
|
|
return $res; |
|
|
|
|
|
} |
|
|
} |
|
|
} |