示例#1
0
文件: Auth.php 项目: jiatower/php
 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');
 }
示例#2
0
文件: Spm.php 项目: jiatower/php
 public function addAction()
 {
     $spmT = new FTable('stats_spm');
     if ($this->isPost()) {
         $auto_id = FRequest::getPostInt('id');
         $spm = FRequest::getPostString('spm');
         $url = FRequest::getPostString('url');
         $spm_name = FRequest::getPostString('spm_name');
         $text = "";
         if ($auto_id) {
             $spmT->where(array('id' => $auto_id))->update(array('spm' => $spm, 'url' => $url, 'spm_name' => $spm_name));
             $text = "修改成功";
         } else {
             $spmT->insert(array('spm' => $spm, 'url' => $url, 'spm_name' => $spm_name));
             $text = "添加成功";
         }
         return $this->success($text, '/admin/spm/index');
     }
     $auto_id = FRequest::getInt('id');
     $spmData = $spmT->where(array('id' => $auto_id))->find();
     if ($spmData) {
         $this->assign('spmData', $spmData);
     }
     $this->display('admin/spm-add');
 }
示例#3
0
文件: TopMenus.php 项目: jiatower/php
 /**
  * 添加地址
  */
 function addAction()
 {
     //global $_F;
     // $_F["debug"] = true;
     if ($this->isPost()) {
         $name = FRequest::getPostString('name');
         $menu = FRequest::getPostString('menu');
         $data2 = array('name' => $name, 'menu' => $menu);
         $TopMenus = new FTable("top_menus");
         $TopMenus->insert($data2);
         $this->showMessage("创建成功", $messageType = 'success', "/TopMenus/list");
         return;
     }
     $this->display('admin/top_menus_add');
 }
示例#4
0
 /**
  * 用户资料首审
  */
 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);
 }
示例#5
0
 /**
  * 添加地址
  */
 function addAction()
 {
     //global $_F;
     // $_F["debug"] = true;
     $uid = FRequest::getInt("uid");
     if ($this->isPost()) {
         $username = FRequest::getPostString('username');
         $phone = FRequest::getPostString('phone');
         $province = FRequest::getPostString('province');
         $city = FRequest::getPostString('city');
         $address = FRequest::getPostString('address');
         $data2 = array('uid' => $uid, 'username' => $username, 'phone' => $phone, 'province' => $province, 'city' => $city, 'address' => $address);
         $user_detail_table = new FTable("user_address");
         $user_detail_table->insert($data2);
         $this->showMessage("创建成功", $messageType = 'success', "/YUserAddress/list?uid=" . $uid);
         return;
     }
     $this->assign("uid", $uid);
     $this->display('admin/y_user_address_add');
 }
示例#6
0
 /**
  * 添加地址
  */
 function addAction()
 {
     //global $_F;
     // $_F["debug"] = true;
     $topid = FRequest::getInt("topid");
     $top_menus = new FTable("top_menus");
     $top_menus_menu = $top_menus->fields(array("menu", "name"))->where(array("id" => $topid))->find();
     if ($this->isPost()) {
         $name = FRequest::getPostString('name');
         $url = FRequest::getPostString('url');
         $data2 = array('name' => $name, 'menu' => $top_menus_menu['menu'], 'url' => $url, 'top_menus_id' => $topid);
         $LeftMenus = new FTable("left_menus");
         $LeftMenus->insert($data2);
         $this->showMessage("创建成功", $messageType = 'success', "/LeftMenus/list?topid=" . $topid);
         return;
     }
     $this->assign("topid", $topid);
     $this->assign("top_menus_menu", $top_menus_menu);
     $this->display('admin/left_menus_add');
 }
示例#7
0
文件: Events.php 项目: jiatower/php
 /**
  * 添加活动
  */
 function addAction()
 {
     //global $_F;
     // $_F["debug"] = true;
     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->insert($data2);
         $this->showMessage("创建成功", $messageType = 'success');
         return;
     }
     $this->display('admin/events_add');
 }
示例#8
0
 /**
  * 插入数据
  *
  * @param $table
  * @param $data
  *
  * @return bool
  */
 public static function insert($table, $data, $db_conf = '')
 {
     if ($db_conf) {
         $table = new FTable($table, '', $db_conf);
     } else {
         $table = new FTable($table);
     }
     return $table->insert($data);
 }
