Exemplo n.º 1
0
 /**
  * 收藏店铺
  **/
 public function innlike()
 {
     $user_id = $this->get_user_id(TRUE);
     $inn_id = input_int($this->input->get('sid'), 1, FALSE, FALSE, '4001');
     $act = input_string($this->input->get('act'), array('like', 'unlike'), FALSE, '4001');
     $inn = $this->model->get_inn_info_by_ids($inn_id);
     if (!$inn) {
         response_code('2010');
     }
     if ($act == 'like') {
         $is_like = $this->model->check_inn_fav($inn_id, $user_id);
         if ($is_like) {
             response_code('2012');
         }
     } else {
         $is_like = $this->model->check_inn_fav($inn_id, $user_id);
         if (!$is_like) {
             response_code('2011');
         }
     }
     $inn_info = array('dest_id' => $inn[$inn_id]['dest_id'], 'local_id' => $inn[$inn_id]['local_id']);
     if ($this->model->inn_fav($act, $inn_id, $user_id, $inn_info)) {
         response_code('1');
     }
     response_code('-1');
 }
Exemplo n.º 2
0
 public function userlog()
 {
     $this->moduleTag = 'userlog';
     $type = input_string($this->input->get('type'), array('all', 'C', 'I', 'D', 'U'), 'all');
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 1, FALSE, 15);
     $starttime = input_empty($this->input->get('starttime'), '');
     $endtime = input_empty($this->input->get('endtime'), '');
     if ($starttime) {
         $starttime = strtotime($starttime);
     }
     if ($endtime) {
         $endtime = strtotime($endtime) + 86399;
     }
     $search = array('starttime' => $starttime, 'endtime' => $endtime, 'type' => $type);
     $rs = $this->model->get_backend_logs($search, $page, $perpage);
     $data = $rs['list'];
     $users = array();
     if ($data) {
         foreach ($data as $key => $val) {
             $ids[] = $val['user_id'];
         }
         $ids = implode(',', array_unique($ids));
         $users = $this->model->get_user_name_by_user_ids($ids);
     }
     $total = $rs['total'];
     $pageInfo = array('total' => $total, 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $total / $perpage, 'url' => makePageUrl($page));
     $this->viewData = array('data' => $data, 'users' => $users, 'pageInfo' => $pageInfo, 'starttime' => $starttime, 'endtime' => $endtime, 'type' => $type);
 }
Exemplo n.º 3
0
 public function index()
 {
     $y = date("Y", time());
     $m = date("m", time());
     $d = date("d", time());
     $t1 = mktime(0, 0, 0, $m, 1, $y);
     //创建本月开始时间
     $t2 = time() - 86400;
     //昨天
     $this->moduleTag = 'point';
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 0, FALSE, 15);
     $starttime = input_empty($this->input->get('starttime'), '');
     $endtime = input_empty($this->input->get('endtime'), '');
     $starttime = $starttime ? $starttime : date('Y-m-d', $t1);
     $endtime = $endtime ? $endtime : date('Y-m-d', $t2);
     if ($starttime) {
         $starttime = strtotime($starttime);
     }
     if ($endtime) {
         $endtime = strtotime($endtime) + 86399;
     }
     $search = array('starttime' => $starttime, 'endtime' => $endtime);
     $rs = $this->model->get_point($search, $page, $perpage);
     $total = $rs['total'];
     $data = $rs['list'];
     $send_point = '';
     $reduce_point = '';
     foreach ($data as $k => $v) {
         $send_point += $v['send_point'];
         $reduce_point += $v['use_point'];
     }
     $pageInfo = array('total' => $total, 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $total / 15, 'url' => makePageUrl($page));
     $this->viewData = array('data' => $data, 'pageInfo' => $pageInfo, 'starttime' => $starttime, 'endtime' => $endtime, 'send_point' => $send_point, 'reduce_point' => $reduce_point);
 }
Exemplo n.º 4
0
 public function is_del_feedback()
 {
     $feed_id = input_int($this->input->post('feed_id'), 1, FALSE, 0);
     $rs = $this->model->is_del_feedback($feed_id);
     if (!$rs) {
         response_code('-1');
     }
     response_code('1');
 }
