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


PHP FDB::affectedRows方法代码示例

本文整理汇总了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);
             }
         }
     }
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:20,代码来源:cron.class.php

示例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;
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:31,代码来源:message.service.php


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