Esempio n. 1
0
 public function index()
 {
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $root = array();
     $root['page_title'] = '预约技师';
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root['return'] = 1;
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         $sql = 'SELECT * FROM ' . DB_PREFIX . 'user WHERE is_effect = 1 AND is_delete = 0 AND service_type_id = 2';
         $tech_list = $GLOBALS['db']->getAll($sql);
         foreach ($tech_list as $key => $value) {
             $p = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $value['province_id']);
             $c = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $value['city_id']);
             for ($i = 0; $i < $value['service_level_id']; $i++) {
                 $value['tech_level'][] = $i;
             }
             $value['addr'] = $p['name'] . '-' . $c['name'] . '-' . $value['addr_detail'];
             $value['user_avatar'] = get_abs_img_root(get_muser_avatar($value['id'], "big"));
             $tech_list[$key] = $value;
         }
         $root['tech_list'] = $tech_list;
     } else {
         $root['user_login_status'] = 0;
     }
     $root['user'] = $user;
     $root['city_name'] = $city_name;
     output($root);
 }
Esempio n. 2
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $result = do_login_user($email, $pwd);
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     $page = intval($GLOBALS['request']['page']) > 0 ? intval($GLOBALS['request']['page']) : 1;
     $page_size = 20;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $user_id = intval($GLOBALS['user_info']['id']);
     $sql = "select group_key,count(group_key) as total from " . DB_PREFIX . "msg_box  \r\n\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1))  \r\n\t\t\t\tgroup by group_key \r\n\t\t\t\torder by system_msg_id desc,max(create_time) desc limit " . $limit;
     $sql_count = "select count(distinct(group_key)) from " . DB_PREFIX . "msg_box  \r\n\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1))";
     $list = $GLOBALS['db']->getAll($sql);
     foreach ($list as $k => $v) {
         $list[$k] = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_box where group_key = '" . $v['group_key'] . "' and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1))  order by create_time desc limit 1");
         $list[$k]['total'] = $v['total'];
         if ($list[$k]['system_msg_id'] > 0) {
             $sys_msgs[] = array("mid" => $list[$k]['group_key'], "uid" => $list[$k]['to_user_id'], "status" => 1, "title" => $list[$k]['title'], "time" => pass_date($list[$k]['create_time']));
         } else {
             $msg_list[] = array("content" => $list[$k]['content'], "uid" => $list[$k]['from_user_id'], "user_name" => $list[$k]['from_user_id'] == $user_data['id'] ? "我" : $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($list[$k]['from_user_id'])), "user_avatar" => get_abs_img_root(get_muser_avatar($list[$k]['from_user_id'], "big")), "tuid" => $list[$k]['to_user_id'], "tuser_name" => $list[$k]['to_user_id'] == $user_data['id'] ? "我" : $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($list[$k]['to_user_id'])), "tuser_avatar" => get_abs_img_root(get_muser_avatar($list[$k]['to_user_id'], "big")), "time" => pass_date($list[$k]['create_time']), "msg_count" => $list[$k]['total'], "mlid" => $list[$k]['group_key']);
         }
     }
     $count = $GLOBALS['db']->getOne($sql_count);
     $root['return'] = 1;
     $root['sys_msgs'] = $sys_msgs;
     $root['msg_list'] = $msg_list;
     //分页
     $page_info['page'] = $page;
     $page_info['page_total'] = ceil($count / $page_size);
     $root['page'] = $page_info;
     output($root);
 }
Esempio n. 3
0
 public function index()
 {
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $root = array();
     $user_data = $GLOBALS['user_info'];
     //logUtils::log_obj($user_data);
     $user_id = intval($user_data['id']);
     if ($user_id == 0) {
         $root['user_login_status'] = 0;
         $root['info'] = "请先登陆";
         $root['page_title'] = "登陆";
     } else {
         $root['user_login_status'] = 1;
         $root['info'] = "用户中心";
         $root['page_title'] = "用户中心";
         $root['uid'] = $user_data['id'];
         $root['user_name'] = $user_data['user_name'];
         $root['user_email'] = $user_data['email'];
         $root['user_money'] = $user_data['money'];
         $root['user_money_format'] = format_price($user_data['money']);
         //用户金额
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     }
     $root['mana_page_title'] = '经理中心';
     $root['user'] = $user_data;
     $root['city_name'] = $city_name;
     output($root);
 }
Esempio n. 4
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $user_data = $GLOBALS['user_info'];
     if (intval($user_data['id']) == 0) {
         $root['return'] = 0;
         $root['info'] = "请先登录";
         output($root);
     }
     if (isset($_FILES['image_1'])) {
         //开始上传
         //创建avatar临时目录
         if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
             @mkdir(APP_ROOT_PATH . "public/avatar");
             @chmod(APP_ROOT_PATH . "public/avatar", 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
             @mkdir(APP_ROOT_PATH . "public/avatar/temp");
             @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
         }
         $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
         //开始移动图片到相应位置
         $id = intval($user_data['id']);
         $uid = sprintf("%09d", $id);
         $dir1 = substr($uid, 0, 3);
         $dir2 = substr($uid, 3, 2);
         $dir3 = substr($uid, 5, 2);
         $path = $dir1 . '/' . $dir2 . '/' . $dir3;
         //创建相应的目录
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
         }
         if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
             @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
             @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
         }
         $id = str_pad($id, 2, "0", STR_PAD_LEFT);
         $id = substr($id, -2);
         $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
         $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
         $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
         @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
         @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
         @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
         @unlink($img_result['image_1']['thumb']['big']['path']);
         @unlink($img_result['image_1']['thumb']['middle']['path']);
         @unlink($img_result['image_1']['thumb']['small']['path']);
         @unlink($img_result['image_1']['path']);
         //end 上传
     }
     $root['return'] = 1;
     $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     output($root);
 }
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $result = do_login_user($email, $pwd);
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     $user_data['id'] = intval($user_data['id']);
     $page = intval($GLOBALS['request']['page']);
     if ($page == 0) {
         $page = 1;
     }
     $home_uid = intval($GLOBALS['request']['uid']);
     $home_user_info_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $home_uid . " and is_effect = 1 and is_delete = 0");
     if (!$home_user_info_data) {
         $root['info'] = "非法的会员";
         output($root);
     }
     $user_info['uid'] = $user_data['id'];
     $user_info['email'] = $user_data['email'];
     $user_info['user_name'] = $user_data['user_name'];
     $user_info['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     $root['user'] = $user_info;
     $home_user_info['uid'] = $home_user_info_data['id'];
     $home_user_info['email'] = $home_user_info_data['email'];
     $home_user_info['user_name'] = $home_user_info_data['user_name'];
     $home_user_info['user_avatar'] = get_abs_img_root(get_muser_avatar($home_user_info_data['id'], "big"));
     $home_user_info['fans'] = $home_user_info_data['focused_count'];
     $home_user_info['follows'] = $home_user_info_data['focus_count'];
     $home_user_info['photos'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_image where user_id = " . $home_user_info_data['id']);
     $home_user_info['favs'] = $GLOBALS['db']->getOne("select sum(fav_count) from " . DB_PREFIX . "topic where user_id = " . $home_user_info_data['id']);
     $root['home_user'] = $home_user_info;
     $limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
     $follow_list = $GLOBALS['db']->getAll("select focused_user_id as id,focused_user_name as user_name from " . DB_PREFIX . "user_focus where focus_user_id = " . $home_user_info_data['id'] . " order by id desc limit " . $limit);
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_focus where focus_user_id = " . $home_user_info_data['id']);
     $follows = array();
     foreach ($follow_list as $k => $v) {
         $follows[$k]['uid'] = $v['id'];
         $follows[$k]['user_name'] = $v['user_name'];
         $follows[$k]['fans'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_focus where focused_user_id = " . $v['id']);
         $follows[$k]['user_avatar'] = get_abs_img_root(get_muser_avatar($v['id'], "big"));
         if ($v['id'] == $user_data['id']) {
             $follows[$k]['is_follow'] = -1;
         } else {
             $focus_uid = intval($v['id']);
             $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_info['uid'] . " and focused_user_id = " . $focus_uid);
             if ($focus_data) {
                 $follows[$k]['is_follow'] = 1;
             } else {
                 $follows[$k]['is_follow'] = 0;
             }
         }
     }
     $root['page'] = array("page" => $page, "page_total" => ceil($total / PAGE_SIZE));
     $root['item'] = $follows;
     $root['return'] = 1;
     $root['status'] = 1;
     output($root);
 }
Esempio n. 6
0
 public function index()
 {
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $root = array();
     $root['page_title'] = '名下技师';
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root['return'] = 1;
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         //配置分页参数
         require_once APP_ROOT_PATH . "wap/lib/page.php";
         $page_size = 10;
         $page = intval($GLOBALS['request']['page']);
         if ($page == 0) {
             $page = 1;
         }
         $limit = ($page - 1) * $page_size . "," . $page_size;
         $sql = 'SELECT 
                     * 
                   FROM
                     ' . DB_PREFIX . 'user 
                   WHERE is_effect = 1 
                     AND is_delete = 0 
                     AND service_type_id = 2
                     AND p_id =' . $user_id . ' limit ' . $limit;
         $sql_count = 'SELECT 
                     count(*) 
                   FROM
                     ' . DB_PREFIX . 'user 
                   WHERE is_effect = 1 
                     AND is_delete = 0 
                     AND service_type_id = 2
                     AND p_id =' . $user_id;
         $tech_list = $GLOBALS['db']->getAll($sql);
         foreach ($tech_list as $key => $value) {
             $p = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $value['province_id']);
             $c = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $value['city_id']);
             for ($i = 0; $i < $value['service_level_id']; $i++) {
                 $value['tech_level'][] = $i;
             }
             $value['addr'] = $p['name'] . '-' . $c['name'] . '-' . $value['addr_detail'];
             $value['user_avatar'] = get_abs_img_root(get_muser_avatar($value['id'], "big"));
             $tech_list[$key] = $value;
         }
         //配置分页
         $count = $GLOBALS['db']->getOne($sql_count);
         $page_total = ceil($count / $page_size);
         $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
         $root['tech_list'] = $tech_list;
     } else {
         $root['user_login_status'] = 0;
     }
     $root['user'] = $user;
     $root['city_name'] = $city_name;
     output($root);
 }
