Example #1
0
 public function single1kindAction()
 {
     $id = $this->dispatcher->getParam(0);
     $user_id = 0;
     if ($this->session->has("current_user")) {
         $user_id = unserialize($this->session->get("current_user"))->id;
     }
     $common = new model\common();
     $sql = "call p_get_bd_detail(?)";
     $query = $common->getReadConnection()->query($sql, array($id));
     $result = $query->fetchAll();
     if (count($result) != 1) {
         $this->response->redirect("fzf.php");
         $this->view->disable();
     } else {
         $this->view->bd = $result[0];
         $query->nextRowSet();
         //详细
         $this->view->places = $query->fetchAll();
         $query->nextRowSet();
         //所有商圈
         $this->view->bds = $query->fetchAll();
     }
     if ($this->settings["is_mobile"] == "true") {
         $this->view->pick("bd/mb-single1kind");
     }
 }
Example #2
0
 public function moreHistoryAction()
 {
     if ($this->settings["is_mobile"] == "true") {
         $idquestion = $_GET["idquestion"];
         $idarticle = $_GET["idarticle"];
         $idbookticket = $_GET["idbookticket"];
         $idbookmeal = $_GET["idbookmeal"];
         $idactvt = $_GET["idactvt"];
         $common = new model\common();
         $sql = "call p_get_history_data(?,?,?,?,?)";
         $query = $common->getReadConnection()->query($sql, array($idquestion, $idarticle, $idbookticket, $idbookmeal, $idactvt));
         //获取数据
         $result = $query->fetchAll();
         usort($result, function ($a, $b) {
             return $a["create_time"] < $b["create_time"];
         });
         $this->view->data = $result;
         $this->view->pick("index/mb-more");
         $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
     }
 }
Example #3
0
 public function evalMealAction()
 {
     if (!$this->session->has("current_user")) {
         $this->response->redirect("login/login");
         $this->view->disable();
         return;
     }
     if ($this->request->isPost()) {
         $book_meal_id = $_POST["id"];
         $evaluation_rank = $_POST["evaluation_rank"];
         $evaluation = $_POST["evaluation"];
         $sql = "UPDATE `book_meal` SET `evaluation`=? ,`evaluation_rank`=?,`state`='cofirm_closed',`closed_time`=now() where id=?";
         $myModel = new model\common();
         $query = $myModel->getReadConnection()->query($sql, array($evaluation, $evaluation_rank, $book_meal_id));
         $this->response->redirect("dofavor/singleMeal/" . $book_meal_id);
         $this->view->disable();
     }
 }
Example #4
0
 /**
  * 微信个人中心
  *  URL:https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxe5cc657d28788f78&redirect_uri=http%3a%2f%2fcssv.anneijia.com%2Flogin%2FwechatLogin&response_type=code&scope=snsapi_userinfo&state=ik#wechat_redirect
  *
  */
 public function wechatMeAction()
 {
     require_once "/../../utility/wechat.class.php";
     $weObj = new \UtillYou\Utility\Wechat();
     $OAuthToken = $weObj->getOauthAccessToken();
     if (!$OAuthToken) {
         echo '请通过微信客户端进入';
         $this->view->disable();
         return;
     }
     $O_user_info = $weObj->getOauthUserinfo($OAuthToken['access_token'], $OAuthToken['openid']);
     $sql = "call p_wechat_user_login(?,?,?,?,?,?,?,?,?)";
     $common = new model\common();
     $result = $common->getReadConnection()->query($sql, array($O_user_info['openid'], $O_user_info['nickname'], $O_user_info['sex'], $O_user_info['province'], $O_user_info['city'], $O_user_info['country'], serialize($O_user_info['privilege']), $O_user_info['headimgurl'], isset($O_user_info['unionid']) ? $O_user_info['unionid'] : ''))->fetchAll();
     $db_user = (object) $result[0];
     $this->session->set("current_user", serialize($db_user));
     $this->session->set("wx_env", "wechat");
     //$db_auth=model\rmAuthToken::findFirstByUser_id($db_user->id);
     //if($db_auth){//有,就更新
     //	$db_auth->selector=$selector;
     //	$db_auth->token_hash=$token_hash;
     //	$db_auth->update();
     //}else{//没有,就创建
     //	$rm_auth_token=new model\rmAuthToken();
     //	$rm_auth_token->selector=$selector;
     //	$rm_auth_token->token_hash=$token_hash;
     //	$rm_auth_token->user_id=$db_user->id;
     //	$rm_auth_token->create();
     //}
     //setcookie("login_auth",$selector.":".$token,time()+60*60*24*30 );
     return $this->response->redirect("user/me/" . $db_user->id);
 }
