public function update()
 {
     B('FilterString');
     $data = M("ApnsMessages")->create();
     $log_info = $data['id'];
     //开始验证有效性
     $this->assign("jumpUrl", u("MApns/edit", array("id" => $data['id'])));
     if (!check_empty($data['content'])) {
         $this->error(L("CONTENT_EMPTY_TIP"));
     }
     if ($data['send_time'] == '') {
         $data['send_time'] = get_gmtime();
     }
     $data['send_time'] = to_timespan($data['send_time']);
     if (intval($_REQUEST['resend']) == 1) {
         $data['status'] = 0;
     }
     $list = M("ApnsMessages")->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Example #2
0
 public function insert_ticket()
 {
     if ($_REQUEST['money'] == '') {
         $this->error("券的金额不能为空");
     }
     if ($_REQUEST['amount'] == '') {
         $this->error("券的数量不能为空");
     }
     if ($_REQUEST['use_time'] == '') {
         $this->error("券的有效天数不能为空");
     }
     $ticket_data['money'] = intval($_REQUEST['money']);
     $ticket_data['quantity'] = intval($_REQUEST['amount']);
     $ticket_data['rest_quantity'] = intval($_REQUEST['amount']);
     $ticket_data['use_time'] = intval($_REQUEST['use_time']);
     $ticket_data['status'] = intval($_REQUEST['status']);
     $ticket_data['value'] = intval($_REQUEST['value']);
     $ticket_data['is_deposit'] = 1;
     //券的类型  0:赠金券 1代金券
     $ticket_data['ticket_type'] = intval($_REQUEST['type']);
     //券的使用类型  0:无条件  1:满减优惠
     $ticket_data['type'] = intval($_REQUEST['use_type']);
     //系统默认时间
     $ticket_data['create_time'] = get_gmtime();
     $ticket_data['start_use'] = to_timespan(trim($_REQUEST['start_time']));
     $ticket_data['deadline'] = to_timespan(trim($_REQUEST['end_time']));
     $rs = M("Ticket")->add($ticket_data);
     if ($rs) {
         $this->success(L("INSERT_SUCCESS"));
     } else {
         $this->error(L("INSERT_FAILED"));
     }
 }
Example #3
0
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("VOUCHER_NAME_EMPTY_TIP"));
     }
     if (doubleval($data['money']) <= 0) {
         $this->error(L("VOUCHER_MONEY_ERROR_TIP"));
     }
     $data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']);
     $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("use_limit", $data['use_limit']);
         //同步可用次数
         M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("begin_time", $data['begin_time']);
         M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("end_time", $data['end_time']);
         M("Ecv")->where("ecv_type_id=" . $data['id'])->setField("money", $data['money']);
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
Example #4
0
 /**
  * 订单来路的图饼展示
  */
 public function order_referer()
 {
     $where = " 1=1 ";
     $where .= " and type <> 1";
     $map['type'] = array("neq", 1);
     $begin_time = strim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
     $end_time = strim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
     if ($end_time == 0) {
         $where .= " and create_time > " . $begin_time;
         $map['create_time'] = array("gt", $begin_time);
     } else {
         $where .= " and create_time between " . $begin_time . " and " . $end_time;
         $map['create_time'] = array("between", array($begin_time, $end_time));
     }
     $sql = "select referer,count(id) as ct from " . DB_PREFIX . "deal_order where " . $where . " and referer <> '' group by referer having count(id) > 0 order by ct desc limit 8 ";
     $total_sql = "select count(*) from " . DB_PREFIX . "deal_order where " . $where;
     $colors = array("0xAAAAAA", "0x669999", "0xBBBB55", "0xCC6600", "0x9999FF", "0x0066CC", "0x99CCCC", "0x999999", "0xFFCC00", "0x009999", "0x99CC33", "0xFF9900", "0x999966", "0x66CCCC", "0x339966", "0xCCCC33");
     $total = intval($GLOBALS['db']->getOne($total_sql));
     $list = $GLOBALS['db']->getAll($sql);
     $items = array();
     foreach ($list as $k => $v) {
         $total -= intval($v['ct']);
         $items[] = array("value" => intval($v['ct']), "tip" => $v['referer'], "on-click" => "jump_to('" . u("DealOrder/deal_index", array("referer" => $v['referer'])) . "')");
     }
     $items[] = array("value" => $total, "tip" => "直接访问", "on-click" => "jump_to('" . u("DealOrder/deal_index", array("referer" => -1)) . "')");
     $data['bg_colour'] = "#ffffff";
     $data['elements'] = array(array("type" => "pie", "colours" => $colors, "alpha" => 1, "border" => 2, "start-angle" => 35, "values" => $items));
     ajax_return($data);
 }
 public function index()
 {
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     $user_id = $GLOBALS['user_info']['id'];
     $status = isset($_REQUEST['stauts']) ? intval($_REQUEST['stauts']) : 3;
     $time = isset($_REQUEST['time']) ? to_timespan($_REQUEST['time'], "Ymd") : "";
     $deal_name = strim($_REQUEST['deal_name']);
     $condition = "";
     if ($deal_name != "") {
         $condition .= " and d.name = '" . $deal_name . "' ";
         $GLOBALS['tmpl']->assign('deal_name', $deal_name);
     }
     if ($time != "") {
         $condition .= " and dlr.repay_time = " . $time . " ";
         $GLOBALS['tmpl']->assign('time', to_date($time, "Y-m-d"));
     }
     $result = getUcRepayPlan($user_id, $status, $limit, $condition);
     if ($result['rs_count'] > 0) {
         $page = new Page($result['rs_count'], app_conf("PAGE_SIZE"));
         //初始化分页对象
         $p = $page->show();
         $GLOBALS['tmpl']->assign('pages', $p);
         $GLOBALS['tmpl']->assign('list', $result['list']);
     }
     $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_REPAY_PLAN']);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_repay_plan.html");
     $GLOBALS['tmpl']->assign("status", $status);
     $GLOBALS['tmpl']->display("page/uc.html");
 }
 public function index()
 {
     $order_sn = strim($_REQUEST['order_sn']);
     $time = isset($_REQUEST['time']) ? to_date(to_timespan($_REQUEST['time'], "Y-m-d"), "Y-m-d") : "";
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     $condition = " 1=1 ";
     if ($order_sn != "") {
         $condition .= " and go.order_sn = '" . $order_sn . "' ";
     }
     if ($time != "") {
         $condition .= " and go.ex_date = '" . $time . "' ";
         $GLOBALS['tmpl']->assign('time', $time);
     }
     $user_id = $GLOBALS['user_info']['id'];
     $result = get_order($limit, $user_id, $condition);
     $page = new Page($result['count'], app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("order_sn", $order_sn);
     $GLOBALS['tmpl']->assign("order_info", $result['list']);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_goods_order.html");
     $GLOBALS['tmpl']->display("page/uc.html");
 }
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $user_names = preg_split("/[ ,]/i", $data['user_names']);
     $user_ids = "";
     foreach ($user_names as $k => $v) {
         $uid = M("User")->where("user_name = '" . $v . "'")->getField("id");
         if ($uid) {
             $user_ids .= $uid . "|";
         }
     }
     $data['user_ids'] = $user_ids;
     $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("title");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['title'])) {
         $this->error(L("MSY_TITLE_EMPTY_TIP"));
     }
     if (!check_empty($data['content'])) {
         $this->error(L("MSY_CONTENT_EMPTY_TIP"));
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
 public function index()
 {
     $GLOBALS['tmpl']->assign("page_title", "投资奖励");
     $start_time = strim($_REQUEST['start_time']);
     $end_time = strim($_REQUEST['end_time']);
     $d = explode('-', $start_time);
     if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)");
         exit;
     }
     $d = explode('-', $end_time);
     if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)");
         exit;
     }
     if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) {
         $this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time);
         exit;
     }
     if (strim($start_time) != "") {
         $where .= " and gr.release_date >='" . strim($start_time) . "'";
     }
     if (strim($end_time) != "") {
         $where .= " and gr.release_date <='" . strim($end_time) . "'";
     }
     if (isset($_REQUEST['gift_type'])) {
         $gift_type = $_REQUEST['gift_type'];
         if ($gift_type != 5) {
             $where .= " and gr.gift_type ='" . $gift_type . "'";
             $GLOBALS['tmpl']->assign("gift_type", $gift_type);
         }
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     if ($limit) {
         $limit = " limit " . $limit;
     }
     $list_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "gift_record gr left join " . DB_PREFIX . "deal d on d.id = gr.deal_id  WHERE gr.user_id='" . $GLOBALS['user_info']['id'] . "' {$where} ");
     $list = array();
     if ($list_count > 0) {
         $sql = "select gr.*,d.name,vg.name as gift_name,sum(dlr.true_reward_money) as reward_money  from " . DB_PREFIX . "gift_record gr " . "left join " . DB_PREFIX . "deal d on d.id = gr.deal_id  " . "left join " . DB_PREFIX . "vip_gift vg on vg.id = gr.gift_value AND gr.gift_type='4' " . "left join " . DB_PREFIX . "deal_load_repay dlr on dlr.load_id = gr.load_id  " . "WHERE gr.user_id='" . $GLOBALS['user_info']['id'] . "' AND ((gr.gift_type = 2 AND dlr.true_reward_money >0 ) OR (gr.gift_type <> 2)) {$where} GROUP BY gr.load_id order by gr.id desc " . $limit;
         $list = $GLOBALS['db']->getAll($sql);
         foreach ($list as $k => $v) {
             $list[$k]['url'] = url("index", "deal#index", array("id" => $v['deal_id']));
         }
     }
     $page = new Page($list_count, app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("list", $list);
     $GLOBALS['tmpl']->assign("start_time", $start_time);
     $GLOBALS['tmpl']->assign("end_time", $end_time);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_gift_record.html");
     $GLOBALS['tmpl']->display("page/uc.html");
 }
