/** * * 积分详细 */ 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"); }