Example #5
0
 public function indexAction()
 {
     $this->view->title = "案内家-问答";
     if ($this->settings["is_mobile"] == "true") {
         $sql = "select * from v_question_list order by question_id desc limit 20";
         if (isset($_GET["k"])) {
             $key = $_GET["k"];
             $value = $_GET["v"];
             switch ($key) {
                 case 'tag':
                     $sql = "select a.is_secret,a.id as question_id,a.body,a.pics,a.votes,a.create_time,a.owner_id,a.owner_name,a.status,a.has_viewed,a.answers_count,a.has_accepted,a.deleted,group_concat(c.tag_name order by c.tag_id) as tag_names,group_concat(c.tag_id order by c.tag_id) as tag_ids\nfrom question a\n\tinner join user b on a.owner_id=b.id\n\tleft join question_tag c on a.id=c.question_id\n\twhere c.tag_id=?\n\tgroup by a.id;";
                     break;
                 case "accepted":
                     $sql .= " where has_accepted=?";
                     break;
                 case "key":
                     $sql .= " where body like '%" . $value . "%'";
                     break;
                 default:
                     # code...
                     break;
             }
         }
         $common = new model\common();
         if (isset($_GET["v"])) {
             $query = $common->getReadConnection()->query($sql, array($_GET["v"]));
         } else {
             $query = $common->getReadConnection()->query($sql);
         }
         //获取问题
         $this->view->questions = $query->fetchAll();
         $this->view->pick("question/mb-index");
     }
 }
Example #6
0
 public function supportAction()
 {
     if (!$this->session->has("current_user")) {
         $this->response->redirect("index/index");
         $this->view->disable();
         return;
     }
     if ($this->request->isPost()) {
         $object_id = $_POST["object_id"];
         $object_type = $_POST["object_type"];
         $positive = $_POST["positive"] == "true" ? 1 : 0;
         $sql = "CALL p_support_article_comment(?,?,?,?);";
         $myModel = new model\common();
         if ($object_type == 'article') {
             $sql = "CALL p_support_article(?,?,?);";
             $query = $myModel->getReadConnection()->query($sql, array($object_id, unserialize($this->session->get("current_user"))->id, $positive));
         } else {
             $article_id = $_POST["article_id"];
             $query = $myModel->getReadConnection()->query($sql, array($object_id, unserialize($this->session->get("current_user"))->id, $positive, $article_id));
         }
     }
 }
Example #7
0
 public function usersAction()
 {
     $common = new model\common();
     $query = $common->getReadConnection()->query("select * from user order by score desc limit 100");
     $this->view->users = $query->fetchAll();
     if ($this->settings["is_mobile"] == "true") {
         $this->view->pick("user/mb-users");
     }
 }
Example #8
0
 public function hasInfoAction()
 {
     if ($this->session->has("current_user")) {
         $sql = "select count(id) as ct from user_notification where user_id=? and deleted=0 and viewed=0;";
         $myModel = new model\common();
         $query = $myModel->getReadConnection()->query($sql, array(unserialize($this->session->get("current_user"))->id));
         echo $query->fetchAll()[0][0];
     } else {
         echo "0";
     }
     $this->view->disable();
 }
Example #9
0
 public function closeActvtAction()
 {
     if (!$this->session->has("current_user")) {
         $this->response->redirect("index/index");
         $this->view->disable();
         return;
     }
     $actvt_id = $_POST["actvt_id"];
     $sql = "update actvt set state='closed' where id=?";
     $myModel = new model\common();
     $query = $myModel->getReadConnection()->query($sql, array($actvt_id));
     $this->view->disable();
 }