当前位置: 首页>>代码示例>>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;未经允许,请勿转载。