Exemplo n.º 5
0
 public function customerList()
 {
     $page = input_int($this->input->get('page'), 1, FALSE, FALSE, '1015');
     //分页
     $perpage = input_int($this->input->get('perpage'), 1, FALSE, FALSE, '1016');
     //分页
     $search = $this->input->get('search');
     $this->load->model('partners_model');
     $data = $this->partners_model->get_list($this->token['user_id'], $page, $perpage, $search);
     response_data($data);
 }
Exemplo n.º 6
0
 public function tranflow()
 {
     $inn_id = $this->get_inn_id(TRUE);
     $inn = $this->finance_model->get_user_inn_by_inn_id($inn_id, FALSE);
     if (!$inn) {
         response_code('1006');
     }
     $last_id = input_int($this->input->get('lastid'), 0, FALSE, 0);
     $limit = input_int($this->input->get('limit'), 1, 50, 20);
     $res = array();
     $data = $this->finance_model->get_account_records_by_inn_id($inn_id, $last_id, $limit);
     if ($data) {
         $month = $data[0]['create_time'];
         $first_month = date('Ym', $month);
         $month_start = strtotime($first_month . '01');
         $month_end = strtotime('+1 month', $month_start) - 1;
         $res['title'][0]['month_start'] = $month_start;
         $res['title'][0]['month_end'] = $month_end;
         $i = 0;
         foreach ($data as $key => $row) {
             if ($row['create_time'] >= $month_start) {
                 $res['title'][$i]['lastid'] = $row['record_id'];
             } else {
                 $month_start = date('Ym', $row['create_time']);
                 $month_start = strtotime($month_start . '01');
                 $month_end = strtotime('+1 month', $month_start) - 1;
                 $i++;
                 $res['title'][$i]['month_start'] = $month_start;
                 $res['title'][$i]['month_end'] = $month_end;
                 $res['title'][$i]['lastid'] = $row['record_id'];
             }
             $res['list'][] = $row;
         }
         foreach ($res['title'] as $key => $row) {
             $rs = $this->finance_model->get_mouth_transflow($inn_id, $row['month_start'], $row['month_end']);
             $res['title'][$key]['cashin'] = $rs['cashin'];
             $res['title'][$key]['cashout'] = $rs['cashout'];
         }
     } else {
         $res = array('title' => array(array('month' => strtotime(date('Ym') . '01'), 'month_end' => $_SERVER['REQUEST_TIME'], 'cashin' => '0', 'cashout' => '0', 'lastid' => '0')), 'list' => array());
     }
     response_json('1', $res);
 }
Exemplo n.º 7
0
 private function check_forum_post($type)
 {
     $forum = array();
     $forum['city'] = check_empty(trimall(strip_tags($this->input->post('city'))), '');
     $forum['lat'] = checkLocationPoint($this->input->post('lat'), 'lat', '');
     //坐标可不传
     $forum['lon'] = checkLocationPoint($this->input->post('lon'), 'lon', '');
     if (empty($forum['lat']) || empty($forum['lon'])) {
         $forum = array();
     }
     $forum['forum_name'] = check_empty(trimall(strip_tags($this->input->post('title'))), '', '6014');
     $forum['type'] = $type;
     $tags = check_empty(trimall(strip_tags($this->input->post('tags'))), '');
     if ($tags) {
         $detail['tags'] = array();
         $tags = explode(',', $tags);
         foreach ($tags as $key => $row) {
             if (!$row) {
                 continue;
             }
             if (mb_strlen($row) > 6) {
                 response_json('6033', '标签:"' . $row . '" 字数过长');
             }
             $detail['tags'][] = $row;
         }
         if (count($detail['tags']) > 3) {
             response_code('6032');
         }
         $detail['tags'] = implode(',', $detail['tags']);
     } else {
         $detail['tags'] = '';
     }
     $detail['note'] = check_empty(strip_tags($this->input->post('note')), '');
     $detail['pictures'] = trimall(strip_tags($this->input->post('images', TRUE)));
     if ($type == 'jianren') {
         $detail['line'] = check_empty(trimall(strip_tags($this->input->post('line', TRUE))), FALSE, '6016');
         if (empty($forum['forum_name'])) {
             $forum['forum_name'] = $detail['line'];
         }
         $start_time = check_empty($this->input->post('start_time'), FALSE, '6017');
         if (substr_count($start_time, '-') != 2) {
             response_code('6024');
         }
         list($year, $month, $day) = explode('-', $start_time);
         if (!$year || !$month || !$day || !checkdate($month, $day, $year)) {
             response_code('6024');
         }
         $start_time = strtotime($start_time);
         if (!$start_time || $start_time < TIME_NOW - 86500 || $start_time > TIME_NOW + 31536000) {
             response_code('6024');
         }
         $detail['start_time'] = $start_time;
         $detail['day'] = input_int($this->input->post('day'), 0, 250, FAlSE, '6015');
     } else {
         $detail['pictures'] = check_empty($detail['pictures'], FALSE, '6013');
     }
     if (empty($forum['forum_name'])) {
         response_code('6014');
     }
     return array('forum' => $forum, 'detail' => $detail);
 }
