コード例 #1
0
ファイル: MUserAccountSearch.php プロジェクト: noikiy/wowewe
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MUserAccount::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'create_time' => $this->create_time, 'amount' => $this->amount, 'status' => $this->status, 'cat' => $this->cat, 'scene_id' => $this->scene_id]);
     $query->andFilterWhere(['like', 'gh_id', $this->gh_id])->andFilterWhere(['like', 'openid', $this->openid])->andFilterWhere(['like', 'memo', $this->memo])->andFilterWhere(['like', 'oid', $this->oid])->andFilterWhere(['like', 'charge_mobile', $this->charge_mobile]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: ExportController.php プロジェクト: noikiy/wowewe
 /**
  * This command export user account data.
  * @param string $filename the file to be exported to.
  */
 public function actionUserAccount($filename = 'user-account.csv')
 {
     $file = Yii::$app->getRuntimePath() . DIRECTORY_SEPARATOR . 'exported_data' . DIRECTORY_SEPARATOR . $filename;
     $useraccount_records = \app\models\MUserAccount::find()->where(['cat' => \app\models\MUserAccount::CAT_CREDIT_CHARGE_MOBILE])->andWhere(['status' => \app\models\MUserAccount::STATUS_CHARGE_REQUEST])->all();
     $fh = fopen($file, "w");
     fprintf($fh, "充值手机号码,充值金额,申请时间\n");
     foreach ($useraccount_records as $useraccount_record) {
         fprintf($fh, "%s,%s,%s\n", $useraccount_record->charge_mobile, intval($useraccount_record->amount / 100), $useraccount_record->create_time);
         $useraccount_record->updateAttributes(['status' => \app\models\MUserAccount::STATUS_CHARGE_PROCESSING]);
     }
     fclose($fh);
     echo "总共" . count($useraccount_records) . "条充值申请!" . PHP_EOL;
 }
コード例 #3
0
ファイル: _form.php プロジェクト: noikiy/wowewe
<div class="muser-account-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'amount')->textInput();
?>

    <?php 
echo $form->field($model, 'memo')->textInput(['maxlength' => 512]);
?>

    <?php 
echo $form->field($model, 'cat')->dropDownList(MUserAccount::getCatOptionName());
?>

    <?php 
echo $form->field($model, 'charge_mobile')->textInput(['maxlength' => 32]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', '新建') : Yii::t('app', '修改'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
コード例 #4
0
ファイル: CheckController.php プロジェクト: noikiy/wowewe
 public function actionUserAccountBalance()
 {
     \Yii::$app->db->createCommand("update wx_user set user_account_balance = 0")->execute();
     $user_accounts = \app\models\MUserAccount::find()->all();
     foreach ($user_accounts as $user_account) {
         //            if ($user_account->cat == \app\models\MUserAccount::CAT_DEBIT_FAN)
         $user_account->user->updateCounters(['user_account_balance' => $user_account->amount]);
     }
 }
コード例 #5
0
ファイル: NightController.php プロジェクト: noikiy/wowewe
 public static function addRecommendFanAmount($date_start, $date_end)
 {
     U::W(__METHOD__ . " BEGIN from {$date_start}, {$date_end}");
     //        $tableName = MSceneDay::tableName();
     $ghs = MGh::find()->all();
     foreach ($ghs as $gh) {
         if ($gh->gh_id !== MGh::GH_XIANGYANGUNICOM) {
             continue;
         }
         foreach ($gh->staffs as $staff) {
             if ($staff->scene_id != 0 && ($staff->cat == MStaff::SCENE_CAT_OUT || $staff->cat == MStaff::SCENE_CAT_FAN) && !empty($staff->openid)) {
                 $real_score = MAccessLog::getRealScoreByRange($gh->gh_id, $staff->scene_id, $date_start, $date_end);
                 if ($real_score > 0) {
                     //$amount = intval($real_score) * 100;
                     //$amount = intval($real_score/3) * 500;
                     $amount = intval($real_score) * 500;
                     if ($amount > 0) {
                         $model = new MUserAccount();
                         $model->gh_id = $staff->gh_id;
                         $model->openid = $staff->openid;
                         $model->scene_id = $staff->scene_id;
                         $model->cat = MUserAccount::CAT_DEBIT_FAN;
                         $model->amount = $amount;
                         $model->memo = '推荐有礼';
                         $model->save(false);
                         //                            U::W("SAVE OK, scene_id={$staff->scene_id}, openid={$staff->openid}, amount={$model->amount}");
                     }
                 } else {
                     //                        U::W("scene_id={$staff->scene_id}, openid={$staff->openid}, realscore={$real_score}, ");
                 }
             } else {
                 //                    U::W("scene_id={$staff->scene_id}, openid={$staff->openid}");
             }
         }
     }
     U::W(__METHOD__ . " END");
     return;
 }
コード例 #6
0
 /**
  * Finds the MUserAccount model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return MUserAccount the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MUserAccount::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #7
0
ファイル: index.php プロジェクト: noikiy/wowewe
    </p>
    -->

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table-responsive'], 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['label' => false, 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    if (empty($model->user->headimgurl)) {
        return '';
    }
    $headimgurl = Html::img(U::getUserHeadimgurl($model->user->headimgurl, 46), ['style' => 'width:46px;']);
    return $headimgurl;
}], ['label' => '微信昵称', 'value' => function ($model, $key, $index, $column) {
    return empty($model->user->nickname) ? '' : $model->user->nickname;
}], 'create_time', ['attribute' => 'amount', 'value' => function ($model, $key, $index, $column) {
    return $model->getAmountInfo();
}], ['attribute' => 'status', 'label' => '状态', 'value' => function ($model, $key, $index, $column) {
    return MUserAccount::getStatusDesc($model->status);
}, 'filter' => MUserAccount::getStatusDesc(), 'headerOptions' => array('style' => 'width:120px;')], ['attribute' => 'cat', 'value' => function ($model, $key, $index, $column) {
    return MUserAccount::getCatOptionName($model->cat);
}, 'filter' => MUserAccount::getCatOptionName()], ['attribute' => 'memo', 'value' => function ($model, $key, $index, $column) {
    return $model->getMemoInfo();
}], 'scene_id', 'charge_mobile', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
?>

</div>

<?php 
/*
    <h2>
        账户余额: <?= $user->getUserAccountBalanceInfo(); ?>
    </h2>
*/
コード例 #8
0
ファイル: WapController.php プロジェクト: noikiy/wowewe
 public function actionQxchonghuafeiajax()
 {
     $uid = $_GET['uid'];
     $user_account = \app\models\MUserAccount::findOne(['id' => $uid]);
     if (empty($user_account)) {
         return json_encode(['code' => 0]);
     }
     if ($user_account->cat != \app\models\MUserAccount::CAT_CREDIT_CHARGE_MOBILE || $user_account->status != \app\models\MUserAccount::STATUS_CHARGE_REQUEST) {
         return json_encode(['code' => -1]);
     }
     $user_account->delete();
     return json_encode(['code' => 0]);
 }
コード例 #9
0
ファイル: MUser.php プロジェクト: noikiy/wowewe
 public function getUserAccounts()
 {
     return $this->hasMany(\app\models\MUserAccount::className(), ['gh_id' => 'gh_id', 'openid' => 'openid'])->orderBy('create_time DESC');
 }