Esempio n. 7
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $user_data = $GLOBALS['user_info'];
     $page = intval($GLOBALS['request']['page']) > 0 ? intval($GLOBALS['request']['page']) : 1;
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $user_id = intval($GLOBALS['user_info']['id']);
     $group_key = addslashes(trim($GLOBALS['request']['mid']));
     $sql = "select count(*) as count,max(system_msg_id) as system_msg_id,max(id) as id from " . DB_PREFIX . "msg_box  \n\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1))  \n\t\t\t\tand group_key = '" . $group_key . "'";
     $row = $GLOBALS['db']->getRow($sql);
     if ($row['count'] == 0) {
         $root['return'] = 0;
     } elseif ($row['system_msg_id'] > 0) {
         //系统消息,仅查看
         $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_box where id = " . $row['id'] . " and is_delete = 0");
         $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set is_read = 1 where id = " . $row['id']);
         $root['return'] = 1;
         $root['msg'] = array('mid' => $group_key, 'title' => $data['title'], 'message' => $data['content'], 'time' => pass_date($data['create_time']));
     } else {
         $root['return'] = 1;
         $root['lid'] = $group_key;
         //消息记录
         $sql = "select * from " . DB_PREFIX . "msg_box  \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1))  \n\t\t\t\t\tand group_key = '" . $group_key . "' \n\t\t\t\t\torder by create_time desc limit " . $limit;
         $sql_count = "select count(*) from " . DB_PREFIX . "msg_box  \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1)) and group_key = '" . $group_key . "'";
         $upd_sql = "update " . DB_PREFIX . "msg_box set is_read = 1 \n\t\t\t\t\twhere is_delete = 0 and ((to_user_id = " . $user_id . " and `type` = 0) or (from_user_id = " . $user_id . " and `type` = 1))  \n\t\t\t\t\tand group_key = '" . $group_key . "' ";
         $GLOBALS['db']->query($upd_sql);
         $list = $GLOBALS['db']->getAll($sql);
         foreach ($list as $k => $v) {
             if ($v['to_user_id'] != $user_id) {
                 $dest_user_id = $v['to_user_id'];
                 break;
             }
             if ($v['from_user_id'] != $user_id) {
                 $dest_user_id = $v['from_user_id'];
                 break;
             }
         }
         $dest_user_name = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . $dest_user_id);
         $root['title'] = "与" . $dest_user_name . "的交流";
         $root['t_name'] = $dest_user_name;
         $count = $GLOBALS['db']->getOne($sql_count);
         $page_info['page'] = $page;
         $page_info['page_total'] = ceil($count / $page_size);
         $page_info['page_size'] = $page_size;
         $root['page'] = $page_info;
         $msg_list = array();
         foreach ($list as $k => $v) {
             $msg_list[] = array("miid" => $v['id'], "mlid" => $v['group_key'], "uid" => $v['from_user_id'], "message" => $v['content'], "time" => pass_date($v['create_time']), "tuid" => $v['to_user_id'], "tuser_name" => $v['to_user_id'] == $user_id ? "我" : $dest_user_name, "tuser_avatar" => get_abs_img_root(get_muser_avatar($v['to_user_id'], "big")), "content" => $v['content'], "user_name" => $v['from_user_id'] == $user_id ? "我" : $dest_user_name, "user_avatar" => get_abs_img_root(get_muser_avatar($v['from_user_id'], "big")));
         }
         $root['msg_list'] = $msg_list;
     }
     if (strim($GLOBALS['request']['from']) == "wap") {
         $root['f_link_data'] = get_link_list();
         $root['email'] = $email;
     }
     // fwb add 2014-08-27
     output($root);
 }
Esempio n. 8
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/model/user.php";
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $root = array();
     $user_data = $GLOBALS['user_info'];
     $user_data['id'] = intval($user_data['id']);
     $uid = intval($user_data['id']);
     if ($uid == 0) {
         $root['info'] = "请先登陆";
         $root['return'] = 2;
         output($root);
     }
     $page = intval($GLOBALS['request']['page']);
     if ($page == 0) {
         $page = 1;
     }
     $user_info['uid'] = $user_data['id'];
     $user_info['email'] = $user_data['email'];
     $user_info['user_name'] = $user_data['user_name'];
     $user_info['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     $root['home_user'] = $root['user'] = $user_info;
     //关注的用户ID
     $uids = $GLOBALS['db']->getOne("select group_concat(focused_user_id) from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_data['id'] . " order by rand() limit 50");
     if ($uids) {
         $uids .= ",0";
     } else {
         $uids = "0";
     }
     $limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
     $topic_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and user_id in (" . $uids . ") order by create_time desc limit " . $limit);
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and user_id in (" . $uids . ") ");
     foreach ($topic_list as $k => $v) {
         $topic_list[$k] = m_get_topic_item($v);
         if ($v['fav_id'] > 0 || $v['relay_id'] > 0) {
             $relay_share = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and id = " . $v['origin_id']);
         }
         if ($relay_share) {
             $topic_list[$k]['relay_share'] = m_get_topic_item($relay_share);
         }
     }
     $root['return'] = 1;
     $root['item'] = $topic_list;
     $root['page'] = array("page" => $page, "page_total" => ceil($total / PAGE_SIZE), "page_size" => PAGE_SIZE);
     output($root);
 }
Esempio n. 9
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $result = do_login_user($email, $pwd);
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     $user_data['id'] = intval($user_data['id']);
     $user_info['uid'] = $user_data['id'];
     $user_info['email'] = $user_data['email'];
     $user_info['user_name'] = $user_data['user_name'];
     $user_info['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     $page = intval($GLOBALS['request']['page']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
     $list = $GLOBALS['db']->getAll("select id,user_name,daren_title from " . DB_PREFIX . "user where is_delete = 0 and is_effect = 1 and is_daren = 1 order by id desc limit " . $limit);
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where is_delete = 0 and is_effect = 1 and is_daren = 1 ");
     $darens = array();
     foreach ($list as $k => $v) {
         $darens[$k]['uid'] = $v['id'];
         $darens[$k]['user_name'] = $v['user_name'];
         if ($v['daren_title'] != '') {
             $darens[$k]['user_name'] .= "[" . $v['daren_title'] . "]";
         }
         $darens[$k]['fans'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_focus where focused_user_id = " . $v['id']);
         $darens[$k]['user_avatar'] = get_abs_img_root(get_muser_avatar($v['id'], "big"));
         if ($v['id'] == $user_data['id']) {
             $darens[$k]['is_follow'] = -1;
         } else {
             $focus_uid = intval($v['id']);
             $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . $user_info['uid'] . " and focused_user_id = " . $focus_uid);
             if ($focus_data) {
                 $darens[$k]['is_follow'] = 1;
             } else {
                 $darens[$k]['is_follow'] = 0;
             }
         }
     }
     $root['page'] = array("page" => $page, "page_total" => ceil($total / PAGE_SIZE));
     $root['item'] = $darens;
     $root['return'] = 1;
     $root['status'] = 1;
     output($root);
 }
Esempio n. 10
0
 public function index()
 {
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $root = array();
     $root['page_title'] = '技师详情';
     $root['mana_page_title'] = '客户资料';
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root['return'] = 1;
     if ($user_id > 0) {
         $m_user_id = $GLOBALS['request']['m_user_id'];
         $root['user_login_status'] = 1;
         $sql = 'SELECT 
                     * 
                   FROM
                     ' . DB_PREFIX . 'user 
                   WHERE id =' . $m_user_id;
         $m_user = $GLOBALS['db']->getRow($sql);
         //地址
         $p = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $m_user['province_id']);
         $c = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $m_user['city_id']);
         $m_user['addr'] = $p['name'] . '-' . $c['name'] . '-' . $m_user['addr_detail'];
         //星级
         for ($i = 0; $i < $m_user['service_level_id']; $i++) {
             $m_user['tech_level'][] = $i;
         }
         //性别
         if ($m_user['sex'] == 1) {
             $m_user['sex'] = '男';
         } elseif ($m_user['sex'] == 0) {
             $m_user['sex'] = '女';
         } else {
             $m_user['sex'] = '保密';
         }
         //头像
         $m_user['user_avatar'] = get_abs_img_root(get_muser_avatar($m_user_id, "big"));
         $root['m_user'] = $m_user;
     } else {
         $root['user_login_status'] = 0;
     }
     $root['user'] = $user;
     $root['city_name'] = $city_name;
     output($root);
 }