Exemplo n.º 8
0
 private function check_inn_info()
 {
     $innInfo = array();
     $innInfo['inn_name'] = check_empty(trimall(strip_tags($this->input->post('inn_name', TRUE))), FALSE, '1010');
     $innInfo['dest_id'] = input_int($this->input->post('dest_id'), 1, FALSE, FALSE, '1011');
     $innInfo['local_id'] = input_int($this->input->post('local_id'), 1, FALSE, FALSE, '1012');
     $profit = check_empty($this->input->post('profit'), FALSE, '1013');
     $innInfo['profit'] = sprintf("%.2f", $profit);
     if ($innInfo['profit'] < 0 || $innInfo['profit'] > 100) {
         response_code('1013');
     }
     $innInfo['inner_contacts'] = check_empty(trimall(strip_tags($this->input->post('inner_contacts'))), FALSE, '1014');
     $innInfo['inner_moblie_number'] = input_mobilenum($this->input->post('inner_moblie_number'), '1015');
     //默认为用户账号(手机号)
     $bdlon = number_format(check_empty($this->input->post('bdlon'), FALSE, '1016'), 7, '.', "");
     $bdlat = number_format(check_empty($this->input->post('bdlat'), FALSE, '1016'), 7, '.', "");
     $gps = BD09LLtoWGS84($bdlon, $bdlat);
     $innInfo['lon'] = $gps[0];
     $innInfo['lat'] = $gps[1];
     $innInfo['bdgps'] = $bdlon . ',' . $bdlat;
     /*	$innInfo['bank_info'] = check_empty(trimall(strip_tags($this->input->post('bank_info'))),FALSE,'1017');
     		$innInfo['bank_account_no'] = input_num(trimall($this->input->post('bank_account_no')),FALSE,FALSE,FALSE,'1018');
     		$innInfo['bank_account_no'] = check_luhn($innInfo['bank_account_no'],'1018');
     		$innInfo['bank_account_name'] = check_empty(trimall(strip_tags($this->input->post('bank_account_name'))),FALSE,'1019');
     	*/
     $innInfo['bank_info'] = $this->input->post('bank_info', TRUE);
     $innInfo['bank_account_no'] = $this->input->post('bank_account_no', TRUE);
     $innInfo['bank_account_name'] = $this->input->post('bank_account_name', TRUE);
     $innInfo['inner_telephone'] = check_empty(trimall(strip_tags($this->input->post('inner_telephone'))), '');
     $innInfo['inn_address'] = check_empty(trimall(strip_tags($this->input->post('inn_address'))), FALSE, '1020');
     return $innInfo;
 }
