コード例 #1
0
ファイル: AdminUserLoginDao.php プロジェクト: lampguru/dake
 /**
  * 获取错误登录记录数
  * @param string $ip
  * @param int    $time
  */
 public function getCount($ip, $time)
 {
     $dtime = InitPHP::getTime() - $time;
     $where = $this->dao->db->build_where(array('ip' => $ip));
     $sql = sprintf("SELECT COUNT(id) as count FROM %s %s AND update_time > %s", $this->table_name, $where, $this->dao->db->build_escape($dtime));
     $result = $this->dao->db->get_one_sql($sql);
     return $result['count'];
 }
コード例 #2
0
ファイル: SingleService.php プロジェクト: lampguru/dake
 /**
  * 添加单页
  * 参数结构:
  * array(
  * 'type' => 单页类型
  * 'name' => 单页名词
  * 'descrip' => 单页详细内容
  * )
  * 
  * @param array $data        	
  */
 public function add($data)
 {
     if (!is_array($data)) {
         return $this->service->return_msg(false, '参数不正确!');
     }
     $data = $this->_cookData($data);
     $data['create_time'] = InitPHP::getTime();
     $result = $this->_getDao()->add($data);
     if (!$result) {
         return $this->service->return_msg(false, '创建失败!');
     }
     return $this->service->return_msg(true, '创建成功!', $result);
 }
コード例 #3
0
ファイル: dbhandler.init.php プロジェクト: superbogy/initphp
 /**
  * 按月分表-分库方法
  * 1. 当数据表数据量过大的时候,可以根据按月分表的方法来进行分表
  * 2. 按月分库会根据当前的时间来决定是几月份的数据
  * 3. 按月分库$defaultId,可以自定义填入月份,例如:get_mon_table('test', 2),则返回 test_02
  * Dao中使用方法:$this->Dao->Db->month_identify($tbl, $defaultId = '')
  * @param string $tbl
  * @param string $defaultId
  */
 public function month_identify($tbl, $defaultId = '')
 {
     if (empty($defaultId)) {
         $mon = sprintf('%02d', date('m', InitPHP::getTime()));
         return $tbl . '_' . $mon;
     } else {
         return $tbl . '_' . sprintf('%02d', $defaultId);
     }
 }
コード例 #4
0
ファイル: AdminLogService.php プロジェクト: lampguru/dake
 /**
  * 新增日志
  * 参数结构
  * array(
  * 'username' => 用户名称
  * 'ip'=> 来源IP地址
  * 'controller' => c
  * 'action' => a
  * 'msg' => msg信息
  * 'data' => 参数
  * )
  * @param array $data
  */
 public function addLog($data)
 {
     $data = $this->_cookLogData($data);
     $data['update_time'] = InitPHP::getTime();
     return $this->_getAdminLogDao()->add($data);
 }
コード例 #5
0
ファイル: AdminUserService.php プロジェクト: lampguru/dake
 /**
  * 后台登录错误信息记录
  * @param string $ip
  * @param string $username
  */
 public function addLoginError($ip, $username)
 {
     return $this->_getAdminUserLoginDao()->add(array('ip' => $ip, 'update_time' => InitPHP::getTime(), 'data' => $username));
 }