Esempio n. 11
0
 public function index()
 {
     /*
     	$email = strim($GLOBALS['request']['email']);//用户名或邮箱
     	if (isset($GLOBALS['request']['old_pwd'])){
     		$pwd = strim($GLOBALS['request']['old_pwd']);//密码
     	}else{
     		$pwd = strim($GLOBALS['request']['pwd']);//密码
     	}
     */
     $new_pwd = strim($GLOBALS['request']['newpassword']);
     //新密码
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root = array();
     $root['page_title'] = '修改密码';
     $root['user_name'] = $user['user_name'];
     $root['city_name'] = $city_name;
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         if (strlen($GLOBALS['request']['newpassword']) < 4) {
             $root['return'] = 0;
             $root['info'] = "注册密码不能少于4位";
             output($root);
         }
         $new_pwd = md5($new_pwd);
         $sql = "update " . DB_PREFIX . "user set user_pwd = '" . $new_pwd . "' where id = {$user_id}";
         $GLOBALS['db']->query($sql);
         $root['return'] = 1;
         $root['uid'] = $user_id;
         $root['email'] = $user['email'];
         $root['user_name'] = $user['user_name'];
         $root['user_pwd'] = $new_pwd;
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
         $root['info'] = "密码更新成功!";
     } else {
         $root['return'] = 0;
         $root['user_login_status'] = 0;
         $root['info'] = "原始密码不正确";
     }
     output($root);
 }
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $result = do_login_user($email, $pwd);
     $user_data = es_session::get('user_info');
     $user_data['id'] = intval($user_data['id']);
     $uid = intval($user_data['id']);
     if ($uid == 0) {
         $root['return'] = 0;
         $root['info'] = "请先登陆";
         output($root);
     }
     $page = intval($GLOBALS['request']['page']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
     //输出回复
     $sql = "select r.* from " . DB_PREFIX . "topic_reply as r left join " . DB_PREFIX . "topic as t on r.topic_id = t.id \r\n\t\t\t\twhere (t.user_id = " . $uid . " or r.user_id = " . $uid . ") and r.is_effect = 1 and r.is_delete = 0 \r\n\t\t\t\torder by r.create_time desc limit " . $limit;
     $sql_count = "select count(*) from " . DB_PREFIX . "topic_reply as r left join " . DB_PREFIX . "topic as t on r.topic_id = t.id \r\n\t\t\t\twhere (t.user_id = " . $uid . " or r.user_id = " . $uid . ") and r.is_effect = 1 and r.is_delete = 0";
     $list = $GLOBALS['db']->getAll($sql);
     $total = $GLOBALS['db']->getOne($sql_count);
     $comment_list = array();
     foreach ($list as $k => $v) {
         $comment_list[$k]['comment_id'] = $v['id'];
         $comment_list[$k]['share_id'] = $v['topic_id'];
         $comment_list[$k]['uid'] = $v['user_id'];
         $comment_list[$k]['parent_id'] = $v['reply_id'];
         $comment_list[$k]['content'] = $v['content'];
         $comment_list[$k]['create_time'] = $v['create_time'];
         $topic = $GLOBALS['db']->getRow("select user_name,content from " . DB_PREFIX . "topic where id = " . $v['topic_id']);
         $comment_list[$k]['scontent'] = "//@" . $topic['user_name'] . ":" . $topic['content'];
         $comment_list[$k]['user_name'] = $v['user_name'];
         $comment_list[$k]['user_avatar'] = get_abs_img_root(get_muser_avatar($v['user_id'], "big"));
         $comment_list[$k]['time'] = pass_date($v['create_time']);
         $comment_list[$k]['parse_expres'] = get_parse_expres($comment_list[$k]['content'] . $comment_list[$k]['scontent']);
         $comment_list[$k]['parse_user'] = get_parse_user($comment_list[$k]['content'] . $comment_list[$k]['scontent']);
     }
     $root['item'] = $comment_list;
     $root['page'] = array("page" => $page, "page_total" => ceil($total / PAGE_SIZE));
     $root['return'] = 1;
     output($root);
 }
Esempio n. 13
0
 public function index()
 {
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $new_pwd = strim($GLOBALS['request']['newpassword']);
     //新密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     $root = array();
     if ($user_id > 0) {
         $root['user_login_status'] = 0;
         if (strlen($GLOBALS['request']['newpassword']) < 4) {
             $root['return'] = 0;
             $root['info'] = "注册密码不能少于4位";
             output($root);
         }
         if ($new_pwd != $pwd) {
             $sql = "update " . DB_PREFIX . "user set user_pwd = '" . md5($new_pwd) . "' where id = {$user_id}";
             $GLOBALS['db']->query($sql);
             $rs = $GLOBALS['db']->affected_rows();
         } else {
             $rs = 1;
         }
         if ($rs > 0) {
             $root['return'] = 1;
             $root['uid'] = $user_id;
             $root['email'] = $user['email'];
             $root['user_name'] = $user['user_name'];
             $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
             $root['info'] = "密码更新成功!";
         } else {
             $root['return'] = 0;
             $root['info'] = "密码更新失败!";
         }
     } else {
         $root['return'] = 0;
         $root['user_login_status'] = 1;
         $root['info'] = "原始密码不正确";
     }
     output($root);
 }
Esempio n. 14
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $email = strim($GLOBALS['request']['email']);
     $pwd = strim($GLOBALS['request']['pwd']);
     $result = do_login_user($email, $pwd);
     $user_data = es_session::get('user_info');
     $uid = intval($user_data['id']);
     if ($uid == 0) {
         $root['info'] = "请先登陆";
         output($root);
     }
     $page = intval($GLOBALS['request']['page']);
     if ($page == 0) {
         $page = 1;
     }
     $user_info['uid'] = $user_data['id'];
     $user_info['email'] = $user_data['email'];
     $user_info['user_name'] = $user_data['user_name'];
     $user_info['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     $root['home_user'] = $root['user'] = $user_info;
     $limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
     $user_name = $user_data['user_name'];
     $user_name_unicode = str_to_unicode_string($user_name);
     $condition = " match(user_name_match) against('" . $user_name_unicode . "' IN BOOLEAN MODE) ";
     $topic_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and " . $condition . " order by create_time desc limit " . $limit);
     $total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and " . $condition);
     foreach ($topic_list as $k => $v) {
         $topic_list[$k] = m_get_topic_item($v);
         if ($v['fav_id'] > 0 || $v['relay_id'] > 0) {
             $relay_share = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where is_effect = 1 and is_delete = 0 and id = " . $v['origin_id']);
         }
         if ($relay_share) {
             $topic_list[$k]['relay_share'] = m_get_topic_item($relay_share);
         }
     }
     $root = array();
     $root['return'] = 1;
     $root['item'] = $topic_list;
     $root['page'] = array("page" => $page, "page_total" => ceil($total / PAGE_SIZE));
     output($root);
 }