示例#9
0
文件: Images.php 项目: jiatower/php
 /**
  * 保存图片地址和url
  * @param $url 图片地址
  * @param $md5 图片md5
  */
 public static function addImageMd5($url, $md5, $type = "chat", $uid = 0)
 {
     $img = array("url" => $url, "md5" => $md5, "type" => $type, "uid" => $uid);
     $image_table = new FTable("image_md5");
     $image_table->insert($img);
 }
示例#10
0
文件: Cron.php 项目: jiatower/php
 public static function addDb($url, $md5, $status)
 {
     $image_t = new FTable("image_md5");
     $num = $image_t->where(array("url" => $url))->count();
     if ($num > 0) {
         return;
     }
     $t = 0;
     if ($status == -1) {
         $t = 1;
     } else {
         if ($status == -2) {
             $t = -1;
         }
     }
     $img = array("url" => $url, "md5" => $md5, "type" => "avatar", "status" => $t);
     $image_table = new FTable("image_md5");
     $image_table->insert($img);
 }
示例#11
0
 /**
  * 添加焦点图
  */
 function addAction()
 {
     if ($this->isPost()) {
         $text = FRequest::getPostString('text');
         $text = str_replace("<p>", "", $text);
         $text = str_replace("</p>", "<br>", $text);
         $riqi = FRequest::getPostString('riqi');
         $title = FRequest::getPostString('title');
         if (!$title) {
             $this->showMessage("标题不能为空", error);
             return;
         }
         if (!$riqi) {
             $this->showMessage("日期不能为空", error);
             return;
         }
         //print_r($content);
         $data2 = array('title' => $title, 'text' => $text, 'riqi' => $riqi);
         $guanwang_news_table = new FTable("guanwang_news");
         $guanwang_news_table->insert($data2);
         $this->showMessage("添加成功", "success", "/GuanwangNews/list");
         return;
     }
     $this->display('admin/guanwang_news_add');
 }
示例#12
0
 /**
  * 添加焦点图
  */
 function addAction()
 {
     if ($this->isPost()) {
         $text = FRequest::getPostString('text');
         $pic = FRequest::getPostString('pic');
         $url = FRequest::getPostString('url');
         $title = FRequest::getPostString('title');
         $position = CommonUtil::getComParam(FRequest::getPostInt('position'), 0);
         if (!$pic) {
             $this->showMessage("图片不能为空", error);
             return;
         }
         if (!$title) {
             $this->showMessage("标题不能为空", error);
             return;
         }
         //打开网页
         //print_r($content);
         $data2 = array('title' => $title, 'text' => $text, 'pic' => $pic, 'url' => $url, 'position' => $position);
         $mumu_youxi_table = new FTable("mumu_youxi");
         $mumu_youxi_table->insert($data2);
         $this->showMessage("添加成功", "success", "/MumuYouxi/list");
         return;
     }
     $this->display('admin/mumu_youxi_add');
 }
