本文整理汇总了PHP中pwQuery类的典型用法代码示例。如果您正苦于以下问题:PHP pwQuery类的具体用法?PHP pwQuery怎么用?PHP pwQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pwQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteByTids
function deleteByTids($tids)
{
if (!S::isArray($tids)) {
return false;
}
return pwQuery::delete($this->_tableName, "{$this->_primaryKey} IN (:{$this->_primaryKey})", array($tids));
}
示例2: deleteByAreaIds
/**
* 批量删除
*
* @param array $areaids 地区IDs
* @return boolean
*/
function deleteByAreaIds($areaids)
{
if (!S::isArray($areaids)) {
return false;
}
return (bool) pwQuery::delete($this->_tableName, "{$this->_primaryKey} in(:{$this->_primaryKey})", array($areaids));
}
示例3: syncredit
function syncredit($arr)
{
if (is_array($arr)) {
foreach ($arr as $uid => $setv) {
$updateMemberData = array();
foreach ($setv as $cid => $value) {
if (is_numeric($cid)) {
$value = intval($value);
/**
$this->db->pw_update(
"SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
"UPDATE pw_membercredit SET value=" . S::sqlEscape($value) . ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
"INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value))
);
**/
$this->db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $cid), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $value)));
} elseif (in_array($cid, array('money', 'rvrc', 'credit', 'currency'))) {
$cid == 'rvrc' && ($value *= 10);
$updateMemberData[$cid] = intval($value);
}
}
if ($updateMemberData) {
$userService = L::loadClass('UserService', 'user');
/* @var $userService PW_UserService */
$userService->update($uid, array(), $updateMemberData);
}
}
}
return new ApiResponse(1);
}
示例4: increase
function increase($userId, $increments)
{
$userId = intval($userId);
if ($userId <= 0 || !is_array($increments)) {
return 0;
}
$incrementStatement = array();
foreach ($increments as $field => $offset) {
$offset = intval($offset);
if (!$offset) {
continue;
}
if ($offset < 0) {
$incrementStatement[] = $field . "=" . $field . $offset;
} else {
$incrementStatement[] = $field . "=" . $field . "+" . $offset;
}
}
if (empty($incrementStatement)) {
return 0;
}
//* $this->_db->update("UPDATE " . $this->_tableName . " SET " . implode(", ", $incrementStatement) . " WHERE uid=" . $this->_addSlashes($userId));
$this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET " . implode(", ", $incrementStatement) . " WHERE uid=:uid", array($this->_tableName, $userId)));
return $this->_db->affected_rows();
}
示例5: deleteByIdentify
function deleteByIdentify($identify)
{
if (!$this->_check() || !$identify) {
return false;
}
return pwQuery::delete($this->_tableName, "identify=:identify", array($identify));
}
示例6: deleteMemberTagsByTagId
/**
* 根据标签ID批量删除
*
* @param int $tagids 标签ID数组
* @return boolean
*/
function deleteMemberTagsByTagId($tagids)
{
if (!S::isArray($tagids)) {
return false;
}
return (bool) pwQuery::delete($this->_tableName, "tagid in(:tagid)", array($tagids));
}
示例7: reduceReplyNumByCommentid
function reduceReplyNumByCommentid($num, $commentid)
{
$num = intval($num);
$commentid = intval($commentid);
if ($num < 1 || $commentid < 1) {
return false;
}
return $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET replynum=replynum-" . S::sqlEscape($num) . ' WHERE commentid=:commentid', array($this->_tableName, $commentid)));
}
示例8: deleteBySid
/**
* 根据链接ID删除数据
*
* @param int $sid 链接ID
* @return int 删除行数
*/
function deleteBySid($sid)
{
$sid = intval($sid);
if ($sid < 1) {
return null;
}
pwQuery::delete($this->_tableName, "sid=:sid", array($sid));
return $this->_db->affected_rows();
}
示例9: deleteAttentionedTopic
/**
*
* 删除用户关注的话题
* @param int $topicId
* @param int $userid
* @return boolean
*/
function deleteAttentionedTopic($topicId, $userid)
{
$userid = intval($userid);
$topicId = intval($topicId);
if (!$userid || !$topicId) {
return false;
}
pwQuery::delete($this->_tableName, "userid=:userid and topicid=:topicid", array($userid, $topicId));
return true;
}
示例10: addTopicRelations
/**
*
* 添加话题新鲜事关系
* @param int $topicId
* @param int $mid
*/
function addTopicRelations($topicId, $mid)
{
$mid = intval($mid);
$topicId = intval($topicId);
if (!$mid || !$topicId) {
return false;
}
$fields = array('topicid' => $topicId, 'mid' => $mid, 'crtime' => $GLOBALS['timestamp']);
pwQuery::replace($this->_tableName, $fields);
return true;
}
示例11: _insertLog
function _insertLog($tableName, $sids, $operate)
{
if (!$tableName || !S::isArray($sids) || !$operate) {
return false;
}
global $db, $timestamp;
$operates = array('update' => 1, 'delete' => 2, 'insert' => 3);
foreach ($sids as $sid) {
pwQuery::replace($tableName, array('id' => $sid, 'sid' => $sid, 'operate' => $operates[$operate], 'modified_time' => $timestamp));
}
return true;
}
示例12: updateReplynumByCommentid
/**
* 更新
*
* @param int $commentid
* @param array $fieldsData
* @return boolean
*/
function updateReplynumByCommentid($exp = '+1', $commentid)
{
$commentid = intval($commentid);
if ($commentid < 1 || !$exp) {
return false;
}
$num = intval(trim($exp, '+-'));
if (strpos($exp, '+') !== false) {
return $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET replynum=replynum+" . S::sqlEscape($num) . ' WHERE commentid=:commentid', array($this->_tableName, $commentid)));
} else {
return $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET replynum=replynum-" . S::sqlEscape($num) . ' WHERE commentid=:commentid', array($this->_tableName, $commentid)));
}
return false;
}
示例13: insertAppevent
function insertAppevent($uid, $appevent = array(), $appid)
{
//插入用户的单个应用信息
//$rt = $this->db->get_one("SELECT uid FROM pw_userapp WHERE uid=".S::sqlEscape($uid)." AND appid=".S::sqlEscape($appid));
$appclient = L::loadClass('appclient');
$rt = $appclient->getUserAppByUidAndAppid($uid, $appid);
if ($rt && $appevent) {
$appevent = serialize($appevent);
//$this->db->update("UPDATE pw_userapp SET appevent=" .S::sqlEscape($appevent). "WHERE uid=".S::sqlEscape($uid)." AND appid=".S::sqlEscape($appid));
pwQuery::update('pw_userapp', 'uid=:uid AND appid=:appid', array($uid, $appid), array('appevent' => $appevent));
return new ApiResponse(true);
}
return new ApiResponse(false);
}
示例14: add
function add($username, $pwd, $email)
{
$this->db->update("INSERT INTO pw_members SET " . UC::sqlSingle(array('username' => $username, 'password' => $pwd, 'email' => $email, 'groupid' => 0, 'regdate' => $this->base->time)));
$uid = $this->db->insert_id();
/**
$this->db->update("INSERT INTO pw_memberdata SET " . $this->base->sqlSingle(array(
'uid' => $uid,
'lastvisit' => $this->base->time,
'thisvisit' => $this->base->time,
'onlineip' => $this->base->onlineip
)));
**/
pwQuery::insert('pw_memberdata', array('uid' => $uid, 'lastvisit' => $this->base->time, 'thisvisit' => $this->base->time, 'onlineip' => $this->base->onlineip));
return $uid;
}
示例15: add
function add($uid, $appid, $appname, $allowfeed, $descrip)
{
global $timestamp;
/*
$this->db->update("REPLACE INTO pw_userapp SET " . S::sqlSingle(array(
'uid' => $uid,
'appid' => $appid,
'appname' => $appname,
)));
*/
pwQuery::replace('pw_userapp', array('uid' => $uid, 'appid' => $appid, 'appname' => $appname));
if ($allowfeed) {
$descrip = S::escapeChar($descrip);
$this->db->update("INSERT INTO pw_feed SET " . S::sqlSingle(array('uid' => $uid, 'type' => 'app', 'descrip' => $descrip, 'timestamp' => $timestamp), false));
}
return new ApiResponse(true);
}