Esempio n. 15
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $root['return'] = 1;
     $city_id = intval($GLOBALS['request']['city_id']);
     $user_data = $GLOBALS['user_info'];
     $ytop = $latitude_top = floatval($GLOBALS['request']['latitude_top']);
     //最上边纬线值 ypoint
     $ybottom = $latitude_bottom = floatval($GLOBALS['request']['latitude_bottom']);
     //最下边纬线值 ypoint
     $xleft = $longitude_left = floatval($GLOBALS['request']['longitude_left']);
     //最左边经度值  xpoint
     $xright = $longitude_right = floatval($GLOBALS['request']['longitude_right']);
     //最右边经度值 xpoint
     $m_distance = doubleval($GLOBALS['request']['m_distance']);
     //范围(米)
     $ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
     //ypoint
     $xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
     //xpoint
     $page = intval($GLOBALS['request']['page']);
     //分页
     $page = $page == 0 ? 1 : $page;
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $pi = 3.14159265;
     //圆周率
     $r = 6378137;
     //地球平均半径(米)
     $sql_count = "select count(*) from " . DB_PREFIX . "user ";
     $sql = "select id,xpoint,ypoint,locate_time,user_name,daren_title, sex,\n\t\t\t\t(ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance  \n\t\t\t\tfrom " . DB_PREFIX . "user ";
     if ($ybottom != 0 && $ytop != 0 && $xleft != 0 && $xright != 0) {
         $where = " ypoint > {$ybottom} and ypoint < {$ytop} and xpoint > {$xleft} and xpoint < {$xright}  and is_effect = 1 and is_delete = 0 ";
     } else {
         $where = " is_effect = 1 and is_delete = 0 ";
     }
     $sql .= " where " . $where;
     $sql .= " order by distance asc ";
     $sql_count .= " where " . $where;
     $sql .= " limit " . $limit;
     $total = $GLOBALS['db']->getOne($sql_count);
     $page_total = ceil($total / $page_size);
     $list = $GLOBALS['db']->getAll($sql);
     foreach ($list as $k => $item) {
         $item['uid'] = $item['id'];
         if ($item['daren_title'] != '') {
             $item['user_name'] .= "[" . $item['daren_title'] . "]";
         }
         $item['fans'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user_focus where focused_user_id = " . $item['id']);
         $item['user_avatar'] = get_abs_img_root(get_muser_avatar($item['id'], "big"));
         if ($item['id'] == $user_data['id']) {
             $item['is_follow'] = -1;
         } else {
             $focus_uid = intval($item['id']);
             $focus_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_focus where focus_user_id = " . intval($user_data['id']) . " and focused_user_id = " . intval($focus_uid));
             if ($focus_data) {
                 $item['is_follow'] = 1;
             } else {
                 $item['is_follow'] = 0;
             }
         }
         $item['locate_time_format'] = pass_date($item['locate_time']);
         $item['distance'] = round($item['distance']);
         $list[$k] = $item;
     }
     $root['email'] = $email;
     //fwb add 2014-08-27
     $root['item'] = $list;
     $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
     output($root);
 }
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         $root['response_code'] = 1;
         if (!check_ipop_limit(get_client_ip(), "setting_save_index", 5)) {
             $root['show_err'] = "提交太频繁";
         }
         require_once APP_ROOT_PATH . "system/libs/user.php";
         $user_data = array();
         $user_data['province'] = strim($_REQUEST['province']);
         $user_data['city'] = strim($_REQUEST['city']);
         $user_data['sex'] = intval($_REQUEST['sex']);
         $user_data['intro'] = strim($_REQUEST['intro']);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $user_data, "UPDATE", "id=" . intval($GLOBALS['user_info']['id']));
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "user_weibo where user_id = " . intval($GLOBALS['user_info']['id']));
         $weibo_data = array();
         $weibo_data['user_id'] = intval($GLOBALS['user_info']['id']);
         $weibo_data['weibo_url'] = strim($_REQUEST['weibo_url']);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "user_weibo", $weibo_data);
         //$root['image'] =$GLOBALS['m_config']['page_size'];
         //	showSuccess("资料保存成功",$ajax,url('settings#index'));
         //			file_put_contents(APP_ROOT_PATH."public/test.txt", print_r($_FILES, 1));
         if (isset($_FILES['image_1'])) {
             //开始上传
             //创建avatar临时目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar");
                 @chmod(APP_ROOT_PATH . "public/avatar", 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/temp");
                 @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
             }
             $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
             //开始移动图片到相应位置
             $id = intval($user['id']);
             $uid = sprintf("%09d", $id);
             $dir1 = substr($uid, 0, 3);
             $dir2 = substr($uid, 3, 2);
             $dir3 = substr($uid, 5, 2);
             $path = $dir1 . '/' . $dir2 . '/' . $dir3;
             //创建相应的目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
             }
             $id = str_pad($id, 2, "0", STR_PAD_LEFT);
             $id = substr($id, -2);
             $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
             $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
             $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
             //	file_put_contents(APP_ROOT_PATH."public/test1.txt", print_r($avatar_file_small, 1));
             @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
             @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
             @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
             @unlink($img_result['image_1']['thumb']['big']['path']);
             @unlink($img_result['image_1']['thumb']['middle']['path']);
             @unlink($img_result['image_1']['thumb']['small']['path']);
             @unlink($img_result['image_1']['path']);
             //end 上传
         }
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
         $root['info'] = "资料保存成功";
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
Esempio n. 17
0
 public function index()
 {
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $root = array();
     $root['page_title'] = '技师详情';
     $root['mana_page_title'] = '技师详情';
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root['return'] = 1;
     if ($user_id > 0) {
         $tech_id = $GLOBALS['request']['tech_id'];
         $root['user_login_status'] = 1;
         $sql = 'SELECT 
                     * 
                   FROM
                     ' . DB_PREFIX . 'user 
                   WHERE id =' . $tech_id;
         $tech = $GLOBALS['db']->getRow($sql);
         $date = date('Y-m-d H:i:s');
         $timestamp = strtotime($date);
         //上个月订单
         $last_month_firstday = strtotime(date('Y', $timestamp) . '-' . (date('m', $timestamp) - 1) . '-01');
         $f_date = date('Y-m-01', $last_month_firstday);
         $last_month_lastday = strtotime("{$f_date} +1 month -1 day");
         $last_month_order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE create_time > " . $last_month_firstday . " AND create_time <  " . $last_month_lastday . " AND technician_id=" . $tech_id;
         $last_month_order_count = $GLOBALS['db']->getRow($last_month_order_sql);
         $root['last_month_order_count'] = $last_month_order_count['count'];
         //本月订单
         $firstday = strtotime(date("Y-m-01", $timestamp));
         $fi_date = date('Y-m-01', $firstday);
         $lastday = strtotime("{$fi_date} +1 month -1 day");
         $month_order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE create_time > " . $firstday . " AND create_time <  " . $lastday . " AND technician_id=" . $tech_id;
         $month_order_count = $GLOBALS['db']->getRow($month_order_sql);
         $root['month_order_count'] = $month_order_count['count'];
         //总订单数
         $order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE technician_id=" . $tech_id;
         $order_count = $GLOBALS['db']->getRow($order_sql);
         $root['order_count'] = $order_count['count'];
         //地址
         $p = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $tech['province_id']);
         $c = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $tech['city_id']);
         $tech['addr'] = $p['name'] . '-' . $c['name'] . '-' . $tech['addr_detail'];
         //星级
         for ($i = 0; $i < $tech['service_level_id']; $i++) {
             $tech['tech_level'][] = $i;
         }
         //性别
         if ($tech['sex'] == 1) {
             $tech['sex'] = '男';
         } elseif ($tech['sex'] == 0) {
             $tech['sex'] = '女';
         } else {
             $tech['sex'] = '保密';
         }
         //头像
         $tech['user_avatar'] = get_abs_img_root(get_muser_avatar($tech_id, "big"));
         $root['tech'] = $tech;
     } else {
         $root['user_login_status'] = 0;
     }
     $root['user'] = $user;
     $root['city_name'] = $city_name;
     output($root);
 }