Exemplo n.º 9
0
 /**
  * 对商品收藏的操作 
  * 添加删除
  */
 public function favor_product()
 {
     $act = input_string($this->input->get('act'), array('add', 'del'), FALSE, FALSE, '1014');
     $product_id = input_int($this->input->get('classid'), 1, FALSE, FALSE, '1009');
     $is_fav = $this->model->check_fav('product', $product_id, $this->token['user_id']);
     $this->_LoadModel('product');
     if ($act == 'add') {
         $product = $this->product_model->get_product_by_id($product_id);
         if (!$product) {
             response_msg('2009');
         }
         if ($is_fav) {
             response_msg('1012');
         }
     } else {
         if (!$is_fav) {
             response_msg('1013');
         }
         $product['del_id'] = $is_fav;
     }
     $this->product_model->update_fav($act, $product_id);
     $this->model->modify_user_fav($act, 'product', $this->token['user_id'], $product);
     response_msg('1');
 }
Exemplo n.º 10
0
 public function is_del()
 {
     $quan_id = input_int($this->input->post('quan_id'), 1, FALSE, 0);
     $rs = $this->model->del_coupon($quan_id);
     if (!$rs) {
         response_code('-1');
     }
     response_code('1');
 }
Exemplo n.º 11
0
 public function downloadBalance()
 {
     $starttime = input_int($this->input->get('st'), 1000000000, 2000000000, 0);
     $endtime = input_int($this->input->get('ed'), 1000000000, 2000000000, 0);
     $dest_id = input_int($this->input->get('tid'), 1, FALSE, 0);
     $local_id = input_int($this->input->get('lid'), 1, FALSE, 0);
     $inn_id = input_int($this->input->get('sid'), 1, FALSE, 0);
     $this->check_finance_auth_in_controller();
     $search = array('starttime' => $starttime, 'endtime' => $endtime);
     if ($inn_id) {
         $search['key'] = 'inn';
         $search['key_id'] = $inn_id;
     } else {
         if ($local_id) {
             $search['key'] = 'local';
             $search['key_id'] = $local_id;
         } else {
             if ($dest_id) {
                 $search['key'] = 'dest';
                 $search['key_id'] = $dest_id;
             } else {
                 //未指定位置使用默认值 0
                 $search['key'] = 'default';
                 $search['key_id'] = 0;
             }
         }
     }
     $data = $this->model->search_balance_order($search);
     $csv = $this->bulitcsv($data['data']);
     $this->load->helper('download');
     force_download(date('Y-m-d H:i:s') . '.csv', $csv);
 }
Exemplo n.º 12
0
 /**
  * 且游订单
  */
 public function qieyou()
 {
     $this->controllerTag = 'qieyou';
     $this->moduleTag = 'qieyouList';
     $starttime = input_int($this->input->get('st'), 1000000000, 2000000000, 0);
     $endtime = input_int($this->input->get('ed'), 1000000000, 2000000000, 0);
     $state = input_string($this->input->get('state'), array('all', 'paid', 'finished', 'refund', 'refunded', 'unpaid', 'cancel', 'waiting'), 'all');
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $cid = input_int($this->input->get('cid'), 1, FALSE, 0);
     $dest_id = input_int($this->input->get('tid'), 1, FALSE, 0);
     $local_id = input_int($this->input->get('lid'), 1, FALSE, 0);
     $inn_id = $this->get_user_inn_id();
     $per_page = 20;
     $orders = array('list' => array(), 'total' => 0);
     $orderstate = array('all' => 0, 'unpaid' => 1, 'paid' => 2, 'finished' => 3, 'refunded' => 4, 'cancel' => 5, 'refund' => 6, 'waiting' => 7);
     $search = array('key' => 'qieyou', 'key_id' => $inn_id, 'sid' => '', 'cid' => $cid, 'state' => $orderstate[$state], 'st' => $starttime, 'ed' => $endtime);
     $key = $this->input->get('key');
     $keyword = $this->input->get('keyword');
     $search_keyword = array('key' => $key, 'keyword' => $keyword);
     $orders = $this->model->get_orders($search, $page, $per_page, $search_keyword);
     /**************页面载入相关信息处理**************/
     $total = $orders['total'];
     $order_products = array();
     $orderlist = array();
     if ($total) {
         $orderview = $this->orderview($orders);
         $orderlist = $orderview['orders'];
         $order_products = $orderview['order_products'];
     }
     $pageInfo = array('total' => $total, 'perpage' => $per_page, 'curpage' => $page, 'totalpage' => $total / $per_page, 'url' => makePageUrl());
     $this->viewData = array('orders' => $orderlist, 'order_products' => $order_products, 'pageInfo' => $pageInfo, 'state' => $state, 'cid' => $cid, 'starttime' => $starttime, 'endtime' => $endtime);
 }
