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


PHP pwQuery::insertClause方法代码示例

本文整理汇总了PHP中pwQuery::insertClause方法的典型用法代码示例。如果您正苦于以下问题:PHP pwQuery::insertClause方法的具体用法?PHP pwQuery::insertClause怎么用?PHP pwQuery::insertClause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pwQuery的用法示例。


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

示例1: 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);
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:30,代码来源:class_Credit.php

示例2: runsql

 /**
  * 对给定数据进行数据库积分增减操作
  *
  * @param array		$setArr		操作数据 array(1 => array('money' => ??, 'rvrc' => ??), 2 => array(), 3 => array(), ...)
  * @param bool		$isAdd		是否实时进行数据库操作
  */
 function runsql($setArr = null, $isAdd = true)
 {
     global $db, $uc_server, $uc_syncredit;
     $setUser = isset($setArr) ? $setArr : $this->setUser;
     $retv = array();
     if ($uc_server && $uc_syncredit) {
         require_once R_P . 'uc_client/uc_client.php';
         $retv = uc_credit_add($setUser, $isAdd);
     }
     $cacheUids = $cacheCredits = array();
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     foreach ($setUser as $uid => $setv) {
         $updateUser = $increaseUser = array();
         foreach ($setv as $cid => $v) {
             if ($this->check($cid) && ($v != 0 || !$isAdd)) {
                 if (isset($retv[$uid][$cid])) {
                     if ($uc_server == 1) {
                         continue;
                     }
                     $act = 'set';
                     $v = $retv[$uid][$cid];
                 } else {
                     $act = $isAdd ? 'add' : 'set';
                 }
                 if (is_numeric($cid)) {
                     $v = intval($v);
                     /**
                     						$db->pw_update(
                     							"SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"UPDATE pw_membercredit SET " . ($act == 'add' ? 'value=value+' : 'value=') . S::sqlEscape($v) .  ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $v))
                     						);
                     						**/
                     $db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::buildClause("UPDATE :pw_table SET " . ($act == 'add' ? 'value=value+' : 'value=') . ':value' . ' WHERE uid=:uid AND cid=:cid', array('pw_membercredit', $v, $uid, $cid)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $v)));
                 } else {
                     $cid == 'rvrc' && ($v *= 10);
                     if ($act == 'add') {
                         $increaseUser[$cid] = intval($v);
                     } else {
                         $updateUser[$cid] = intval($v);
                     }
                 }
             }
         }
         if ($increaseUser) {
             $userService->updateByIncrement($uid, array(), $increaseUser);
         }
         if ($updateUser) {
             $userService->update($uid, array(), $updateUser);
         }
         unset($this->getUser[$uid]);
         $cacheUids[] = 'UID_' . $uid;
         $cacheCredits[] = 'UID_CREDIT_' . $uid;
     }
     //		if ($cacheUids) {
     //			$_cache = getDatastore();
     //			$_cache->delete($cacheUids);
     //			$_cache->delete($cacheCredits);/*积分*/
     //		}
     $this->writeLog();
     !isset($setArr) && ($this->setUser = array());
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:69,代码来源:credit.php