Esempio n. 18
0
}
if ($class == 'app_down') {
    es_cookie::set("is_app_down", 1);
    app_redirect(wap_url('index', 'index'));
}
if ($class == 'biz_unset') {
    es_session::delete("supplier_id");
    es_session::delete("biz_email");
    es_session::delete("biz_pwd");
    showSuccess('退出成功!', 0, wap_url('index', 'biz_login#index'));
}
if ($user_info) {
    $request_param['uid'] = intval($user_info["id"]);
    $request_param['pwd'] = $user_info["user_pwd"];
    $request_param['email'] = $user_info["user_name"];
    $user_info['user_avatar'] = get_muser_avatar($user_info['id'], "big");
    $GLOBALS['tmpl']->assign('user_info', $user_info);
}
//logUtils::log_obj($user_info);
/*
//if(es_session::get("uid")){// && ($class != "login" && $class !='register' && $class !='register_verify_code')){
if(es_cookie::get("user_info") || es_session::get("user_info")){	
	//$request_param['uid']=es_session::get("uid");
	//$request_param['pwd']=es_session::get("user_pwd");
	//$request_param['email']=es_session::get("user_email");
	
	
	
	if(es_session::get("user_info")){
		$user_info = es_session::get('user_info');
		
Esempio n. 19
0
 public function index()
 {
     $email = strim($GLOBALS['request']['email']);
     //邮箱
     $pwd = strim($GLOBALS['request']['password']);
     //密码
     $user_name = strim($GLOBALS['request']['user_name']);
     //用户名
     $gender = intval($GLOBALS['request']['gender']);
     $ref_uid = intval($GLOBALS['request']['ref_uid']);
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     if (strlen($pwd) < 4) {
         $root['return'] = 0;
         $root['info'] = "密码不能低于四位";
     } else {
         $user_data['email'] = $email;
         $user_data['user_name'] = $user_name;
         $user_data['user_pwd'] = $pwd;
         $user_data['sex'] = $gender;
         if ($ref_uid) {
             $user_data['pid'] = $ref_uid;
         } else {
             $user_data['pid'] = 0;
         }
         $res = save_user($user_data);
         if ($res['status'] == 1) {
             $root['return'] = 1;
             $root['status'] = 1;
             // fwb add 2014-08-27
             $root['info'] = "注册成功";
             $root['uid'] = $res['data'];
             $root['id'] = $res['data'];
             $root['user_name'] = $user_name;
             $root['user_email'] = $email;
             $root['user_avatar'] = get_abs_img_root(get_muser_avatar($root['uid'], "big"));
             $root['user_pwd'] = $res['user_pwd'];
         } else {
             $error = $res['data'];
             if (!$error['field_show_name']) {
                 $error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
             }
             if ($error['error'] == EMPTY_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
             }
             if ($error['error'] == FORMAT_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
             }
             if ($error['error'] == EXIST_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
             }
             $root['return'] = 0;
             $root['status'] = 0;
             // fwb add 2014-08-27
             $root['info'] = $error_msg;
         }
     }
     if (strim($GLOBALS['request']['sina_id']) != '') {
         $root['login_type'] = "Sina";
     }
     if (strim($GLOBALS['request']['tencent_id']) != '') {
         $root['login_type'] = "Tencent";
     }
     if (strim($GLOBALS['request']['qq_id']) != '') {
         $root['login_type'] = "Qq";
     }
     $root['page_title'] = '注册';
     $root['city_name'] = $city_name;
     output($root);
 }
Esempio n. 20
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/model/user.php";
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     if ($email != "" && $pwd != "") {
         $result = do_login_user($email, $pwd);
         if ($result['status']) {
             $user_data = es_session::get('user_info');
             $root['return'] = 1;
             $root['user_login_status'] = 1;
             //用户登陆状态:1:成功登陆;0:未成功登陆
             $root['info'] = "用户登陆成功";
             $root['uid'] = $user_data['id'];
             $root['user_name'] = $user_data['user_name'];
             $root['user_pwd'] = $user_data['user_pwd'];
             $root['user_email'] = $user_data['email'];
             $root['user_money'] = $user_data['money'];
             $root['user_money_format'] = format_price($user_data['money']);
             //用户金额
             $root['user_score'] = $user_data['score'];
             //用户积分
             $root['home_user']['fans'] = $user_data['focused_count'];
             $root['home_user']['photos'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_image where user_id = " . $user_data['id']);
             $root['home_user']['goods'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where user_id = " . $user_data['id'] . " and topic_group = 'Fanwe' and is_delete = 0 and is_effect = 1");
             $root['home_user']['follows'] = $user_data['focus_count'];
             $root['home_user']['favs'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where user_id = " . $user_data['id'] . " and fav_id <> 0");
             $root['home_user']['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
             $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
             if (strim($GLOBALS['request']['sina_id']) != '') {
                 if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where sina_id = '" . strim($GLOBALS['request']['sina_id']) . "'") == 0) {
                     $access_token = trim($GLOBALS['request']['access_token']);
                     $GLOBALS['db']->query("update " . DB_PREFIX . "user set sina_id = '" . strim($GLOBALS['request']['sina_id']) . "',sina_token = '" . $access_token . "' where id = " . $user_data['id']);
                 }
             }
             if (strim($GLOBALS['request']['tencent_id']) != '') {
                 if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where tencent_id = '" . strim($GLOBALS['request']['tencent_id']) . "'") == 0) {
                     $GLOBALS['db']->query("update " . DB_PREFIX . "user set tencent_id = '" . strim($GLOBALS['request']['tencent_id']) . "' where id = " . $user_data['id']);
                     $openid = trim($GLOBALS['request']['openid']);
                     $openkey = trim($GLOBALS['request']['openkey']);
                     $access_token = trim($GLOBALS['request']['access_token']);
                     $GLOBALS['db']->query("update " . DB_PREFIX . "user set t_access_token ='" . $access_token . "',t_openkey = '" . $openkey . "',t_openid = '" . $openid . "', login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . " where id =" . $user_data['id']);
                 }
             }
             if (strim($GLOBALS['request']['qq_id']) != '') {
                 if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where qq_id = '" . strim($GLOBALS['request']['qq_id']) . "'") == 0) {
                     $GLOBALS['db']->query("update " . DB_PREFIX . "user set qq_id = '" . strim($GLOBALS['request']['qq_id']) . "' where id = " . $user_data['id']);
                 }
             }
         } else {
             if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) {
                 $err = "会员不存在";
             }
             if ($result['data'] == ACCOUNT_PASSWORD_ERROR) {
                 $err = "密码错误";
             }
             if ($result['data'] == ACCOUNT_NO_VERIFY_ERROR) {
                 $err = "会员未通过验证";
             }
             $root['return'] = 0;
             $root['user_login_status'] = 0;
             //用户登陆状态:1:成功登陆;0:未成功登陆
             $root['info'] = $err;
             $root['uid'] = 0;
             $root['user_name'] = $email;
             $root['user_email'] = $email;
         }
         if (strim($GLOBALS['request']['sina_id']) != '') {
             $root['login_type'] = "Sina";
         }
         if (strim($GLOBALS['request']['tencent_id']) != '') {
             $root['login_type'] = "Tencent";
         }
     } else {
         $root['return'] = 0;
         $root['user_login_status'] = 0;
         //用户登陆状态:1:成功登陆;0:未成功登陆
         $root['info'] = "用户或密码不能为空";
         $root['uid'] = 0;
         $root['user_name'] = $email;
     }
     if ($email) {
         $root['page_title'] = "我的账户";
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     } else {
         $root['page_title'] = "登陆";
         $api = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "api_login where class_name = 'Qqv2'");
         if ($api) {
             $class_name = $api['class_name'];
             if (file_exists(APP_ROOT_PATH . "system/api_login/" . $class_name . "_api.php")) {
                 require_once APP_ROOT_PATH . "system/api_login/" . $class_name . "_api.php";
                 $api_class = $class_name . "_api";
                 $api_obj = new $api_class($api);
                 $url = $api_obj->get_api_url();
                 //$root['qq_login1'] = $url;
                 $domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . APP_ROOT . $GLOBALS['IMG_APP_ROOT'] : app_conf("PUBLIC_DOMAIN_ROOT");
                 $url = str_replace("./public/", $domain . "/public/", $url);
                 $url = str_replace('sjmapi/', '', $url);
                 $root['qq_login'] = $url;
             }
         }
     }
     $root['city_name'] = $city_name;
     $root['act'] = "login";
     output($root);
 }
Esempio n. 21
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     //var_dump($GLOBALS);
     $result = do_login_user($email, $pwd);
     var_dump($result);
     if ($result['status']) {
         $user_data = es_session::get('user_info');
         $root['return'] = 1;
         $root['user_login_status'] = 1;
         //用户登陆状态:1:成功登陆;0:未成功登陆
         $root['info'] = "用户登陆成功";
         $root['uid'] = $user_data['id'];
         $root['user_name'] = $user_data['user_name'];
         $root['user_email'] = $user_data['email'];
         $root['user_money'] = $user_data['money'];
         $root['user_money_format'] = format_price($user_data['money']);
         //用户金额
         $root['home_user']['fans'] = $user_data['focused_count'];
         $root['home_user']['photos'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_image where user_id = " . $user_data['id']);
         $root['home_user']['goods'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where user_id = " . $user_data['id'] . " and topic_group = 'Fanwe' and is_delete = 0 and is_effect = 1");
         $root['home_user']['follows'] = $user_data['focus_count'];
         $root['home_user']['favs'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic where user_id = " . $user_data['id'] . " and fav_id <> 0");
         $root['home_user']['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
         if (strim($GLOBALS['request']['sina_id']) != '') {
             if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where sina_id = '" . strim($GLOBALS['request']['sina_id']) . "'") == 0) {
                 $access_token = trim($GLOBALS['request']['access_token']);
                 $GLOBALS['db']->query("update " . DB_PREFIX . "user set sina_id = '" . strim($GLOBALS['request']['sina_id']) . "',sina_token = '" . $access_token . "' where id = " . $user_data['id']);
             }
         }
         if (strim($GLOBALS['request']['tencent_id']) != '') {
             if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where tencent_id = '" . strim($GLOBALS['request']['tencent_id']) . "'") == 0) {
                 $GLOBALS['db']->query("update " . DB_PREFIX . "user set tencent_id = '" . strim($GLOBALS['request']['tencent_id']) . "' where id = " . $user_data['id']);
                 $openid = trim($GLOBALS['request']['openid']);
                 $openkey = trim($GLOBALS['request']['openkey']);
                 $access_token = trim($GLOBALS['request']['access_token']);
                 $GLOBALS['db']->query("update " . DB_PREFIX . "user set t_access_token ='" . $access_token . "',t_openkey = '" . $openkey . "',t_openid = '" . $openid . "', login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . " where id =" . $user_data['id']);
             }
         }
     } else {
         if ($result['data'] == ACCOUNT_NO_EXIST_ERROR) {
             $err = "会员不存在";
         }
         if ($result['data'] == ACCOUNT_PASSWORD_ERROR) {
             $err = "密码错误";
         }
         if ($result['data'] == ACCOUNT_NO_VERIFY_ERROR) {
             $err = "会员未通过验证";
         }
         $root['return'] = 0;
         $root['user_login_status'] = 0;
         //用户登陆状态:1:成功登陆;0:未成功登陆
         $root['info'] = $err;
         $root['uid'] = 0;
         $root['user_name'] = $email;
         $root['user_email'] = $email;
     }
     if (strim($GLOBALS['request']['sina_id']) != '') {
         $root['login_type'] = "Sina";
     }
     if (strim($GLOBALS['request']['tencent_id']) != '') {
         $root['login_type'] = "Tencent";
     }
     $root['act'] = "login";
     output($root);
 }
Esempio n. 22
0
 public function index()
 {
     $mobile = trim($GLOBALS['request']['mobile']);
     $code = strim($GLOBALS['request']['code']);
     /*验证码*/
     $ref_uid = intval($GLOBALS['request']['ref_uid']);
     /*邀请id*/
     $is_register = strim($GLOBALS['request']['is_register']);
     //0:仅验证;1:除验证外,如果用户不存在,则直接创建一个新用户,客户端自动登陆;
     if ($mobile == '') {
         $root['status'] = 0;
         $root['info'] = '手机号码不能为空';
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['status'] = 0;
         $root['info'] = "请输入正确的手机号码";
         output($root);
     }
     //print_r($GLOBALS['request']);
     if ($code == '') {
         $root['info'] = "请输入验证码!";
         $root['status'] = 0;
         output($root);
     }
     $db_code = $GLOBALS['db']->getRow("select id,code,add_time from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '{$mobile}' order by id desc");
     //print_r($db_code['code']);
     if ($db_code['code'] != $code) {
         $root['info'] = "请输入正确的验证码!";
         $root['status'] = 0;
         output($root);
     }
     $new_time = get_gmtime();
     if ($new_time - $db_code['add_time'] > 60 * 30) {
         $root['info'] = "验证码已失效,请重新获取!";
         $root['status'] = 0;
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify  where mobile_phone = " . $mobile . "");
         output($root);
     }
     //$GLOBALS['db']->query("update ".DB_PREFIX."sms_mobile_verify set status = 1 where id=".$db_code['id']."");
     $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify where id=" . $db_code['id'] . "");
     //is_register 0:仅验证;1:除验证外,如果用户不存在,则直接创建一个新用户,客户端自动登陆;
     if ($is_register == 1) {
         $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where mobile = '{$mobile}'");
         require_once APP_ROOT_PATH . "/system/model/user.php";
         if (!$user_data) {
             //自动注册一个用户;
             $pwd = rand(1111, 9999);
             $user_data = mobile_reg($mobile, $pwd, $ref_uid);
             $pwd = md5($pwd);
         } else {
             $mobile = $user_data['mobile'];
             $pwd = $user_data['user_pwd'];
         }
         //检查用户,用户密码
         auto_do_login_user($mobile, $pwd, false);
         $user = $GLOBALS['user_info'];
         $user_id = intval($user['id']);
         if ($user_id > 0) {
             $root['return'] = 1;
             $root['user_login_status'] = 1;
             //用户登陆状态:1:成功登陆;0:未成功登陆
             $root['info'] = "用户登陆成功";
             $root['uid'] = $user['id'];
             $root['user_name'] = $user['user_name'];
             $root['user_email'] = $user['email'];
             $root['user_money'] = $user['money'];
             $root['mobile'] = $user['mobile'];
             $root['user_pwd'] = $user['user_pwd'];
             $root['user_money_format'] = format_price($user['money']);
             //用户金额
             $root['home_user']['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
             $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
         } else {
             $root['user_login_status'] = 0;
             //用户登陆状态:1:成功登陆;0:未成功登陆
             $root['info'] = "用户登陆失败!";
             $root['status'] = 1;
         }
     } else {
         $root['info'] = "验证成功";
     }
     $root['status'] = 1;
     output($root);
 }
