Ejemplo n.º 1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getJackpot()
 {
     return $this->hasOne(JackpotDetails::className(), ['id' => 'jackpot_id']);
 }
Ejemplo n.º 2
0
 public function getJackpotDetails()
 {
     return $this->hasMany(JackpotDetails::className(), ['continent' => 'code']);
 }
Ejemplo n.º 3
0
 /**
  * Upcoming Jackpot list Web Service
  * @return mixed
  */
 public function actionApiJackpotUpcomingList()
 {
     $this->layout = false;
     $model = new JackpotDetails();
     header('Content-type: application/json');
     $json = file_get_contents('php://input');
     //convert the string of data to an array
     $data['Jackpot'] = json_decode($json, true);
     //$data['Jackpot'] = Yii::$app->request->post();
     $limit = empty($data['Jackpot']['limit']) ? '20' : $data['Jackpot']['limit'];
     $start = empty($data['Jackpot']['offset']) ? '0' : $data['Jackpot']['offset'];
     if ($start > 0) {
         $start = $start * $limit;
     }
     $jackpotListCount = JackpotDetails::find()->where(['>', 'end_date', date("Y-m-d H:i:s")])->asArray()->all();
     $jackpotList = JackpotDetails::find()->where(['>', 'end_date', date("Y-m-d H:i:s")])->limit($limit)->offset($start)->asArray()->all();
     if (!empty($jackpotList)) {
         $index = 0;
         foreach ($jackpotList as $list) {
             $time = strtotime($list['end_date']) + 3600;
             // Add 1 hour
             $jackpotListNew[$index]['lotteryName'] = $list['name'];
             $jackpotListNew[$index]['lotteryStartDate'] = $list['start_date'];
             $jackpotListNew[$index]['drawDate'] = date("Y-m-d H:i:s", $time);
             $jackpotListNew[$index]['jackpotPrize'] = $list['jackpot_price'];
             $jackpotListNew[$index]['ticketPrize'] = $list['ticket_price'];
             $jackpotListNew[$index]['lotteryImage'] = $list['jackpot_section_image'];
             $jackpotListNew[$index]['countryIcon'] = $list['countryid'] . '.png';
             $index++;
         }
         $return['status'] = 1;
         $return['data'] = $jackpotListNew;
         $return['totalRecords'] = count($jackpotListCount);
         $return['message'] = "Data Retrieved  Successfully.";
         return json_encode($return);
     } else {
         $return['status'] = 0;
         $return['message'] = "There is no Upcoming Jackpot.";
         return json_encode($return);
     }
 }
Ejemplo n.º 4
0
 /**
  * Finds the JackpotDetails model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return JackpotDetails the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = JackpotDetails::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Ejemplo n.º 5
0
 /**
  * Lists all Past Jackpots models.
  * @return mixed
  */
 public function actionPast()
 {
     $lastMonth = time() - 3600 * 24 * 30;
     $last_month = date("Y-m-d H:i:s", $lastMonth);
     $dataProvider = new ActiveDataProvider(['query' => JackpotDetails::find()->where(['<', 'end_date', date("Y-m-d H:i:s", time() + 3600)])->andWhere(['>=', 'end_date', $last_month])]);
     return $this->render('past', ['dataProvider' => $dataProvider]);
 }
Ejemplo n.º 6
0
 public function getJackpotDetailsCode()
 {
     return $this->hasMany(JackpotDetails::className(), ['countryid' => 'code']);
 }