Exemplo n.º 13
0
 /**
  * 收藏商品
  **/
 public function itemlike()
 {
     $user_id = $this->get_user_id(TRUE);
     $product_id = input_int($this->input->get('item_id'), 1, FALSE, FALSE, '2001');
     $act = input_string($this->input->get('act'), array('like', 'unlike'), FALSE, '4001');
     $product = $this->model->get_product_by_product_id($product_id);
     if (!$product) {
         response_code('2001');
     }
     if ($act == 'like') {
         $is_like = $this->model->check_product_fav($product_id, $user_id);
         if ($is_like) {
             response_code('2014');
         }
     } else {
         $is_like = $this->model->check_product_fav($product_id, $user_id);
         if (!$is_like) {
             response_code('2013');
         }
     }
     if ($this->model->product_fav($act, $product, $user_id)) {
         response_code('1');
     }
     response_code('-1');
 }
Exemplo n.º 14
0
 public function searchDestInns()
 {
     $this->moduleTag = 'searchDestInns';
     $dest_id = input_int($this->input->get('tid'), 1, FALSE, 0);
     $local_id = input_int($this->input->get('lid'), 1, FALSE, 0);
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = DEFAULT_PERPAGE;
     $arr = $this->model->get_localArr(0, $local_id, $dest_id);
     $destInfo = $arr['destInfo'];
     $localArr = $arr['localArr'];
     $destInnsInfo = $this->model->searchInnsBy_dest_Id(build_limit($page, $perpage), $dest_id, $local_id);
     $pageInfo = array('total' => $destInnsInfo['total'], 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $destInnsInfo['total'] / $perpage, 'url' => makePageUrl($page));
     $this->viewData = array('destInnsInfo' => $destInnsInfo, 'destInfo' => $destInfo, 'localArr' => $localArr, 'pageInfo' => $pageInfo);
 }
Exemplo n.º 15
0
 /**
  * 会员管理  删除用户 允许加入 拒绝加入
  **/
 public function modifyMember()
 {
     $user_id = $this->get_user_id(TRUE);
     $group_id = input_int($this->input->post('group'), 1000, FALSE, FALSE, '6001');
     $member_id = input_int($this->input->post('member'), 1000, FALSE, FALSE, '4003');
     $act = input_string($this->input->post('act'), array('delmember', 'allow', 'ignore'), FALSE, '4001');
     $group = $this->check_user_group_auth($user_id, $group_id);
     $member = $this->model->get_user_member_info($member_id);
     if (!$member || $member['group_id'] != $group_id) {
         response_code('6006');
     }
     $rs = FALSE;
     switch ($act) {
         case 'delmember':
             if ($member['is_admin'] && $user_id != $group['create_by']) {
                 response_code('6005');
             }
             if ($member['user_id'] == $group['create_by']) {
                 response_code('6005');
             }
             $rs = $this->model->delete_group_member($member);
             //删除成员
             break;
         case 'setadmin':
             //	$rs = $this->model->delete_group_member($member);	//删除成员
             break;
         case 'unsetadmin':
             //	$rs = $this->model->delete_group_member($member);	//删除成员
             break;
         case 'setgroupown':
             if ($user_id != $group['create_by']) {
                 response_code('6005');
             }
             if ($member['user_id'] == $group['create_by']) {
                 response_code('6005');
             }
             break;
         case 'allow':
             if (!$member['waiting']) {
                 response_code('6007');
             }
             $rs = $this->model->allow_group_member($member, $user_id);
             //允许加入部落
             if ($rs) {
                 // 修改已发消息
                 $this->load->model('message_model');
                 $msg_detail['waiting'] = 0;
                 $msg_detail['member_id'] = $member['member_id'];
                 $msg_detail['set_user_name'] = $this->get_current_data('nick_name');
                 $this->message_model->update_message_detail($msg_detail);
             }
             break;
         case 'ignore':
             if (!$member['waiting']) {
                 response_code('6007');
             }
             $rs = $this->model->ignore_group_member($member);
             //删除请求
             if ($rs) {
                 // 修改已发消息
                 $this->load->model('message_model');
                 $msg_detail['waiting'] = 2;
                 $msg_detail['member_id'] = $member['member_id'];
                 $msg_detail['set_user_name'] = $this->get_user_name();
                 $this->message_model->update_message_detail($msg_detail);
             }
             break;
     }
     if ($rs) {
         response_code('1');
     }
     response_code('4000');
 }