Esempio n. 23
0
 public function index()
 {
     /*
     	$email = strim($GLOBALS['request']['email']);//用户名或邮箱
     	if (isset($GLOBALS['request']['old_pwd'])){
     		$pwd = strim($GLOBALS['request']['old_pwd']);//密码
     	}else{
     		$pwd = strim($GLOBALS['request']['pwd']);//密码
     	}
     */
     $new_pwd = strim($GLOBALS['request']['newpassword']);
     //新密码
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root = array();
     //                $region_lv1 = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."delivery_region where pid = 0");  //一级地址
     //                foreach($region_lv1 as $k=>$v)
     //                {
     //                        if($v['id'] == $order_info['region_lv1'])
     //                        {
     //                                $region_lv1[$k]['selected'] = 1;
     //                                break;
     //                        }
     //                }
     $consignee_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_consignee where user_id = " . $user_id);
     $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "delivery_region where pid = 1");
     //二级地址
     foreach ($region_lv2 as $k => $v) {
         if ($v['id'] == $consignee_list['region_lv2']) {
             $region_lv2[$k]['selected'] = 1;
             break;
         }
     }
     $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "delivery_region where pid = " . $consignee_list['region_lv2']);
     //三级地址
     foreach ($region_lv3 as $k => $v) {
         if ($v['id'] == $consignee_list['region_lv3']) {
             $region_lv3[$k]['selected'] = 1;
             break;
         }
     }
     $region_lv4 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "delivery_region where pid = " . $consignee_list['region_lv3']);
     //四级地址
     foreach ($region_lv4 as $k => $v) {
         if ($v['id'] == $consignee_list['region_lv4']) {
             $region_lv4[$k]['selected'] = 1;
             break;
         }
     }
     //                $user_id=intval($GLOBALS['user_info']['id']);
     //输出所有配送方式
     foreach ($consignee_list as $k => $v) {
         $consignee_list[$k]['del_url'] = url('index', 'uc_consignee#del', array('id' => $v['id']));
         $consignee_list[$k]['dfurl'] = url('index', 'uc_consignee#set_default', array('id' => $v['id']));
         $consignee_list[$k]['region_lv2'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "delivery_region where id = " . $v['region_lv2']);
         $consignee_list[$k]['region_lv3'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "delivery_region where id = " . $v['region_lv3']);
         $consignee_list[$k]['region_lv4'] = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "delivery_region where id = " . $v['region_lv4']);
     }
     //		$GLOBALS['tmpl']->assign("consignee_list",$consignee_list);
     //                $root["region_lv1"] = $region_lv1;
     $root["consignee_list"] = $consignee_list;
     $root["region_lv2"] = $region_lv2;
     $root["region_lv3"] = $region_lv3;
     $root["region_lv4"] = $region_lv4;
     //                //地区列表
     //                $region_lv2 = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."region_conf where region_level = 2");  //二级地址
     //                foreach($region_lv2 as $k=>$v)
     //                {
     //                    if($v['id'] == intval($this->user['province_id']))
     //                    {
     //                        $region_lv2[$k]['selected'] = 1;
     //                        break;
     //                    }
     //                }
     //                $region_lv3 = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."region_conf where pid = ".intval($user['province_id']));  //三级地址
     //                foreach($region_lv3 as $k=>$v)
     //                {
     //                    if($v['id'] == intval($this->user['city_id']))
     //                    {
     //                        $region_lv3[$k]['selected'] = 1;
     //                        break;
     //                    }
     //                }
     //
     //                $root["region_lv2"]=$region_lv2;
     //                $root["region_lv3"]=$region_lv3;
     $root['page_title'] = '修改密码';
     $root['user_name'] = $user['user_name'];
     $root['mobile'] = $user['mobile'];
     $root['user_name'] = $user['user_name'];
     $root['user_name'] = $user['user_name'];
     $root['user_name'] = $user['user_name'];
     $root['user_name'] = $user['user_name'];
     $root['city_name'] = $city_name;
     if ($user_id > 0) {
         $root['user_login_status'] = 1;
         if (strlen($GLOBALS['request']['newpassword']) < 4) {
             $root['return'] = 0;
             $root['info'] = "注册密码不能少于4位";
             output($root);
         }
         $new_pwd = md5($new_pwd);
         $sql = "update " . DB_PREFIX . "user set user_pwd = '" . $new_pwd . "' where id = {$user_id}";
         $GLOBALS['db']->query($sql);
         $root['return'] = 1;
         $root['uid'] = $user_id;
         $root['email'] = $user['email'];
         $root['user_name'] = $user['user_name'];
         $root['user_pwd'] = $new_pwd;
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
         $root['info'] = "密码更新成功!";
     } else {
         $root['return'] = 0;
         $root['user_login_status'] = 0;
         $root['info'] = "原始密码不正确";
     }
     output($root);
 }
