Exemplo n.º 1
0
 public static function toupiaoAjax($author_openid, $vote_openid, $score)
 {
     $zhongqiu_vote = self::findOne(['vote_openid' => $vote_openid]);
     //U::W("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
     //U::W($zhongqiu_vote);
     //U::W($author_openid);
     //U::W($vote_openid);
     //U::W($score);
     if (empty($zhongqiu_vote)) {
         $zhongqiu_vote = new \app\models\MZhongqiuVote();
     } else {
         //已经投过一次票了,提示用户已投过票,只能每人只能投一次票哟
         return \yii\helpers\Json::encode(['code' => 11]);
     }
     $zhongqiu_vote->author_openid = $author_openid;
     $zhongqiu_vote->vote_openid = $vote_openid;
     $zhongqiu_vote->vote_score = $score;
     $zhongqiu_vote->save(false);
     //写入到投票表中;
     $zhongqiu_score = \app\models\MZhongqiuScore::findOne(['author_openid' => $author_openid]);
     //U::W("++++++++++++++++++++++++++++++++++++++++++");
     //U::W($zhongqiu_score);
     if (empty($zhongqiu_score)) {
         $zhongqiu_score = new \app\models\MZhongqiuScore();
     }
     $zhongqiu_score->author_openid = $author_openid;
     $zhongqiu_score->score = $zhongqiu_score->score + $score;
     $zhongqiu_score->status = 0;
     //$zhongqiu_score->create_time = $qa->create_time;
     $zhongqiu_score->save(false);
     return \yii\helpers\Json::encode(['code' => 0]);
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MZhongqiuScore::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['score_id' => $this->score_id, 'score' => $this->score, 'create_time' => $this->create_time, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'author_openid', $this->author_openid]);
     return $dataProvider;
 }
Exemplo n.º 3
0
 public function actionZhongqiuVote()
 {
     /*
           $this->layout = false;
             $id = $_GET["id"];
     //$gh_id = U::getSessionParam('gh_id');
             $gh_id = 'gh_03a74ac96138';
             $openid = U::getSessionParam('openid');
             $wx_user = \app\models\MUser::findOne([
                 'gh_id' => $gh_id,
                 'openid' => $openid,
             ]);
             if (empty($wx_user) || $wx_user->subscribe === 0) {
                 return $this->render('need_subscribe');
             }
     $qingshi_author = \app\models\MQingshiAuthor::findOne([
                 'id' => $id,
             ]);
     return $this->render('qingshi-vote', [
                 'observer' => $wx_user,
                 'qingshi_author' => $qingshi_author,
             ]);
     */
     $this->layout = false;
     //$gh_id = U::getSessionParam('gh_id');
     $gh_id = 'gh_03a74ac96138';
     $openid = U::getSessionParam('openid');
     $wx_user = \app\models\MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
     if (empty($wx_user) || $wx_user->subscribe === 0) {
         return $this->render('need_subscribe');
     }
     if (empty($wx_user->openidBindMobiles)) {
         $url = \yii\helpers\Url::to();
         \Yii::$app->getSession()->set('RETURN_URL', $url);
         return $this->redirect(['wap/addbindmobile', 'gh_id' => $gh_id, 'openid' => $openid]);
     }
     if (isset($_GET["id"])) {
         $id = $_GET["id"];
         $zhongqiu_score = \app\models\MZhongqiuScore::findOne(['author_openid' => $id]);
     } else {
         $zhongqiu_score = \app\models\MZhongqiuScore::findOne(['author_openid' => $openid]);
     }
     if (empty($zhongqiu_score)) {
         $zhongqiu_score = new \app\models\MZhongqiuScore();
         $zhongqiu_score->author_openid = $openid;
         $zhongqiu_score->score = 0;
         $zhongqiu_score->save(false);
     }
     return $this->render('zhongqiu-vote', ['observer' => $wx_user, 'zhongqiu_score' => $zhongqiu_score]);
 }
Exemplo n.º 4
0
    }
    ?>

                <div class="media-body">
                    <?php 
    echo emoji_unified_to_html(emoji_softbank_to_unified($vote->user->nickname));
    ?>
                    <p><?php 
    echo $vote->create_time;
    ?>
</p>
                </div>

                <span class="badge badge-primary" style="font-size: 12pt">
                   <?php 
    $zhongqiu_score = \app\models\MZhongqiuScore::findOne(['author_openid' => $vote->author_openid]);
    echo $zhongqiu_score->score;
    ?>
                </span>

              </li>
            <?php 
}
?>
            </ul>
    
            <span style="color:red">有999个沃币方可获得兑奖资格哟~</span>

            <br>
            <p align="center">
            <a class="btn btn-block" href="#tppm" style="width: 300px" >返回</a>
Exemplo n.º 5
0
 /**
  * Finds the MZhongqiuScore model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return MZhongqiuScore the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MZhongqiuScore::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }