本文整理汇总了PHP中UserModel::errCode方法的典型用法代码示例。如果您正苦于以下问题:PHP UserModel::errCode方法的具体用法?PHP UserModel::errCode怎么用?PHP UserModel::errCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserModel
的用法示例。
在下文中一共展示了UserModel::errCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login()
{
self::initDB();
$errStr = '';
$user = isset($_REQUEST['email']) && strlen($_REQUEST['email']) > 4 ? $_REQUEST['email'] : '';
$pwd = isset($_REQUEST['pwd']) && strlen($_REQUEST['pwd']) > 4 ? md5($_REQUEST['pwd']) : '';
if (empty(trim($errStr))) {
$errStr .= '请重新输入用户名!';
}
if (empty(trim($pwd))) {
$errStr .= '请重新输入密码!';
}
if (empty(trim($errStr))) {
self::$errCode = '1301';
self::$errMsg = $errStr;
return false;
}
$sql = 'select * from ws_user where userName="' . $user . '" and password = "' . $pwd . '"';
$query = self::$dbConn->query($sql);
return self::$dbConn->fetch_array_all($query);
}
示例2: userLogin
/**
* UserModel::userLogin()
* 用户登录走开放系统
* add by 管拥军 2013-08-21
* @return bool
*/
public static function userLogin($username, $password)
{
require_once WEB_PATH . "html/api/include/opensys_functions.php";
$paramArr = array('method' => 'power.user.login.get', 'format' => 'json', 'v' => '1.0', 'username' => 'Message', 'user_name' => $username, 'pwd' => $password, 'com_id' => 1, 'sysName' => self::$sysName, 'sysToken' => self::$sysToken);
$loginInfo = callOpenSystem($paramArr);
// var_dump($loginInfo);exit;
unset($paramArr);
$loginInfo = json_decode($loginInfo);
if (isset($loginInfo->errCode)) {
echo $loginInfo->errMsg;
self::$errCode = $loginInfo->errCode;
self::$errMsg = $loginInfo->errMsg;
return false;
}
//var_dump($loginInfo);exit;
$_SESSION['userToken'] = $loginInfo->userToken;
$_SESSION['userId'] = $loginInfo->userId;
//分系统用户ID
$_SESSION['globaluserid'] = $loginInfo->globalUserId;
//统一用户系统ID
$_SESSION['sysUserId'] = $loginInfo->userId;
//分系统id
$_SESSION['userName'] = $loginInfo->userName;
$_SESSION['companyId'] = $loginInfo->company;
return "ok";
}
示例3: userLogin
/**
* UserModel::userLogin()
* 用户登录走开放系统
* add by 管拥军 2013-08-21
* @return bool
*/
public static function userLogin($username, $password, $version)
{
$paramArr = array('method' => 'power.user.login.get', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'user_name' => $username, 'pwd' => rawurlencode($password), 'version' => $version, 'sysName' => C('AUTH_SYSNAME'), 'sysToken' => C('AUTH_SYSTOKEN'));
$loginInfo = callOpenSystem($paramArr);
unset($paramArr);
//如果开放系统登录超时,走本地登录
if (empty($loginInfo)) {
self::initDB();
$pwd = md5(md5(rawurldecode(rawurlencode($password))));
$sql = "SELECT a.user_company,a.user_id,a.user_token,b.global_user_company,b.global_user_id,b.global_user_name FROM power_user AS a\n\t\t\t\t\t\tLEFT JOIN power_global_user AS b ON a.user_email = b.global_user_email\n\t\t\t\t\t\tWHERE a.user_pwd = '{$pwd}' AND a.user_email = '{$username}' AND a.user_system_id = '" . C('AUTH_SYSTEM_ID') . "' AND b.global_user_is_delete = 0 LIMIT 1";
$query = self::$dbConn->query($sql);
if (!$query) {
return false;
}
$res = self::$dbConn->fetch_array($query);
$_SESSION['userToken'] = $res['user_token'];
$_SESSION['sysUserId'] = $res['global_user_id'];
//统一用户系统ID
$_SESSION['userId'] = $res['user_id'];
//分系统用户ID
$_SESSION['userName'] = $res['global_user_name'];
$_SESSION['companyId'] = $res['global_user_company'];
return "ok";
} else {
$loginInfo = json_decode($loginInfo);
if (isset($loginInfo->errCode)) {
echo $loginInfo->errMsg;
self::$errCode = $loginInfo->errCode;
self::$errMsg = $loginInfo->errMsg;
return false;
}
$_SESSION['userToken'] = $loginInfo->userToken;
$_SESSION['sysUserId'] = $loginInfo->globalUserId;
//统一用户系统ID
$_SESSION['userId'] = $loginInfo->userId;
//分系统用户ID
$_SESSION['userName'] = $loginInfo->userCnName;
$_SESSION['companyId'] = $loginInfo->company;
return "ok";
}
}
示例4: userLogin
/**
* UserModel::userLogin()
* 用户登录走开放系统
* add by 管拥军 2013-08-21
* @return bool
*/
public static function userLogin($username, $password, $company)
{
$paramArr = array('method' => 'power.user.login.get', 'format' => 'json', 'v' => '1.0', 'username' => C('OPEN_SYS_USER'), 'user_name' => $username, 'pwd' => $password, 'com_id' => $company, 'sysName' => C('AUTH_SYSNAME'), 'sysToken' => C('AUTH_SYSTOKEN'));
$loginInfo = callOpenSystem($paramArr);
unset($paramArr);
$loginInfo = json_decode($loginInfo);
if (isset($loginInfo->errCode)) {
echo $loginInfo->errMsg;
self::$errCode = $loginInfo->errCode;
self::$errMsg = $loginInfo->errMsg;
return false;
}
$_SESSION['userToken'] = $loginInfo->userToken;
$_SESSION['sysUserId'] = $loginInfo->globalUserId;
//统一用户系统ID
$_SESSION['userId'] = $loginInfo->userId;
//分系统用户ID
$_SESSION['userName'] = $loginInfo->userName;
$_SESSION['companyId'] = $loginInfo->company;
$_SESSION['userCnName'] = $loginInfo->userCnName;
//中文名
setcookie("userCnName", $loginInfo->userCnName, time() + 24 * 3600);
//颗粒化权限 写进 session
global $dbConn;
$sql = "SELECT * FROM `ph_purchases_access` where user_id={$_SESSION['sysUserId']}";
$sql = $dbConn->execute($sql);
$accessInfo = $dbConn->fetch_one($sql);
if (!empty($accessInfo)) {
$_SESSION['power_access'] = $accessInfo['access'];
$_SESSION['access_id'] = $accessInfo['power_ids'] . ",{$_SESSION['sysUserId']}";
} else {
$_SESSION['access_id'] = $_SESSION['sysUserId'];
}
return "ok";
}
示例5: getGlobalUserLists
public function getGlobalUserLists($filed, $where, $order = '', $limit = '')
{
self::initDB();
$sql = 'SELECT ' . $filed . ' FROM ' . self::$table_power_global_user . ' AS a
LEFT JOIN ' . self::$table_job_info . ' AS b ON a.global_user_job=b.job_id
LEFT JOIN ' . self::$table_dept_info . ' AS c ON a.global_user_dept=c.dept_id
LEFT JOIN ' . self::$table_company_info . ' AS d ON a.global_user_company=d.company_id
' . $where . ' ' . $order . ' ' . $limit;
$query = self::$dbConn->query($sql);
if (!$query) {
self::$errCode = '1803';
self::$errMsg = "[{$sql}] is error";
return false;
}
self::$errCode = 0;
self::$errMsg = "[{$sql}]";
if ($this->is_count === true) {
$this->is_count = false;
return self::$dbConn->num_rows($query);
}
return self::$dbConn->fetch_array_all($query);
}
示例6: showNameList
/**
* 功能:展示所有用户
* @author wxb
* 日期:2013/11/21
* */
public static function showNameList()
{
self::initDB();
$field = "global_user_name as name ,global_user_id as id ";
$sql = "SELECT {$field} FROM `" . self::$table . "` WHERE 1 AND `global_user_is_delete` = 0 AND global_user_status = 1 ";
$sql .= " ORDER BY global_user_id DESC ";
$query = self::$dbConn->query($sql);
if ($query) {
$ret = self::$dbConn->fetch_array_all($query);
return $ret;
} else {
self::$errCode = "003";
self::$errMsg = "Error occurred!Function=" . __FUNCTION__ . " sql= " . $sql;
return false;
}
}
示例7: userLogin
/**
* UserModel::userLogin()
* 用户登录走开放系统
* add by 管拥军 2013-08-21
* @return bool
*/
public static function userLogin($username, $password, $companyId)
{
require_once WEB_PATH . "html/api/include/opensys_functions.php";
$paramArr = array('method' => 'power.user.login.get', 'format' => 'json', 'v' => '1.0', 'username' => 'purchase', 'user_name' => $username, 'pwd' => rawurlencode($password), 'sysName' => self::$sysName, 'sysToken' => self::$sysToken, 'com_id' => $companyId);
$loginInfo = callOpenSystem($paramArr);
unset($paramArr);
$loginInfo = json_decode($loginInfo);
if (isset($loginInfo->errCode)) {
echo $loginInfo->errMsg;
self::$errCode = $loginInfo->errCode;
self::$errMsg = $loginInfo->errMsg;
return false;
}
$_SESSION['userToken'] = $loginInfo->userToken;
$_SESSION['sysUserId'] = $loginInfo->userId;
$_SESSION['userId'] = $loginInfo->globalUserId;
$_SESSION['userName'] = $loginInfo->userName;
$_SESSION['companyId'] = $loginInfo->company;
return "ok";
}