Esempio n. 24
0
 public function index()
 {
     //		$email = strim($GLOBALS['request']['email']);//邮箱
     $email = strim($GLOBALS['request']['mobile']);
     //邮箱
     $mobile = $email;
     $pwd = strim($GLOBALS['request']['password']);
     //密码
     $user_name = $email;
     //邮箱
     $code = strim($GLOBALS['request']['code']);
     //		$user_name = strim($GLOBALS['request']['user_name']);//用户名
     //		$gender = intval($GLOBALS['request']['gender']);
     $ref_uid = intval($GLOBALS['request']['ref_uid']);
     //		$city_name =strim($GLOBALS['request']['city_name']);//城市名称
     if ($mobile == '') {
         $root['status'] = 0;
         $root['info'] = '手机号码不能为空';
         output($root);
     }
     if (!check_mobile($mobile)) {
         $root['status'] = 0;
         $root['info'] = "请输入正确的手机号码";
         output($root);
     }
     //print_r($GLOBALS['request']);
     if ($code == '') {
         $root['info'] = "请输入验证码!";
         $root['status'] = 0;
         output($root);
     }
     $db_code = $GLOBALS['db']->getRow("select id,code,add_time from " . DB_PREFIX . "sms_mobile_verify where mobile_phone = '{$mobile}' order by id desc");
     //print_r($db_code['code']);
     if ($db_code['code'] != $code) {
         $root['info'] = "请输入正确的验证码!";
         $root['status'] = 0;
         output($root);
     }
     $new_time = get_gmtime();
     if ($new_time - $db_code['add_time'] > 60 * 30) {
         $root['info'] = "验证码已失效,请重新获取!";
         $root['status'] = 0;
         $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify  where mobile_phone = " . $mobile . "");
         output($root);
     }
     //$GLOBALS['db']->query("update ".DB_PREFIX."sms_mobile_verify set status = 1 where id=".$db_code['id']."");
     $GLOBALS['db']->query("delete from " . DB_PREFIX . "sms_mobile_verify where id=" . $db_code['id'] . "");
     if (strlen($pwd) < 4) {
         $root['return'] = 0;
         $root['info'] = "密码不能低于四位";
     } else {
         $user_data['email'] = $email;
         $user_data['user_name'] = $user_name;
         $user_data['mobile'] = $mobile;
         $user_data['user_pwd'] = $pwd;
         $user_data['sex'] = '-1';
         if ($ref_uid) {
             $user_data['pid'] = $ref_uid;
         } else {
             $user_data['pid'] = 0;
         }
         $res = save_user($user_data);
         if ($res['status'] == 1) {
             $root['return'] = 1;
             $root['status'] = 1;
             // fwb add 2014-08-27
             $root['info'] = "注册成功";
             $root['uid'] = $res['data'];
             $root['id'] = $res['data'];
             $root['user_name'] = $user_name;
             $root['user_email'] = $email;
             $root['user_avatar'] = get_abs_img_root(get_muser_avatar($root['uid'], "big"));
             $root['user_pwd'] = $res['user_pwd'];
         } else {
             $error = $res['data'];
             if (!$error['field_show_name']) {
                 $error['field_show_name'] = $GLOBALS['lang']['USER_TITLE_' . strtoupper($error['field_name'])];
             }
             if ($error['error'] == EMPTY_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['EMPTY_ERROR_TIP'], $error['field_show_name']);
             }
             if ($error['error'] == FORMAT_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['FORMAT_ERROR_TIP'], $error['field_show_name']);
             }
             if ($error['error'] == EXIST_ERROR) {
                 $error_msg = sprintf($GLOBALS['lang']['EXIST_ERROR_TIP'], $error['field_show_name']);
             }
             $root['return'] = 0;
             $root['status'] = 0;
             // fwb add 2014-08-27
             $root['info'] = $error_msg;
         }
     }
     if (strim($GLOBALS['request']['sina_id']) != '') {
         $root['login_type'] = "Sina";
     }
     if (strim($GLOBALS['request']['tencent_id']) != '') {
         $root['login_type'] = "Tencent";
     }
     if (strim($GLOBALS['request']['qq_id']) != '') {
         $root['login_type'] = "Qq";
     }
     $root['page_title'] = '注册';
     $root['city_name'] = $city_name;
     output($root);
 }
 public function index()
 {
     require_once APP_ROOT_PATH . "system/libs/user.php";
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $GLOBALS['user_info'] = $user_data = es_session::get('user_info');
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         if (isset($_FILES['image_1'])) {
             //开始上传
             //创建avatar临时目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar");
                 @chmod(APP_ROOT_PATH . "public/avatar", 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/temp")) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/temp");
                 @chmod(APP_ROOT_PATH . "public/avatar/temp", 0777);
             }
             $img_result = save_image_upload($_FILES, "image_1", "avatar/temp", $whs = array('small' => array(48, 48, 1, 0), 'middle' => array(120, 120, 1, 0), 'big' => array(200, 200, 1, 0)));
             //开始移动图片到相应位置
             $id = intval($user_data['id']);
             $uid = sprintf("%09d", $id);
             $dir1 = substr($uid, 0, 3);
             $dir2 = substr($uid, 3, 2);
             $dir3 = substr($uid, 5, 2);
             $path = $dir1 . '/' . $dir2 . '/' . $dir3;
             //创建相应的目录
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2, 0777);
             }
             if (!is_dir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3)) {
                 @mkdir(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3);
                 @chmod(APP_ROOT_PATH . "public/avatar/" . $dir1 . '/' . $dir2 . '/' . $dir3, 0777);
             }
             $id = str_pad($id, 2, "0", STR_PAD_LEFT);
             $id = substr($id, -2);
             $avatar_file_big = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_big.jpg";
             $avatar_file_middle = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_middle.jpg";
             $avatar_file_small = APP_ROOT_PATH . "public/avatar/" . $path . "/" . $id . "virtual_avatar_small.jpg";
             @file_put_contents($avatar_file_big, file_get_contents($img_result['image_1']['thumb']['big']['path']));
             @file_put_contents($avatar_file_middle, file_get_contents($img_result['image_1']['thumb']['middle']['path']));
             @file_put_contents($avatar_file_small, file_get_contents($img_result['image_1']['thumb']['small']['path']));
             @unlink($img_result['image_1']['thumb']['big']['path']);
             @unlink($img_result['image_1']['thumb']['middle']['path']);
             @unlink($img_result['image_1']['thumb']['small']['path']);
             @unlink($img_result['image_1']['path']);
             //end 上传
         }
         $root['response_code'] = 1;
         $root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     output($root);
 }
Esempio n. 26
0
 public function index()
 {
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $root = array();
     $root['page_title'] = '订单详情';
     $root['mana_page_title'] = '订单详情';
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root['return'] = 1;
     if ($user_id > 0) {
         $order_id = $GLOBALS['request']['order_id'];
         $root['user_login_status'] = 1;
         $sql = "select do.* from " . DB_PREFIX . "deal_order as do where do.is_delete = 0 and " . " do.id = " . $order_id . " and do.type = 0";
         $order = $GLOBALS['db']->getRow($sql);
         $order['endtime'] = $order['service_time'] * 60;
         $order['starttime'] = time() - $order['service_start_time'];
         if ($order['starttime'] > $order['endtime']) {
             $order['starttime'] = $order['endtime'] - 1;
         }
         if ($order['starttime'] < 0) {
             $order['starttime'] = 0;
         }
         //用户信息
         $c_user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $order['user_id']);
         $p = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $c_user['province_id']);
         $c = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $c_user['city_id']);
         $c_user['addr'] = $p['name'] . '-' . $c['name'] . '-' . $c_user['addr_detail'];
         $order['c_user'] = $c_user;
         //服务项目
         $deals = $GLOBALS['db']->getAll("SELECT * FROM " . DB_PREFIX . "deal WHERE id IN(" . $order['deal_ids'] . ") ORDER BY id DESC");
         foreach ($deals as $key => $value) {
             $comment = $GLOBALS['db']->getRow("SELECT * FROM " . DB_PREFIX . "supplier_location_dp  WHERE user_id = " . $order['user_id'] . "  AND deal_id = " . $value['id'] . " ORDER BY create_time DESC LIMIT 1");
             if (!empty($comment)) {
                 $order['user_comment'] = $comment['content'];
                 //星级
                 for ($i = 0; $i < $comment['point']; $i++) {
                     $order['points'][] = $i;
                 }
                 break;
             }
         }
         $order['deals'] = $deals;
         $root['order'] = $order;
         //-------------------------------------------------------技师资料-------------------------------------------------------------------
         $tech_sql = 'SELECT 
                     * 
                   FROM
                     ' . DB_PREFIX . 'user 
                   WHERE id =' . $order['technician_id'];
         $tech = $GLOBALS['db']->getRow($tech_sql);
         $date = date('Y-m-d H:i:s');
         $timestamp = strtotime($date);
         //上个月订单
         $last_month_firstday = strtotime(date('Y', $timestamp) . '-' . (date('m', $timestamp) - 1) . '-01');
         $f_date = date('Y-m-01', $last_month_firstday);
         $last_month_lastday = strtotime("{$f_date} +1 month -1 day");
         $last_month_order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE create_time > " . $last_month_firstday . " AND create_time <  " . $last_month_lastday . " AND technician_id=" . $order['technician_id'];
         $last_month_order_count = $GLOBALS['db']->getRow($last_month_order_sql);
         $root['last_month_order_count'] = $last_month_order_count['count'];
         //本月订单
         $firstday = strtotime(date("Y-m-01", $timestamp));
         $fi_date = date('Y-m-01', $firstday);
         $lastday = strtotime("{$fi_date} +1 month -1 day");
         $month_order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE create_time > " . $firstday . " AND create_time <  " . $lastday . " AND technician_id=" . $order['technician_id'];
         $month_order_count = $GLOBALS['db']->getRow($month_order_sql);
         $root['month_order_count'] = $month_order_count['count'];
         //总订单数
         $order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE technician_id=" . $order['technician_id'];
         $order_count = $GLOBALS['db']->getRow($order_sql);
         $root['order_count'] = $order_count['count'];
         //地址
         $tech_p = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $tech['province_id']);
         $tech_c = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $tech['city_id']);
         $tech['addr'] = $tech_p['name'] . '-' . $tech_c['name'] . '-' . $tech['addr_detail'];
         //星级
         for ($i = 0; $i < $tech['service_level_id']; $i++) {
             $tech['tech_level'][] = $i;
         }
         //性别
         if ($tech['sex'] == 1) {
             $tech['sex'] = '男';
         } elseif ($tech['sex'] == 0) {
             $tech['sex'] = '女';
         } else {
             $tech['sex'] = '保密';
         }
         //头像
         $tech['user_avatar'] = get_abs_img_root(get_muser_avatar($tech_id, "big"));
         $root['tech'] = $tech;
     } else {
         $root['user_login_status'] = 0;
     }
     $root['user'] = $user;
     $root['city_name'] = $city_name;
     output($root);
 }