Exemplo n.º 16
0
Arquivo: inn.php Projeto: qiuai/qieyou
 /**
  * 商户子账户管理
  * 访问权限:innholder only
  */
 public function submanage()
 {
     $action = input_string($this->input->get('act'), array('add', 'del', 'wake', 'stop'), FALSE, '4001');
     $innInfo = $this->model->get_inn_info_by_inn_id($this->token['inn_id'], FALSE);
     if ($this->token['user_id'] != $innInfo['innholder_id']) {
         response_msg('1018');
     }
     if (in_array($action, array('del', 'wake', 'stop'))) {
         $user_id = input_int($this->input->get('uid'), 1, FALSE, FALSE, '1019');
         $data = $this->model->get_sub_detail_by_user_id($this->token['inn_id'], $user_id);
         if (!$data) {
             response_msg('1020');
         }
         $rs = $this->model->modify_inn_sub_by_user_id($action, $this->token['inn_id'], $user_id);
         if ($rs) {
             response_msg('1');
         }
         response_msg('4000');
     }
     response_msg('1');
 }
Exemplo n.º 17
0
 private function check_forum()
 {
     $info['title'] = check_empty(strip_tags($this->input->post('title')));
     $info['content'] = check_empty(strip_tags($this->input->post('content')));
     $user_name = $this->input->post('user_name');
     $users = $this->model->get_userinfo($user_name);
     if (!$users) {
         response_code('1003');
     }
     $info['user_id'] = $users['user_id'];
     $info['group_id'] = input_int($this->input->post('group_id'), 1000, FAlSE, 0);
     if (!$this->model->get_group($info['group_id'])) {
         response_code('1034');
     }
     $info['type'] = input_string($this->input->post('type'), array('tour', 'jianren', 'wenda'), FALSE, '4001');
     $tags = check_empty(trimall(strip_tags($this->input->post('tags'))), '');
     if ($tags) {
         $info['tags'] = array();
         $tags = explode(',', $tags);
         foreach ($tags as $key => $row) {
             if (!$row) {
                 continue;
             }
             if (mb_strlen($row) > 6) {
                 response_json('6033', '标签:"' . $row . '" 字数过长');
             }
             $info['tags'][] = $row;
         }
         if (count($info['tags']) > 3) {
             response_code('6032');
         }
         $info['tags'] = implode(',', $info['tags']);
     } else {
         $info['tags'] = '';
     }
     $create_time = strtotime($this->input->post('create_time'));
     $info['create_time'] = $create_time > $_SERVER['REQUEST_TIME'] ? $_SERVER['REQUEST_TIME'] : ($create_time ? $create_time : $_SERVER['REQUEST_TIME']);
     $info['city'] = '丽江市';
     if ($this->input->post('address') != "") {
         $address_arr = array('丽江市古城区束河古镇龙泉路束河完小东60米' => '100.213112,26.9271', '100.215646,26.928155', '丽江市古城区束河古镇泉居委会中和路中和村32号' => '100.212796,26.92867', '丽江市束河东康八组拐柳巷(近飞花触水)' => '100.209386,26.927245', '丽江古城区束河古镇悦榕路(近束河古镇中心位置)' => '100.219511,26.931215', '丽江束河古镇北门停车场(束河古镇,近四方街)' => '100.215071,26.931239', '云南省丽江束河古镇龙泉行政文明二社24号' => '100.213463,26.930885', '束河古镇仁里村8号九鼎龙潭西北侧' => '100.212726,26.932672', '云南省丽江市城西北7公里束河村古街旁' => '100.210235,26.931054', '云南省丽江市玉龙纳西族自治县15公里处' => '100.232102,27.115041', '丽江市白沙乡北部玉水寨旅游风景区内' => '100.207576,27.003324', '丽江香格里拉大道延伸段' => '100.225606,26.914328', '云南省丽江市古城区长水路85' => '100.240785,26.871959', '丽江义尚街文明巷81号' => '100.250337,26.879137');
         $address_position = explode(',', $address_arr[$this->input->post('address')]);
         $info['lat'] = $address_position[0];
         $info['lon'] = $address_position[1];
     }
     $info['img'] = $this->input->post('img');
     return $info;
 }