Example #9
0
 public function index()
 {
     init_app_page();
     $s_account_info = $GLOBALS["account_info"];
     $supplier_id = intval($s_account_info['supplier_id']);
     $name = strim($_REQUEST['name']);
     $begin_time = strim($_REQUEST['begin_time']);
     $end_time = strim($_REQUEST['end_time']);
     $begin_time_s = to_timespan($begin_time, "Y-m-d H:i");
     $end_time_s = to_timespan($end_time, "Y-m-d H:i");
     $condition = "";
     if ($name != "") {
         $youhui_ids = $GLOBALS['db']->getRow("select group_concat(id SEPARATOR ',') as ids  from " . DB_PREFIX . "youhui where name  like '%" . $name . "%'");
         $condition .= " and log.youhui_id in (" . $youhui_ids['ids'] . ") ";
     }
     if ($begin_time_s) {
         $condition .= " and log.create_time > " . $begin_time_s . " ";
     }
     if ($end_time_s) {
         $condition .= " and log.create_time < " . $end_time_s . " ";
     }
     $GLOBALS['tmpl']->assign("name", $name);
     $GLOBALS['tmpl']->assign("begin_time", $begin_time);
     $GLOBALS['tmpl']->assign("end_time", $end_time);
     //分页
     $page_size = 15;
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * $page_size . "," . $page_size;
     $list = $GLOBALS['db']->getAll("select distinct(log.id),log.* from " . DB_PREFIX . "youhui_log as log  left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = log.youhui_id where l.location_id in (" . implode(",", $s_account_info['location_ids']) . ") " . $condition . " order by log.create_time desc limit " . $limit);
     foreach ($list as $k => $v) {
         $list[$k]['user_name'] = load_user($v['user_id']);
         $list[$k]['user_name'] = $list[$k]['user_name']['user_name'];
         $youhui_info = load_auto_cache("youhui", array('id' => $v['youhui_id']));
         $list[$k]['youhui_name'] = $youhui_info['name'];
         $location_info = load_auto_cache("store", array('id' => $v['location_id']));
         $list[$k]['location_name'] = $location_info['name'];
         if ($list[$k]['expire_time'] != 0 && $list[$k]['expire_time'] < NOW_TIME) {
             $list[$k]['expire_time'] = "已过期";
         } elseif ($list[$k]['expire_time'] == 0) {
             $list[$k]['expire_time'] = "永久有效";
         } else {
             $list[$k]['expire_time'] = to_date($list[$k]['expire_time']);
         }
         $list[$k]['url'] = url('index', 'youhui#' . $v['youhui_id']);
     }
     $total = $GLOBALS['db']->getOne("select count(distinct(log.id)) from " . DB_PREFIX . "youhui_log as log  left join " . DB_PREFIX . "youhui_location_link as l on l.youhui_id = log.youhui_id where l.location_id in (" . implode(",", $s_account_info['location_ids']) . ") " . $condition);
     $page = new Page($total, $page_size);
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("list", $list);
     $GLOBALS['tmpl']->assign("head_title", "优惠券下载记录");
     $GLOBALS['tmpl']->display("pages/youhuio/index.html");
 }
 private function getlist($extwhere)
 {
     //分类
     $cate_tree = M("DealCate")->where('is_delete = 0')->findAll();
     $cate_tree = D("DealCate")->toFormatTree($cate_tree, 'name');
     $this->assign("cate_tree", $cate_tree);
     $conditon = " 1=1 ";
     //开始加载搜索条件
     if (intval($_REQUEST['deal_id']) > 0) {
         $conditon .= " and d.deal_id = " . intval($_REQUEST['deal_id']);
     }
     if (intval($_REQUEST['cate_id']) > 0) {
         require_once APP_ROOT_PATH . "system/utils/child.php";
         $child = new Child("deal_cate");
         $cate_ids = $child->getChildIds(intval($_REQUEST['cate_id']));
         $cate_ids[] = intval($_REQUEST['cate_id']);
         $conditon .= " and d.cate_id in (" . implode(",", $cate_ids) . ")";
     }
     if (trim($_REQUEST['user_name']) != '') {
         $sql = "select group_concat(id) from " . DB_PREFIX . "user where user_name like '%" . trim($_REQUEST['user_name']) . "%'";
         $ids = $GLOBALS['db']->getOne($sql);
         if ($ids) {
             $conditon .= " and dl.user_id in ({$ids}) ";
         } else {
             $conditon .= " and dl.user_id = 0 ";
         }
     }
     if (intval($_REQUEST['user_id']) > 0) {
         $sql = "select user_name from " . DB_PREFIX . "user where id='" . intval($_REQUEST['user_id']) . "'";
         $_REQUEST['user_name'] = $GLOBALS['db']->getOne($sql);
         $conditon .= " and dl.user_id = " . intval($_REQUEST['user_id']);
     }
     $begin_time = trim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
     $end_time = trim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
     if ($begin_time > 0 || $end_time > 0) {
         if ($end_time == 0) {
             $conditon .= " and dl.create_time >= {$begin_time} ";
         } else {
             $conditon .= " and dl.create_time between  {$begin_time} and {$end_time} ";
         }
     }
     $count = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_load dl LEFT JOIN " . DB_PREFIX . "deal d ON d.id =dl.deal_id where {$conditon} {$extwhere} ORDER BY dl.id DESC ");
     if (!empty($_REQUEST['listRows'])) {
         $listRows = $_REQUEST['listRows'];
     } else {
         $listRows = '';
     }
     $p = new Page($count, $listRows);
     if ($count > 0) {
         $list = $GLOBALS['db']->getAll("SELECT dl.*,d.name,d.repay_time,d.repay_time_type,d.loantype,d.rate,d.cate_id FROM " . DB_PREFIX . "deal_load dl LEFT JOIN " . DB_PREFIX . "deal d ON d.id =dl.deal_id where {$conditon} {$extwhere} ORDER BY dl.id DESC  limit  " . $p->firstRow . ',' . $p->listRows);
         $this->assign("list", $list);
     }
     $page = $p->show();
     $this->assign("page", $page);
 }
 public function index()
 {
     if (trim($_REQUEST['log_info']) != '') {
         $map['log_info'] = array('like', '%' . trim($_REQUEST['log_info']) . '%');
     }
     $log_begin_time = trim($_REQUEST['log_begin_time']) == '' ? 0 : to_timespan($_REQUEST['log_begin_time']);
     $log_end_time = trim($_REQUEST['log_end_time']) == '' ? 0 : to_timespan($_REQUEST['log_end_time']);
     if ($log_end_time == 0) {
         $map['log_time'] = array('gt', $log_begin_time);
     } else {
         $map['log_time'] = array('between', array($log_begin_time, $log_end_time));
     }
     $this->assign("default_map", $map);
     parent::index();
 }
Example #12
0
 public function index()
 {
     $root = array();
     $email = strim($GLOBALS['request']['email']);
     //用户名或邮箱
     $pwd = strim($GLOBALS['request']['pwd']);
     //密码
     $id = intval($GLOBALS['request']['id']);
     //$user_id = intval($GLOBALS['user_info']['id']);
     $page = intval($GLOBALS['request']['page']);
     //检查用户,用户密码
     $user = user_check($email, $pwd);
     $user_id = intval($user['id']);
     if ($user_id > 0) {
         require APP_ROOT_PATH . 'app/Lib/deal.php';
         require APP_ROOT_PATH . 'app/Lib/uc_goods_func.php';
         $root['user_login_status'] = 1;
         $root['response_code'] = 1;
         $order_sn = strim($_REQUEST['order_sn']);
         $time = isset($_REQUEST['time']) ? to_date(to_timespan($_REQUEST['time'], "Y-m-d"), "Y-m-d") : "";
         if ($page == 0) {
             $page = 1;
         }
         $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
         $condition = " 1=1 ";
         if ($order_sn != "") {
             $condition .= " and go.order_sn = '" . $order_sn . "' ";
         }
         if ($time != "") {
             $condition .= " and go.ex_date = '" . $time . "' ";
             $root['time'] = $time;
         }
         $root['user_id'] = $user_id;
         $orders = get_order($limit, $user_id, $condition);
         $root['page'] = array("page" => $page, "page_total" => ceil($orders['count'] / app_conf("DEAL_PAGE_SIZE")), "page_size" => app_conf("DEAL_PAGE_SIZE"));
         $root['order_sn'] = $order_sn;
         $root['order_info'] = $orders['list'];
     } else {
         $root['response_code'] = 0;
         $root['show_err'] = "未登录";
         $root['user_login_status'] = 0;
     }
     $root['program_title'] = "我的兑现";
     output($root);
 }
 public function index()
 {
     $GLOBALS['tmpl']->assign("page_title", "节日福利");
     $start_time = strim($_REQUEST['start_time']);
     $end_time = strim($_REQUEST['end_time']);
     $d = explode('-', $start_time);
     if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)");
         exit;
     }
     $d = explode('-', $end_time);
     if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)");
         exit;
     }
     if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) {
         $this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time);
         exit;
     }
     if (strim($start_time) != "") {
         $where .= " and send_date >='" . strim($start_time) . "'";
     }
     if (strim($end_time) != "") {
         $where .= " and send_date <='" . strim($end_time) . "'";
     }
     $page = intval($_REQUEST['p']);
     if ($page == 0) {
         $page = 1;
     }
     $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE");
     if ($limit) {
         $limit = " limit " . $limit;
     }
     $list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "given_record gr left join " . DB_PREFIX . "user u on u.id = gr.user_id left join " . DB_PREFIX . "vip_festivals vf on vf.id = gr.gift_id  WHERE u.id='" . $GLOBALS['user_info']['id'] . "' {$where} order by gr.id desc " . $limit);
     $list_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "given_record gr left join " . DB_PREFIX . "user u on u.id = gr.user_id left join " . DB_PREFIX . "vip_festivals vf on vf.id = gr.gift_id WHERE u.id='" . $GLOBALS['user_info']['id'] . "' {$where}  ");
     $page = new Page($list_count, app_conf("PAGE_SIZE"));
     //初始化分页对象
     $p = $page->show();
     $GLOBALS['tmpl']->assign('pages', $p);
     $GLOBALS['tmpl']->assign("list", $list);
     $GLOBALS['tmpl']->assign("start_time", $start_time);
     $GLOBALS['tmpl']->assign("end_time", $end_time);
     $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_given_record.html");
     $GLOBALS['tmpl']->display("page/uc.html");
 }
 public function index()
 {
     //用于处理团购搜索的处理程序
     $se_name = trim(addslashes($_POST['se_name']));
     $se_begin = trim(addslashes($_POST['se_begin']));
     $se_end = trim(addslashes($_POST['se_end']));
     $se_begin = to_timespan($se_begin, 'Y-m-d');
     $se_end = to_timespan($se_end, 'Y-m-d');
     $se_end = $se_end != 0 ? $se_end + 24 * 3600 - 1 : $se_end;
     $search['se_name'] = $se_name;
     $search['se_begin'] = $se_begin;
     $search['se_end'] = $se_end;
     $se_module = trim(addslashes($_POST['se_module']));
     $se_action = trim(addslashes($_POST['se_action']));
     $se_id = intval(addslashes($_POST['se_id']));
     $search_code = urlencode(base64_encode(serialize($search)));
     $url = APP_ROOT . "/tuan.php?ctl=" . $se_module . "&act=" . $se_action . "&id=" . $se_id . "&search=" . $search_code;
     app_redirect($url);
 }