示例3: PrintEot

         $u_credit = $credit->get($rt['uid'], 'CUSTOM');
         include PrintEot('usermanage');
         exit;
     } else {
         S::gp(array('uid', 'creditdb'), 'P');
         !is_numeric($uid) && adminmsg('operate_error');
         foreach ($creditdb as $key => $value) {
             if (is_numeric($key) && is_numeric($value)) {
                 /**
                 					$db->pw_update(
                 						"SELECT uid FROM pw_membercredit WHERE uid=".S::sqlEscape($uid)."AND cid=".S::sqlEscape($key),
                 						"UPDATE pw_membercredit SET value=".S::sqlEscape($value)."WHERE uid=".S::sqlEscape($uid)."AND cid=".S::sqlEscape($key),
                 						"INSERT INTO pw_membercredit SET ".S::sqlSingle(array('uid'=>$uid,'cid'=>$key,'value'=>$value))
                 					);
                 					**/
                 $db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . "AND cid=" . S::sqlEscape($key), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $key), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $key, 'value' => $value)));
             }
         }
         adminmsg('operate_success');
     }
 } else {
     S::gp(array('page'), 'GP', 2);
     $page < 1 && ($page = 1);
     $limit = S::sqlLimit(($page - 1) * $db_perpage, $db_perpage);
     $rt = $db->get_one("SELECT COUNT(*) AS sum FROM pw_membercredit WHERE value!=0");
     $pages = numofpage($rt['sum'], $page, ceil($rt['sum'] / $db_perpage), "{$basename}&");
     $query = $db->query("SELECT m.uid,m.username,mc.cid,mc.value FROM pw_membercredit mc LEFT JOIN pw_members m USING(uid) WHERE value!=0 ORDER BY cid, value DESC {$limit}");
     while ($rt = $db->fetch_array($query)) {
         $rt['name'] = $_CREDITDB[$rt['cid']][0];
         $creditdb[] = $rt;
     }
开发者ID:jechiy,项目名称:PHPWind,代码行数:31,代码来源:usermanage.php

示例4: _insertUser

 function _insertUser()
 {
     global $timestamp, $onlineip, $credit;
     /**
     		$pwSQL = S::sqlSingle(array(
     			'uid' => $this->uid,
     			'username' => $this->data['username'],
     			'password' => $this->data['password'],
     			'safecv' => $this->data['safecv'],
     			'email' => $this->data['email'],
     			'groupid' => $this->data['groupid'],
     			'memberid' => $this->data['memberid'],
     			'regdate' => $timestamp,
     			'yz' => $this->data['yz'],
     			'userstatus' => $this->data['userstatus'],
     			'newpm' => 0
     		));
     		$this->db->update("REPLACE INTO pw_members SET $pwSQL");
     		**/
     $pwSQL = array('uid' => $this->uid, 'username' => $this->data['username'], 'password' => $this->data['password'], 'safecv' => $this->data['safecv'], 'email' => $this->data['email'], 'groupid' => $this->data['groupid'], 'memberid' => $this->data['memberid'], 'regdate' => $timestamp, 'yz' => $this->data['yz'], 'userstatus' => $this->data['userstatus'], 'newpm' => 0);
     pwQuery::replace('pw_members', $pwSQL);
     /**
     		$pwSQL = S::sqlSingle(array(
     			'uid' => $this->uid,
     			'postnum' => 0,
     			'lastvisit' => $timestamp,
     			'thisvisit' => $timestamp,
     			'onlineip' => $onlineip
     		));
     		$this->db->pw_update(
     			'SELECT uid FROM pw_memberdata WHERE uid=' . S::sqlEscape($this->uid),
     			'UPDATE pw_memberdata SET ' . $pwSQL . ' WHERE uid=' . S::sqlEscape($this->uid),
     			'INSERT INTO pw_memberdata SET ' . $pwSQL
     		);
     		**/
     $pwSQL = array('uid' => $this->uid, 'postnum' => 0, 'lastvisit' => $timestamp, 'thisvisit' => $timestamp, 'onlineip' => $onlineip);
     $this->db->pw_update('SELECT uid FROM pw_memberdata WHERE uid=' . S::sqlEscape($this->uid), pwQuery::updateClause('pw_memberdata', 'uid =:uid', array($this->uid), $pwSQL), pwQuery::insertClause('pw_memberdata', $pwSQL));
     //$this->db->update("REPLACE INTO pw_memberdata SET $pwSQL");
     require_once R_P . 'require/credit.php';
     $credit->addLog('reg_register', L::reg('rg_regcredit'), array('uid' => $this->uid, 'username' => stripslashes($this->data['username']), 'ip' => $onlineip));
     $credit->sets($this->uid, L::reg('rg_regcredit'), false);
     $credit->runsql();
     //* $this->db->update("UPDATE pw_bbsinfo SET newmember=" . S::sqlEscape($this->data['username']) . ",totalmember=totalmember+1 WHERE id='1'");
     $this->db->update(pwQuery::buildClause("UPDATE :pw_table SET newmember=:newmember,totalmember=totalmember+1 WHERE id=:id", array('pw_bbsinfo', $this->data['username'], 1)));
     $this->memberinfo or $this->memberinfo['uid'] = $this->uid;
     if ($this->memberinfo) {
         /**
         			$this->db->update("REPLACE INTO pw_memberinfo SET uid=" . S::sqlEscape($this->uid) . ',' . S::sqlSingle($this->memberinfo));
         			**/
         $_temp = array('uid' => $this->uid) + $this->memberinfo;
         pwQuery::replace('pw_memberinfo', $_temp);
     }
     $statistics = L::loadClass('Statistics', 'datanalyse');
     $statistics->register();
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:55,代码来源:register.class.php

示例5: array

            				"SELECT * FROM pw_singleright WHERE uid=" . S::sqlEscape($uid),
            				"UPDATE pw_singleright SET" . S::sqlSingle(array(
            						'visit'	=> $visit,
            						'post'	=> $post,
            						'reply'	=> $reply
            					))
            				. " WHERE uid=" . S::sqlEscape($uid),
            				"INSERT INTO pw_singleright SET" . S::sqlSingle(array(
            					'uid'	=> $uid,
            					'visit'	=> $visit,
            					'post'	=> $post,
            					'reply'	=> $reply
            				))
            			);
            			**/
            $db->pw_update("SELECT * FROM pw_singleright WHERE uid=" . S::sqlEscape($uid), pwQuery::updateClause('pw_singleright', 'uid =:uid', array($uid), array('visit' => $visit, 'post' => $post, 'reply' => $reply)), pwQuery::insertClause('pw_singleright', array('uid' => $uid, 'visit' => $visit, 'post' => $post, 'reply' => $reply)));
            adminmsg('operate_success');
        }
    } elseif ($_POST['job'] == 'del') {
        S::gp(array('selid'), 'P');
        $tmpSelid = $selid;
        if (!($selid = checkselid($selid))) {
            adminmsg('operate_error');
        }
        //* $db->update("DELETE FROM pw_singleright WHERE uid IN($selid)");
        pwQuery::delete('pw_singleright', 'uid IN (:uid)', array($tmpSelid));
        adminmsg('operate_success');
    }
} elseif ($action == 'user') {
    //* include_once pwCache::getPath(D_P.'data/bbscache/level.php');
    //* include_once pwCache::getPath(D_P.'data/bbscache/forumcache.php');
开发者ID:jechiy,项目名称:PHPWind,代码行数:31,代码来源:singleright.php

示例6: list

 //邀请处理
 if (GetCookie('o_invite') && $db_modes['o']['ifopen'] == 1) {
     list($o_u, $hash, $app) = explode("\t", GetCookie('o_invite'));
     if (is_numeric($o_u) && strlen($hash) == 18) {
         require_once R_P . 'require/o_invite.php';
     }
 }
 $visitors = unserialize($space['visitors']);
 is_array($visitors) || ($visitors = array());
 if (!isset($visitors[$winduid]) || $timestamp - $visitors[$winduid] > 900) {
     $visitors[$winduid] = $timestamp;
     arsort($visitors);
     if (count($visitors) > 12) {
         array_pop($visitors);
     }
     $db->pw_update("SELECT uid FROM pw_space WHERE uid=" . S::sqlEscape($uid), pwQuery::buildClause("UPDATE :pw_table SET visits=visits+1,visitors=:visitors WHERE uid=:uid", array('pw_space', serialize($visitors), intval($uid))), pwQuery::insertClause('pw_space', array('uid' => $uid, 'visits' => 1, 'visitors' => serialize($visitors))));
 }
 if (perf::checkMemcache()) {
     $_cacheService = Perf::gatherCache('pw_space');
     $tmp = $_cacheService->getSpaceByUid($winduid);
     $tovisitors = $tmp['tovisitors'];
 } else {
     $tovisitors = $db->get_value("SELECT tovisitors FROM pw_space WHERE uid=" . S::sqlEscape($winduid));
 }
 $tovisitors = unserialize($tovisitors);
 is_array($tovisitors) || ($tovisitors = array());
 if (!isset($tovisitors[$uid]) || $timestamp - $tovisitors[$uid] > 900) {
     $tovisitors[$uid] = $timestamp;
     arsort($tovisitors);
     if (count($tovisitors) > 12) {
         array_pop($tovisitors);
开发者ID:jechiy,项目名称:PHPWind,代码行数:31,代码来源:space.php

示例7: insert

 function insert($tableName, $col_names)
 {
     $GLOBALS['db']->update(pwQuery::insertClause($tableName, $col_names));
     $insert_id = $GLOBALS['db']->insert_id();
     $insert_id && Perf::gatherQuery('insert', array($tableName), array_merge($col_names, array('insert_id' => $insert_id)));
     return $insert_id;
 }
开发者ID:jechiy,项目名称:PHPWind,代码行数:7,代码来源:common.php


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