示例#13
0
文件: Index.php 项目: jiatower/php
 public function doSleepAction()
 {
     /* $Url = 'http://image1.yuanfenba.net/uploads/oss/photo/201508/20/20000561547.jpg@%20256w_90Q_1x.jpg';
             $S = parse_url($Url);
     
             if($Url){
                 $index = strrpos($Url,"@",0);
                 if($index){
                     $Url = strstr($Url, '@', TRUE);
                 }
             }
             echo $Url."<br>";
     
             echo json_encode($S)."<br>";
             $S = strtolower($S['host']) ; //取域名部分
     
             $re = pathinfo($Url);
             echo json_encode($re)."<br>";
             if(!strpos($S,"yuanFenba.net")){
                 echo"no error path";
             }else{
                 echo "yes";
             }
     \
             echo $S;*/
     /*for($i =0;$i<=100;$i++){
           $r = rand(0,20);
           echo (rand(0,20)-10)."<br>";
       }*/
     /*$url = "http://image2.yuanfenba.net/uploads/oss/photo/201506/19/13072474951.jpg";
             //获取图片二进制流
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $url);
             // curl_setopt($ch, CURLOPT_GET, 1);
             // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch,CURLOPT_HEADER,0);
             curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//return the image value
     
             //  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
             // curl_setopt($ch, CURLOPT_TIMEOUT, 15);
     
             curl_setopt($ch,CURLINFO_CONTENT_LENGTH_DOWNLOAD,1);//content 下载原大小
             curl_setopt($ch,CURLINFO_SIZE_DOWNLOAD,1);//实际下载大小
     
             $imageData = curl_exec($ch);
             $info = curl_getinfo($ch);
             curl_close($ch);
     
            // dfsdaf
            var_dump($info);
             echo("-------".$info["size_download"]!=$info["download_content_length"]);
             if($info["size_download"]!=$info["download_content_length"]){
                 // 实际下载大小于源文件大小不符
               //  echo("-------");
     
             }
             $md5 = md5($imageData);*/
     $stm = time();
     $log2 = new FLogger("images_log");
     $log2->append("---begin----" . $stm);
     $t = new FTable("user_detail");
     $t->fields(array("uid", "avatar", "avatarlevel"))->where(array("avatarlevel" => array('neq', '-1'), "uid" => array('gt' => '5025587')))->order(array("uid" => "asc"));
     //$data = $t->limit(100)->select();
     $res = $t->select();
     $data = $res;
     $log2->append("---begin----" . count($data));
     $i = 0;
     foreach ($data as $ud) {
         $url = $ud["avatar"];
         if ($url == "") {
             continue;
         }
         $image_table = new FTable("image_md5");
         $n = $image_table->where(array("url" => $url))->count();
         if ($n > 0) {
             $log2->append("-ok--" . $ud["uid"] . "--" . $ud["avatar"]);
             continue;
         }
         // sleep(1);
         //获取图片二进制流
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         // curl_setopt($ch, CURLOPT_GET, 1);
         // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         //return the image value
         //  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
         // curl_setopt($ch, CURLOPT_TIMEOUT, 15);
         $imageData = curl_exec($ch);
         $info = curl_getinfo($ch);
         curl_close($ch);
         // 判断是否全部下载完成
         if ($info["size_download"] != $info["download_content_length"]) {
             // 实际下载大小于源文件大小不符
             $log2->append("-下载不完整-" . $ud["uid"] . "--" . $ud["avatar"] . "---实际:-" . $info["size_download"] . "-源文件:-" . $info["download_content_length"]);
             continue;
         }
         $md5 = md5($imageData);
         /*if($i%20==0){
               $log2->append("---".$ud["uid"]."--".$ud["avatar"]."md5: ".$md5);
           }*/
         $log2->append("---" . $ud["uid"] . "--" . $ud["avatar"] . "md5: " . $md5);
         $t = 0;
         $img = array("url" => $url, "md5" => $md5, "type" => "avatar", "status" => $t);
         $image_table2 = new FTable("image_md5");
         try {
             $image_table2->insert($img);
         } catch (Exception $e) {
             $log2->append("重复key :" . $url . "e: " . $e->getTraceAsString());
         }
         $i++;
     }
 }
示例#14
0
文件: Edit.php 项目: jiatower/php
 /**
  * 创建幕幕管理员用户
  */
 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;
 }
示例#15
0
 public function shenheAction()
 {
     // global $_F;
     // $_F["debug"] = true;
     $size = FRequest::getPostInt('size');
     $list = FRequest::getPostString('avatarlevel' . $size);
     $query = explode(",", $list);
     $uid = $query[0];
     $gender = $query[1];
     $status = $query[2];
     $data2 = array('uid' => $uid, 'gender' => $gender, 'level' => $status, 'changes' => 1);
     $user_star_level_table = new FTable("user_star_level");
     $result = $user_star_level_table->insert($data2);
     if ($result) {
         //$this->success('修改成功!');
     } else {
         //$this->error("修改失败");
     }
     return;
 }
示例#16
0
文件: App.php 项目: jiatower/php
 public function doAddAction()
 {
     $c_uid = trim(FRequest::getString("c_uid"));
     $ver = FRequest::getInt("ver");
     $c_sid = trim(FRequest::getString("c_sid"));
     $data = array('ver' => $ver, 'c_uid' => $c_uid, 'c_sid' => $c_sid, 'status' => 1);
     $t = new FTable("app_version");
     $t->insert($data);
     FResponse::output(CommonUtil::GetDefRes(200, "操作成功"));
     return;
 }
