本文整理汇总了PHP中FDB::affectedRows方法的典型用法代码示例。如果您正苦于以下问题:PHP FDB::affectedRows方法的具体用法?PHP FDB::affectedRows怎么用?PHP FDB::affectedRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FDB
的用法示例。
在下文中一共展示了FDB::affectedRows方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$crons = array();
$res = FDB::query("SELECT * FROM " . FDB::table('cron') . " WHERE run_time <= '" . TIME_UTC . "' ORDER BY run_time DESC");
while ($data = FDB::fetch($res)) {
$crons[$data['type']][] = $data;
}
if (count($crons) > 0) {
$query = FDB::query("DELETE FROM " . FDB::table('cron') . " WHERE run_time <= '" . TIME_UTC . "'");
if ($query !== FALSE && FDB::affectedRows() > 0) {
@set_time_limit(1800);
if (function_exists('ini_set')) {
ini_set('max_execution_time', 1800);
}
foreach ($crons as $ctype => $cron_list) {
FS($ctype)->runCron($cron_list);
}
}
}
}
示例2: deleteByMiid
public function deleteByMiid($uid, $miid)
{
if (empty($miid) || empty($uid)) {
return 0;
}
$index = FDB::fetchFirst("SELECT * FROM " . FDB::table('user_msg_index') . " AS mi \r\n\t\t\tLEFT JOIN " . FDB::table('user_msg_list') . " AS ml ON ml.mlid=mi.mlid \r\n\t\t\tWHERE mi.miid='{$miid}'");
$users = explode('_', $index['min_max']);
if (!in_array($uid, $users)) {
return MSG_PRIVILEGE_NONE_ERROR;
}
$mlid = $index['mlid'];
if ($index['uid'] != $uid) {
FDB::query("UPDATE " . MessageService::getTablaName($mlid) . " SET status = 2 WHERE miid='{$miid}' AND status=0");
$update_num = FDB::affectedRows();
FDB::query("DELETE FROM " . MessageService::getTablaName($mlid) . " WHERE miid='{$miid}' AND status=1");
$delete_num = FDB::affectedRows();
} else {
FDB::query("UPDATE " . MessageService::getTablaName($mlid) . " SET status = 1 WHERE miid='{$miid}' AND status=0");
$update_num = FDB::affectedRows();
FDB::query("DELETE FROM " . MessageService::getTablaName($mlid) . " WHERE miid='{$miid}' AND status=2");
$delete_num = FDB::affectedRows();
}
if (!FDB::resultFirst("SELECT COUNT(*) FROM " . MessageService::getTablaName($mlid) . " WHERE mlid='{$index['mlid']}'")) {
FDB::query("DELETE FROM " . FDB::table('user_msg_list') . " WHERE mlid='{$mlid}'");
FDB::query("DELETE FROM " . FDB::table('user_msg_member') . " WHERE mlid='{$mlid}'");
FDB::query("DELETE FROM " . FDB::table('user_msg_index') . " WHERE mlid='{$mlid}'");
} else {
FDB::query("UPDATE " . FDB::table('user_msg_member') . " SET num = num - " . ($update_num + $delete_num) . " WHERE mlid='" . $mlid . "' AND uid='{$uid}'");
}
return 1;
}