當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRUD::deleteByid方法代碼示例

本文整理匯總了PHP中CRUD::deleteByid方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRUD::deleteByid方法的具體用法?PHP CRUD::deleteByid怎麽用?PHP CRUD::deleteByid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRUD的用法示例。


在下文中一共展示了CRUD::deleteByid方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: doWebUserAward

 /**
 * 
 * 積分詳細
 */
 public function doWebUserAward()
 {
     global $_GPC;
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     $uid = $_GPC['uid'];
     $type = !empty($_GPC['type']) ? $_GPC['type'] : 0;
     if ($operation == 'display') {
         $pindex = max(1, intval($_GPC['page']));
         $psize = 10;
         switch ($type) {
             case self::$TYPE_DAY:
             case self::$TYPE_SERIAL:
             case self::$TYPE_FOLLOW:
             case self::$TYPE_SYSTEM:
                 $querySql = "select * from " . tablename(CRUD::$table_sign_award) . "  where uid=:uid and \tsign_type=:qtype order by createtime desc limit " . ($pindex - 1) * $psize . ',' . $psize;
                 $countSql = "select count(*) from " . tablename(CRUD::$table_sign_award) . " where uid=:uid and \tsign_type=:qtype";
                 $q_condition = array(':uid' => $uid, ':qtype' => $type);
                 break;
             case 0:
                 $querySql = "select * from " . tablename(CRUD::$table_sign_award) . "  where uid=:uid  order by createtime desc limit " . ($pindex - 1) * $psize . ',' . $psize;
                 $countSql = "select count(*) from " . tablename(CRUD::$table_sign_award) . " where uid=:uid";
                 $q_condition = array(':uid' => $uid);
                 break;
         }
         $list = pdo_fetchall($querySql, $q_condition);
         $total = pdo_fetchcolumn($countSql, $q_condition);
         $pager = pagination($total, $pindex, $psize);
     } elseif ($operation == 'delete') {
         $id = $_GPC['id'];
         $award = CRUD::findById(CRUD::$table_sign_award, $id);
         if (empty($award)) {
             message("獎勵積分刪除或已不存在");
         }
         $user = CRUD::findById(CRUD::$table_sign_user, $uid);
         CRUD::deleteByid(CRUD::$table_sign_award, $id);
         $user_data = array('credit' => $user['credit'] - $award['credit']);
         CRUD::updateById(CRUD::$table_sign_user, $user_data, $uid);
         //更新用戶積分
         message('刪除成功!', referer(), 'success');
     }
     include $this->template("user_award");
 }
開發者ID:ChainBoy,項目名稱:wxfx,代碼行數:46,代碼來源:site.php


注:本文中的CRUD::deleteByid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。