Esempio n. 27
0
function USSina()
{
    es_session::start();
    $sina_id = trim($GLOBALS['request']['sina_id']);
    $access_token = trim($GLOBALS['request']['access_token']);
    $r = $GLOBALS['request']['user_info'];
    $r = json_decode($r, true);
    $name = $r['screen_name'];
    $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where sina_id = '" . $sina_id . "' and sina_id <> '' and sina_id <> 0");
    if ($user_data) {
        if ($user_data['is_effect'] == 0 || $user_data['is_delete'] == 1) {
            $result['resulttype'] = 0;
        } else {
            $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id']));
            $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc");
            if ($user_current_group['score'] < $user_group['score']) {
                $user_data['group_id'] = intval($user_group['id']);
            }
            $GLOBALS['db']->query("update " . DB_PREFIX . "user set sina_token ='" . $access_token . "', login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']);
            $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . intval($user_data['id']) . " where session_id = '" . es_session::id() . "'");
            $result['user_pwd'] = $user_data['user_pwd'];
            $result['uid'] = $user_data['id'];
            $result['email'] = $user_data['email'];
            $result['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
            $name = $user_data['user_name'];
            $result['resulttype'] = 1;
        }
    } else {
        $result['email'] = "";
        $result['user_pwd'] = md5(get_gmtime());
        $result['user_name'] = $name;
        $result['sina_token'] = $access_token;
        $result['sina_id'] = $sina_id;
        $result['uid'] = bind_add_user($result);
        if ($result['uid'] > 0) {
            $result['user_avatar'] = '';
            $result['resulttype'] = 1;
        } else {
            $result['resulttype'] = -1;
        }
    }
    $result['access_token'] = $access_token;
    $result['sina_id'] = $sina_id;
    $result['user_name'] = $name;
    $result['act'] = "synclogin";
    $result['login_type'] = "Sina";
    output($result);
}
Esempio n. 28
0
function Qq()
{
    $openid = trim($GLOBALS['request']['openid']);
    $access_token = trim($GLOBALS['request']['access_token']);
    $r = $GLOBALS['request']['user_info'];
    //$r = json_decode($r,true);
    //print_r($GLOBALS['request']); exit;
    if ($GLOBALS['request']['type'] == "ios") {
        $name = $GLOBALS['request']['nickname'];
    } else {
        $name = $r['nickname'];
    }
    $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where qq_id = '" . $openid . "' and qq_id <> '' ");
    if ($user_data) {
        if ($user_data['is_effect'] == 0 || $user_data['is_delete'] == 1) {
            $result['resulttype'] = 0;
        } else {
            $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id']));
            $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['score']) . " order by score desc");
            if ($user_current_group['score'] < $user_group['score']) {
                $user_data['group_id'] = intval($user_group['id']);
            }
            $GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . get_client_ip() . "',login_time= " . get_gmtime() . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']);
            $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . intval($user_data['id']) . " where session_id = '" . es_session::id() . "'");
            $result['user_pwd'] = $user_data['user_pwd'];
            $result['uid'] = $user_data['id'];
            $result['email'] = $user_data['email'];
            $result['user_money'] = $user_data['money'];
            $result['user_money_format'] = format_price($user_data['money']);
            //用户金额
            $result['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
            $name = $user_data['user_name'];
            $result['resulttype'] = 1;
        }
    } else {
        $user_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where user_name='" . $name . "' ");
        if ($user_count > 0) {
            $name = "QQ" . rand(1000, 9999) . "_" . $name;
        }
        $result['email'] = "";
        $result['user_pwd'] = md5(get_gmtime());
        $result['user_name'] = $name;
        $result['qq_id'] = $openid;
        $result['uid'] = bind_add_user($result);
        if ($result['uid'] > 0) {
            $result['user_avatar'] = '';
            $result['user_money'] = 0;
            $result['user_money_format'] = "¥0";
            //用户金额
            $result['resulttype'] = 1;
        } else {
            $result['resulttype'] = -1;
        }
    }
    $result['access_token'] = $access_token;
    $result['qq_id'] = $openid;
    $result['user_name'] = $name;
    $result['act'] = "synclogin";
    $result['login_type'] = "Qq";
    output($result);
}
Esempio n. 29
0
function uc_center($username_email, $pwd)
{
    // 检查用户,用户密码
    $user = user_check($username_email, $pwd);
    $user_id = intval($user['id']);
    if ($user_id > 0) {
        $province_str = $GLOBALS['db']->getOne("select province from " . DB_PREFIX . "user where id = " . $user_id);
        $city_str = $GLOBALS['db']->getOne("select city from " . DB_PREFIX . "user where id = " . $user_id);
        if ($province_str . $city_str == '') {
            $user_location = '未知';
        } else {
            $user_location = $province_str . " " . $city_str;
        }
        $user['money_format'] = format_price($user['money']);
        // 可用资金
        $user['create_time_format'] = to_date($user['create_time'], 'Y-m-d');
        // 注册时间
        $result['user_login_status'] = 1;
        $result['response_code'] = 1;
        $result['user_name'] = $user['user_name'];
        $result['id'] = $user['id'];
        $result['email'] = $user['email'];
        $result['money'] = $user['money'];
        $result['money_format'] = $user['money_format'];
        $result['province'] = $user['province'];
        $result['city'] = $user['city'];
        $result['sex'] = $user['sex'];
        $result['intro'] = $user['intro'];
        $result['info'] = "";
        $result['mobile'] = $user['mobile'];
        $result['image'] = get_user_avatar_root($user['id'], "middle");
        $result['user_avatar'] = get_abs_img_root(get_muser_avatar($user['id'], "big"));
        $weibo_list = $GLOBALS['db']->getOne("select weibo_url from " . DB_PREFIX . "user_weibo where user_id = " . intval($GLOBALS['user_info']['id']));
        $result['weibo_list'] = $weibo_list;
        $result['create_time_format'] = $user['create_time_format'];
        $result['investor_status'] = intval($user['investor_status']);
        $result['identify_positive_image'] = $user['identify_positive_image'];
        $result['identify_business_licence'] = $user['identify_business_licence'];
        $result['is_investor'] = $user['is_investor'];
        $data = detectStateAudit($user);
        $result['status_express'] = $data['status_express'];
        $result['status'] = $data['status'];
    } else {
        $result['user_login_status'] = 0;
        $result['response_code'] = 0;
        $result['info'] = "未登录";
    }
    return $result;
}
Esempio n. 30
0
 public function index()
 {
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $root = array();
     $root['page_title'] = '技师详情';
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root['return'] = 1;
     if ($user_id > 0) {
         $tech_id = $GLOBALS['request']['tech_id'];
         $root['user_login_status'] = 1;
         $sql = 'SELECT 
                     * 
                   FROM
                     ' . DB_PREFIX . 'user 
                   WHERE id =' . $tech_id;
         $tech = $GLOBALS['db']->getRow($sql);
         $date = date('Y-m-d H:i:s');
         $timestamp = strtotime($date);
         //上个月订单
         $last_month_firstday = strtotime(date('Y', $timestamp) . '-' . (date('m', $timestamp) - 1) . '-01');
         $f_date = date('Y-m-01', $last_month_firstday);
         $last_month_lastday = strtotime("{$f_date} +1 month -1 day");
         $last_month_order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE create_time > " . $last_month_firstday . " AND create_time <  " . $last_month_lastday . " AND technician_id=" . $tech_id;
         $last_month_order_count = $GLOBALS['db']->getRow($last_month_order_sql);
         $root['last_month_order_count'] = $last_month_order_count['count'];
         //未结束订单
         $tach_order_unfinished_sql = "SELECT * FROM " . DB_PREFIX . "deal_order o," . DB_PREFIX . "deal_order_item i WHERE o.id=i.order_id and (o.service_start_time=0 or o.service_start_time>0 and o.service_start_time+o.service_time*60<" . time() . ") AND o.technician_id=" . $tech_id;
         $tach_order_unfinished = $GLOBALS['db']->getAll($tach_order_unfinished_sql);
         foreach ($tach_order_unfinished as $k => $v) {
             $tach_order_unfinished[$k]['img'] = get_abs_img_root(make_img($v['deal_icon'], 108, 85, 1));
             $tach_order_unfinished[$k]['order_time_format'] = $v['order_time'] > 0 ? date('Y-m-d H:i:s', $v['order_time']) : '没有预约时间';
         }
         $root['tach_order_unfinished'] = $tach_order_unfinished;
         //本月订单
         $firstday = strtotime(date("Y-m-01", $timestamp));
         $fi_date = date('Y-m-01', $firstday);
         $lastday = strtotime("{$fi_date} +1 month -1 day");
         $month_order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE create_time > " . $firstday . " AND create_time <  " . $lastday . " AND technician_id=" . $tech_id;
         $month_order_count = $GLOBALS['db']->getRow($month_order_sql);
         $root['month_order_count'] = $month_order_count['count'];
         //总订单数
         $order_sql = "SELECT count(*) as count FROM " . DB_PREFIX . "deal_order WHERE technician_id=" . $tech_id;
         $order_count = $GLOBALS['db']->getRow($order_sql);
         $root['order_count'] = $order_count['count'];
         //地址
         $p = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $tech['province_id']);
         $c = $GLOBALS['db']->getRow("select name from " . DB_PREFIX . "region_conf where id = " . $tech['city_id']);
         $tech['addr'] = $p['name'] . '-' . $c['name'] . '-' . $tech['addr_detail'];
         //服务
         $goods_list = $GLOBALS['db']->getAll("select * from fanwe_deal_tech t,fanwe_deal d where t.deal_id=d.id and t.tech_id=" . $tech['id']);
         foreach ($goods_list as $k => $v) {
             $goods_list[$k]['img'] = get_abs_img_root(make_img($v['img'], 108, 85, 1));
         }
         $root['goods_list'] = $goods_list;
         //星级
         for ($i = 0; $i < $tech['service_level_id']; $i++) {
             $tech['tech_level'][] = $i;
         }
         //性别
         if ($tech['sex'] == 1) {
             $tech['sex'] = '男';
         } elseif ($tech['sex'] == 0) {
             $tech['sex'] = '女';
         } else {
             $tech['sex'] = '保密';
         }
         //头像
         $tech['user_avatar'] = get_abs_img_root(get_muser_avatar($tech_id, "big"));
         $root['tech'] = $tech;
     } else {
         $root['user_login_status'] = 0;
     }
     $root['user'] = $user;
     $root['city_name'] = $city_name;
     output($root);
 }