RedactivityController.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace frontend\controllers;
  3. use common\models\ActivityReceive;
  4. use common\models\RedActivity;
  5. use Yii;
  6. use yii\web\Controller;
  7. use yii\filters\AccessControl;
  8. /**
  9. * red controller
  10. */
  11. class RedactivityController extends BasewechatController
  12. {
  13. static $pagenum = 20;
  14. public function behaviors()
  15. {
  16. return [
  17. 'access' => [
  18. 'class' => AccessControl::className(),
  19. 'rules' => [
  20. [
  21. 'actions' => [],
  22. 'allow' => true,
  23. 'roles' => ['@'],
  24. ],
  25. ],
  26. ],
  27. ];
  28. }
  29. /**
  30. * 红包记录
  31. */
  32. public function actionRedlog()
  33. {
  34. $mod = ActivityReceive::findBySql("SELECT a.amount,a.receive_at,b.title FROM {{%activity_receive}} AS a LEFT JOIN {{%building}} AS b ON a.source_id = b.id WHERE a.uid = :uid AND a.status = :status ORDER BY a.id desc LIMIT ".self::$pagenum,[':uid'=>Yii::$app->user->id,':status'=>ActivityReceive::STATUS_YES]);
  35. $list = $mod->asArray()->all();
  36. Yii::$app->view->title="红包记录";
  37. return $this->render('redlog',['datas'=>$list]);
  38. }
  39. }