Exemplo n.º 18
0
 /**
  * 删除我的帖子  我的回帖   type:forum 话题 post 回帖
  **/
 public function delMyForum()
 {
     $user_id = $this->get_user_id(TRUE);
     $type = input_string($this->input->post('type'), array('forum', 'post'), FALSE, '4001');
     $type_id = input_int($this->input->post('typeid'), 1, FALSE, FALSE, '4001');
     switch ($type) {
         case 'forum':
             $forum = $this->model->get_user_forum_by_id($type_id);
             if (!$forum || $forum['is_delete']) {
                 response_code('6004');
             }
             if ($forum['create_user'] != $user_id) {
                 response_code('6005');
             }
             $rs = $this->model->delete_forum_by_id($forum);
             break;
         case 'post':
             $post = $this->model->get_user_post_by_id($type_id);
             if (!$post || $post['is_delete']) {
                 response_code('6025');
             }
             if ($post['create_user'] != $user_id) {
                 response_code('6005');
             }
             $rs = $this->model->delete_post_by_id($post);
             break;
     }
     if ($rs) {
         response_code('1');
     }
     response_code('4000');
 }
Exemplo n.º 19
0
 private function check_user_data($type)
 {
     if ($type == 'address') {
         $address = array();
         $address['real_name'] = check_empty(trimall(strip_tags($this->input->post('real_name'))), FALSE, '1014');
         $address['mobile'] = input_mobilenum($this->input->post('mobile'), '5001');
         $address['location_id'] = input_int($this->input->post('local_id'), 100000, 1000000, FALSE, '1015');
         $address['address'] = check_empty(trimall(strip_tags($this->input->post('address'))), FALSE, '1016');
         $local = check_empty($this->model->get_local_info($address['location_id']), FALSE, '1015');
         $address['location'] = $local['sheng']['name'] . $local['shi']['name'] . $local['city']['name'];
         return $address;
     } else {
         if ($type == 'identify') {
             $identify = array();
             $identify['real_name'] = check_empty(trimall(strip_tags($this->input->post('real_name'))), FALSE, '1014');
             $identify['idcard'] = input_identity_number($this->input->post('idcard'), '1019');
             return $identify;
         } else {
             response_code('4001');
         }
     }
 }
Exemplo n.º 20
0
 /**
  * 商品评价提交
  * 
  **/
 public function commentPost()
 {
     $user_id = $this->get_user_id(TRUE);
     $order_num = input_num($this->input->post('order'), 10000, FALSE, FALSE, '3001');
     $data['points'] = input_int($this->input->post('stars'), 1, 5, FALSE, '3011');
     $data['note'] = $this->input->post('note');
     $data['picture'] = rtrim($this->input->post('images'), ',');
     if (!$data['picture'] && !$data['note']) {
         response_code('3012');
     }
     $data['has_pic'] = $data['picture'] ? 1 : 0;
     $order = $this->model->get_order_detail_by_order_num($order_num, $user_id);
     if (!$order) {
         response_code('3001');
     }
     if ($order['commented']) {
         response_code('3013');
     }
     $data['user_id'] = $order['user_id'];
     $data['product_id'] = $order['product_id'];
     $rs = $this->model->add_product_comment($order_num, $data);
     if ($rs) {
         response_code('1');
     }
     response_code('4000');
 }
