示例#1
0
 public function getRewardsByuId($uId)
 {
     $storeId = VendorRegister::find()->select(['vendor_unique_id'])->where(['uid' => Yii::$app->user->id]);
     $userRewards = RewardsMain::find()->where(['storeId' => $storeId, 'uId' => $uId])->one();
     return $userRewards;
 }
示例#2
0
 public static function getStoreId($uId)
 {
     $storeId = VendorRegister::find()->select('vendor_unique_id')->where(['uid' => $uId])->one();
     return $storeId['vendor_unique_id'];
 }
示例#3
0
 public function getRewardsRequestsByStoreCustomerId($customerId)
 {
     $storeId = VendorRegister::find()->select(['vendor_unique_id'])->where(['uid' => Yii::$app->user->id])->one();
     $query = new Query();
     if (isset($_GET['request'])) {
         if ($_GET['request'] == 1) {
             $query->from('rewards_details')->where(['storeId' => $storeId->vendor_unique_id, 'rewardsFlag' => 'ADD', 'uId' => $customerId]);
         }
         if ($_GET['request'] == 2) {
             $query->from('rewards_details')->where(['storeId' => $storeId->vendor_unique_id, 'rewardsFlag' => 'CONFIRMED', 'uId' => $customerId]);
         }
         if ($_GET['request'] == 3) {
             $query->from('rewards_details')->where(['storeId' => $storeId->vendor_unique_id, 'rewardsFlag' => 'REEDEEMED', 'uId' => $customerId]);
         }
         if ($_GET['request'] == 4) {
             $query->from('rewards_details')->where("(storeId = '{$storeId->vendor_unique_id}') AND ((rewardsFlag = 'ADD') OR (rewardsFlag = 'CONFIRMED')) AND uId= {$customerId}");
         }
     } else {
         $query->from('rewards_details')->where(['storeId' => $storeId->vendor_unique_id, 'rewardsFlag' => 'ADD', 'uId' => $customerId]);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 25]]);
     return $dataProvider;
 }
示例#4
0
 public function actionActivate()
 {
     $this->layout = "@app/views/layouts/vendor";
     $queryParams = Yii::$app->request->getQueryParams();
     $email = $queryParams[1]['email'];
     $auth_key = $queryParams[1]['auth_key'];
     $userData = ['email' => $email, 'auth_key' => $auth_key];
     $model = User::findByAttributesNew($userData);
     $storeId = VendorRegister::getStoreId($model->id);
     //print_r($model);exit();
     if (!empty($model)) {
         if ($model->status == 10) {
             Yii::$app->getSession()->setFlash('success', 'You are already used this Activation Link');
         } else {
             $userda = Yii::$app->db->createCommand()->update('user', ['status' => 10], ['id' => $model->id])->execute();
             Yii::$app->getSession()->setFlash('success', 'You are successfully Activated');
         }
     } else {
         Yii::$app->getSession()->setFlash('error', 'Invalid Activation Link');
     }
     return $this->render('vendorActivation', ['storeId' => $storeId]);
     //print_r($userda);exit();
     //redirect / flash / login whatever
 }