修复可以看到其他用户收集任务的bug

一点点的整理工作
This commit is contained in:
Chenx221 2024-03-04 15:50:51 +08:00
parent 84b087362f
commit a70d7ad63a
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021
3 changed files with 10 additions and 6 deletions

View File

@ -2,6 +2,7 @@
namespace app\models; namespace app\models;
use Yii;
use yii\base\Model; use yii\base\Model;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
use app\models\CollectionTasks; use app\models\CollectionTasks;
@ -40,7 +41,7 @@ class CollectionSearch extends CollectionTasks
*/ */
public function search($params) public function search($params)
{ {
$query = CollectionTasks::find(); $query = CollectionTasks::find()->where(['user_id' => Yii::$app->user->id]);
// add conditions that should always apply here // add conditions that should always apply here
@ -59,7 +60,7 @@ class CollectionSearch extends CollectionTasks
// grid filtering conditions // grid filtering conditions
$query->andFilterWhere([ $query->andFilterWhere([
'id' => $this->id, 'id' => $this->id,
'user_id' => $this->user_id, // 'user_id' => $this->user_id,
'created_at' => $this->created_at, 'created_at' => $this->created_at,
]); ]);

View File

@ -3,6 +3,7 @@
namespace app\models; namespace app\models;
use Yii; use Yii;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord; use yii\db\ActiveRecord;
/** /**
@ -71,7 +72,7 @@ class CollectionTasks extends ActiveRecord
/** /**
* Gets query for [[CollectionUploadeds]]. * Gets query for [[CollectionUploadeds]].
* *
* @return \yii\db\ActiveQuery * @return ActiveQuery
*/ */
public function getCollectionUploadeds() public function getCollectionUploadeds()
{ {
@ -81,7 +82,7 @@ class CollectionTasks extends ActiveRecord
/** /**
* Gets query for [[User]]. * Gets query for [[User]].
* *
* @return \yii\db\ActiveQuery * @return ActiveQuery
*/ */
public function getUser() public function getUser()
{ {

View File

@ -3,6 +3,8 @@
namespace app\models; namespace app\models;
use Yii; use Yii;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord;
/** /**
* This is the model class for table "share". * This is the model class for table "share".
@ -15,7 +17,7 @@ use Yii;
* *
* @property User $sharer * @property User $sharer
*/ */
class Share extends \yii\db\ActiveRecord class Share extends ActiveRecord
{ {
const SCENARIO_UPDATE = 'update'; const SCENARIO_UPDATE = 'update';
/** /**
@ -59,7 +61,7 @@ class Share extends \yii\db\ActiveRecord
/** /**
* Gets query for [[Sharer]]. * Gets query for [[Sharer]].
* *
* @return \yii\db\ActiveQuery * @return ActiveQuery
*/ */
public function getSharer() public function getSharer()
{ {