Example #15
0
 public function reply()
 {
     $ajax = 1;
     global_run();
     if (!$GLOBALS['user_info']) {
         $result['status'] = -1000;
         $result['info'] = "未登录";
         ajax_return($result);
     }
     if ($_REQUEST['content'] == '') {
         showErr($GLOBALS['lang']['MESSAGE_CONTENT_EMPTY'], $ajax);
     }
     /*验证每天只允许评论5次*/
     $day_send_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_reply where create_time>" . to_timespan(to_date(NOW_TIME, "Y-m-d"), "Y-m-d") . " and create_time<" . NOW_TIME);
     if ($day_send_count >= 8) {
         showErr('今天你已经发很多了哦~', $ajax);
     }
     if (!check_ipop_limit(get_client_ip(), "message", intval(app_conf("SUBMIT_DELAY")), 0)) {
         showErr($GLOBALS['lang']['MESSAGE_SUBMIT_FAST'], $ajax);
     }
     $topic_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic where id = " . intval($_REQUEST['topic_id']));
     if (!$topic_info) {
         showErr("主题不存在", $ajax);
     }
     $reply_data = array();
     $reply_data['topic_id'] = intval($_REQUEST['topic_id']);
     $reply_data['user_id'] = intval($GLOBALS['user_info']['id']);
     $reply_data['user_name'] = $GLOBALS['user_info']['user_name'];
     $reply_data['reply_id'] = intval($_REQUEST['reply_id']);
     $reply_data['create_time'] = NOW_TIME;
     $reply_data['is_effect'] = 1;
     $reply_data['is_delete'] = 0;
     $reply_data['content'] = strim(valid_str(addslashes($_REQUEST['content'])));
     require_once APP_ROOT_PATH . 'system/model/topic.php';
     $reply_id = insert_topic_reply($reply_data);
     //返回页面的数据
     $reply_data['reply_id'] = $reply_id;
     $reply_data['create_time'] = to_date(NOW_TIME, "Y-m-d H:i");
     $reply_data['avatar'] = show_avatar($reply_data['user_id'], "small");
     $reply_data['user_url'] = url("index", "uc_home#index", array("id" => $reply_data['user_id']));
     $reply_data['status'] = 1;
     ajax_return($reply_data);
 }
 public function index()
 {
     $now = get_gmtime();
     if (trim($_REQUEST['user_name']) != '') {
         $map[DB_PREFIX . 'user.user_name'] = array('like', '%' . trim($_REQUEST['user_name']) . '%');
     }
     if (trim($_REQUEST['email']) != '') {
         $map[DB_PREFIX . 'user.email'] = array('like', '%' . trim($_REQUEST['email']) . '%');
     }
     if (trim($_REQUEST['mobile']) != '') {
         $map[DB_PREFIX . 'user.mobile'] = array('like', '%' . trim($_REQUEST['mobile']) . '%');
     }
     $create_time_2 = empty($_REQUEST['create_time_2']) ? to_date($now, 'Y-m-d') : strim($_REQUEST['create_time_2']);
     $create_time_2 = to_timespan($create_time_2) + 24 * 3600;
     if (trim($_REQUEST['create_time_1']) != '') {
         $map[DB_PREFIX . 'user.create_time'] = array('between', array(to_timespan($_REQUEST['create_time_1']), $create_time_2));
     }
     if (intval($_REQUEST['id']) > 0) {
         $map[DB_PREFIX . 'user.id'] = intval($_REQUEST['id']);
     }
     if ($_REQUEST['is_effect'] == 'NULL') {
         unset($_REQUEST['is_effect']);
     }
     if ($_REQUEST['is_effect'] != NULL) {
         $map['is_effect'] = intval($_REQUEST['is_effect']);
     }
     if ($_REQUEST['is_investor'] == 'NULL') {
         unset($_REQUEST['is_investor']);
     }
     if (trim($_REQUEST['is_investor']) != '') {
         $map[DB_PREFIX . 'user.is_investor'] = intval($_REQUEST['is_investor']);
     }
     if (method_exists($this, '_filter')) {
         $this->_filter($map);
     }
     $name = $this->getActionName();
     $model = D($name);
     if (!empty($model)) {
         $this->_list($model, $map);
     }
     $this->display();
 }
 function foreach_pay($page = 1)
 {
     $log_begin_time = trim($_REQUEST['log_begin_time']) == '' ? 0 : to_timespan($_REQUEST['log_begin_time']);
     $log_end_time = trim($_REQUEST['log_end_time']) == '' ? 0 : to_timespan($_REQUEST['log_end_time']);
     if ($log_end_time == 0) {
         $condtion = " and dlr.repay_time > {$log_begin_time} ";
     } else {
         $condtion = " and (dlr.repay_time between {$log_begin_time} and {$log_end_time} )";
     }
     $sql_count = "SELECT count(dlr.id) FROM " . DB_PREFIX . "deal_load_repay dlr LEFT JOIN " . DB_PREFIX . "user u on u.id = dlr.user_id LEFT JOIN " . DB_PREFIX . "referrals r ON r.rel_user_id= dlr.user_id WHERE u.pid >0 and dlr.has_repay=1 {$condtion} ";
     $count = $GLOBALS['db']->getOne($sql_count);
     if (!empty($_REQUEST['listRows'])) {
         $listRows = $_REQUEST['listRows'];
     } else {
         $listRows = '';
     }
     $p = new Page($count, $listRows);
     if ($count > 0) {
         $sql = "SELECT dlr.*,(dlr.l_key + 1)  as l_key,(dlr.repay_money - dlr.self_money) as lixi,((dlr.repay_money - dlr.self_money) * u.referral_rate * 0.01 ) as smoney,u.referral_rate,u.id as rel_user_id,u.pid as user_id,r.pay_time FROM " . DB_PREFIX . "deal_load_repay dlr LEFT JOIN " . DB_PREFIX . "user u on u.id = dlr.user_id LEFT JOIN " . DB_PREFIX . "referrals r ON r.rel_user_id= dlr.user_id and r.deal_id=dlr.deal_id and r.load_id=dlr.load_id and r.l_key = dlr.l_key WHERE u.pid >0 and dlr.has_repay=1  and (r.id is null or r.id >0) {$condtion} LIMIT " . ($p->firstRow . ',' . $p->listRows);
         $list = $GLOBALS['db']->getAll($sql);
         foreach ($list as $k => $v) {
             if ($v['pay_time'] == 0) {
                 $res = pay_referrals($v['id']);
                 if ($res) {
                     save_log("ID:" . $v['id'] . l("REFERRALS_PAY_SUCCESS"), 1);
                 } else {
                     save_log("ID:" . $v['id'] . l("REFERRALS_PAY_FAILED"), 0);
                 }
             }
         }
     }
     if ($p->nowPage >= $p->totalPages) {
         $this->success(l("REFERRALS_PAY_SUCCESS"));
     } else {
         register_shutdown_function(array(&$this, 'foreach_pay'), $page + 1);
     }
 }
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("VOTE_NAME_EMPTY_TIP"));
     }
     $data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']);
     $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
 public function export_csv($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     $start_time = strim($_REQUEST['start_time']);
     $end_time = strim($_REQUEST['end_time']);
     $d = explode('-', $start_time);
     if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)");
         exit;
     }
     $d = explode('-', $end_time);
     if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)");
         exit;
     }
     if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) {
         $this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time);
         exit;
     }
     if ($limit) {
         $limit = " limit " . $limit;
     }
     $className = getCollName();
     //环迅
     if (strtolower($className) == "ips") {
         $condition = " and t.pErrCode = 'MG00000F' ";
         if (strim($_REQUEST['pBidNo']) != '') {
             $condition .= " and pBidNo like '%" . strim($_REQUEST['pBidNo']) . "%'";
         }
         if (strim($_REQUEST['deal_name']) != '') {
             $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'";
         }
         if (strim($_REQUEST['user_name']) != '') {
             $condition .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $condition .= " and UNIX_TIMESTAMP(pDate) >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $condition .= " and UNIX_TIMESTAMP(pDate) <=" . to_timespan(strim($end_time));
         }
         $sql = "select t.*,d.`name`,u.user_name,d.borrow_amount,\r\n\t\t\td.borrow_amount*CONVERT(d.services_fee,DECIMAL)*0.01 as deal_fee,\r\n\t\t\t(d.borrow_amount - (d.borrow_amount*CONVERT(d.services_fee,DECIMAL)*0.01)) as loan_amount\r\n\t\t\t from " . DB_PREFIX . "ips_transfer as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id where t.pTransferType = 1 ";
         $count_sql = "select count(*) from " . DB_PREFIX . "ips_transfer as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id where t.pTransferType = 1 ";
         //取得满足条件的记录数
         $list = $GLOBALS['db']->getAll($sql . $condition . " order by id desc " . $limit);
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
         //print_r($count);die;
         //$name=$this->getActionName();
     } elseif (strtolower($className) == "yeepay") {
         $condition = " where  bizType = 'TENDER' and is_complete_transaction = 1 and t.code ='1' and is_callback = 1 ";
         if (strim($_REQUEST['pBidNo']) != '') {
             $condition .= " and d.id like '%" . strim($_REQUEST['pBidNo']) . "%'";
         }
         if (strim($_REQUEST['deal_name']) != '') {
             $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'";
         }
         if (strim($_REQUEST['user_name']) != '') {
             $condition .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $condition .= " and t.create_time >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $condition .= " and t.create_time <=" . to_timespan(strim($end_time));
         }
         $sql = "select d.id,d.`name`,u.user_name,d.borrow_amount as borrow_amount,d.id as pBidNo,\r\n\t\t\td.borrow_amount*CONVERT(d.services_fee,DECIMAL)*0.01 as deal_fee,\r\n\t\t\t(d.borrow_amount - (d.borrow_amount*CONVERT(d.services_fee,DECIMAL)*0.01)) as loan_amount,\r\n\t\t\t1 as pTransferMode, requestNo as pIpsBillNo, FROM_UNIXTIME(t.update_time ,'%Y-%m-%d') as pIpsTime\r\n\t\t\t from " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.tenderOrderNo\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id ";
         $count_sql = "select count(*) from " . DB_PREFIX . "yeepay_cp_transaction as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.tenderOrderNo\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id ";
         //取得满足条件的记录数
         $list = $GLOBALS['db']->getAll($sql . $condition . " group by t.tenderOrderNo order by t.id desc " . $limit);
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
         //print_r($count);die;
         //$name=$this->getActionName();
     } elseif (strtolower($className) == "baofoo") {
         $condition = " where  action_type = '2' and t.code ='CSD000' and is_callback = 1 ";
         if (strim($_REQUEST['pBidNo']) != '') {
             $condition .= " and d.id like '%" . strim($_REQUEST['pBidNo']) . "%'";
         }
         if (strim($_REQUEST['deal_name']) != '') {
             $condition .= " and d.name like '%" . strim($_REQUEST['deal_name']) . "%'";
         }
         if (strim($_REQUEST['user_name']) != '') {
             $condition .= " and u.user_name like '%" . strim($_REQUEST['user_name']) . "%'";
         }
         if (strim($start_time) != "") {
             $condition .= " and (t.req_time/1000) >=" . to_timespan(strim($start_time));
         }
         if (strim($end_time) != "") {
             $condition .= " and (t.req_time/1000) <=" . to_timespan(strim($end_time));
         }
         $sql = "select d.id,d.`name`,u.user_name,d.borrow_amount as borrow_amount,d.id as pBidNo,\r\n\t\t\td.borrow_amount*CONVERT(d.services_fee,DECIMAL)*0.01 as deal_fee,\r\n\t\t\t(d.borrow_amount - (d.borrow_amount*CONVERT(d.services_fee,DECIMAL)*0.01)) as loan_amount,\r\n\t\t\t1 as pTransferMode, order_id as pIpsBillNo, FROM_UNIXTIME(t.req_time/1000 ,'%Y-%m-%d') as pIpsTime\r\n\t\t\t from " . DB_PREFIX . "baofoo_business as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.cus_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id ";
         $count_sql = "select count(*) from " . DB_PREFIX . "baofoo_business as t\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.cus_id\r\n\t\t\tLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id ";
         //print_r($sql.$condition);die;
         //取得满足条件的记录数
         $list = $GLOBALS['db']->getAll($sql . $condition . "  group by t.cus_id order by id desc " . $limit);
         $list_count = $GLOBALS['db']->getOne($count_sql . $condition);
     }
     if ($list) {
         register_shutdown_function(array(&$this, 'export_csv'), $page + 1);
         $list_value_old = array('id' => '""', 'pBidNo' => '""', 'name' => '""', 'user_name' => '""', 'borrow_amount' => '""', 'deal_fee' => '""', 'loan_amount' => '""', 'pIpsTime' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "编号,标号,贷款名称,借款人,借款金额,成交服务费,放款金额,第三方处理时间");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $list_value = $list_value_old;
             $list_value["id"] = '"' . iconv('utf-8', 'gbk', $v['id']) . '"';
             $list_value["name"] = '"' . iconv('utf-8', 'gbk', $v['name']) . '"';
             $list_value["pBidNo"] = '"' . iconv('utf-8', 'gbk', $v["pBidNo"]) . '"';
             $list_value["user_name"] = '"' . iconv('utf-8', 'gbk', $v["user_name"]) . '"';
             $list_value["borrow_amount"] = '"' . iconv('utf-8', 'gbk', $v["borrow_amount"]) . '"';
             $list_value["deal_fee"] = '"' . iconv('utf-8', 'gbk', $v["deal_fee"]) . '"';
             $list_value["loan_amount"] = '"' . iconv('utf-8', 'gbk', $v["loan_amount"]) . '"';
             $list_value["pIpsTime"] = '"' . iconv('utf-8', 'gbk', $v["pIpsTime"]) . '"';
             $content .= implode(",", $list_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=order_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
 function ajax_calculate()
 {
     $deal['loantype'] = intval($_REQUEST['borrowpay']);
     $deal['borrow_amount'] = intval($_REQUEST['borrowamount']);
     $deal['repay_time'] = intval($_REQUEST['repaytime']);
     $deal['repay_time_type'] = intval($_REQUEST['repaytimetype']);
     $deal['rate'] = trim($_REQUEST['apr']);
     $deal['repay_start_time'] = to_timespan(to_date(TIME_UTC, "Y-m-d"));
     $deal_repay_rs = deal_repay_money($deal);
     $deal['month_repay_money'] = $deal_repay_rs['month_repay_money'];
     //总的必须还多少本息
     $deal['remain_repay_money'] = $deal_repay_rs['remain_repay_money'];
     //最后一期还款
     $deal['last_month_repay_money'] = $deal_repay_rs['last_month_repay_money'];
     $deal['month_manage_money'] = $deal['borrow_amount'] * (double) app_conf('MANAGE_FEE') / 100;
     //总的多少管理费
     if ($deal['repay_time_type'] == 1) {
         $deal['all_manage_money'] = $deal['month_manage_money'] * $deal["repay_time"];
     } else {
         $deal['all_manage_money'] = $deal['month_manage_money'];
     }
     $GLOBALS['tmpl']->assign("borrowpay", $deal['loantype']);
     $GLOBALS['tmpl']->assign("borrowamount", $deal['borrow_amount']);
     $GLOBALS['tmpl']->assign("apr", $deal['rate']);
     if ($deal['repay_time_type'] == 1) {
         $GLOBALS['tmpl']->assign("rate", $deal['rate'] / 12);
     } else {
         $GLOBALS['tmpl']->assign("rate", $deal['rate'] / 12 / 30);
     }
     $GLOBALS['tmpl']->assign("repaytime", $deal['repay_time']);
     $GLOBALS['tmpl']->assign("repaytimetype", $deal['repay_time_type']);
     $GLOBALS['tmpl']->assign("repayamount", $deal['month_repay_money']);
     $GLOBALS['tmpl']->assign("repayallamount", $deal['remain_repay_money']);
     $level = intval($_REQUEST['level']);
     $level_list = load_auto_cache("level");
     $GLOBALS['tmpl']->assign("services_fee", $level_list['services_fee'][$level] / 100 * $deal['borrow_amount']);
     if ($deal['repay_time_type'] == 0) {
         $inrepayshow = 0;
     } else {
         $inrepayshow = intval($_REQUEST['inrepayshow']);
     }
     $impose_day = intval($_REQUEST['impose_day']);
     if (isset($_REQUEST['isshow']) && intval($_REQUEST['isshow']) == 1) {
         $loantype = $deal['loantype'];
         $LoanModule = LoadLoanModule($loantype);
         $list = $LoanModule->make_repay_plan($deal);
         if ($impose_day >= app_conf('YZ_IMPSE_DAY')) {
             $impose_fee = app_conf('IMPOSE_FEE_DAY2');
             $manage_impose_fee = app_conf('MANAGE_IMPOSE_FEE_DAY2');
         } else {
             $impose_fee = app_conf('IMPOSE_FEE_DAY1');
             $manage_impose_fee = app_conf('MANAGE_IMPOSE_FEE_DAY1');
         }
         $left_repay_money = $deal['remain_repay_money'];
         foreach ($list as $k => $v) {
             $list[$k]['impose_money'] = $v['repay_money'] * $impose_fee * $impose_day * 0.01;
             $list[$k]['manage_impose_money'] = $v['repay_money'] * $manage_impose_fee * $impose_day * 0.01;
             $list[$k]['left_repay_money'] = $left_repay_money = $left_repay_money - round($v['repay_money'], 2);
         }
         $GLOBALS['tmpl']->assign("list", $list);
     }
     //提前还款
     if ($inrepayshow == 1) {
         $tq_list = array();
         $deal['compensate_fee'] = app_conf('COMPENSATE_FEE');
         for ($i = 0; $i < $deal['repay_time']; $i++) {
             $loaninfo['deal'] = $deal;
             if (is_last_repay($deal['loantype'])) {
                 $loaninfo['deal']['month_manage_money'] = $deal['all_manage_money'];
             }
             $tq_list[$i] = inrepay_repay($loaninfo, $i, next_replay_month(TIME_UTC, $i + 1));
             if (is_last_repay($deal['loantype'])) {
                 $tq_list[$i]['month_repay_money'] = 0;
                 $tq_list[$i]['month_repay_money'] = 0;
                 if ($i + 1 == $deal['repay_time']) {
                     $tq_list[$i]['manage_money'] = $deal['all_manage_money'];
                     $tq_list[$i]['month_repay_money'] = $deal['last_month_repay_money'];
                 }
             } else {
                 $tq_list[$i]['manage_money'] = $deal['month_manage_money'];
                 $tq_list[$i]['month_repay_money'] = $deal['month_repay_money'];
                 if ($i + 1 == $deal['repay_time']) {
                     $tq_list[$i]['month_repay_money'] = $deal['last_month_repay_money'];
                 }
             }
         }
         $GLOBALS['tmpl']->assign("tq_list", $tq_list);
     }
     $GLOBALS['tmpl']->display("inc/tool/calculate_result.html");
 }
 public function index()
 {
     $GLOBALS['tmpl']->caching = true;
     $GLOBALS['tmpl']->cache_lifetime = 600;
     //首页缓存10分钟
     $cache_id = md5(MODULE_NAME . ACTION_NAME);
     if (!$GLOBALS['tmpl']->is_cached("page/index.html", $cache_id)) {
         make_deal_cate_js();
         make_delivery_region_js();
         change_deal_status();
         //开始输出友情链接
         $f_link_group = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link_group where is_effect = 1 order by sort desc");
         foreach ($f_link_group as $k => $v) {
             $g_links = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "link where is_effect = 1 and show_index = 1 and group_id = " . $v['id'] . " order by sort desc");
             if ($g_links) {
                 foreach ($g_links as $kk => $vv) {
                     if (substr($vv['url'], 0, 7) == 'http://') {
                         $g_links[$kk]['url'] = str_replace("http://", "", $vv['url']);
                     }
                 }
                 $f_link_group[$k]['links'] = $g_links;
             } else {
                 unset($f_link_group[$k]);
             }
         }
         //最新借款列表
         $deal_list = get_deal_list(11, 0, "publish_wait =0 AND deal_status in(1,2,4) ", " deal_status ASC,is_recommend DESC,sort DESC,id DESC");
         $GLOBALS['tmpl']->assign("deal_list", $deal_list['list']);
         //输出最新转让
         $transfer_list = get_transfer_list(11, " and d.deal_status >= 4 ", '', '', " d.create_time DESC , dlt.id DESC ");
         $GLOBALS['tmpl']->assign('transfer_list', $transfer_list['list']);
         //输出公告
         $notice_list = get_notice(7);
         $GLOBALS['tmpl']->assign("notice_list", $notice_list);
         //输出公司动态
         $art_id = $GLOBALS['db']->getOne("SELECT id FROM " . DB_PREFIX . "article_cate where title='公司动态'");
         if ($art_id > 0) {
             $compnay_active_list = get_article_list(5, $art_id);
             $GLOBALS['tmpl']->assign("art_id", $art_id);
             $GLOBALS['tmpl']->assign("compnay_active_list", $compnay_active_list['list']);
         }
         //投资排行
         //天
         $now_time = to_timespan(to_date(TIME_UTC, "Y-m-d"), "Y-m-d");
         $day_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $now_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 5");
         //周
         $week_time = to_timespan(to_date(TIME_UTC - to_date(TIME_UTC, "w") * 24 * 3600, "Y-m-d"), "Y-m-d");
         $week_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $week_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 5 ");
         //月
         $month_time = to_timespan(to_date(TIME_UTC, "Y-m") . "-01", "Y-m-d");
         $month_load_top_list = $GLOBALS['db']->getAll("SELECT * FROM (SELECT user_name,sum(money) as total_money FROM " . DB_PREFIX . "deal_load where create_time >= " . $month_time . " group by user_id ORDER BY total_money DESC) as tmp LIMIT 5");
         $GLOBALS['tmpl']->assign("day_load_top_list", $day_load_top_list);
         $GLOBALS['tmpl']->assign("week_load_top_list", $week_load_top_list);
         $GLOBALS['tmpl']->assign("month_load_top_list", $month_load_top_list);
         //收益排名
         $load_repay_list = $GLOBALS['db']->getAll("SELECT us.*,u.user_name FROM " . DB_PREFIX . "user_sta us LEFT JOIN " . DB_PREFIX . "user u ON us.user_id=u.id WHERE u.is_effect =1 and u.is_delete=0 and us.load_earnings > 0  ORDER BY us.load_earnings DESC LIMIT 5");
         $GLOBALS['tmpl']->assign("load_repay_list", $load_repay_list);
         //使用技巧
         $use_tech_list = get_article_list(12, 6);
         $GLOBALS['tmpl']->assign("use_tech_list", $use_tech_list);
         $now = TIME_UTC;
         $vote = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "vote where is_effect = 1 and begin_time < " . $now . " and (end_time = 0 or end_time > " . $now . ") order by sort desc limit 1");
         $GLOBALS['tmpl']->assign("vote", $vote);
         $GLOBALS['tmpl']->assign("f_link_data", $f_link_group);
         //累计投资金额
         $stats['total_load'] = $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "deal_load where is_repay= 0 ");
         $stats['total_load_format'] = format_conf_count(number_format($stats['total_load'], 2));
         //成交笔数
         $stats['deal_total_count'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal where  deal_status >=4 ");
         //累计创造收益
         $stats['total_rate'] = $GLOBALS['db']->getOne("SELECT sum(repay_money-self_money) FROM " . DB_PREFIX . "deal_load_repay where  has_repay = 1 ");
         $stats['total_rate_format'] = format_conf_count(number_format($stats['total_rate'], 2));
         //本息保证金(元)
         $stats['total_bzh'] = $GLOBALS['db']->getOne("SELECT sum(guarantor_real_freezen_amt+real_freezen_amt) FROM " . DB_PREFIX . "deal where deal_status= 4 ");
         $stats['total_bzh_format'] = format_conf_count(number_format($stats['total_bzh'], 2));
         //待收资金(元)
         $stats['total_repay'] = $GLOBALS['db']->getOne("SELECT sum(repay_money) FROM " . DB_PREFIX . "deal_load_repay where has_repay = 1 ");
         $stats['total_repay_format'] = format_conf_count(number_format($stats['total_repay'], 2));
         //待投资金(元)
         $statsU = $GLOBALS['db']->getRow("SELECT sum(money) as total_usermoney ,count(*) total_user FROM " . DB_PREFIX . "user where is_effect = 1 and is_delete=0 ");
         $stats['total_usermoney'] = $statsU['total_usermoney'];
         $stats['total_usermoney_format'] = format_conf_count(number_format($stats['total_usermoney'], 2));
         $stats['total_user'] = $statsU['total_user'];
         $GLOBALS['tmpl']->assign("stats", $stats);
         //格式化统计代码
         $VIRTUAL_MONEY_1_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_1"))) + $stats['total_load']);
         $VIRTUAL_MONEY_2_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_2"))) + $stats['total_rate']);
         $VIRTUAL_MONEY_3_FORMAT = format_conf_count(floatval(trim(app_conf("VIRTUAL_MONEY_3"))) + $stats['total_bzh']);
         $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_1_FORMAT", $VIRTUAL_MONEY_1_FORMAT);
         $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_2_FORMAT", $VIRTUAL_MONEY_2_FORMAT);
         $GLOBALS['tmpl']->assign("VIRTUAL_MONEY_3_FORMAT", $VIRTUAL_MONEY_3_FORMAT);
         $GLOBALS['tmpl']->assign("show_site_titile", 1);
     }
     $GLOBALS['tmpl']->display("page/index.html", $cache_id);
 }
