| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace backend\controllers;
- use common\services\xhInviteService;
- use common\components\util;
- use Yii;
- use yii\web\Controller;
- use yii\helpers\Json;
- use common\components\qrCodeUtil;
- use common\components\page;
- use common\models\xhInvite;
- class InviteController extends BackendController
- {
- /**
- * 二维码列表
- */
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $query = xhInvite::find();
- $query->where(['merchantId' =>$this->merchantId]);
- $countQuery = clone $query;
- $count = $countQuery->count();
- $page = isset($get['page']) ? $get['page'] : 1;
- $pageSize = 20;
- $offset = ($page - 1) * $pageSize;
- $models = $query->offset($offset)->orderBy('id desc')->limit($pageSize)->asArray()->all();
- $page = new page($count,$page,$pageSize);
- $paging = $page->fpage();
- $now = time();
- return $this->render('list', ['models' => $models,'paging' => $paging]);
- }
- /**
- * 生成二维码
- */
- public function actionGenerate()
- {
- if(empty($this->merchant['agentLevel'])){
- util::failInfo('您还不是代理商');
- }
- $return = xhInviteService::generate($this->merchantId);
- util::encode($return);
- }
- }
|