Esempio n. 1
0
 /**
  * 获取公众号
  * 该方法会通过设定的公众wid函数来获取公众号数据
  * @return null
  * @throws NotFoundHttpException
  */
 public function getWechat()
 {
     if ($this->_wechat === null) {
         $wid = Yii::$app->request->getQueryParam(Yii::$app->getModule('wechat')->wechatUrlParam);
         if (!$wid || ($wechat = Wechat::find()->active()->one()) === null) {
             throw new NotFoundHttpException('The requested page does not exist.');
         }
         $this->setWechat($wechat);
     }
     return $this->_wechat;
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Wechat::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'type' => $this->type, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'token', $this->token])->andFilterWhere(['like', 'access_token', $this->access_token])->andFilterWhere(['like', 'account', $this->account])->andFilterWhere(['like', 'original', $this->original])->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'secret', $this->secret])->andFilterWhere(['like', 'encoding_aes_key', $this->encoding_aes_key])->andFilterWhere(['like', 'avatar', $this->avatar])->andFilterWhere(['like', 'qrcode', $this->qrcode])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password]);
     return $dataProvider;
 }
Esempio n. 3
0
<?php

use yii\helpers\Html;
use callmez\wechat\models\Wechat;
use callmez\wechat\assets\WechatAsset;
use callmez\wechat\assets\AngularAsset;
use callmez\wechat\helpers\ModuleHelper;
AngularAsset::register($this);
$wechatAsset = WechatAsset::register($this);
$this->title = '微信模拟器';
$wechats = [];
foreach (Wechat::find()->all() as $k => $wechat) {
    $wechats[$wechat->id] = ['name' => $wechat->name, 'original' => $wechat->original, 'api' => ModuleHelper::getApiUrl($wechat, ['id' => $wechat->id, 'token' => $wechat->token])];
}
?>
<div ng-app="simulatorApp">
    <div class="row" ng-controller="SimulatorController">
        <div class="col-sm-8">
            <div class="page-header"><h4><?php 
echo Html::encode($this->title);
?>
</h4></div>
            <?php 
echo Html::beginForm('', 'post', ['id' => 'wechatForm', 'class' => 'form-horizontal']);
?>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="button" class="btn btn-block btn-primary" ng-click="submitMessage()" ng-disabled="submit.disabled">{{submit.text || '发送'}}</button>
                </div>
            </div>