public function search($params) { //$query = MSceneDetail::find()->where('scene_amt<0'); $query = MSceneDetail::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => 20]]); $this->addCondition($query, 'gh_id'); $this->addCondition($query, 'scene_id'); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $this->addCondition($query, 'scene_amt'); $this->addCondition($query, 'memo', true); if (trim($this->create_time) !== '') { $query->andWhere('date(create_time)>=:create_time', [':create_time' => $this->create_time]); } if (trim($this->create_time_2) !== '') { $query->andWhere('date(create_time)<=:create_time_2', [':create_time_2' => $this->create_time_2]); } $this->addCondition($query, 'status'); return $dataProvider; }
public function actionTjyl() { $this->layout = 'wapy'; $gh_id = U::getSessionParam('gh_id'); $openid = U::getSessionParam('openid'); $model = MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]); if (empty($model->openidBindMobiles)) { Yii::$app->getSession()->set('RETURN_URL', Url::to()); return $this->redirect(['addbindmobile', 'gh_id' => $gh_id, 'openid' => $openid]); } $scenes = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND scene_amt<0 ORDER BY create_time DESC', [':gh_id' => $gh_id, ':scene_id' => $model->scene_id])->all(); //可提现沃点 $ktxwd_scenes = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND scene_amt>0 AND status=1 ORDER BY create_time DESC', [':gh_id' => $gh_id, ':scene_id' => $model->scene_id])->all(); //预期沃点 $yqwd_scenes = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND scene_amt>0 AND status=0', [':gh_id' => $gh_id, ':scene_id' => $model->scene_id])->all(); //预期沃点 包含粉丝取消关注 $yqwd_fans_qx_scenes = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND scene_amt>0 AND status<>1 ORDER BY create_time DESC', [':gh_id' => $gh_id, ':scene_id' => $model->scene_id])->all(); U::W(count($yqwd_fans_qx_scenes)); return $this->render('tjyl', ['gh_id' => $gh_id, 'openid' => $openid, 'user' => $model, 'scenes' => $scenes, 'ktxwd_scenes' => $ktxwd_scenes, 'yqwd_scenes' => $yqwd_scenes, 'yqwd_fans_qx_scenes' => $yqwd_fans_qx_scenes]); }
public function getWokeYqwdLast7Days() { //已提沃点 if (empty($this->scene_id)) { return 0; } //今天 $d1 = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND status=:status AND scene_amt>0 AND to_days(create_time)=to_days(now())', [':gh_id' => $this->gh_id, ':scene_id' => $this->scene_id, ':status' => MSceneDetail::STATUS_INIT])->sum('scene_amt'); if ($d1 == null) { $d1 = 0; } //昨天 $d2 = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND status=:status AND scene_amt>0 AND to_days(now())-to_days(create_time)=1', [':gh_id' => $this->gh_id, ':scene_id' => $this->scene_id, ':status' => MSceneDetail::STATUS_INIT])->sum('scene_amt'); if ($d2 == null) { $d2 = 0; } $d3 = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND status=:status AND scene_amt>0 AND to_days(now())-to_days(create_time)=2', [':gh_id' => $this->gh_id, ':scene_id' => $this->scene_id, ':status' => MSceneDetail::STATUS_INIT])->sum('scene_amt'); if ($d3 == null) { $d3 = 0; } $d4 = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND status=:status AND scene_amt>0 AND to_days(now())-to_days(create_time)=3', [':gh_id' => $this->gh_id, ':scene_id' => $this->scene_id, ':status' => MSceneDetail::STATUS_INIT])->sum('scene_amt'); if ($d4 == null) { $d4 = 0; } $d5 = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND status=:status AND scene_amt>0 AND to_days(now())-to_days(create_time)=4', [':gh_id' => $this->gh_id, ':scene_id' => $this->scene_id, ':status' => MSceneDetail::STATUS_INIT])->sum('scene_amt'); if ($d5 == null) { $d5 = 0; } $d6 = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND status=:status AND scene_amt>0 AND to_days(now())-to_days(create_time)=5', [':gh_id' => $this->gh_id, ':scene_id' => $this->scene_id, ':status' => MSceneDetail::STATUS_INIT])->sum('scene_amt'); if ($d6 == null) { $d6 = 0; } $d7 = MSceneDetail::find()->where('gh_id=:gh_id AND scene_id=:scene_id AND status=:status AND scene_amt>0 AND to_days(now())-to_days(create_time)=6', [':gh_id' => $this->gh_id, ':scene_id' => $this->scene_id, ':status' => MSceneDetail::STATUS_INIT])->sum('scene_amt'); if ($d7 == null) { $d7 = 0; } $last7days = array($d1, $d2, $d3, $d4, $d5, $d6, $d7); U::W("###########\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\n"); U::W($last7days); //return array_values($last7days); return empty($last7days) ? 0 : $last7days; }