Example #22
0
 public function get_invest_stroke($user_id)
 {
     $result = array();
     if (!$user_id) {
         $user_id = intval($GLOBALS['user_info']['id']);
     } else {
         $user_id = intval($user_id);
     }
     $x_axis_labels = array();
     $elements_values = array();
     $m_info = array();
     for ($i = 5; $i >= 0; $i--) {
         if ($i == 5) {
             $y_m = to_date(NOW_TIME, "Y-m");
             $start_day = $y_m . "-1";
             $next_m = to_date(NOW_TIME, "n") + 1;
             $now_year = to_date(NOW_TIME, "Y");
             $next = $now_year . "-" . $next_m . "-1";
             $m_info['start'] = to_timespan($start_day, 'Y-m-d');
             $m_info['end'] = to_timespan($next, "Y-n-d") - 1;
             $m_info['next_start'] = $m_info['start'];
             $m_info['all_end'] = $m_info['end'];
             $x_axis_labels[$i] = to_date(NOW_TIME, "Y-m");
         } else {
             $m_info['end'] = $m_info['next_start'] - 1;
             $y_m = to_date($m_info['end'], "Y-m");
             $m_info['start'] = to_timespan($y_m . "-1", 'Y-m-d');
             $m_info['next_start'] = $m_info['start'];
             if ($i == 1) {
                 $m_info['all_start'] = $m_info['start'];
             }
             $x_axis_labels[$i] = $y_m;
         }
         $m_price = floatval($GLOBALS['db']->getOne("select sum(price) from " . DB_PREFIX . "deal_support_log where user_id=" . $user_id . " and create_time > " . $m_info['start'] . " and create_time < " . $m_info['end'] . " "));
         $elements_values[$i] = array("top" => $m_price, "tip" => $y_m . "月<br>投资" . format_price($m_price));
     }
     ksort($elements_values);
     ksort($x_axis_labels);
     $price_all = $GLOBALS['db']->getOne("select sum(price) from " . DB_PREFIX . "deal_support_log where user_id=" . $user_id . " and create_time >" . $m_info['all_start'] . " and create_time < " . $m_info['all_end'] . "");
     if ($price_all > 100) {
         $max = ceil($price_all / 100) * 100;
         $max += ceil($max * 0.1 / 100) * 100;
     } elseif ($price_all < 100 && $price_all > 0) {
         $max = ceil($price_all / 100) * 100 + 200;
     } else {
         $max = 1000;
     }
     $result['bg_colour'] = "#ffffff";
     $result["x_axis"] = array("stroke" => "1", "tick_height" => "10", "colour" => "#000", "grid_colour" => "#000", "labels" => array("labels" => $x_axis_labels));
     $result["elements"] = array(array("type" => "bar", "alpha" => 0.8, "colour" => "#3d9eeb", "values" => $elements_values));
     $result["y_axis"] = array("stroke" => "1", "tick_length" => "3", "colour" => "#000", "grid_colour" => "#000", "max" => $max);
     $result["title"] = array("text" => "半年内总投资额" . format_price($price_all), "style" => "{font-size: 14px; color:#333; font-family: 'Microsoft Yahei','FAE\\8F6F\\96C5\\9ED1',Arial,'Hiragino Sans GB','B8BF53'; text-align: right; padding:10px 0px 10px 0px;}");
     //print_r($result);
     ajax_return($result);
 }
