function listAction() { //global $_F; // $_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $query_str = " ( mm.type='pic' or mm.type='text' ) "; $where = array(); if ($uid > 0) { $where["mm.from"] = $uid; //$query_str=$query_str." and (mm.from='$uid' or mm.to='$uid') and mm.from<>1 and mm.to<>1 "; $where["str"] = $query_str; $user_detail_table = new FTable("user_detail"); $user_detail = $user_detail_table->where(array('uid' => $uid))->find(); $user_avatar = CommonUtil::getMoreSizeImg($user_detail["avatar"], 100, 100); $table = new FTable("message", "mm", FDB::$DB_MUMU_MESSAGE); $user_messages = $table->fields(array("mm.tm", "mm.from", "mm.to", "mm.content"))->where($where)->groupBy("mm.to")->page($page)->limit(20)->order(array("mm.tm" => "desc"))->select(); $user_messages1 = $table->fields(array("mm.tm", "mm.from", "mm.to", "mm.content"))->where($where)->groupBy("mm.to")->order(array("mm.tm" => "desc"))->select(); $total = count($user_messages1); foreach ($user_messages as &$user_message) { $user_detail_table = new FTable("user_detail"); $user_detail = $user_detail_table->where(array('uid' => $user_message["to"]))->find(); $user_message["to_avatar"] = CommonUtil::getMoreSizeImg($user_detail["avatar"], 100, 100); $user_message["content"] = json_decode($user_message["content"]); } } if ($uid > 0) { $page_info = $table->getPagerInfo(); $this->assign('page_info', FPager::getPagerInfo($total, $page, '20')); $this->assign('user_messages', $user_messages); $this->assign('user_avatar', $user_avatar); } $this->assign('uid', $uid); $this->display('admin/usermessage_list'); }
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 defaultAction() { //global $_F; //$_F["debug"] = true; $user_online_table = new FTable("user_online", "uo"); $user_online_man = $user_online_table->leftJoin("user_main", "um", "uo.uid=um.uid")->where(array("um.gender" => 1, "uo.tm" => array('gte' => date("Y-m-d H:i:s", time())), 'uo.uid' => array('gte' => '5000000')))->count(); $user_online_table = new FTable("user_online", "uo"); $user_online_woman = $user_online_table->leftJoin("user_main", "um", "uo.uid=um.uid")->where(array("um.gender" => 2, "uo.tm" => array('gte' => date("Y-m-d H:i:s", time())), 'uo.uid' => array('gte' => '5000000')))->count(); $user_online_table = new FTable("user_main"); $reg_data = $user_online_table->fields(array("gender", "count(*) as num"))->where(array('uid' => array('gte' => '5000000')))->groupBy("gender")->select(); foreach ($reg_data as $data) { $gender = $data["gender"]; if ($gender == 1) { $man_num = $data["num"]; } else { if ($gender == 2) { $woman_num = $data["num"]; } } } $this->assign('user_online_man', $user_online_man); $this->assign('user_online_woman', $user_online_woman); $this->assign('man_num', $man_num); $this->assign('woman_num', $woman_num); $this->display('admin/online'); }
function listAction() { //global $_F; // $_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $query_str = " ( mm.type='pic' or mm.type='text' ) "; $where = array(); if ($uid > 0) { $where["mm.from"] = $uid; $where["str"] = $query_str; } $table = new FTable("message", "mm", FDB::$DB_MUMU_MESSAGE); $user_messages = $table->fields(array("mm.to", "mm.content"))->where($where)->page($page)->limit(100)->order(array("mm.id" => "desc"))->select(); foreach ($user_messages as &$user_message) { // $useradd_table = new FTable("user_address"); // $useradd = $useradd_table->where(array('addrid' => $addrid))->find(); $user_message["content"] = json_decode($user_message["content"]); } $page_info = $table->getPagerInfo(); if ($uid > 0) { $this->assign('page_info', $page_info); $this->assign('user_messages', $user_messages); } $this->assign('uid', $uid); $this->display('admin/usermessage_list_jd'); }
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 deleteAction() { $spmT = new FTable('stats_spm'); $auto_id = FRequest::getInt('id'); $spmT->where(array('id' => $auto_id))->remove(true); FResponse::redirect('r'); }
/** * 某商品结果(二维码,密码) * @throws Exception */ public function detailAction() { global $_F; /*echo "cookie: ".json_encode($_COOKIE)."<br>";*/ if (!$this->isLogin()) { return; } $id = FRequest::getInt("id"); $table = new FTable("mall_buy_history", "mb"); $buy = $table->where(array("id" => $id))->find(); if ($buy["uid"] != $_F["uid"]) { /* echo "信息不符".json_encode($buy)."---".$_F["uid"]."---".json_encode($_COOKIE);*/ return; } if (!$buy["item_id"] || $buy["item_id"] <= 0) { return; } $this->assign("buy", $buy); $table = new FTable("mall_inventory", "mi"); $r = $table->fields(array("mall.title", "mall.pic", "mi.goods_id", "mi.secrete", "mi.status"))->leftJoin("mall", "mall", "mi.goods_id = mall.id")->where(array("mi.id" => $buy["item_id"]))->find(); $secrete = json_decode($r["secrete"], true); $this->assign("secrete", $secrete); $this->assign("buy_info", $r); $this->assign("base_url", FConfig::get('global.base_url') . "/mall/info"); $this->display('mall_detail'); }
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 static function dispatch() { global $_F; self::init(); if (!$_F['controller'] || !$_F['action']) { if (F_RUN_MODE == 'sync') { return false; } throw new Exception("访问路径不正确,没有找到 {$_F['uri']}", 404); } $path_info = explode('/', $_F['uri']); if (isset($path_info[1]) && !isset($path_info[2]) && !isset($path_info[3]) && FConfig::get("global.openDiy")) { $pager_table = new FTable('page'); $pager_info = $pager_table->where("url='" . $_F['uri'] . "'")->find(); if ($pager_info) { $_F['controller'] = 'Controller_Front_Public'; $_F['default'] = $_F['action']; $_F['action'] = 'default'; } } else { if (!class_exists($_F['controller'])) { if (F_RUN_MODE == 'sync') { return false; } if ($_F['module']) { $c_backup = str_replace(ucfirst($_F['module']) . '_', '', $_F['controller']); if (class_exists($c_backup)) { $_F['controller'] = $c_backup; } else { throw new Exception("找不到控制器:{$_F['controller']}", 404); } } else { throw new Exception("找不到控制器:{$_F['controller']}", 404); } } } $controller = new $_F['controller'](); $action = $_F['action'] . 'Action'; if (method_exists($controller, $action . "")) { if (method_exists($controller, 'beforeAction')) { // IMPORTANT beforeAction must return true if (!$controller->beforeAction()) { return false; } } // 加载函数类 require_once FLIB_ROOT . "functions/function_core.php"; $controller->{$action}(); } else { try { $fView = new FView(); $fView->display(); } catch (Exception $e) { throw new Exception("找不到 {$_F['action']}Action ", 404); } } return true; }
public function loginAction() { global $_F; // $_F['debug'] = 1; if ($this->isPost()) { $username = trim($_POST['username']); $password = trim($_POST['password']); /*$checkCode = FRequest::getPostString('check_code'); if (!$checkCode) { return $this->error('请输入验证码!'); }*/ session_start(); // if ($checkCode != $_SESSION['rand_code']) { // return $this->error('验证码错误!'); // } $refer = trim($_POST['refer']); if (strpos($refer, 'login')) { $refer = null; } $managerTable = new FTable('manager'); $encryptPassword = Service_Manager::getEncryptPassword($password); $managerData = $managerTable->where(array('username' => $username))->find(); $managerLoginLogTable = new FTable('manager_login_log'); $newLoginLogData = array('username' => $username, 'login_time' => date('Y-m-d H:i:s'), 'login_ip' => FRequest::getClientIP()); if (!$managerData) { $newLoginLogData['result'] = 2; $newLoginLogData['comment'] = '用户名不存在'; $managerLoginLogTable->insert($newLoginLogData); return $this->error('用户名不存在!'); } else { if ($managerData['password'] == $encryptPassword) { $user_id = $managerData['user_id']; // 获取管理员user_id 和 密钥 $user_table = new FTable("user_main"); $user = $user_table->where(array("uid" => $user_id))->find(); // $auth_str = md5("{$managerData['username']}|{$managerData['password']}|{$managerData['gid']}"); FSession::set('manager_uid', $managerData['uid']); FSession::set('user_id', $user_id); FSession::set('sid', $user['sid']); // 更新登录时间 $managerTable->where(array("uid" => $managerData['uid']))->update(array('last_login_time' => date('Y-m-d H:i:s'))); $newLoginLogData['uid'] = $managerData['uid']; $newLoginLogData['result'] = 1; $managerLoginLogTable->insert($newLoginLogData); // FCookie::set('manager_auth', "{$managerData['uid']}\t{$auth_str}", 3600000); FResponse::redirect('/'); return true; } else { $newLoginLogData['result'] = 2; $newLoginLogData['comment'] = '密码错误'; $managerLoginLogTable->insert($newLoginLogData); return $this->error('对不起,密码错误!'); } } } $this->display('admin/login'); }
/** * 返回用户是登录状态 * @return bool */ protected function isLogin() { global $_F; $uid = FCookie::get("uid"); $sid = FCookie::get("key"); $table = new FTable("user_main"); $user = $table->fields(array("sid"))->where(array("uid" => $uid))->find(); $_F["uid"] = $uid; return $user["sid"] == $sid; }
function listAction() { //global $_F; //$_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $nickname = FRequest::getString('nickname'); $gender = FRequest::getInt('gender'); $where = array(); if ($uid || $nickname) { if ($uid) { $where["ud.uid"] = $uid; } if ($nickname) { $where["ud.nickname"] = array('like' => $nickname); } } else { $where["um.stat"] = '0'; $where["ud.avatarlevel"] = '-2'; $where["ud.uid"] = array('gte' => '5000000'); } if ($gender) { $where["um.gender"] = $gender; } $table = new FTable("user_detail", "ud"); $users = $table->fields(array("ud.uid", "um.gender", "ud.nickname", "ud.avatar", "ud.avatarlevel"))->leftJoin("user_main", "um", "ud.uid=um.uid")->where($where)->page($page)->limit(50)->order(array("ud.uid" => "asc"))->select(); foreach ($users as &$user) { $uid_d = $user["uid"]; $table2 = new FTable("image_md5", "im"); $image_md5 = $table2->fields(array("im.md5"))->where(array("im.url" => $user["avatar"]))->find(); // echo($user["avatar"]); $table3 = new FTable("image_md5", "im"); $images = $table3->fields(array("im.url"))->where(array("im.md5" => $image_md5["md5"], "str" => " im.url<>'" . $user["avatar"] . "' ", "im.type" => "avatar"))->select(); $i = 1; foreach ($images as $image) { $i++; $table4 = new FTable("user_detail", "ud"); $users4 = $table4->fields(array("ud.uid"))->where(array("ud.avatar" => $image['url']))->find(); if ($users4) { $uid_d = $uid_d . "," . $users4['uid']; } } $user["uid_d"] = $uid_d; $user["uid_i"] = $i; $user["avatar"] = CommonUtil::getMoreSizeImg($user["avatar"], 222, 222); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('users', $users); $this->assign('uid', $uid); $this->assign('nickname', $nickname); $this->assign('gender', $gender); $this->display('admin/user_avatar_list'); }
public function logAction() { global $_F; $page = FRequest::getInt('page'); $actionLogTable = new FTable('auction_log'); $where = array('status' => 1); $actionList = $actionLogTable->where($where)->page($page)->limit(50)->select(); $pagerInfo = $actionLogTable->getPagerInfo(); $this->assign('page_info', $pagerInfo); $this->assign('auction_logs', $actionList); $this->display('admin/auction-log'); }
public function chexiaoAction() { //global $_F; // $_F["debug"] = true; $tid = FRequest::getInt('tid'); $priority = FRequest::getPostInt('priority'); $discovery_table = new FTable("discovery", "mmd", FDB::$DB_MUMU_SORT); $discovery_table->where(array("tid" => $tid))->update(array("priority" => "0")); echo "<script LANGUAGE='javascript'> document.getElementById('priority_" . $tid . "').value=0;</script>"; $this->showMessage("撤销成功", "success"); return; }
public static function updateSystemCache() { $setting_file = WEB_ROOT_DIR . self::$cache_file; // FFile::rmDir(WEB_ROOT_DIR . 'data/system/'); $t = new FTable('setting'); $settings = $t->select(); $setting_write = array(); foreach ($settings as $row) { $setting_write[$row['setting_key']] = $row['setting_value']; } FFile::save($setting_file, "<?php\n" . 'return ' . var_export($setting_write, true) . ';'); FCache::flush(); }
public function defaultAction() { //global $_F; //$_F["debug"] = true; $table = new FTable("weixin_huodong"); $weixin_huodongs = $table->fields(array("id", "title", "text", "pic", "url", "position"))->limit(20)->order(array("position" => "asc", "id" => "desc"))->select(); foreach ($weixin_huodongs as &$weixin_huodong) { $weixin_huodong["pic"] = CommonUtil::getMoreSizeImg($weixin_huodong["pic"], 280, 280); $weixin_huodong["text"] = mb_substr($weixin_huodong["text"], 0, 50, "utf-8"); } $this->assign('weixin_huodong', $weixin_huodongs); $this->assign('title', '微信活动-慕慕'); $this->display('weixin_huodong'); }
public function defaultAction() { //global $_F; //$_F["debug"] = true; $table = new FTable("mumu_youxi"); $mumu_youxis = $table->fields(array("id", "title", "text", "pic", "url", "position"))->limit(20)->order(array("position" => "asc", "id" => "desc"))->select(); foreach ($mumu_youxis as &$mumu_youxi) { $mumu_youxi["pic"] = CommonUtil::getMoreSizeImg($mumu_youxi["pic"], 280, 280); $mumu_youxi["text"] = mb_substr($mumu_youxi["text"], 0, 50, "utf-8"); } $this->assign('mumu_youxi', $mumu_youxis); $this->assign('title', '慕慕游戏'); $this->display('mumu_youxi'); }
public static function getLeftMenus($top) { global $_F; $manager_table = new FTable("manager"); $manager = $manager_table->where(array('uid' => $_F["uid"]))->find(); $top_menus_ids = explode(",", $manager['top_menus_id']); $left_menus_ids = explode(",", $manager['left_menus_id']); /*$left_menus=array(); $left_menus['default'] =array( array('name' => '创建幕幕帐号', 'url' => '/admin/YUser/add', 'url_jian' => '/admin/YUser/add'), array('name' => '在线用户', 'url' => '/admin/Online/default', 'url_jian' => '/admin/Online/default') ); foreach($top_menus_ids as &$top_menus_id) { $left_menus_x=array(); $top_menus_table = new FTable("top_menus"); $top_menus1 = $top_menus_table->fields(array("name", "id","menu"))->where(array("id" => $top_menus_id))->find(); $left_menus_table = new FTable("left_menus"); $left_menus1 = $left_menus_table->fields(array("name", "url"))->where(array("top_menus_id" => $top_menus1['id'],"id"=>array('in' => $left_menus_ids)))->select(); // $left_menus_x[$top_menus1['menu']]=$left_menus1; // array_push($left_menus[$top_menus1['menu']],$left_menus1); foreach($left_menus1 as &$left_menus12){ $left=explode("/",$left_menus12["url"]); $left_menus12["url_jian"] = "/".$left[1]."/".$left[2]."/"; } $left_menus[$top_menus1['menu']]=$left_menus1; } echo(json_encode($left_menus)); $menuArray =$left_menus; $menuItems = $menuArray[$top];*/ $left_menus_table = new FTable("left_menus"); $left_menus1 = $left_menus_table->fields(array("name", "url"))->where(array("menu" => $top, "id" => array('in' => $left_menus_ids)))->select(); foreach ($left_menus1 as &$left_menus12) { $left = explode("/", $left_menus12["url"]); $left_menus12["url_jian"] = "/" . $left[1] . "/" . $left[2] . "/"; } $menuItems = $left_menus1; return $menuItems; }
/** * 用户资料首审 */ function verifyUserFirstAction() { $uid = FRequest::getInt("uid"); $status = FRequest::getInt("status"); $reason = FRequest::getString("reason"); if (CommonUtil::parmIsEmpty($uid) || CommonUtil::parmIsEmpty($status)) { FResponse::output(CommonUtil::GetDefRes(201, "参数错误")); return; } // 检测如果已经存在需要复审记录,则直接返回 $table2 = new FTable("verify_user"); $n = $table2->where(array("uid" => $uid, "flag" => 0))->count(); if ($n > 0) { FResponse::output(CommonUtil::GetDefRes(200, "操作成功")); return; } // 原子操作,开启事务处理 FDB::begin(); try { // 修改用户资料修改记录状态 $table = new FTable("update_record"); $table->where(array("uid" => $uid, "status" => 0))->update(array("status" => 1)); // 插入到复审的表里 $table2 = new FTable("verify_user"); $id = $table2->insert(array("uid" => $uid, "status" => $status, "reason" => $reason, "aid" => FSession::get('user_id'))); FDB::commit(); } catch (Exception $e) { FDB::rollBack(); //写入日志 $log = new FLogger("user_log"); $log->append("verifyUserFirstAction:" . $e); FResponse::output(CommonUtil::GetDefRes(201, "操作失败")); return; } // FResponse::output(CommonUtil::GetDefRes(200,"操作成功")); //下面是一审完了,走二审接口 /*$table2 = new FTable("verify_user","vu"); $verify_user = $table2->fields(array("vu.id")) ->where(array("vu.uid"=>$uid,"vu.flag"=>0))->find();*/ $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); }
/** * 约会说明 */ public function dateAction() { global $_F; //$_F["debug"] = true; $uid = FCookie::get("uid"); $user = Service_Client::getUserByUid($uid); if ($user["province"] == "北京" || $user["province"] == "天津" || $user["province"] == "上海" || $user["province"] == "重庆") { $user["city"] = $user["province"]; } $table = new FTable("date_place"); $place_num = $table->where(array("city" => $user["city"]))->count(); $table = new FTable("date_request", "dr"); $query_sql = " ( ud.province = '" . $user["city"] . "' or ud.city = '" . $user["province"] . "' )"; $date_num = $table->leftJoin("user_detail", "ud", "dr.uid1=ud.uid")->where(array("dr.available" => 1, "str" => $query_sql))->count(); $this->assign("base_url", FConfig::get('global.base_url')); $this->assign("place_num", $place_num); $this->assign("user", $user); $this->assign("date_num", $date_num); $this->display('client_date'); }
public function shenheAction() { //global $_F; // $_F["debug"] = true; $id = FRequest::getInt('id'); $picslevel = FRequest::getPostInt('picslevel'); $topic_table = new FTable("topic"); $topic_table->where(array('id' => $id))->update(array("picslevel" => $picslevel)); $params = array("tid" => "200"); $params = json_encode($params); $url = FConfig::get('global.service_mumu_url') . "/topic/ClearCache"; $params = Service_Common::post($url, $params); $params = json_decode($params); if ($params->status == "ok") { $this->showMessage("审核成功", $messageType = 'success'); } else { $this->showMessage("审核失败", $messageType = 'success'); } return; }
public function defaultAction() { //global $_F; //$_F["debug"] = true; $table = new FTable("mumu_ba"); $mumu_bas = $table->fields(array("id", "title", "text", "pic", "riqi", "position"))->limit(20)->order(array("position" => "asc", "id" => "desc"))->select(); $domList = array(); foreach ($mumu_bas as &$mumu_ba) { $riqi = explode("-", $mumu_ba["riqi"]); $mumu_ba["pic"] = CommonUtil::getMoreSizeImg($mumu_ba["pic"], 400, 450); $mumu_ba["riqi_nian"] = $riqi[0]; $mumu_ba["riqi_yue"] = $riqi[1]; $mumu_ba["riqi_ri"] = $riqi[2]; $sub_arr = array("height" => "100%", "width" => "100%", "content" => '<div><div style="line-height:30px; text-align:left; padding-left: 20px; font-size: 18px; font-weight: bold;">' . $mumu_ba["title"] . '</div><div style=" text-align:center;"><img src="' . $mumu_ba["pic"] . '"></div><div style="height:100px;overflow: hidden;"><div style="float:left; width:100px; margin-right:10px;"><div style=" line-height:45px;font-size:36px; font-weight:bold; color:#0099FF; text-align:center;">' . $riqi[2] . '</div><div style="line-height:25px; text-align:center;">' . self::NumChinese(intval($riqi[1])) . ' ' . $riqi[0] . '</div></div><div style="line-height:25px;overflow: hidden; padding-right: 15px;">' . $mumu_ba["text"] . '</div></div></div>'); array_push($domList, $sub_arr); } //echo( json_encode($domList)); $this->assign('domList', json_encode($domList)); $this->assign('title', '慕慕语录-慕慕'); $this->display('mumu_ba'); }
function listAction() { //global $_F; //$_F["debug"] = true; $page = max(1, FRequest::getInt('page')); $uid = FRequest::getInt('uid'); $where = array(); if ($uid) { $where["vr.uid"] = $uid; } else { $where["vr.status"] = 0; } $table = new FTable("video_record", "vr"); $users = $table->fields(array("vr.uid", "vr.id", "vr.photos", "vr.status", "vr.tm", "ud.video_img", "ud.nickname", "um.reg_ip", "um.model", "um.sysver"))->leftJoin("user_detail", "ud", "vr.uid=ud.uid")->leftJoin("user_main", "um", "vr.uid=um.uid")->where($where)->page($page)->limit(20)->order(array("vr.id" => "asc"))->select(); foreach ($users as &$user) { $user["video_img"] = CommonUtil::getMoreSizeImg($user["video_img"], 222, 222); } $page_info = $table->getPagerInfo(); $this->assign('page_info', $page_info); $this->assign('users', $users); $this->assign('uid', $uid); $this->display('admin/user_video_record'); }
public function deleteAction() { $useradds = new FTable('user_address'); $addrid = FRequest::getInt('addrid'); $useradds->where(array('addrid' => $addrid))->remove(true); FResponse::redirect('r'); }
/** * 创建幕幕管理员用户 */ public static function addUser() { //判断5000000uid一下的最新一个 $user_table = new FTable("user_main"); $sql_str = " uid < 5000000 and uid > 1000000 "; $user = $user_table->fields(array("uid"))->where(array("str" => $sql_str))->order(array("uid" => "desc"))->find(); $password = microtime(); $sid = Service_Manager::getEncryptPassword($password); if (!$user) { $user["uid"] = 1000000; } $data = array('uid' => $user['uid'] + 1, 'gender' => 1, 'kf_id' => 0, 'reg_time' => date('Y-m-d H:i:s'), 'sid' => $sid); $user_table = new FTable("user_main"); $uid = $user_table->insert($data); $data2 = array('uid' => $uid, 'nickname' => "admin_test", 'age' => 1, 'avatar' => ""); $user_detail_table = new FTable("user_detail"); $user_detail_table->insert($data2); $admin_table = new FTable("admin"); $data3 = array("uid" => $uid); $admin_table->insert($data3); return $uid; }
/** * 统计符合条目的数目 * * @param $table * @param null $conditions * * @return int */ public static function count($table, $conditions = null) { $table = new FTable($table); return $table->count($conditions); }
/** * 审核用户详情 */ function updateAction() { global $_F; $uid = FRequest::getInt("uid"); $user_detail_table = new FTable("user_main", "um"); $user = $user_detail_table->leftJoin("user_detail", "ud", "um.uid=ud.uid")->where(array("um.uid" => $uid))->select(); $user[0]["age"] = CommonUtil::birthdayToAge($user[0]["birthday"]); $interests = explode(",", $user[0]["interest"]); $this->assign("old_interests", $interests); $photo_table = new FTable("user_photo_album"); $photos = $photo_table->fields(array("pic", "albumid"))->where(array("uid" => $uid, "first_status" => 0))->select(); $photo_arr = $photos; $uid_d = $uid; $table2 = new FTable("image_md5", "im"); $image_md5 = $table2->fields(array("im.md5"))->where(array("im.url" => $user[0]["avatar"]))->find(); // echo($user["avatar"]); $table3 = new FTable("image_md5", "im"); $images = $table3->fields(array("im.url"))->where(array("im.md5" => $image_md5["md5"], "str" => " im.url<>'" . $user[0]["avatar"] . "' "))->select(); $i = 1; foreach ($images as $image) { $i++; $table4 = new FTable("user_detail", "ud"); $users4 = $table4->fields(array("ud.uid"))->where(array("ud.avatar" => $image['url']))->find(); if ($users4) { $uid_d = $uid_d . "," . $users4['uid']; } } $user[0]["uid_d"] = $uid_d; $user[0]["uid_i"] = $i; $user[0]["avatar"] = CommonUtil::getMoreSizeImg($user[0]["avatar"], 222, 222); $this->assign("user", $user[0]); $update_record = new FTable("update_record"); $updates = $update_record->fields(array("item"))->where(array("uid" => $uid, "status" => 0))->select(); //$update_arr = $updates; //$size = count($updates); $update_arr = array(); $j = 0; foreach ($updates as $update) { $update_arr[$j] = $update['item']; $j++; } //echo(json_encode($update_arr)); if (in_array("nickname", $update_arr)) { $nickname = "red"; } if (in_array("avatar", $update_arr)) { $avatar = "red"; } if (in_array("aboutme", $update_arr)) { $aboutme = "red"; } /* $photo_arr = array(); foreach($photos as $photo){ array_push($photo_arr,$photo["pic"]); }*/ //echo(count($photo_arr)); $this->assign("photos", $photo_arr); $this->assign("photos_num", count($photo_arr)); $this->assign("stars", self::$STARS); $this->assign("nickname", $nickname); $this->assign("avatar", $avatar); $this->assign("aboutme", $aboutme); $this->display('admin/y_user_update'); }
public function puzzle2Action() { global $_F; // $_F["debug"] = true; $uid = FRequest::getInt('uid'); $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; } $user = Service_Client::getUserByUid($uid); $table2 = new FTable("comment", "c"); $tms = $table2->fields(array("ud.uid", "ud.nickname", "ud.avatar", "c.*"))->where(array("source_id" => $id, "status" => 0, "source_type" => 1, "type" => 3))->leftJoin("user_detail", "ud", "c.uid = ud.uid")->select(); $join = false; $join_item = array(); foreach ($tms as $key => &$tmItem) { if ($tmItem["avatar"] == "" || $tmItem["nickname"] == "") { unset($tms[$key]); continue; } $avatar = $tmItem["avatar"]; $tmItem["avatar"] = CommonUtil::getMoreSizeImg($avatar, 100, 100); if ($tmItem["uid"] == $uid) { $join = true; $join_item = $tmItem; break; } } if (count($tms) > 10) { $tms_10 = array_slice($tms, 0, 10); } else { $tms_10 = $tms; } // 如果用户参与了拼图游戏,则需要结算胜率 if ($join) { $this->assign("tm", $join_item["content"]); } $dy["pic"] = CommonUtil::getMoreSizeImg($dy["pic"], 200, 200); $dy["pic_big"] = CommonUtil::getMoreSizeImg($dy["pic"], 400, 400); $user["avatar"] = CommonUtil::getMoreSizeImg($user["avatar"], 50, 50); $this->assign("tms", $tms_10); $this->assign("join", $join); $this->assign("dy", $dy); $this->assign("user", $user); $this->display('sharePuzzle2'); /*$this->display('sliding');*/ }
public function shenheAction() { // global $_F; // $_F["debug"] = true; $status = FRequest::getPostInt('status'); $url = FRequest::getPostString('url'); $data2 = array('sexy_review' => '0', 'ad_review' => '0', 'status' => $status); $image_md5_table = new FTable("image_md5"); $result = $image_md5_table->where(array('url' => $url))->update($data2); if ($result) { echo '修改成功!'; } else { echo "修改失败"; } return; }
/** * 修改活动 */ function updateAction() { $id = FRequest::getInt("id"); if ($this->isPost()) { $text = FRequest::getPostString('text'); $textlong = FRequest::getPostString('textlong'); $pic = FRequest::getPostString('pic'); $picda = FRequest::getPostString('picda'); $tip = FRequest::getPostString('tip'); $anniu_caozuo = FRequest::getPostInt('anniu_caozuo'); $timeout = FRequest::getPostString('timeout'); if (!$text) { $this->showMessage("活动标题不能为空", error); return; } if (!$textlong) { $this->showMessage("活动内容不能为空", error); return; } if (!$pic) { $this->showMessage("活动图片不能为空", error); return; } if (!$tip) { $this->showMessage("按钮文字不能为空", error); return; } $textlong = str_replace("<p>", "", $textlong); $textlong = str_replace("</p>", "<br>", $textlong); //打开网页 $url = FRequest::getPostString('url'); //打开圈子 $topic_id = FRequest::getPostString('topic_id'); //打开游戏 $gid = FRequest::getPostString('gid'); $area_id = FRequest::getPostString('area_id'); $buts = array(); $buts[0] = array("tip" => "忽略", "cmd" => "cmd_close", "def" => false); if ($anniu_caozuo == 1) { $data = array("url" => $url); if (!$url) { $this->showMessage("链接地址不能为空", error); return; } $buts[1] = array("tip" => $tip, "cmd" => "cmd_open_web", "def" => true, "data" => $data); } if ($anniu_caozuo == 2) { $data = array("tid" => $topic_id); if (!$topic_id) { $this->showMessage("圈子话题ID不能为空", error); return; } $buts[1] = array("tip" => $tip, "cmd" => "cmd_open_topic", "def" => true, "data" => $data); } if ($anniu_caozuo == 3) { $data = array("gid" => $gid, "area_id" => $area_id); $buts[1] = array("tip" => $tip, "cmd" => "cmd_entry_game", "def" => true, "data" => $data); } $content = array("text" => $textlong, "pic" => $picda, "buts" => $buts); $content = self::decodeUnicode(json_encode($content)); //print_r($content); $data2 = array('title' => $text, 'pic' => $pic, 'timeout' => $timeout . ":00", 'content' => $content); if ($picda) { $data2["style"] = 2; } else { $data2["style"] = 1; } $events_table = new FTable("events"); $events_table->where(array("id" => $id))->update($data2); $this->showMessage("修改活动成功", "success", "/EventsList/list"); return; } $events_table = new FTable("events"); $events = $events_table->where(array('id' => $id))->find(); $events["content"] = json_decode($events["content"]); $events["timeout"] = substr($events["timeout"], 0, -3); $this->assign("events", $events); $this->assign("id", $id); $this->display('admin/events_update'); }