当前位置: 首页>>代码示例>>PHP>>正文


PHP core\Model类代码示例

本文整理汇总了PHP中core\Model的典型用法代码示例。如果您正苦于以下问题:PHP Model类的具体用法?PHP Model怎么用?PHP Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check

 /**
  * 检查签到任务
  *
  * @param array $task
  * @param int $uid
  *
  * @return mixed
  */
 public function check($task, $uid)
 {
     $this->task = $task;
     $this->uid = $uid;
     /**
      * 签到任务是否以前签过到了
      */
     $model = new Model();
     $check_sign = $model->find('select * from video_user_check_sign where uid=:uid', array('uid' => $uid));
     if (!$check_sign) {
         return 'can_apply';
     }
     if ($task['relatedid']) {
         $isDo = $model->find('select * from video_task_user where relatedid=? and uid=?', array($task['relatedid'], $user['uid']));
         // 当没有申请或者没有完成父任务时
         if (!$isDo || $isDo['status'] != 1) {
             return 'can_apply';
         }
     }
     /**
      * 计算差值
      */
     $s = date('Ymd', time()) - date('Ymd', strtotime($check_sign['last_time']));
     if ($s == 0) {
         return 'all';
     }
     if ($s >= 1) {
         return 'can_apply';
     }
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:38,代码来源:CheckSign.php

示例2: checkTask

 /**
  * 检测用户任务对应的状态的问题
  * @param $task  array 某条任务
  * @param $uid  int 某个用户
  *
  * @return mixed
  * <p>
  *  返回 FALSE 则表示任务失败
  *  返回 TRUE 则表示任务用户可以做
  *  返回 array进度的数组 则根据情况更新
  * </p>
  */
 public function checkTask($task, $uid)
 {
     $this->task = $task;
     $this->user = $uid;
     /**
      * 当为period 为 0 一次性的任务的时候 判断是否已经完成
      * 后面各种任务脚本中就不用再判断此任务了
      */
     if ($task['period'] == 0) {
         $model = new Model();
         $taskUser = $model->find('select * from video_task_user where vtask_id=' . $task['vtask_id'] . ' and uid=' . $uid);
         // 当task_user 的status 为 1的时候就表示完成且领奖了
         if ($taskUser && $taskUser['status'] == 1) {
             return 'all';
         }
     }
     /**
      * 进行检查和更新各个任务的状态 调用各任务脚本
      */
     $script = $task['script_name'];
     $className = 'App\\Service\\Task\\TaskScript\\' . ucfirst($this->script[$script]);
     // 暂时做了doctrine($this->em)的手动注入 未走service
     $class = new $className();
     return $class->check($task, $uid);
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:37,代码来源:CheckUserTask.php

示例3: present

 /**
  * 提升用户的等级 到 多少级
  *
  * @param $gift int 提升等级
  * @param $uid int 用户uid
  */
 public function present($gift, $uid)
 {
     $model = new Model();
     $this->setRedis();
     $userinfo = $this->_redisInstance->hGetAll('huser_info:' . $uid);
     // 判断是否要提升到的等级是否小于本身用户的等级了,如果小于就不提升了
     if ($userinfo['lv_rich'] >= $gift) {
         return true;
     } else {
         $lv_rich = $gift;
         // 根据等级计算 对应的值
         $lvs = $this->getLvRich();
         $rich = $lvs[$lv_rich]['level_value'];
     }
     $data = array('lv_rich' => $lv_rich, 'rich' => $rich);
     $result = $model->flush('video_user', $data, array('uid' => $uid));
     // 更新用户的等级的redis
     if ($result !== false) {
         $this->_redisInstance->hset('huser_info:' . $uid, 'lv_rich', $lv_rich);
         $this->_redisInstance->hset('huser_info:' . $uid, 'rich', $rich);
         // 记录日志
         $exp_log = array('uid' => $uid, 'exp' => $rich - $userinfo['rich'], 'type' => 1, 'status' => 2, 'roled' => $userinfo['roled'], 'admin_id' => 10000, 'init_time' => date('Y-m-d H:i:s'), 'dml_time' => date('Y-m-d H:i:s'), 'dml_flag' => 1, 'curr_exp' => $userinfo['rich']);
         $model->add('video_user_mexp', $exp_log);
         return true;
     }
     return false;
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:33,代码来源:Top.php

示例4: present

 /**
  * 添加用户的礼物到背包中
  *
  * @param $gifts
  * @param $uid
  */
 public function present($gifts, $uid)
 {
     // 暂时性的屏蔽掉
     return true;
     $model = new Model();
     $gift = $gifts[0];
     $data = array('uid' => $uid, 'icon_id' => $gift['id'], 'type' => 1, 'init_time' => date('Y-m-d H:i:s'), 'dml_flag' => 1);
     $model->add('video_user_icon', $data);
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:15,代码来源:Medals.php

示例5: getLvRich

 /**
  * 获取等级对应的经验的值
  *
  * @return array
  */
 protected function getLvRich()
 {
     $model = new Model();
     $lvs = $model->findAll('select * from video_level_rich');
     $data = array();
     foreach ($lvs as $lv) {
         $data[$lv['level_id']] = $lv;
     }
     return $data;
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:15,代码来源:GiftBase.php

示例6: present

 /**
  * 送钻石
  *
  * @param $gift
  * @param $uid
  * @return mixed
  */
 public function present($gift, $uid)
 {
     $model = new Model();
     $this->setRedis();
     $userinfo = $this->_redisInstance->hGetAll('huser_info:' . $uid);
     $points = $userinfo['points'] + $gift;
     $result = $model->flush('video_user', array('points' => $points), array('uid' => $uid));
     if ($result !== false) {
         $this->_redisInstance->hset('huser_info:' . $uid, 'points', $points);
         return true;
     }
     return false;
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:20,代码来源:Points.php

示例7: present

 /**
  * 添加用户
  *
  * @param $gifts
  * @param $uid
  */
 public function present($gifts, $uid)
 {
     $model = new Model();
     $gift = $gifts[0];
     $data = array('icon_id' => $gift['id']);
     $result = $model->flush('video_user', $data, array('uid' => $uid));
     if ($result !== false) {
         $this->setRedis();
         $this->_redisInstance->hset('huser_info:' . $uid, 'icon_id', $gift['id']);
         return true;
     }
     return false;
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:19,代码来源:Icon.php

示例8: check

 /**
  * 检查首次预约的任务
  *
  * @param $task
  * @param $uid
  *
  * @return mixed
  */
 public function check($task, $uid)
 {
     $this->task = $task;
     $this->uid = $uid;
     $model = new Model();
     $userTask = $model->find('select * from video_task_user where vtask_id=' . $task['vtask_id'] . ' and uid=' . $uid);
     $user = $model->find('select * from video_user where uid=' . $uid);
     if ($task['pre_vtask_id']) {
         $isDo = $model->find('select * from video_task_user where vtask_id=? and uid=?', array($task['pre_vtask_id'], $user['uid']));
         // 当没有申请或者没有完成父任务时
         if (!$isDo || $isDo['status'] != 1) {
             return 'can_apply';
         }
     }
     /**
      * 如果没有接任务的话,就判断是否可以自动申请任务
      */
     if (!$userTask) {
         /**
          * 只要用户满足做这个任务的条件就要插入一条数据 等待预约的验证
          */
         $c = serialize(array('csc' => 0, 'update_time' => time()));
         $data = array('uid' => $uid, 'vtask_id' => $task['vtask_id'], 'status' => 0, 'csc' => $c, 'apply_date' => time(), 'init_time' => date('Y-m-d H:i:s'), 'dml_time' => date('Y-m-d H:i:s'), 'dml_flag' => 1);
         $model->add('video_task_user', $data);
         // 增加一个申请人数
         $this->updateTaskApplicants($task);
         return 'doing';
     }
     $ut = $userTask;
     $csc = unserialize($ut['csc']);
     if ($ut['status'] == 1) {
         return 'all';
     }
     if ($ut['status'] == -1) {
         return 'failed';
     }
     if ($ut['status'] == 0 && $csc['csc'] == 100) {
         return 'success';
     }
     /**
      * 当没有完成的时候要检查进度
      */
     if ($ut['status'] == 0 && $csc['csc'] != 100) {
         /**
          * 检查是否完成了预约,是就更新状态
          * 要求在申请任务之后 预约的才算
          */
         $invite = $model->find('select * from video_room_duration where invitetime>? and reuid=?', array($ut['apply_date'], $uid));
         if ($invite) {
             $data = array();
             $csc['csc'] = 100;
             $csc['update_time'] = time();
             $data['csc'] = serialize($csc);
             $model->flush('video_task_user', $data, array('auto_id' => $ut['auto_id']));
             return 'success';
         }
         return 'doing';
     }
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:67,代码来源:Invite.php

示例9: present

 /**
  * 添加用户的礼物到背包中
  *
  * @param $gifts
  * @param $uid
  */
 public function present($gifts, $uid)
 {
     $model = new Model();
     $flag = false;
     foreach ($gifts as $gift) {
         $has_gif = $model->find('select * from video_pack where uid=? and gid=?', array($uid, $gift['id']));
         if ($has_gif) {
             if (!empty($gift['exp'])) {
                 $expires = $has_gif['expires'] + $gift['exp'] * 24 * 3600;
                 $model->flush('video_pack', array('expires' => $expires), array('uid' => $uid, 'gid' => $gift['id']));
             }
             $flag = true;
         } else {
             $exp = time() + $gift['exp'] * 24 * 3600;
             $result = $model->add('video_pack', array('uid' => $uid, 'gid' => $gift['id'], 'num' => $gift['num'], 'expires' => $exp));
             if ($result !== false) {
                 $flag = true;
             } else {
                 $flag = false;
             }
         }
     }
     return $flag;
 }
开发者ID:TeamOfMalaysia,项目名称:H,代码行数:30,代码来源:Goods.php

示例10: __construct

 public function __construct($OSE = array(), $FROM = self::FROM_BDD)
 {
     parent::__construct();
     $this->teatre = array("te_id" => 0, "te_nom" => "", "te_nomVisible" => "", "te_configuracio" => 0);
     switch ($FROM) {
         case self::FROM_BDD:
             foreach ($this->teatre as $K => $V) {
                 $this->teatre[$K] = $OSE[$K];
                 if ($K == 'te_configuracio') {
                     $this->teatre['te_configuracio'] = json_decode($OSE['te_configuracio'], true);
                 }
             }
             break;
         case self::FROM_JSON:
             $S = $OSE['teatre'];
             foreach ($this->teatre as $K => $V) {
                 if (!isset($S[$K])) {
                     throw new MyException("Falta entrar el camp, {$K}");
                 } else {
                     $this->teatre[$K] = $S[$K];
                     //if($K == 'te_configuracio') $this->teatre['te_configuracio'] = json_encode($S[$K]);
                 }
             }
             break;
         case self::FROM_EMPTY:
             $this->teatre['te_id'] = 0;
             break;
     }
 }
开发者ID:nagiro,项目名称:Entrades,代码行数:29,代码来源:TeatreTableObject.php

示例11: __construct

 public function __construct($OT = array(), $FROM = self::FROM_BDD)
 {
     parent::__construct();
     $this->espectacle['e_id'] = 0;
     $this->espectacle['e_Titol'] = '';
     $this->espectacle['e_SrcMin'] = '';
     $this->espectacle['e_Resum'] = '';
     $this->espectacle['e_Tipus'] = '';
     $this->espectacle['e_Html'] = '';
     $this->espectacle['e_Imatge'] = '';
     $this->espectacle['e_OrganitzadorCif'] = '';
     $this->espectacle['e_OrganitzadorNom'] = '';
     $this->espectacle['e_Correcte'] = 0;
     $this->espectacle['e_Companyia'] = "";
     switch ($FROM) {
         case self::FROM_BDD:
             foreach ($this->espectacle as $K => $V) {
                 $this->espectacle[$K] = $OT[$K];
             }
             break;
         case self::FROM_JSON:
             foreach ($this->espectacle as $K => $V) {
                 $this->espectacle[$K] = $OT['espectacle'][$K];
             }
             break;
         case self::FROM_EMPTY:
             $this->espectacle['e_id'] = 0;
             break;
     }
 }
开发者ID:nagiro,项目名称:Entrades,代码行数:30,代码来源:EspectacleTableObject.php

示例12: __construct

 public function __construct($OT = NULL, $FROM = self::FROM_EMPTY)
 {
     parent::__construct();
     $this->localitat['l_zona'] = 0;
     $this->localitat['l_fila'] = 0;
     $this->localitat['l_seient'] = 0;
     $this->localitat['l_idSessio'] = 0;
     $this->localitat['l_estat'] = '';
     $this->localitat['l_pagament'] = '';
     $this->localitat['l_data'] = '';
     $this->localitat['l_idComanda'] = 0;
     $this->localitat['l_idPreu'] = '';
     $this->localitat['l_codi'] = '';
     $this->localitat['l_horaArribada'] = NULL;
     $this->extres['isNew'] = false;
     switch ($FROM) {
         case self::FROM_BDD:
             foreach ($this->localitat as $K => $V) {
                 $this->localitat[$K] = $OT[$K];
             }
             $this->localitat['l_idPreu'] = json_decode($this->localitat['l_idPreu'], true);
             $this->localitat['nom_seient'] = $this->localitat['l_zona'] . '-' . $this->localitat['l_fila'] . '-' . $this->localitat['l_seient'];
             $this->localitat['nom_estat'] = $this->estats[$this->localitat['l_estat']];
             break;
         case self::FROM_JSON:
             foreach ($this->localitat as $K => $V) {
                 $this->localitat[$K] = $OT['localitat'][$K];
             }
             break;
         case self::FROM_EMPTY:
             break;
     }
 }
开发者ID:nagiro,项目名称:Entrades,代码行数:33,代码来源:LocalitatTableObject.php

示例13:

 /**
  * Call the parent construct
  */
 function __construct()
 {
     parent::__construct();
     $this->moviesql = 'SELECT * FROM ' . PREFIX . 'movie';
     $this->yearsql = 'SELECT ' . PREFIX . 'movie.title,
                    ' . PREFIX . 'movie.description,
                    ' . PREFIX . 'movie.seoname
                    FROM  ' . PREFIX . 'movie_year
                    INNER JOIN  ' . PREFIX . 'movie
                    ON  ' . PREFIX . 'movie.id =  ' . PREFIX . 'movie_year.movie_id
                    INNER JOIN ' . PREFIX . 'yr
                    ON ' . PREFIX . 'yr.id = ' . PREFIX . 'movie_year.year_id
                    WHERE  ' . PREFIX . 'yr.yr=:yr';
     $this->actorsql = 'SELECT ' . PREFIX . 'movie.title,
                                       ' . PREFIX . 'movie.description,
                                       ' . PREFIX . 'movie.seoname
                                 FROM  ' . PREFIX . 'movie_actor
                                 INNER JOIN  ' . PREFIX . 'movie
                                 ON  ' . PREFIX . 'movie.id =  ' . PREFIX . 'movie_actor.movie_id
                                 INNER JOIN ' . PREFIX . 'actor
                                 ON ' . PREFIX . 'actor.id = ' . PREFIX . 'movie_actor.actor_id
                                 WHERE  ' . PREFIX . 'actor.actorseo=:actor';
     $this->genresql = 'SELECT ' . PREFIX . 'movie.title,
                                       ' . PREFIX . 'movie.description,
                                       ' . PREFIX . 'movie.seoname
                                 FROM  ' . PREFIX . 'movie_genre
                                 INNER JOIN  ' . PREFIX . 'movie
                                 ON  ' . PREFIX . 'movie.id =  ' . PREFIX . 'movie_genre.movie_id
                                 INNER JOIN ' . PREFIX . 'genre
                                 ON ' . PREFIX . 'genre.id = ' . PREFIX . 'movie_genre.genre_id
                                 WHERE  ' . PREFIX . 'genre.seogenre=:genre';
     $this->countrysql = 'SELECT ' . PREFIX . 'movie.title,
                                       ' . PREFIX . 'movie.description,
                                       ' . PREFIX . 'movie.seoname
                                 FROM  ' . PREFIX . 'movie_origin
                                 INNER JOIN  ' . PREFIX . 'movie
                                 ON  ' . PREFIX . 'movie.id =  ' . PREFIX . 'movie_origin.movie_id
                                 INNER JOIN ' . PREFIX . 'origin
                                 ON ' . PREFIX . 'origin.id = ' . PREFIX . 'movie_origin.origin_id
                                 WHERE  ' . PREFIX . 'origin.countryseo=:country';
     $this->languagesql = 'SELECT ' . PREFIX . 'movie.title,
                                       ' . PREFIX . 'movie.description,
                                       ' . PREFIX . 'movie.seoname
                                 FROM  ' . PREFIX . 'movie_languages
                                 INNER JOIN  ' . PREFIX . 'movie
                                 ON  ' . PREFIX . 'movie.id =  ' . PREFIX . 'movie_languages.movie_id
                                 INNER JOIN ' . PREFIX . 'language
                                 ON ' . PREFIX . 'language.id = ' . PREFIX . 'movie_languages.language_id
                                 WHERE  ' . PREFIX . 'language.languageseo=:language';
     $this->ratingsql = 'SELECT ' . PREFIX . 'movie.title,
                                       ' . PREFIX . 'movie.description,
                                       ' . PREFIX . 'movie.seoname
                                 FROM  ' . PREFIX . 'movie_rating
                                 INNER JOIN  ' . PREFIX . 'movie
                                 ON  ' . PREFIX . 'movie.id =  ' . PREFIX . 'movie_rating.movie_id
                                 INNER JOIN ' . PREFIX . 'rating
                                 ON ' . PREFIX . 'rating.id = ' . PREFIX . 'movie_rating.rating_id
                                 WHERE  ' . PREFIX . 'rating.seorating=:rating';
 }
开发者ID:BryanYeh,项目名称:Movies,代码行数:62,代码来源:Movies.php

示例14: __construct

 public function __construct($OSE = array(), $FROM = self::FROM_BDD)
 {
     parent::__construct();
     $this->sessio = array("s_id" => 0, "s_idEspectacle" => 0, "s_idTeatre" => 0, "s_Preus" => array(), "s_SeientsLliures" => 0, "s_Localitats" => 0, "s_DataHora" => 0, "s_Correcte" => 0, "s_VisibleWeb" => 0, "s_PermetCompraOnline" => 1, "s_NomesCompraAmics" => 0, "s_DataHoraCompra" => 0);
     $this->espectacle = new EspectacleTableObject(null, EspectacleTableObject::FROM_EMPTY);
     switch ($FROM) {
         case self::FROM_BDD:
             foreach ($this->sessio as $K => $V) {
                 $this->sessio[$K] = $OSE[$K];
             }
             if (isset($OSE['e_Titol'])) {
                 $this->espectacle = new EspectacleTableObject($OSE, EspectacleTableObject::FROM_BDD);
             }
             $this->generaExtres();
             break;
         case self::FROM_JSON:
             $S = $OSE['sessio'];
             foreach ($this->sessio as $K => $V) {
                 if (!isset($S[$K])) {
                     throw new MyException("Falta entrar el camp, {$K}");
                 } else {
                     $this->sessio[$K] = $S[$K];
                 }
             }
             $this->sessio['s_Preus'] = json_encode($this->sessio['s_Preus']);
             $this->generaExtres();
             break;
         case self::FROM_FORM:
             $S = $OSE['sessio'];
             foreach ($this->sessio as $K => $V) {
                 if (!isset($S[$K])) {
                     throw new MyException("Falta entrar el camp, {$K}");
                 } else {
                     $this->sessio[$K] = $S[$K];
                 }
             }
             if (!isset($OSE['sessio']['tmp_Hora']) || !isset($OSE['sessio']['tmp_Dia'])) {
                 throw new MyException("Has d'entrar algun dia i hora per la sessió.");
             } else {
                 //Guardo el dia i hora de la sessió
                 $this->sessio['tmp_Hora'] = $OSE['sessio']['tmp_Hora'];
                 $this->sessio['tmp_Dia'] = $OSE['sessio']['tmp_Dia'];
                 $this->sessio['s_Preus'] = json_encode($this->sessio['s_Preus']);
             }
             if (!isset($OSE['sessio']['tmp_HoraCompra']) || empty($OSE['sessio']['tmp_HoraCompra']) || !isset($OSE['sessio']['tmp_DiaCompra']) || empty($OSE['sessio']['tmp_DiaCompra'])) {
                 throw new MyException("Has d'entrar algun dia i hora per començar a vendre entrades.");
             } else {
                 //Guardo el dia i hora de la sessió
                 $this->sessio['tmp_HoraCompra'] = $OSE['sessio']['tmp_HoraCompra'];
                 $this->sessio['tmp_DiaCompra'] = $OSE['sessio']['tmp_DiaCompra'];
             }
             $this->generaExtres(self::FROM_FORM);
             break;
         case self::FROM_EMPTY:
             $this->sessio['s_id'] = 0;
             $this->sessio['s_Preus'] = array();
             break;
     }
 }
开发者ID:nagiro,项目名称:Entrades,代码行数:59,代码来源:SessioTableObject.php

示例15: mkdir

 function __construct()
 {
     parent::__construct();
     $this->pathcache = ROOT . DS . "cache" . DS . "iso3166";
     if (!file_exists($this->pathcache)) {
         mkdir($this->pathcache);
     }
 }
开发者ID:CamTosh,项目名称:Mediastorrent,代码行数:8,代码来源:Iso31.php


注:本文中的core\Model类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。