Example #23
0
 public function shop_update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     //对于商户请求操作
     if (intval($_REQUEST['edit_type']) == 2 && intval($_REQUEST['deal_id']) > 0) {
         //商户提交修改审核
         $deal_submit_id = intval($_REQUEST['id']);
         $data['id'] = intval($_REQUEST['deal_id']);
     }
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/shop_edit", array("id" => $data['id'])));
     if ($data['buy_type'] == 0) {
         if (intval($data['return_score']) < 0) {
             $this->error("积分返还不能为负数");
         }
         if (floatval($data['return_money']) < 0) {
             $this->error("现金返还不能为负数");
         }
     } else {
         $data['return_score'] = "-" . abs($_REQUEST['deal_score']);
         if (intval($_REQUEST['deal_score']) == 0) {
             $this->error("请输入所需的积分");
         }
     }
     if (!check_empty($data['name'])) {
         $this->error(L("DEAL_NAME_EMPTY_TIP"));
     }
     if (!check_empty($data['sub_name'])) {
         $this->error(L("DEAL_SUB_NAME_EMPTY_TIP"));
     }
     if ($data['shop_cate_id'] == 0) {
         $this->error(L("SHOP_CATE_EMPTY_TIP"));
     }
     if ($data['max_bought'] < 0) {
         $this->error(L("DEAL_MAX_BOUGHT_ERROR_TIP"));
     }
     if ($data['user_min_bought'] < 0) {
         $this->error(L("DEAL_USER_MIN_BOUGHT_ERROR_TIP"));
     }
     if ($data['user_max_bought'] < 0) {
         $this->error(L("DEAL_USER_MAX_BOUGHT_ERROR_TIP"));
     }
     if ($data['user_max_bought'] < $data['user_min_bought'] && $data['user_max_bought'] > 0) {
         $this->error(L("DEAL_USER_MAX_MIN_BOUGHT_ERROR_TIP"));
     }
     if ($data['brand_promote'] == 1) {
         //品牌促销
         $brand_info = M("Brand")->getById($data['brand_id']);
         if ($brand_info['brand_promote'] == 1) {
             $data['begin_time'] = $brand_info['begin_time'];
             $data['end_time'] = $brand_info['end_time'];
         }
     } else {
         $data['begin_time'] = strim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']);
         $data['end_time'] = strim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
     }
     $data['coupon_begin_time'] = strim($data['coupon_begin_time']) == '' ? 0 : to_timespan($data['coupon_begin_time']);
     $data['coupon_end_time'] = strim($data['coupon_end_time']) == '' ? 0 : to_timespan($data['coupon_end_time']);
     //将第一张图片设为团购图片
     $imgs = $_REQUEST['img'];
     foreach ($imgs as $k => $v) {
         if ($v != '') {
             $data['img'] = $v;
             break;
         }
     }
     $data['update_time'] = NOW_TIME;
     $data['publish_wait'] = 0;
     if (intval($data['is_coupon']) == 1 && intval($data['is_refund']) == 1) {
         $data['expire_refund'] = intval($_REQUEST['expire_refund']);
         $data['any_refund'] = intval($_REQUEST['any_refund']);
     } else {
         $data['expire_refund'] = 0;
         $data['any_refund'] = 0;
     }
     if ($_REQUEST['deal_attr'] && count($_REQUEST['deal_attr']) > 0) {
         $data['multi_attr'] = 1;
     } else {
         $data['multi_attr'] = 0;
     }
     if ($data['buy_type'] != 1) {
         $deal_tags = $_REQUEST['deal_tag'];
         $deal_tag = 0;
         foreach ($deal_tags as $t) {
             $t2 = pow(2, $t);
             $deal_tag = $deal_tag | $t2;
         }
         $data['deal_tag'] = $deal_tag;
     } else {
         $data['deal_tag'] = 0;
     }
     $data['is_lottery'] = 0;
     foreach ($deal_tags as $t) {
         if ($t == 0) {
             $data['is_lottery'] = 1;
         }
     }
     if ($data['buy_type'] == 1) {
         $data['cart_type'] = 3;
         $data['is_refund'] = 0;
         $data['deal_tag'] = 0;
         $data['is_lottery'] = 0;
     }
     $inc_prices = $_REQUEST['inc_price'];
     if (isset($_REQUEST['level_ids'])) {
         //无数据
         $level_ids = $_REQUEST['level_ids'];
         foreach ($level_ids as $key => $value) {
             $deal_tech_level = array('level_id' => $value, 'deal_id' => $data['id'], 'price' => $inc_prices[$key], 'createtime' => time());
             M('dealTechLevel')->add($deal_tech_level);
         }
     } elseif ($_REQUEST['deal_tech_level_ids']) {
         //有数据
         $deal_tech_level_ids = $_REQUEST['deal_tech_level_ids'];
         foreach ($deal_tech_level_ids as $key => $value) {
             $deal_tech_level = array('id' => $value, 'price' => $inc_prices[$key], 'createtime' => time());
             M('dealTechLevel')->save($deal_tech_level);
         }
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         $GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set expire_refund = " . $data['expire_refund'] . ",any_refund = " . $data['any_refund'] . ",supplier_id=" . $data['supplier_id'] . ",end_time=" . $data['coupon_end_time'] . ",begin_time=" . $data['coupon_begin_time'] . " where deal_id = " . $data['id']);
         //开始处理图片
         M("DealGallery")->where("deal_id=" . $data['id'])->delete();
         $imgs = $_REQUEST['img'];
         foreach ($imgs as $k => $v) {
             if ($v != '') {
                 $img_data['deal_id'] = $data['id'];
                 $img_data['img'] = $v;
                 $img_data['sort'] = $k;
                 M("DealGallery")->add($img_data);
             }
         }
         //end 处理图片
         //开始处理属性
         M("DealAttr")->where("deal_id=" . $data['id'])->delete();
         $deal_attr = $_REQUEST['deal_attr'];
         $deal_attr_price = $_REQUEST['deal_attr_price'];
         $deal_add_balance_price = $_REQUEST['deal_add_balance_price'];
         $deal_attr_stock_hd = $_REQUEST['deal_attr_stock_hd'];
         foreach ($deal_attr as $goods_type_attr_id => $arr) {
             foreach ($arr as $k => $v) {
                 if ($v != '') {
                     $deal_attr_item['deal_id'] = $data['id'];
                     $deal_attr_item['goods_type_attr_id'] = $goods_type_attr_id;
                     $deal_attr_item['name'] = $v;
                     $deal_attr_item['add_balance_price'] = $deal_add_balance_price[$goods_type_attr_id][$k];
                     $deal_attr_item['price'] = $deal_attr_price[$goods_type_attr_id][$k];
                     $deal_attr_item['is_checked'] = intval($deal_attr_stock_hd[$goods_type_attr_id][$k]);
                     M("DealAttr")->add($deal_attr_item);
                 }
             }
         }
         //开始创建属性库存
         M("AttrStock")->where("deal_id=" . $data['id'])->delete();
         $stock_cfg = $_REQUEST['stock_cfg_num'];
         $attr_cfg = $_REQUEST['stock_attr'];
         $attr_str = $_REQUEST['stock_cfg'];
         foreach ($stock_cfg as $row => $v) {
             $stock_data = array();
             $stock_data['deal_id'] = $data['id'];
             $stock_data['stock_cfg'] = $v;
             $stock_data['attr_str'] = $attr_str[$row];
             $attr_cfg_data = array();
             foreach ($attr_cfg as $attr_id => $cfg) {
                 $attr_cfg_data[$attr_id] = $cfg[$row];
             }
             $stock_data['attr_cfg'] = serialize($attr_cfg_data);
             $sql = "select sum(oi.number) from " . DB_PREFIX . "deal_order_item as oi left join " . DB_PREFIX . "deal as d on d.id = oi.deal_id left join " . DB_PREFIX . "deal_order as do on oi.order_id = do.id where" . " do.pay_status = 2 and do.is_delete = 0 and d.id = " . $data['id'] . " and oi.attr_str like '%" . $attr_str[$row] . "%'";
             $stock_data['buy_count'] = intval($GLOBALS['db']->getOne($sql));
             M("AttrStock")->add($stock_data);
         }
         M("FreeDelivery")->where("deal_id=" . $data['id'])->delete();
         if (intval($_REQUEST['free_delivery']) == 1) {
             $delivery_ids = $_REQUEST['delivery_id'];
             $free_counts = $_REQUEST['free_count'];
             foreach ($delivery_ids as $k => $v) {
                 $free_conf = array();
                 $free_conf['delivery_id'] = $delivery_ids[$k];
                 $free_conf['free_count'] = $free_counts[$k];
                 $free_conf['deal_id'] = $data['id'];
                 M("FreeDelivery")->add($free_conf);
             }
         }
         M("DealPayment")->where("deal_id=" . $data['id'])->delete();
         if (intval($_REQUEST['define_payment']) == 1) {
             $payment_ids = $_REQUEST['payment_id'];
             foreach ($payment_ids as $k => $v) {
                 $payment_conf = array();
                 $payment_conf['payment_id'] = $payment_ids[$k];
                 $payment_conf['deal_id'] = $data['id'];
                 M("DealPayment")->add($payment_conf);
             }
         }
         M("DealDelivery")->where("deal_id=" . $data['id'])->delete();
         $delivery_ids = $_REQUEST['forbid_delivery_id'];
         foreach ($delivery_ids as $k => $v) {
             $delivery_conf = array();
             $delivery_conf['delivery_id'] = $delivery_ids[$k];
             $delivery_conf['deal_id'] = $data['id'];
             M("DealDelivery")->add($delivery_conf);
         }
         //开始创建筛选项
         M("DealFilter")->where("deal_id=" . $data['id'])->delete();
         $filter = $_REQUEST['filter'];
         foreach ($filter as $filter_group_id => $filter_value) {
             $filter_data = array();
             $filter_data['filter'] = $filter_value;
             $filter_data['filter_group_id'] = $filter_group_id;
             $filter_data['deal_id'] = $data['id'];
             M("DealFilter")->add($filter_data);
             //				$filter_array = preg_split("/[ ,]/i",$filter_value);
             //				foreach($filter_array as $filter_item)
             //				{
             //					$filter_row = M("Filter")->where("filter_group_id = ".$filter_group_id." and name = '".$filter_item."'")->find();
             //					if(!$filter_row)
             //					{
             //						if(strim($filter_item)!='')
             //						{
             //							$filter_row = array();
             //							$filter_row['name'] = $filter_item;
             //							$filter_row['filter_group_id'] = $filter_group_id;
             //							M("Filter")->add($filter_row);
             //						}
             //
             //					}
             //				}
         }
         M("DealLocationLink")->where("deal_id=" . $data['id'])->delete();
         foreach ($_REQUEST['location_id'] as $location_id) {
             $link_data = array();
             $link_data['location_id'] = $location_id;
             $link_data['deal_id'] = $data['id'];
             M("DealLocationLink")->add($link_data);
         }
         //成功提示
         syn_deal_status($data['id']);
         syn_deal_match($data['id']);
         syn_attr_stock_key($data['id']);
         //对于商户请求操作
         if (intval($_REQUEST['edit_type']) == 2 && $deal_submit_id > 0) {
             //商户提交修改审核
             /*同步商户发布表状态*/
             $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_submit", array("admin_check_status" => 1), "UPDATE", "id=" . $deal_submit_id);
             // 1 通过 2 拒绝',
         }
         //成功提示
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         $dbErr = M()->getDbError();
         save_log($log_info . L("UPDATE_FAILED") . $dbErr, 0);
         $this->error(L("UPDATE_FAILED") . $dbErr, 0);
     }
 }