Exemplo n.º 21
0
 public function is_del_group()
 {
     $group_id = input_int($this->input->post('group_id'), 1, FALSE, 0);
     $rs = $this->model->is_del_group($group_id);
     if (!$rs) {
         response_code('-1');
     }
     response_code('1');
 }
Exemplo n.º 22
0
 private function check_product_value($add = FALSE)
 {
     log_message('error', json_encode($this->input->post()));
     $data = array();
     $inn = $this->model->get_inn_info_by_inn_id($this->token['inn_id'], FALSE);
     $price = input_empty($this->input->post('price'), FALSE, '4003');
     $price = sprintf("%.2f", $price);
     if ($price < 0) {
         response_msg('2016');
     }
     $old_price = input_empty($this->input->post('old_price'), 0);
     $old_price = sprintf("%.2f", $old_price);
     if ($old_price == 0) {
         $old_price = $price;
     } else {
         if ($old_price < $price) {
             response_msg('2017');
         }
     }
     if ($add) {
         $data['category'] = input_int($this->input->post('cid'), 0, FALSE, FALSE, '2004');
         if ($data['category'] == 6) {
             response_msg('4001');
         }
         $data['category_id'] = input_int($this->input->post('ccid'), 0, FALSE, FALSE, '2006');
         $data['tuan_end_time'] = $this->input->post('tuan_end_time') ? strtotime($this->input->post('tuan_end_time')) : '';
         $data['tuan_end_time'] = input_int($data['tuan_end_time'], $_SERVER['REQUEST_TIME'], $_SERVER['REQUEST_TIME'] + 31536000, $_SERVER['REQUEST_TIME'] + 31536000);
         //有效期1年以内 过期下架
     }
     $data['product_name'] = input_empty($this->input->post('product_name'), FALSE, '4003');
     $data['price'] = $price;
     $data['old_price'] = $old_price;
     $data['quantity'] = input_int($this->input->post('quantity'), 0, FALSE, FALSE, '2015');
     $data['note'] = $this->input->post('note', TRUE);
     $data['booking_info'] = $this->input->post('booking_info', TRUE);
     $data['thumb'] = input_empty($this->input->post('thumb'), 0);
     $data['product_images'] = input_empty($this->input->post('product_images'), FALSE, '2019');
     $data['product_images'] = explode(',', $data['product_images']);
     foreach ($data['product_images'] as $key => $row) {
         $info = explode('.', strrev($row));
         $gallery[] = strrev($info[1]) . 'm.' . strrev($info[0]);
         if ($key == 0) {
             $data['thumb'] = strrev($info[1]) . 's.' . strrev($info[0]);
         }
     }
     if (empty($data['thumb'])) {
         response_msg('2018');
     }
     $data['product_images'] = implode(',', $data['product_images']);
     $data['gallery'] = implode(',', $gallery);
     $data['detail_images'] = input_empty($this->input->post('detail_images'), '');
     $data['content'] = mb_substr($data['note'], 0, 50, 'utf-8');
     return $data;
 }
Exemplo n.º 23
0
 public function optionEdit()
 {
     if (IS_POST) {
         $opt['id'] = input_int($this->input->get_post('id'), 1, FALSE, FALSE, '-1');
         $opt['note'] = $this->input->get_post('note');
         $data = $this->optionConfig();
         $opt['img'] = $data['img'];
         $opt['type'] = $data['type'];
         $this->load->model('product_option_model');
         if ($this->product_option_model->optEdit($opt)) {
             response_json(1);
         } else {
             response_json(-1);
         }
     }
 }