Esempio n. 1
0
 public function actionCodes($id)
 {
     $this->layout = '//layouts/memberList';
     $type = Yii::app()->request->getParam('type', Globals::CODE_TYPE_LEGAL);
     $codeTable = 'scratch_awards';
     $whereSql = 'scratchId=' . $id . ' and type=' . $type;
     $count = Yii::app()->db->createCommand('SELECT COUNT(*) FROM ' . $codeTable . ' where ' . $whereSql)->queryScalar();
     $sql = 'SELECT * FROM ' . $codeTable . ' where ' . $whereSql;
     $dataProvider = new CSqlDataProvider($sql, array('totalItemCount' => $count, 'sort' => array('attributes' => array('name')), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('code', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'scratchId' => $id, 'type' => $type));
 }
Esempio n. 2
0
 public function actionGiftCodes($id)
 {
     $this->layout = '/layouts/memberList';
     $codeTable = sprintf(GiftModel::CREATE_CODE_TABLE_NAME, $this->wechatInfo->id);
     $whereSql = 'giftId=' . $id;
     //DELET
     $count = Yii::app()->db->createCommand('SELECT COUNT(*) FROM ' . $codeTable . ' where ' . $whereSql)->queryScalar();
     $sql = 'SELECT * FROM ' . $codeTable . ' where ' . $whereSql;
     $dataProvider = new CSqlDataProvider($sql, array('totalItemCount' => $count, 'sort' => array('attributes' => array('name')), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('giftCode', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'giftId' => $id));
 }