Example #24
0
 public function update_sms()
 {
     //开始验证
     if (intval($_REQUEST['sms_type']) == 0) {
         if ($_REQUEST['content'] == '') {
             $this->error(L("SMS_CONTENT_EMPTY_TIP"));
         }
     } else {
         if (intval($_REQUEST['deal_id']) == 0 || M("Deal")->where("is_delete=0 and id =" . intval($_REQUEST['deal_id']))->count() == 0) {
             $this->error(l("DEAL_ID_ERROR"));
         }
     }
     if (intval($_REQUEST['send_type']) == 2) {
         if ($_REQUEST['send_define_data'] == '') {
             $this->error(l("SEND_DEFINE_DATE_EMPTY_TIP"));
         }
     }
     $msg_data['type'] = 0;
     $msg_data['content'] = $_REQUEST['content'];
     if ($_REQUEST['sms_type'] == 1) {
         if ($msg_data['content'] == '') {
             $msg_data['content'] = get_deal_sms_content(intval($_REQUEST['deal_id']));
         }
     }
     $msg_data['send_time'] = strim($_REQUEST['send_time']) == '' ? NOW_TIME : to_timespan($_REQUEST['send_time']);
     $msg_data['deal_id'] = intval($_REQUEST['deal_id']);
     $msg_data['send_type'] = intval($_REQUEST['send_type']);
     switch ($msg_data['send_type']) {
         case 0:
             //会员组
             $msg_data['send_type_id'] = intval($_REQUEST['group_id']);
             break;
         case 1:
             //订阅城市
             $msg_data['send_type_id'] = intval($_REQUEST['city_id']);
             break;
         case 2:
             //自定义号码
             $msg_data['send_type_id'] = 0;
             break;
     }
     $msg_data['send_define_data'] = $_REQUEST['send_define_data'];
     $msg_data['id'] = intval($_REQUEST['id']);
     if (intval($_REQUEST['resend']) == 1) {
         $msg_data['send_status'] = 0;
         M("PromoteMsgList")->where("msg_id=" . intval($msg_data['id']))->delete();
     }
     $rs = M("PromoteMsg")->save($msg_data);
     if ($rs) {
         save_log($msg_data['content'] . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         $this->error(L("UPDATE_FAILED"));
     }
 }
Example #25
0
function get_licai_status($id)
{
    $vo = $GLOBALS["db"]->getRow("select * from " . DB_PREFIX . "licai where id =" . $id);
    if (!$vo) {
        return "";
    }
    $time = get_peizi_next_date(to_timespan($vo["begin_interest_date"]), $vo['begin_buy_date']);
    if (NOW_TIME < to_timespan($time)) {
        $status = 0;
    } elseif ($vo["end_date"] == "" || ($vo["end_date"] = "0000-00-00" || NOW_TIME <= to_timespan($vo["end_date"]) && NOW_TIME >= to_timespan($time))) {
        $status = 1;
    } elseif (NOW_TIME > to_timespan($vo["end_date"])) {
        $status = 3;
    }
    return $status;
}
 public function export_csv_deal_info($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     //pay_status 1 已还款、2待还款、3逾期还款
     $pay_status = intval(trim($_REQUEST['pay_status']));
     $time = trim($_REQUEST['time']);
     if (trim($_REQUEST['id']) != '') {
         $id = intval(trim($_REQUEST['id']));
     }
     if (trim($_REQUEST['user_name']) != '') {
         $user_name = trim($_REQUEST['user_name']);
     }
     if (trim($_REQUEST['deal_sn']) != '') {
         $deal_sn = trim($_REQUEST['deal_sn']);
     }
     if (trim($_REQUEST['sub_name']) != '') {
         $sub_name = trim($_REQUEST['sub_name']);
     }
     if (trim($_REQUEST['has_repay']) != '') {
         $has_repay = trim($_REQUEST['has_repay']);
     }
     $begin_time = trim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
     $end_time = trim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
     $condtion = "  (a.repay_date ='{$time}' )";
     if ($pay_status == 3) {
         $where = "((has_repay = 1 and a.true_repay_time > a.repay_time) or (has_repay = 0 and  a.repay_time < " . TIME_UTC . ")) and a.repay_date ='{$time}' ";
         //			$where="((has_repay = 1 and a.true_repay_date ='$time' ";
     } elseif ($pay_status == 2) {
         $where = "a.has_repay = 0 and {$condtion} ";
     } elseif ($pay_status == 1) {
         $where = " a.has_repay =1 and (a.true_repay_date ='{$time}')  ";
     } else {
         $where = "1=1";
     }
     $sql_str = "select a.id as hkID,\n\t\tu.user_name as jkr,\n\t\tb.deal_sn as jkbsm,\n\t\tb.sub_name as jkbt,\n\t\tCONCAT('第',a.l_key + 1,'期') as jkqs,\n\t\tc.`name` as jklx,\n\t\tFROM_UNIXTIME(a.repay_time + 28800, '%Y-%m-%d') as yhsj,\n\t\ta.repay_money as yhbx,\n\t\ta.manage_money as glfy,\n\t\ta.impose_money + a.manage_impose_money as fx,\n\t\tcase has_repay\n\t\twhen 0 then 0\n\t\twhen 1 then \n\t\ta.repay_money + a.impose_money + a.manage_impose_money + a.manage_money\n\t\twhen 2 then \n\t\t (select sum(repay_money + impose_money + repay_manage_money + repay_manage_impose_money) from " . DB_PREFIX . "deal_load_repay l where l.has_repay = 1 and l.deal_id = a.deal_id and l.repay_id = a.id)\n\t\telse \n\t\t '0'\n\t\tend as  shze,\n\t\tif (datediff(FROM_UNIXTIME(a.true_repay_time + 28800, '%Y-%m-%d'),FROM_UNIXTIME(a.repay_time + 28800, '%Y-%m-%d')) > 0, \n\t\tdatediff(FROM_UNIXTIME(a.true_repay_time + 28800, '%Y-%m-%d'),FROM_UNIXTIME(a.repay_time + 28800, '%Y-%m-%d')),\n\t\t0) as yqts, \n\t\tFROM_UNIXTIME(a.true_repay_time + 28800, '%Y-%m-%d') as shsj,\n\t\tcase has_repay\n\t\twhen 0 then '未还'\n\t\twhen 1 then '已还'\n\t\twhen 2 then '部分还款'\n\t\telse \n\t\t '已收款'\n\t\tend as zt,\n\t\tif(is_site_bad = 1,'是','否') as sfhz,\n\t\ta.deal_id as deal_id\n\t\tfrom " . DB_PREFIX . "deal_repay as a\n\t\tleft join " . DB_PREFIX . "user u on u.id = a.user_id\n\t\tLEFT JOIN " . DB_PREFIX . "deal b on b.id = a.deal_id\n\t\tLEFT JOIN " . DB_PREFIX . "deal_cate c on c.id = b.cate_id\n\t\twhere {$where}";
     if ($id) {
         $sql_str .= " and a.id = '{$id}'";
     }
     if ($user_name) {
         $sql_str .= " and u.user_name like '%{$user_name}%'";
     }
     if ($deal_sn) {
         $sql_str .= " and b.deal_sn like '%{$deal_sn}%'";
     }
     if ($sub_name) {
         $sql_str .= " and b.sub_name like '%{$sub_name}%'";
     }
     if (isset($_REQUEST['has_repay'])) {
         if ($has_repay == 4) {
             //$sql_str .="$sql_str";
         } elseif ($has_repay == 3) {
             $sql_str .= " and has_repay = 0 ";
         } else {
             $sql_str .= " and has_repay = '{$has_repay}'";
         }
     }
     //echo"$has_repay";
     if ($begin_time > 0 || $end_time > 0) {
         if ($begin_time > 0 && $end_time == 0) {
             $sql_str .= " and (a.repay_time > {$begin_time})";
         } elseif ($begin_time == 0 && $end_time > 0) {
             $sql_str .= " and (a.repay_time < {$end_time} )";
         } elseif ($begin_time > 0 && $end_time > 0) {
             $sql_str .= " and (a.repay_time between {$begin_time} and {$end_time} )";
         }
     }
     $sql_str .= " limit {$limit} ";
     $list = array();
     $list = $GLOBALS['db']->getAll($sql_str);
     //		echo $sql_str;
     //		exit;
     //		var_dump($list);exit;
     if ($list) {
         register_shutdown_function(array(&$this, 'export_csv_deal_info'), $page + 1);
         $deal_info_value = array('hkID' => '""', 'jkr' => '""', 'jkbsm' => '""', 'jkbt' => '""', 'jkqs' => '""', 'jklx' => '""', 'yhsj' => '""', 'yhbx' => '""', 'glfy' => '""', 'fx' => '""', 'shze' => '""', 'yqts' => '""', 'shsj' => '""', 'zt' => '""', 'sfhz' => '""');
         if ($page == 1) {
             $content_deal_info = iconv("utf-8", "gbk", "还款ID,借款人,借款标识名,借款标题,借款期数,借款类型,应还时间,应还本息,管理费用,罚息,实还总额,逾期天数,实还时间,状态,是否坏账");
         }
         if ($page == 1) {
             $content_deal_info = $content_deal_info . "\n";
         }
         foreach ($list as $k => $v) {
             $deal_info_value = array();
             $deal_info_value['hkID'] = iconv('utf-8', 'gbk', '"' . $v['hkID'] . '"');
             $deal_info_value['jkr'] = iconv('utf-8', 'gbk', '"' . $v['jkr'] . '"');
             $deal_info_value['jkbsm'] = iconv('utf-8', 'gbk', '"' . $v['jkbsm'] . '"');
             $deal_info_value['jkbt'] = iconv('utf-8', 'gbk', '"' . $v['jkbt'] . '"');
             $deal_info_value['jkqs'] = iconv('utf-8', 'gbk', '"' . $v['jkqs'] . '"');
             $deal_info_value['jklx'] = iconv('utf-8', 'gbk', '"' . $v['jklx'] . '"');
             $deal_info_value['yhsj'] = iconv('utf-8', 'gbk', '"' . $v['yhsj'] . '"');
             $deal_info_value['yhbx'] = iconv('utf-8', 'gbk', '"' . number_format($v['yhbx'], 2) . '"');
             $deal_info_value['glfy'] = iconv('utf-8', 'gbk', '"' . number_format($v['glfy'], 2) . '"');
             $deal_info_value['fx'] = iconv('utf-8', 'gbk', '"' . number_format($v['fx'], 2) . '"');
             $deal_info_value['shze'] = iconv('utf-8', 'gbk', '"' . number_format($v['shze'], 2) . '"');
             $deal_info_value['yqts'] = iconv('utf-8', 'gbk', '"' . $v['yqts'] . '"');
             $deal_info_value['shsj'] = iconv('utf-8', 'gbk', '"' . $v['shsj'] . '"');
             $deal_info_value['zt'] = iconv('utf-8', 'gbk', '"' . $v['zt'] . '"');
             $deal_info_value['sfhz'] = iconv('utf-8', 'gbk', '"' . $v['sfhz'] . '"');
             $content_deal_info .= implode(",", $deal_info_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=deal_info_list.csv");
         echo $content_deal_info;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
 public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     $log_info = M(MODULE_NAME)->where("id=" . intval($data['id']))->getField("name");
     //开始验证有效性
     $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
     if (!check_empty($data['name'])) {
         $this->error(L("BRAND_NAME_EMPTY_TIP"));
     }
     $data['begin_time'] = trim($data['begin_time']) == '' ? 0 : to_timespan($data['begin_time']);
     $data['end_time'] = trim($data['end_time']) == '' ? 0 : to_timespan($data['end_time']);
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if (false !== $list) {
         //同步更新所有的产品
         M("Deal")->where("brand_id=" . $data['id'] . " and brand_promote = 1")->setField("begin_time", $data['begin_time']);
         M("Deal")->where("brand_id=" . $data['id'] . " and brand_promote = 1")->setField("end_time", $data['end_time']);
         //成功提示
         syn_brand_status($data['id']);
         clear_auto_cache("static_goods_info");
         save_log($log_info . L("UPDATE_SUCCESS"), 1);
         $this->success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         save_log($log_info . L("UPDATE_FAILED"), 0);
         $this->error(L("UPDATE_FAILED"), 0, $log_info . L("UPDATE_FAILED"));
     }
 }
 public function export_csv($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     $sql = "select t.*,d.`name`,u.user_name from " . DB_PREFIX . "ips_transfer as t\nLEFT JOIN " . DB_PREFIX . "deal as d on d.id = t.deal_id\nLEFT JOIN " . DB_PREFIX . "user as u on u.id = d.user_id where t.pTransferType = 1 ";
     if (strim($_REQUEST['pMerCode']) != '') {
         $condition .= " and t.pMerCode like '%" . strim($_REQUEST['pMerCode']) . "%'";
     }
     if (strim($_REQUEST['pMerBillNo']) != '') {
         $condition .= " and t.pMerBillNo like '%" . strim($_REQUEST['pMerBillNo']) . "%'";
     }
     if (strim($_REQUEST['pBidNo']) != '') {
         $condition .= " and t.pBidNo like '%" . strim($_REQUEST['pBidNo']) . "%'";
     }
     if (isset($_REQUEST['pTransferType']) && intval(strim($_REQUEST['pTransferType'])) != -1) {
         $condition .= " and t.pTransferType = " . intval(strim($_REQUEST['pTransferType']));
     }
     if (isset($_REQUEST['pTransferMode']) && intval(strim($_REQUEST['pTransferMode'])) != -1) {
         $condition .= " and t.pTransferMode = " . intval(strim($_REQUEST['pTransferMode']));
     }
     if (isset($_REQUEST['pIpsBillNo']) && strim($_REQUEST['pIpsBillNo']) != "") {
         $condition .= " and t.pIpsBillNo = " . strim($_REQUEST['pIpsBillNo']);
     }
     $start_time = strim($_REQUEST['start_time']);
     $end_time = strim($_REQUEST['end_time']);
     $d = explode('-', $start_time);
     if (isset($_REQUEST['start_time']) && $start_time != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("开始时间不是有效的时间格式:{$start_time}(yyyy-mm-dd)");
         exit;
     }
     $d = explode('-', $end_time);
     if (isset($_REQUEST['end_time']) && strim($end_time) != "" && checkdate($d[1], $d[2], $d[0]) == false) {
         $this->error("结束时间不是有效的时间格式:{$end_time}(yyyy-mm-dd)");
         exit;
     }
     if ($start_time != "" && strim($end_time) != "" && to_timespan($start_time) > to_timespan($end_time)) {
         $this->error('开始时间不能大于结束时间:' . $start_time . '至' . $end_time);
         exit;
     }
     if (strim($start_time) != "") {
         $condition .= " and UNIX_TIMESTAMP(pDate) >=" . to_timespan(strim($start_time));
     }
     if (strim($end_time) != "") {
         $condition .= " and UNIX_TIMESTAMP(pDate) <=" . to_timespan(strim($end_time));
     }
     $list = $GLOBALS['db']->getAll($sql . $condition . " limit " . $limit);
     if ($list) {
         register_shutdown_function(array(&$this, 'export_csv'), $page + 1);
         $list_value_old = array('id' => '""', 'name' => '""', 'ref_data' => '""', 'pMerCode' => '""', 'pMerBillNo' => '""', 'pBidNo' => '""', 'pDate' => '""', 'pTransferType' => '""', 'pTransferMode' => '""', 'pMemo1' => '""', 'pMemo2' => '""', 'pMemo3' => '""', 'pIpsBillNo' => '""', 'pIpsTime' => '""', 'user_name' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "编号,贷款名称,参考,平台账号,商户开户流水号,标的号,商户日期,转账类型,转账方式,备注1,备注2,备注3,IPS订单号,IPS处理时间,借款人");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $list_value = $list_value_old;
             $list_value["id"] = '"' . iconv('utf-8', 'gbk', $v['id']) . '"';
             $list_value["name"] = '"' . iconv('utf-8', 'gbk', $v['name']) . '"';
             $list_value["ref_data"] = '"' . iconv('utf-8', 'gbk', $v["ref_data"]) . '"';
             $list_value["pMerCode"] = '"' . iconv('utf-8', 'gbk', $v["pMerCode"]) . '"';
             $list_value["pMerBillNo"] = '"' . iconv('utf-8', 'gbk', $v["pMerBillNo"]) . '"';
             $list_value["pBidNo"] = '"' . iconv('utf-8', 'gbk', $v["pBidNo"]) . '"';
             $list_value["pDate"] = '"' . iconv('utf-8', 'gbk', $v["pDate"]) . '"';
             $list_value["pTransferType"] = '"' . iconv('utf-8', 'gbk', l("P_TRANSFER_TYPE_" . $v["pTransferType"])) . '"';
             $list_value["pTransferMode"] = '"' . iconv('utf-8', 'gbk', l("P_TRANSFER_MODE_" . $v["pTransferMode"])) . '"';
             $list_value["pMemo1"] = '"' . iconv('utf-8', 'gbk', $v["pMemo1"]) . '"';
             $list_value["pMemo2"] = '"' . iconv('utf-8', 'gbk', $v["pMemo2"]) . '"';
             $list_value["pMemo3"] = '"' . iconv('utf-8', 'gbk', $v["pMemo3"]) . '"';
             $list_value["pIpsTime"] = '"' . iconv('utf-8', 'gbk', $v["pIpsTime"]) . '"';
             $list_value["pIpsBillNo"] = '"' . iconv('utf-8', 'gbk', $v["pIpsBillNo"]) . '"';
             $list_value["user_name"] = '"' . iconv('utf-8', 'gbk', $v["user_name"]) . '"';
             $content .= implode(",", $list_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=order_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
Example #29
0
 public function fund_export_csv($page = 1)
 {
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     //定义条件
     $title_arrays = array("0" => "结存", "1" => "充值", "2" => "投标成功", "3" => "招标成功", "4" => "偿还本息", "5" => "回收本息", "6" => "提前还款", "7" => "提前回收", "8" => "申请提现", "9" => "提现手续费", "10" => "借款管理费", "11" => "逾期罚息", "12" => "逾期管理费", "13" => "人工操作", "14" => "借款服务费", "15" => "出售债权", "16" => "购买债权", "17" => "债权转让管理费", "18" => "开户奖励", "19" => "流标还返", "20" => "投标管理费", "21" => "投标逾期收入", "23" => "邀请返利", "24" => "投标返利", "25" => "签到成功", "26" => "逾期罚金(垫付后)", "27" => "其他费用", "28" => "投资奖励", "26" => "红包奖励");
     $cate = isset($_REQUEST['cate']) ? intval($_REQUEST['cate']) >= 0 ? intval($_REQUEST['cate']) : -1 : -1;
     $extWhere = " 1=1 ";
     if ($cate >= 0) {
         $extWhere .= " AND type = " . $cate;
     }
     if (trim($_REQUEST['user_names']) != '') {
         $extWhere .= " and u.user_name like '%" . trim($_REQUEST['user_names']) . "%'";
     }
     $begin_time = !isset($_REQUEST['begin_time']) ? 0 : (trim($_REQUEST['begin_time']) == "" ? 0 : to_timespan($_REQUEST['begin_time'], "Y-m-d"));
     $end_time = !isset($_REQUEST['end_time']) ? 0 : (trim($_REQUEST['end_time']) == "" ? 0 : to_timespan($_REQUEST['end_time'], "Y-m-d"));
     if ($begin_time > 0 || $end_time > 0) {
         if ($end_time == 0) {
             $extWhere .= " and uml.create_time >= {$begin_time} ";
         } else {
             $extWhere .= " and uml.create_time between  {$begin_time} and {$end_time} ";
         }
     }
     $_REQUEST['begin_time'] = to_date($begin_time, "Y-m-d");
     $_REQUEST['end_time'] = to_date($end_time, "Y-m-d");
     $list = $GLOBALS['db']->getAll("select uml.*,u.user_name  from " . DB_PREFIX . "user_money_log uml left join " . DB_PREFIX . "user u on uml.user_id=u.id  where {$extWhere} order by id desc  LIMIT " . $limit);
     foreach ($list as $k => $v) {
         $n = $list[$k]['type'];
         $list[$k]['type_format'] = $title_arrays[$n];
     }
     if ($list) {
         register_shutdown_function(array(&$this, 'fund_export_csv'), $page + 1);
         $user_value = array('id' => '""', 'user_id' => '""', 'type_format' => '""', 'money' => '""', 'account_money' => '""', 'memo' => '""', 'create_time_ymd' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "编号,会员名,类型,操作金额,余额,备注,操作时间");
         }
         $content = $content . "\n";
         foreach ($list as $k => $v) {
             $fund_list = array();
             $fund_list['id'] = iconv('utf-8', 'gbk', '"' . $v['id'] . '"');
             $fund_list['user_name'] = iconv('utf-8', 'gbk', '"' . get_user_name_reals($v['user_id']) . '"');
             $fund_list['type_format'] = iconv('utf-8', 'gbk', '"' . $v['type_format'] . '"');
             $fund_list['money'] = iconv('utf-8', 'gbk', '"' . format_price($v['money']) . '"');
             $fund_list['account_money'] = iconv('utf-8', 'gbk', '"' . format_price($v['account_money']) . '"');
             $fund_list['memo'] = iconv('utf-8', 'gbk', '"' . $v['memo'] . '"');
             $fund_list['create_time_ymd'] = iconv('utf-8', 'gbk', '"' . $v['create_time_ymd'] . '"');
             $content .= implode(",", $fund_list) . "\n";
         }
         header("Content-Disposition: attachment; filename=fund_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
 public function export_csv_site_costs_info($page = 1)
 {
     $now = get_gmtime();
     set_time_limit(0);
     $limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
     $begin_time = trim($_REQUEST['begin_time']) == '' ? 0 : to_timespan($_REQUEST['begin_time']);
     $end_time = trim($_REQUEST['end_time']) == '' ? 0 : to_timespan($_REQUEST['end_time']);
     $now = get_gmtime();
     $sql_str = "select \n\t\t\tu.user_name as hymc,\n\t\t\ta.total_price as czzj, \n\t\t\tFROM_UNIXTIME(a.create_time+28800 , '%Y-%m-%d %H:%i:%S') as czsj,\n\t\t\tcase \n\t\t\twhen type = 0 then '回报众筹'\n\t\t\twhen type = 1 then '股权众筹'\n\t\t\telse ''\n\t\t\tend xmlx\n\t\t\tfrom " . DB_PREFIX . "deal_order as a left join " . DB_PREFIX . "user as u on u.id = a.user_id  where a.order_status =3 and 1 = 1 ";
     if (trim($_REQUEST['user_name']) != '') {
         $sql_str .= " and u.user_name like '%" . trim($_REQUEST['user_name']) . "%'  ";
     }
     if ($begin_time > 0 || $end_time > 0) {
         if ($begin_time > 0 && $end_time == 0) {
             $sql_str .= " and (a.create_time > {$begin_time})";
         } elseif ($begin_time == 0 && $end_time > 0) {
             $sql_str .= " and (a.create_time < {$end_time} )";
         } elseif ($begin_time > 0 && $end_time > 0) {
             $sql_str .= " and (a.create_time > {$begin_time} and a.create_time < {$end_time} )";
         }
     }
     if (intval($_REQUEST['type']) <= 1) {
         $sql_str .= " and a.type = " . intval($_REQUEST['type']) . "  ";
     }
     $list = array();
     $list = $GLOBALS['db']->getAll($sql_str);
     if ($list) {
         $total_value = array('hymc' => '""', 'czzj' => '""', 'czsj' => '""', 'xmlx' => '""');
         if ($page == 1) {
             $content_total = iconv("utf-8", "gbk", "会员名称,操作金额,操作时间,项目类型");
         }
         if ($page == 1) {
             $content_total = $content_total . "\n";
         }
         foreach ($list as $k => $v) {
             $total_value = array();
             $total_value['hymc'] = iconv('utf-8', 'gbk', '"' . $v['hymc'] . '"');
             $total_value['czzj'] = iconv('utf-8', 'gbk', '"' . $v['czzj'] . '"');
             $total_value['czsj'] = iconv('utf-8', 'gbk', '"' . $v['czsj'] . '"');
             $total_value['xmlx'] = iconv('utf-8', 'gbk', '"' . $v['xmlx'] . '"');
             $content_total .= implode(",", $total_value) . "\n";
         }
         header("Content-Disposition: attachment; filename=total_list.csv");
         echo $content_total;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }