Пример #1
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);
 }
Пример #2
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);
 }
Пример #3
0
 public function feedback()
 {
     $this->moduleTag = 'feedback';
     $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'), '');
     if ($starttime) {
         $starttime = strtotime($starttime);
     }
     if ($endtime) {
         $endtime = strtotime($endtime) + 86399;
     }
     $search = array('starttime' => $starttime, 'endtime' => $endtime);
     $rs = $this->model->get_user_feedback($search, $page, $perpage);
     $total = $rs['total'];
     $data = $rs['list'];
     $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);
 }
Пример #4
0
 /**
  * 用户管理 用户列表
  * web page
  */
 public function index()
 {
     $this->moduleTag = 'userIndex';
     $type = input_string($this->input->get('type'), array('all', 'user', 'innholder', 'cservice', 'smanager'), 'all');
     $user_name = $this->input->get('user_name');
     $nick_name = $this->input->get('nick_name');
     $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'), '');
     if ($starttime) {
         $starttime = strtotime($starttime);
     }
     if ($endtime) {
         $endtime = strtotime($endtime) + 86399;
     }
     $search = array('starttime' => $starttime, 'endtime' => $endtime, 'type' => $type, 'user_name' => $user_name, 'nick_name' => $nick_name);
     $data = $this->model->get_backend_users_by_param($search, $page, $perpage);
     $total = $data['total'];
     $users = $data['list'];
     $pageInfo = array('total' => $total, 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $total / 15, 'url' => makePageUrl($page));
     $this->viewData = array('users' => $users, 'type' => $type, 'pageInfo' => $pageInfo, 'starttime' => $starttime, 'endtime' => $endtime);
 }
Пример #5
0
 public function reply()
 {
     $this->moduleTag = 'reply';
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 0, FALSE, 15);
     $class = input_string($this->input->get('class'), array('all', 'wenda', 'jianren', 'tour'), 'all');
     $keyword = input_empty(trim($this->input->get('keyword')), '');
     $starttime = input_empty($this->input->get('starttime'), '');
     $is_del = input_int($this->input->get('is_del'), 1, FALSE, 0);
     $endtime = input_empty($this->input->get('endtime'), '');
     if ($starttime) {
         $starttime = strtotime($starttime);
     }
     if ($endtime) {
         $endtime = strtotime($endtime) + 86399;
     }
     $search = array('starttime' => $starttime, 'endtime' => $endtime, 'class' => $class, 'keyword' => $keyword, 'is_del' => $is_del);
     $rs = $this->model->get_reply($search, $page, $perpage);
     $total = $rs['total'];
     $data = $rs['list'];
     $pageInfo = array('total' => $total, 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $total / 15, 'url' => makePageUrl($page));
     $this->viewData = array('frontUrl' => $this->config->item('front_url'), 'data' => $data, 'pageInfo' => $pageInfo, 'starttime' => $starttime, 'endtime' => $endtime, 'class' => $class, 'is_del' => $is_del);
 }
Пример #6
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;
 }
Пример #7
0
 private function check_product_value($type)
 {
     $data = array();
     $price = input_empty($this->input->post('price'), FALSE, '2001');
     $price = sprintf("%.2f", $price);
     if ($price < 0) {
         response_code('2001');
     }
     $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_code('2002');
         }
     }
     $data['category'] = input_int($this->input->post('category'), 1, FALSE, FALSE, '2003');
     $data['category_id'] = input_int($this->input->post('category_id'), 1, FALSE, FALSE, '2004');
     $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年以内 过期下架
     if ($type == 'tuan') {
         $profit = input_empty($this->input->post('profit'), FALSE, '2005');
         $profit = sprintf("%.2f", $profit);
         if ($profit < 0) {
             response_code('2005');
         }
         $purchase_price = input_empty($this->input->post('purchase_price'), FALSE, '2006');
         $purchase_price = sprintf("%.2f", $purchase_price);
         if ($purchase_price < 0) {
             response_code('2006');
         }
         $agent = $price - $profit - $purchase_price;
         if ($agent < 0) {
             response_code('2007');
         }
         $agent = sprintf("%.2f", $agent);
         $facility = $this->input->post('receipt') ? 'receipt' : '';
         $data['agent'] = $agent;
         $data['purchase_price'] = $purchase_price;
         $data['facility'] = $facility;
     }
     $data['is_express'] = $this->input->post('is_express') ? '1' : '0';
     $data['product_name'] = input_empty($this->input->post('product_name', TRUE), FALSE, '2008');
     $data['price'] = $price;
     $data['old_price'] = $old_price;
     $data['quantity'] = input_int($this->input->post('quantity'), 0, FALSE, FALSE, '2009');
     $data['note'] = $this->input->post('note', TRUE);
     $data['booking_info'] = $this->input->post('booking_info', TRUE);
     $data['thumb'] = input_empty($this->input->post('thumb'), '');
     $data['product_images'] = input_empty($this->input->post('images', TRUE), FALSE, '2010');
     $data['detail_images'] = input_empty($this->input->post('detail_images'), array());
     $gallery = array();
     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_code('2011');
     }
     $data['product_images'] = implode(',', $data['product_images']);
     $data['gallery'] = implode(',', $gallery);
     $data['detail_images'] = implode(',', $data['detail_images']);
     $data['content'] = input_empty($this->input->post('content'), '');
     return $data;
 }
Пример #8
0
 /**
  * submit the cash out apply
  */
 public function applyCash()
 {
     $apply_amount = input_empty($this->input->post('apply_amount'), FALSE, '4001');
     $apply['amount'] = sprintf("%.2f", $apply_amount);
     if ($apply['amount'] <= 0) {
         response_msg('4001');
     }
     $innInfo = $this->model->get_inn_info_by_inn_id($this->token['inn_id']);
     if (!$innInfo) {
         response_msg('1018');
     }
     if ($innInfo['account'] - $innInfo['withdrawing'] < $apply_amount) {
         response_msg('1022');
     }
     $apply['user_id'] = $this->token['user_id'];
     $apply['inn_id'] = $this->token['inn_id'];
     $this->_LoadModel('finance');
     $rs = $this->finance_model->inn_apply_cashout($apply);
     if (!$rs) {
         response_msg('5001');
     }
     response_msg('1');
 }
Пример #9
0
 public function submitOrder()
 {
     $pid = input_int($this->input->post('pid'), 1, FALSE, FALSE, '2008');
     $count = input_int($this->input->post('count'), 1, FALSE, FALSE, '2008');
     $product = $this->model->get_product_detail_by_product_id($pid);
     if (!$product) {
         response_msg('2009');
     }
     if (!$product['sale_license'] || $product['state'] == 'N' || $product['state'] == 'D' || $product['quantity'] < $count) {
         response_msg('3009');
     }
     if ($product['tuan_end_time'] < $_SERVER['REQUEST_TIME']) {
         response_msg('3010');
     }
     $partner['id'] = input_int($this->input->post('pn_id'), 1, FALSE, 0);
     $partner['name'] = input_empty($this->input->post('pn_name'), '3005');
     $partner['mobile'] = input_mobilenum($this->input->post('pn_mobile'), '3006');
     if ($product['category'] == '7') {
         $partner['identity_no'] = input_identity_number($this->input->post('pf_identity_no'), '3013');
     }
     $partner['count'] = $count;
     $order['user_id'] = $this->token['user_id'];
     $order['contact'] = $partner['name'];
     $order['telephone'] = $partner['mobile'];
     $order['inn_id'] = $product['inn_id'];
     $order['seller_inn'] = $product['inn_id'] == $this->token['inn_id'] ? 0 : $this->token['inn_id'];
     $order['total'] = $count * $product['price'];
     //且游收益计算 :如果是且游的商品 看是否有代售 代售则分配佣金 price-agent * count   不是且游商品看分佣比例
     if ($product['is_qieyou']) {
         $order['inns_profit'] = 0;
         $order['agent_commission'] = $order['seller_inn'] ? $product['agent'] * $count : 0;
     } else {
         if ($product['state'] == 'T') {
             if ($product['inn_id'] == $this->token['inn_id']) {
                 $order['inns_profit'] = ($product['purchase_price'] + $product['agent']) * $count;
                 $order['agent_commission'] = 0;
             } else {
                 $order['inns_profit'] = $product['purchase_price'] * $count;
                 $order['agent_commission'] = $product['agent'] * $count;
             }
         } else {
             $order['inns_profit'] = $order['total'] * $product['profit'] / 100;
             $order['agent_commission'] = 0;
         }
     }
     $order['profit'] = $order['total'] - $order['agent_commission'] - $order['inns_profit'];
     // 拼音转换
     $this->load->library('spell');
     $spell = new spell();
     $order['spell'] = $spell->getAllPY(iconv('utf-8', 'gb2312', $order['user_name']), ' ');
     $rs = $this->model->user_submit_order($order, $product, $partner);
     if ($rs) {
         $rs = array('code' => '1', 'msg' => $rs);
         response_data($rs);
     }
     response_msg('3007');
 }