예제 #1
0
 public static function eventReply($key)
 {
     $db = Vera_Database::getInstance();
     $result = $db->select('wechat_Click', '*', array('event_key' => $key));
     if (!$result) {
         return false;
     }
     return $result[0];
 }
예제 #2
0
 private static function getActs()
 {
     $db = Vera_Database::getInstance();
     $start = date("Y-m-d H:i:s", time() + 86400);
     //一天内
     $end = date("Y-m-d H:i:s", time() - 3600);
     //过期一小时内
     $condition = "startTime <= '{$start}'  and '{$end}' <= endTime and isPassed = 1";
     return $db->select('rollcall_Board', 'md5', $condition);
 }
예제 #3
0
 protected static function getUserInfo()
 {
     if (empty(self::$resource)) {
         throw new Exception("Resource can not be empty", 1);
     }
     if (!($db = Vera_Database::getInstance())) {
         throw new Exception("Cannot get instance of database", 1);
     }
     $result = $db->select('vera_User', '*', array('wechat_id' => self::$resource['openid']));
     if (!$result) {
         self::$userInfo = -1;
         return NULL;
     }
     self::$userInfo = $result[0];
     return $result[0];
 }
예제 #4
0
 protected function getYibanInfo()
 {
     if (empty(self::$resource)) {
         return false;
     }
     if (!($db = Vera_Database::getInstance())) {
         return false;
     }
     $num = $this->getStuNum();
     $result = $db->select('vera_Yiban', '*', array('xmu_num' => $num, 'fromApp' => 'mall'));
     if (!$result) {
         self::$yibanInfo = -1;
         return false;
     }
     self::$yibanInfo = $result[0];
     return $result[0];
 }
예제 #5
0
 /**
  * 取未来一段时间的任务,未推送且已审核通过
  * @param  integer $seconds 未来一段时间(秒)
  * @return  array            任务数组
  */
 public function getNowTasks($seconds = 600)
 {
     $db = Vera_Database::getInstance();
     $next = date("Y-m-d H:i:s", time() + $seconds);
     $cond = "pushTime <= '{$next}' and state = 0 and review = 1";
     //取出未来一段时间以内没有推送过的任务
     $result = $db->select('wechat_PushTask', '*', $cond);
     if (!$result) {
         return false;
     }
     return $result;
 }
예제 #6
0
 /**
  * @param string $yb_uid 易班id
  * @param int $teacher_id 老师id
  * @return int 影响行数
  * @author nili <*****@*****.**>
  */
 public static function vote($teacher_id, $yb_uid)
 {
     $db = Vera_Database::getInstance();
     $db->insert('wap_TeacherLog', array('yb_uid' => $yb_uid, 'teacher_id' => $teacher_id, 'time' => date('Y-m-d H:i:s')));
     $where = array('id' => $teacher_id);
     $set = 'vote=vote + 1';
     $db->update('wap_Teacher', $set, $where);
 }
예제 #7
0
 /**
  * 插入一条抽奖日志
  * @param string $yiban_uid 易班id
  * @param string $xmu_num 学号
  * @param string $award 获得网薪值
  * @return  int 影响行数
  * @author nili 
  */
 public static function insertLog($yiban_uid, $xmu_num, $award)
 {
     $db = Vera_Database::getInstance();
     return $db->insert('wechat_TmpLuck', array('xmu_num' => $xmu_num, 'yiban_uid' => $yiban_uid, 'award' => $award, 'time' => date("Y-m-d H:i:s")));
 }
예제 #8
0
 /**
  * 根据学号获取密码
  * @param string  $xmu_num 学号
  * @return string 密码
  * @author nili
  */
 public static function getPwdByXmuNum($xmu_num)
 {
     $db = Vera_Database::getInstance();
     $res = $db->select('vera_User', 'xmu_password', array('xmu_num' => $xmu_num));
     return $res[0]['xmu_password'];
 }