示例#17
0
 /**
  *
  */
 function defaultAction()
 {
     // $datetime_zuotian = date("Y-m-d ", time() - 86400);
     // $datetime_jintian = date("Y-m-d ", time());
     $datetime_jintian = FRequest::getString("datetime_jintian");
     if ($datetime_jintian) {
         //$datetime_jintian = "2015-07-04";
         //$datetime_jintian = date("Y-m-d ", time());
         $datetime_zuotian = date("Y-m-d", strtotime("{$datetime_jintian} - 1 days"));
         $query_str = " tm >= '" . $datetime_zuotian . " 00:00:00' and  tm < '" . $datetime_jintian . " 00:00:00'   ";
         $query_str2 = " ac.tm >= '" . $datetime_zuotian . " 00:00:00' and  ac.tm < '" . $datetime_jintian . " 00:00:00'   ";
         $user_star_date = array();
         $user_star_date['date'] = $datetime_zuotian;
         $table = new FTable("Actions", "ac", FDB::$DB_MUMU_STAT);
         $actions = $table->fields(array("count(*) as count", "gender"))->where(array("str" => $query_str2, "type" => 22))->groupBy("gender")->select();
         foreach ($actions as $action) {
             if ($action['gender'] == 1) {
                 $user_star_date['login_man'] = $action['count'];
             }
             if ($action['gender'] == 2) {
                 $user_star_date['login_woman'] = $action['count'];
             }
         }
         $table = new FTable("user_star_level", "usl");
         $usls = $table->fields(array("usl.uid"))->where(array("usl.level" => array('gte' => '1')))->select();
         $user_ids = array();
         foreach ($usls as $usl) {
             array_push($user_ids, $usl['uid']);
         }
         $user_ids = implode(",", $user_ids);
         //echo($user_ids);
         $table = new FTable("user_star_level", "usl");
         $usls = $table->fields(array("count(*) as count", "level", "gender"))->where(array("usl.level" => array('gte' => '1')))->groupBy("level,gender")->select();
         // echo(json_encode($usls));
         foreach ($usls as $usl) {
             if ($usl['level'] == '1') {
                 if ($usl['gender'] == '1') {
                     $user_star_date["level1_man"] = $usl['count'];
                 }
                 if ($usl['gender'] == '2') {
                     $user_star_date["level1_woman"] = $usl['count'];
                 }
             }
             if ($usl['level'] == '2') {
                 if ($usl['gender'] == '1') {
                     $user_star_date["level2_man"] = $usl['count'];
                 }
                 if ($usl['gender'] == '2') {
                     $user_star_date["level2_woman"] = $usl['count'];
                 }
             }
             if ($usl['level'] == '3') {
                 if ($usl['gender'] == '1') {
                     $user_star_date["level3_man"] = $usl['count'];
                 }
                 if ($usl['gender'] == '2') {
                     $user_star_date["level3_woman"] = $usl['count'];
                 }
             }
         }
         $table = new FTable("user_star_level", "usl");
         $usls = $table->fields(array("count(*) as count", "level", "gender"))->where(array("usl.level" => array('in' => '1,2'), "changes" => "-1", "str" => $query_str))->groupBy("level,gender")->select();
         // echo(json_encode($usls));
         foreach ($usls as $usl) {
             if ($usl['level'] == '2') {
                 if ($usl['gender'] == '1') {
                     $user_star_date["level3_2_man"] = $usl['count'];
                 }
                 if ($usl['gender'] == '2') {
                     $user_star_date["level3_2_woman"] = $usl['count'];
                 }
             }
             if ($usl['level'] == '1') {
                 if ($usl['gender'] == '1') {
                     $user_star_date["level2_1_man"] = $usl['count'];
                 }
                 if ($usl['gender'] == '2') {
                     $user_star_date["level2_1_woman"] = $usl['count'];
                 }
             }
         }
         $table = new FTable("Actions", "ac", FDB::$DB_MUMU_STAT);
         $actions = $table->where(array("str" => $query_str2, "uid" => array('in' => $user_ids), "gender" => 1, "type" => '9'))->groupBy("uid")->select();
         $user_star_date['star_message_man'] = count($actions);
         $table = new FTable("Actions", "ac", FDB::$DB_MUMU_STAT);
         $actions = $table->where(array("str" => $query_str2, "uid" => array('in' => $user_ids), "gender" => 2, "type" => '9'))->groupBy("uid")->select();
         $user_star_date['star_message_woman'] = count($actions);
         $table = new FTable("Actions", "ac", FDB::$DB_MUMU_STAT);
         $actions = $table->fields(array("count(*) as count", "gender", "type"))->where(array("str" => $query_str2, "uid" => array('in' => $user_ids), "type" => array('in' => '10,9')))->groupBy("type,gender")->select();
         foreach ($actions as $action) {
             //总消息量
             if ($action['type'] == '9') {
                 if ($action['gender'] == 1) {
                     $user_star_date['star_messages_man'] = $action['count'];
                 }
                 if ($action['gender'] == 2) {
                     $user_star_date['star_messages_woman'] = $action['count'];
                 }
             }
             //关注人数
             if ($action['type'] == '10') {
                 if ($action['gender'] == 1) {
                     $user_star_date['star_follow_man'] = $action['count'];
                 }
                 if ($action['gender'] == 2) {
                     $user_star_date['star_follow_woman'] = $action['count'];
                 }
             }
         }
         $table = new FTable("Actions", "ac", FDB::$DB_MUMU_STAT);
         $actions = $table->where(array("str" => $query_str2, "uid" => array('in' => $user_ids), "gender" => 1, "type" => '13'))->groupBy("uid")->select();
         $user_star_date['star_game_man'] = count($actions);
         $table = new FTable("Actions", "ac", FDB::$DB_MUMU_STAT);
         $actions = $table->where(array("str" => $query_str2, "uid" => array('in' => $user_ids), "gender" => 2, "type" => '13'))->groupBy("uid")->select();
         $user_star_date['star_game_woman'] = count($actions);
         //echo(json_encode($user_star_date));
         $table = new FTable("user_star_date");
         $user_star_date1 = $table->where(array("date" => $datetime_zuotian))->select();
         if ($user_star_date1) {
             $user_star_level_table = new FTable("user_star_date");
             $result = $user_star_level_table->where(array('date' => $datetime_zuotian))->update($user_star_date);
         } else {
             $user_star_level_table = new FTable("user_star_date");
             $result = $user_star_level_table->insert($user_star_date);
         }
         if ($result) {
             //$this->success('插入成功!');
         } else {
             //$this->error("插入失败");
         }
     }
 }
示例#18
0
文件: FDB.php 项目: jiatower/php
 /**
  * 插入数据
  *
  * @param $table
  * @param $data
  *
  * @return bool
  */
 public static function insert($table, $data)
 {
     if (!$data['status']) {
         $data['status'] = 1;
     }
     $table = new FTable($table);
     return $table->insert($data);
 }
示例#19
0
文件: MumuBa.php 项目: jiatower/php
 /**
  * 添加
  */
 function addAction()
 {
     if ($this->isPost()) {
         $text = FRequest::getPostString('text');
         $riqi = date("Y-m-d", time());
         $pic = FRequest::getPostString('pic');
         $title = FRequest::getPostString('title');
         if (!$pic) {
             $this->showMessage("图片不能为空", error);
             return;
         }
         if (!$title) {
             $this->showMessage("标题不能为空", error);
             return;
         }
         //打开网页
         //print_r($content);
         $data2 = array('title' => $title, 'text' => $text, 'pic' => $pic, 'riqi' => $riqi);
         $mumu_ba_table = new FTable("mumu_ba");
         $mumu_ba_table->insert($data2);
         $this->showMessage("添加成功", "success", "/MumuBa/list");
         return;
     }
     $this->display('admin/mumu_ba_add');
 }
示例#20
0
 /**
  * 添加焦点图
  */
 function addAction()
 {
     $type = FRequest::getString('type');
     $this->assign('type', $type);
     if ($this->isPost()) {
         $text = FRequest::getPostString('text');
         $pic = FRequest::getPostString('pic');
         $anniu_caozuo = FRequest::getPostInt('anniu_caozuo');
         $events_id = FRequest::getPostInt('events_id');
         $type = FRequest::getPostString('type');
         $position = CommonUtil::getComParam(FRequest::getPostInt('position'), 0);
         if (!$pic) {
             $this->showMessage("图片不能为空", error);
             return;
         }
         //打开网页
         $url = FRequest::getPostString('url');
         //打开游戏
         $gid = FRequest::getPostString('gid');
         $area_id = FRequest::getPostString('area_id');
         $buts = array();
         if ($anniu_caozuo == 1) {
             $data = array("url" => $url);
             if (!$url) {
                 $this->showMessage("链接地址不能为空", error);
                 return;
             }
             $buts = array("cmd" => "cmd_open_web", "data" => $data);
         }
         if ($anniu_caozuo == 2) {
             $data = array();
             $buts = array("cmd" => "cmd_open_actlist", "data" => $data);
         }
         if ($anniu_caozuo == 3) {
             $data = array("id" => $events_id);
             $buts = array("cmd" => "cmd_open_act", "data" => $data);
         }
         if ($anniu_caozuo == 4) {
             $data = array();
             $buts = array("cmd" => "cmd_open_actaward", "data" => $data);
         }
         if ($anniu_caozuo == 5) {
             $data = array("gid" => $gid, "area_id" => $area_id);
             $buts = array("cmd" => "cmd_entry_game", "data" => $data);
         }
         $text = str_replace("<p>", "", $text);
         $text = str_replace("</p>", "<br>", $text);
         $action = self::decodeUnicode(json_encode($buts));
         //print_r($content);
         $data2 = array('type' => $type, 'text' => $text, 'pic' => $pic, 'action' => $action, 'position' => $position, 'status' => 1);
         $events_table = new FTable("focus");
         $events_table->insert($data2);
         $this->showMessage("添加成功", "success", "/FocusList/list?type=" . $type . "");
         return;
     }
     $this->display('admin/focus_add');
 }
示例#21
0
文件: Crontab.php 项目: jiatower/php
 function messageDateAction()
 {
     // $datetime_zuotian = date("Y-m-d ", time() - 86400);
     // $datetime_jintian = date("Y-m-d ", time());
     $datetime_jintian = FRequest::getString("datetime_jintian");
     if (!$datetime_jintian) {
         $datetime_jintian = date("Y-m-d ", time());
     }
     if ($datetime_jintian) {
         //$datetime_jintian = "2015-07-04";
         //$datetime_jintian = date("Y-m-d ", time());
         $datetime_zuotian = date("Y-m-d", strtotime("{$datetime_jintian} - 1 days"));
         $datetime_qitian = date("Y-m-d ", strtotime("{$datetime_jintian} - 7 days"));
         $query_str_7 = "  tm < '" . $datetime_qitian . " 00:00:00'   ";
         $where = array();
         $users = array();
         $query_str = " mm.from>'5000000' and mm.tm >= '" . $datetime_zuotian . " 00:00:00' and  mm.tm < '" . $datetime_jintian . " 00:00:00' and mm.type in ('text','pic','voice') ";
         //$query_str = " 1=1";
         $useradds = new FTable('user_message_7');
         $useradds->where(array('str' => $query_str_7))->remove(true);
         $where["str"] = $query_str;
         $table = new FTable("message", "mm", FDB::$DB_MUMU_MESSAGE);
         $user_messages = $table->fields(array("mm.from", "mm.tm"))->where($where)->groupBy("mm.from")->select();
         foreach ($user_messages as $user_message) {
             $data2 = array('uid' => $user_message['from'], 'tm' => $user_message['tm']);
             $user_detail_table = new FTable("user_message_7");
             $user_detail_table->insert($data2);
         }
         $table = new FTable("tag_message", "mm", FDB::$DB_MUMU_MESSAGE);
         $user_messages = $table->fields(array("mm.from", "mm.tm"))->where($where)->groupBy("mm.from")->select();
         foreach ($user_messages as $user_message) {
             $data2 = array('uid' => $user_message['from'], 'tm' => $user_message['tm']);
             $user_detail_table = new FTable("user_message_7");
             $user_detail_table->insert($data2);
         }
     }
 }