...
|
...
|
@@ -24,8 +24,7 @@ class LivingController extends BaseController |
|
|
{
|
|
|
$key = __CLASS__.__FUNCTION__.'app'.$this->app;
|
|
|
if (!$ret = $this->cache->get($key)){
|
|
|
|
|
|
$ret = Room::find()->with(['master'])->where(['and',['!=','best','0'],['app'=>$this->app]])->limit(2)->orderBy(['best'=>SORT_ASC])->all();
|
|
|
$ret = Room::find()->with(['master'])->where(['and',['!=','best','0'],"find_in_set({$this->app},app)"])->limit(2)->orderBy(['best'=>SORT_ASC])->all();
|
|
|
|
|
|
foreach ($ret as $k=>$model){
|
|
|
$row = [
|
...
|
...
|
@@ -42,7 +41,7 @@ class LivingController extends BaseController |
|
|
}
|
|
|
|
|
|
$dependency = new \yii\caching\DbDependency(['sql' => Yii::$app->db
|
|
|
->createCommand('SELECT MAX(update_time),count(*) FROM {{%room}} WHERE best!="0" AND app=:app')
|
|
|
->createCommand('SELECT MAX(update_time),count(*) FROM {{%room}} WHERE best!="0" AND find_in_set(:app,app)')
|
|
|
->bindValue(':app', $this->app)
|
|
|
->getRawSql()]);
|
|
|
$this->cache->set($key, json_encode($ret), Yii::$app->params['defaultCacheExpire'], $dependency);
|
...
|
...
|
@@ -59,7 +58,7 @@ class LivingController extends BaseController |
|
|
$key = __CLASS__.__FUNCTION__.'app'.$this->app;
|
|
|
if (!$ret = $this->cache->get($key)){
|
|
|
|
|
|
$ret = Room::find()->with(['master','roomNums'])->where(['and',['living'=>1],['status'=>1],['app'=>$this->app]])->joinWith('roomNums rn')->orderBy(['rn.online_num'=>SORT_DESC])->all();
|
|
|
$ret = Room::find()->with(['master','roomNums'])->where(['and',['living'=>1],"find_in_set({$this->app},app)"])->joinWith('roomNums rn')->orderBy(['rn.online_num'=>SORT_DESC])->all();
|
|
|
|
|
|
foreach ($ret as $k=>$model){
|
|
|
$row = [
|
...
|
...
|
@@ -82,7 +81,7 @@ class LivingController extends BaseController |
|
|
}
|
|
|
|
|
|
$dependency = new \yii\caching\DbDependency(['sql' => Yii::$app->db
|
|
|
->createCommand('SELECT MAX(update_time),count(*) FROM {{%room}} WHERE living=1 AND status=1 AND app=:app')
|
|
|
->createCommand('SELECT MAX(update_time),count(*) FROM {{%room}} WHERE living=1 AND find_in_set(:app,app)')
|
|
|
->bindValue(':app', $this->app)
|
|
|
->getRawSql()]);
|
|
|
$this->cache->set($key, json_encode($ret), Yii::$app->params['defaultCacheExpire'], $dependency);
|
...
|
...
|
@@ -114,7 +113,7 @@ class LivingController extends BaseController |
|
|
$key = __CLASS__.__FUNCTION__.'app'.$this->app;
|
|
|
if (!$ret = $this->cache->get($key)){
|
|
|
|
|
|
$ret = Room::find()->with(['master'])->where(['and',['living'=>0],['app'=>$this->app]])->orderBy(['starting_time'=>SORT_ASC])->all();
|
|
|
$ret = Room::find()->with(['master'])->where(['and',['living'=>0],"find_in_set({$this->app},app)"])->orderBy(['starting_time'=>SORT_ASC])->all();
|
|
|
|
|
|
foreach ($ret as $k=>$model){
|
|
|
$row = [
|
...
|
...
|
@@ -130,7 +129,7 @@ class LivingController extends BaseController |
|
|
}
|
|
|
|
|
|
$dependency = new \yii\caching\DbDependency(['sql' => Yii::$app->db
|
|
|
->createCommand('SELECT MAX(update_time),count(*) FROM {{%room}} WHERE living=0 AND app=:app')
|
|
|
->createCommand('SELECT MAX(update_time),count(*) FROM {{%room}} WHERE living=0 AND find_in_set(:app,app)')
|
|
|
->bindValue(':app', $this->app)
|
|
|
->getRawSql()]);
|
|
|
$this->cache->set($key, json_encode($ret), Yii::$app->params['defaultCacheExpire'], $dependency);
|
...
|
...
|
@@ -148,7 +147,7 @@ class LivingController extends BaseController |
|
|
$key = __CLASS__.__FUNCTION__.'app'.$this->app;
|
|
|
if (!$ret = $this->cache->get($key)){
|
|
|
|
|
|
$ret = Video::find()->with(['master'])->where(['and',['status' => 1],['not', ['url' => null]],['not', ['url' => '']],['app'=>$this->app]])->orderBy(['create_time'=>SORT_DESC])->all();
|
|
|
$ret = Video::find()->with(['master'])->where(['and',['status' => 1],['not', ['url' => null]],['not', ['url' => '']],"find_in_set({$this->app},app)"])->orderBy(['create_time'=>SORT_DESC])->all();
|
|
|
|
|
|
foreach ($ret as $k=>$model){
|
|
|
$row = [
|
...
|
...
|
@@ -168,7 +167,7 @@ class LivingController extends BaseController |
|
|
}
|
|
|
|
|
|
$dependency = new \yii\caching\DbDependency(['sql' => Yii::$app->db
|
|
|
->createCommand('SELECT MAX(update_time),count(*) FROM {{%video}} WHERE status=1 AND NOT (url IS NULL) AND NOT (url="") AND app=:app')
|
|
|
->createCommand('SELECT MAX(update_time),count(*) FROM {{%video}} WHERE status=1 AND NOT (url IS NULL) AND NOT (url="") AND find_in_set(:app,app)')
|
|
|
->bindValue(':app', $this->app)
|
|
|
->getRawSql()]);
|
|
|
$this->cache->set($key, json_encode($ret), Yii::$app->params['defaultCacheExpire'], $dependency);
|
...
|
...
|
|