public function getCategoryAction() { $parent_id = FRequest::getInt('parent_id'); $categoryTable = new FTable('category'); $cateList = $categoryTable->fields(array('cat_id', 'cat_name'))->where(array('status' => 1, 'parent_id' => $parent_id))->order(array('sort' => 'desc'))->select(); FResponse::output($cateList); }
public function cntAction() { global $_F; $tm = date("Y-m-d"); $c_uid = FRequest::getString('c_uid'); $c_sid = FRequest::getString('c_sid'); if ($c_uid == "" || $c_sid == "") { $rs = array("msg" => "参数错误,必选参数c_uid,c_sid", "code" => 201); FResponse::output($rs); return; } $fields = array("stats_date", "c_uid", "c_sid", "sum(reg_cnt) as reg_cnt"); $stats_table = new FTable("stats"); $stats_table->fields($fields); $where = array(); if ($c_uid != "") { $where["c_uid"] = $c_uid; } if ($c_sid != "") { $where["c_sid"] = $c_sid; } $where["stats_date"] = $tm; $logList = $stats_table->where($where)->select(); $empty = array("stats_date" => $tm, "c_uid" => $c_uid, "c_sid" => $c_sid, "reg_cnt" => 0); if (count($logList) > 0) { FResponse::output($logList[0]); return; } FResponse::output($empty); }
public function deleteAction() { $top_menus = new FTable('top_menus'); $topid = FRequest::getInt('topid'); $top_menus->where(array('id' => $topid))->remove(true); FResponse::redirect('r'); }
public function deleteAction() { $gid = FRequest::getInt('gid'); $where = array('gid' => $gid); $managerList = $this->db_group->where($where)->remove(true); FResponse::refresh(); }
public function deleteAction() { $spmT = new FTable('stats_spm'); $auto_id = FRequest::getInt('id'); $spmT->where(array('id' => $auto_id))->remove(true); FResponse::redirect('r'); }
public function articleAction() { global $_F; $id = FRequest::getInt('id'); $table = new FTable("dynamics", "dy"); $dy = $table->where(array("id" => $id))->find(); // echo(json_encode($dy)); if (!$dy || $dy["uid"] <= 0) { return; } FResponse::redirect($dy["url"]); }
/** * @param $e Exception */ public function traceError($e) { global $_F; $error_code = 0; if (!is_array($e)) { $error_code = $e->getCode(); } if (is_array($e)) { $error_message = $e['message']; $error_file = $e['file']; $error_line = $e['line']; } else { $error_message = $e->getMessage(); $error_file = $e->getFile(); $error_line = $e->getLine(); $exception_trace = nl2br($e->__toString()); } $fLogger = new FLogger('error'); $exception_message = $error_message . '<br /> 异常出现在:' . $error_file . ' 第 ' . $error_line . ' 行'; $fLogger->append($exception_message); if (!$_F['debug']) { if ($error_code == 404) { FResponse::sendStatusHeader(404); $this->view->displaySysPage('404.tpl'); // echo "<strong>404 NOT FOUND</strong>"; } else { FResponse::sendStatusHeader(500); $this->view->displaySysPage('500.tpl'); } exit; } if ($_F['in_ajax']) { if ($_F['debug']) { FResponse::output(array('result' => 'exception', 'content' => $exception_message)); exit; } else { if ($error_code == 404) { FResponse::sendStatusHeader(404); } else { FResponse::sendStatusHeader(500); } exit; } } header('HTTP/1.1 500 FLib Error'); header('status: 500 FLib Error'); $exception_message = str_replace(APP_ROOT, '', $exception_message); $exception_trace = str_replace(APP_ROOT, '', $exception_trace); $this->view->set('exception_message', str_replace(APP_ROOT, '', $exception_message)); $this->view->set('exception_trace', preg_replace('#[\\w\\d \\#]+?/f.php.+?$#si', ' Flib 引导入口', $exception_trace)); $this->view->displaySysPage('exception.tpl'); }
public function defaultAction() { global $_F; $url = "http://down.mumu123.cn/mumu/MuMu_1617_1000_6_1.005.apk"; $mumu_auth = FCookie::get('mumu_auth'); $v = FRequest::getString('v'); if ($v) { FResponse::redirect($url); } else { if ($mumu_auth) { FResponse::redirect($url); } else { FResponse::redirect('/public/reg'); } } }
public function deleteAction() { $useradds = new FTable('user_address'); $addrid = FRequest::getInt('addrid'); $useradds->where(array('addrid' => $addrid))->remove(true); FResponse::redirect('r'); }
public function logoutAction() { Service_Manager::removeSession(); FResponse::redirect('/'); }
/** * 用户资料复审 */ function verifyUserSecondAction() { $id = FRequest::getInt("id"); $uid = FRequest::getInt("uid"); $status = FRequest::getInt("status"); // $reason = FRequest::getString("reason"); if (CommonUtil::parmIsEmpty($uid) || CommonUtil::parmIsEmpty($status) || CommonUtil::parmIsEmpty($id)) { FResponse::output(CommonUtil::GetDefRes(201, "参数错误")); return; } //请求服务端接口 $url = FConfig::get('global.service_mumu_url') . "/s/user/IUserInfoVerify"; $res = Service_Common::secPost($url, array("id" => $id, "uid" => $uid, "level" => $status)); FResponse::output($res); }
/** * 客户端接口统一输出json结构 */ function print_com($results, $msg = "success", $code = 200, $res = array()) { $result = array('result' => $results); $result['msg'] = $msg; $result['code'] = $code; $result['content'] = $res; // 获取系统时间 //$sysTm = Service_Common::getSysTm(); //$result["sys_tm"] = $sysTm; ob_clean(); //header("Content-Type: application/json; charset=UTF-8"); //echo '{"result":"failed","items":{"real_name":"\u4e0d\u80fd\u4e3a\u7a7a","username":"******","id_card":"\u4e0d\u80fd\u4e3a\u7a7a","phone":"\u4e0d\u80fd\u4e3a\u7a7a","email":"\u4e0d\u80fd\u4e3a\u7a7a","good_at":"\u4e0d\u80fd\u4e3a\u7a7a","join_date":"\u4e0d\u80fd\u4e3a\u7a7a","comment":"\u4e0d\u80fd\u4e3a\u7a7a","teacher_Frade":"\u4e0d\u80fd\u4e3a\u7a7a"}}'; //exit; FResponse::output(json_encode($result)); exit; }
protected function ajaxReturn($mix) { FResponse::output($mix); return true; }
public function updateAction() { $c_uid = trim(FRequest::getString("c_uid")); $ver = FRequest::getInt("ver"); $status = FRequest::getInt("status"); $c_sid = trim(FRequest::getString("c_sid")); $data = array('status' => $status); $where = array('ver' => $ver, 'c_uid' => $c_uid, 'c_sid' => $c_sid); $t = new FTable("app_version"); $t->update($data, $where); FResponse::output(CommonUtil::GetDefRes(200, "操作成功")); return; }
/** * 微信oauth登陆->第一步:用户同意授权,获取code * 应用授权作用域,snsapi_base (不弹出授权页面,直接跳转,只能获取用户openid), * snsapi_userinfo (弹出授权页面,可通过openid拿到昵称、性别、所在地。并且,即使在未关注的情况下,只要用户授权,也能获取其信息) * 直接在微信打开链接,可以不填此参数。做页面302重定向时候,必须带此参数 * * @param string $redirect_uri 授权后重定向的回调链接地址 * @param string $scope 应用授权作用域 0为snsapi_base,1为snsapi_userinfo * @param string $state 重定向后会带上state参数,开发者可以填写任意参数值 */ public function redirectGetOauthCode($redirect_uri, $scope = 0, $state = '') { $scope = $scope == 0 ? 'snsapi_base' : 'snsapi_userinfo'; $url = self::CONNECT_OAUTH_AUTHORIZE_URL . 'appid=' . $this->appid . '&redirect_uri=' . urlencode($redirect_uri) . '&response_type=code&scope=' . $scope . '&state=' . $state . '#wechat_redirect'; // $logger = new FLogger('weixin_login'); // $logger->append($url); // echo($url); FResponse::redirect($url); // header("location: " . $url); }
/** * @param $e Exception | array */ public function traceError($e) { global $_F; $error_code = 0; $exception_trace = ''; if (!is_array($e)) { $error_code = $e->getCode(); } if (is_array($e)) { $error_message = $e['message']; $error_file = $e['file']; $error_line = $e['line']; } else { $error_message = $e->getMessage(); $error_file = $e->getFile(); $error_line = $e->getLine(); $exception_trace = nl2br($e->__toString()); } $exception_message = $error_message . '<br /> 异常出现在:' . $error_file . ' 第 ' . $error_line . ' 行'; $log_text = "\n--------------------------------------------------------\n"; if (isset($_F['current_sql'])) { $log_text .= "SQL: " . $_F['current_sql'] . "\n"; $log_text .= "--------------------------------------------------------\n"; } if (is_object($e)) { $log_text .= $e->__toString() . "\n"; $log_text .= "--------------------------------------------------------\n"; } else { $log_text .= $error_message . "\n"; $log_text .= "--------------------------------------------------------\n"; } if ($_F['run_in'] == 'shell') { $log_text_header = "\n\n ==========================================\n ERROR FOUND\n ========================================== \n"; die($log_text_header . $log_text); } FLogger::write($log_text, 'error'); if (!$_F['debug']) { if ($error_code == 404) { FResponse::sendStatusHeader(404); $this->view->displaySysPage('404.tpl'); } else { FResponse::sendStatusHeader(500); $this->view->displaySysPage('500.tpl'); } exit; } $exception_message = str_replace(F_APP_ROOT, '', $exception_message); if ($_F['in_ajax']) { if ($_F['debug']) { $ajaxError = preg_replace('/<br.+?>/i', "\n", $exception_message); FResponse::output(array('result' => 'error', 'msg' => $ajaxError)); exit; } else { if ($error_code == 404) { FResponse::sendStatusHeader(404); } else { FResponse::sendStatusHeader(500); } exit; } } $exception_trace = str_replace(F_APP_ROOT, '', $exception_trace); $this->view->assign('exception_message', $exception_message); $this->view->assign('exception_trace', preg_replace('#[\\w\\d \\#]+?/f.php.+?$#si', ' Flib 引导入口', $exception_trace)); $this->view->displaySysPage('exception.tpl'); }
public function deleteAction() { $uid = FRequest::getInt('uid'); $where = array('uid' => $uid); $managerList = $this->db_manager->where($where)->remove(true); FResponse::redirect('/admin/manager/list'); }
/** * 图片检测接口 * img 图片url */ public function checkImgAction() { //sleep(50); $log = new FLogger("images_log"); $url = FRequest::getString('imgs'); $item = FRequest::getInt("type"); if (!$url) { FResponse::output(array('status' => 'fail', 'msg' => 'parm img is empty')); return; } if (!$item || $item <= 0) { FResponse::output(array('status' => 'fail', 'msg' => 'parm type is empty')); return; } $images = explode(",", $url); if (!$images || count($images) <= 0) { FResponse::output(array('status' => 'fail', 'msg' => 'the length of images is less than 0')); return; } // 检测图片域名 foreach ($images as &$url) { $S = parse_url($url); $S = strtolower($S['host']); //取域名部分 if ($item == Service_TupuTech::$SEXY_AND_AD && !(strpos($S, "yuanfenba.net") || strpos($S, "mumu123.cn"))) { FResponse::output(array('status' => 'fail', 'msg' => 'the host of image is error')); return; } if (strpos($S, "yuanfenba.net") || strpos($S, "mumu123.cn")) { $url = CommonUtil::getImgBySize($url, 256); } } $log->append("checkImgAction - begin :" . time() . json_encode($images)); $res = Service_TupuTech::doCheckImages($images, $item); $log->append("checkImgAction - 1 :" . time()); if ($res["code"] == 0) { $data = Service_Images::addImagesRecord($res, $item); FResponse::output($data); } else { $log->append("[ERROR] checkImgAction is error" . json_encode($res)); FResponse::output(array('status' => 'fail', 'msg' => 'check img is error')); } $log->append("checkImgAction - end :" . time()); }