Example #1
0
 public function view()
 {
     require_once APP_ROOT_PATH . 'system/libs/licai.php';
     $id = intval($_REQUEST["id"]);
     if (!$id) {
         $this->error("操作失败,请返回重试");
     }
     $vo = $GLOBALS["db"]->getRow("select lco.*,lc.type,lc.name,lc.licai_sn from " . DB_PREFIX . "licai_order lco\n\t\t left join " . DB_PREFIX . "licai lc on lco.licai_id = lc.id where lco.id =" . $id);
     if ($vo["status"] == 0) {
         $vo["status_format"] = "未支付";
     } elseif ($vo["status"] == 1) {
         $vo["status_format"] = "已支付";
     } elseif ($vo["status"] == 2) {
         $vo["status_format"] = "部分赎回";
     } elseif ($vo["status"] == 3) {
         $vo["status_format"] = "已完结";
     }
     $vo["site_buy_fee_rate_format"] = $vo['site_buy_fee_rate'] . "%";
     if ($vo["begin_interest_type"] == 0) {
         $vo["begin_interest_type_format"] = "当日生效";
     } elseif ($vo["begin_interest_type"] == 1) {
         $vo["begin_interest_type_format"] = "次日生效";
     } elseif ($vo["begin_interest_type"] == 2) {
         $vo["begin_interest_type_format"] = "下个工作日生效";
     } elseif ($vo["begin_interest_type"] == 3) {
         $vo["begin_interest_type_format"] = "下二个工作日生效";
     }
     switch ($vo["type"]) {
         //case 0: $vo["type_format"] = "余额宝";
         //	break;
         case 1:
             $vo["type_format"] = "固定定存";
             break;
         case 2:
             $vo["type_format"] = "浮动定存";
             break;
             //case 3: $vo["type_format"] = "票据";
             //	break;
             //case 4: $vo["type_format"] = "基金";
             //	break;
     }
     $vo["fee_format"] = format_price($vo["site_buy_fee_rate"] * $vo["money"]);
     $vo["freeze_bond_format"] = format_price($vo["freeze_bond"]);
     $vo["pay_money_format"] = format_money_wan($vo["pay_money"]);
     $vo["before_breach_rate_format"] = $vo["before_breach_rate"] . "%";
     $vo["site_buy_fee_rate_format"] = $vo["site_buy_fee_rate"] . "%";
     $vo["breach_rate_format"] = $vo["breach_rate"] . "%";
     $vo["money_format"] = format_money_wan($vo["money"]);
     if ($vo["status_time"] == "" || $vo["status_time"] == "0000-00-00 00:00:00") {
         $vo["status_time"] = $vo["create_time"];
     }
     $this->assign('vo', $vo);
     $this->display();
 }
 public function status()
 {
     $id = intval($_REQUEST["id"]);
     $vo = $GLOBALS["db"]->getRow("select * from " . DB_PREFIX . "licai_redempte where id =" . $id);
     $vo["money_format"] = format_money_wan($vo["money"]);
     $this->assign("vo", $vo);
     $this->display();
 }
Example #3
0
 public function export_csv($page = 1)
 {
     require_once APP_ROOT_PATH . 'system/libs/licai.php';
     $pagesize = 10;
     set_time_limit(0);
     $limit = ($page - 1) * intval($pagesize) . "," . intval($pagesize);
     //	$limit=((0).",".(10));
     //echo $limit;exit;
     $condition = " ";
     if (strim($_REQUEST["type"]) != "" && intval($_REQUEST["type"]) != -1) {
         $condition .= " and lc.type = " . intval($_REQUEST["type"]);
     }
     if (strim($_REQUEST["p_name"]) != "") {
         $condition .= " and lc.name like '%" . strim($_REQUEST["p_name"]) . "%'";
     }
     if (strim($_REQUEST["user_name"]) != "") {
         $condition .= " and u.user_name like '%" . strim($_REQUEST["user_name"]) . "%'";
     }
     $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 lc.begin_buy_date >= '" . strim($start_time) . "'";
         $this->assign("start_time", $start_time);
     }
     if (strim($end_time) != "") {
         $condition .= " and lc.begin_buy_date <= '" . strim($end_time) . "'";
         $this->assign("end_time", $end_time);
     }
     $list = $GLOBALS['db']->getAll("SELECT lc.*,u.user_name \n\t\tFROM " . DB_PREFIX . "licai lc \n\t\tleft join " . DB_PREFIX . "user u on u.id = lc.user_id \n\t\twhere 1=1 " . $condition . " limit " . $limit);
     foreach ($list as $k => $v) {
         //收益率
         $list[$k]["average_income_rate_format"] = $v["average_income_rate"] . "%";
         //产品期限
         if ($v["end_date"] == "" || $v["end_date"] == "0000-00-00") {
             $v["end_date"] = "无期限";
         }
         $list[$k]["show_time"] = $v["begin_buy_date"] . "至" . $v["end_date"];
         $list[$k]["is_recommend_format"] = $v["is_recommend"] == 0 ? "否" : "是";
         //参与人数
         $list[$k]["member_count"] = intval($v["total_people"]);
         $list[$k]["status_format"] = $v["status"] == 0 ? "无效" : "有效";
         switch ($v["type"]) {
             //case 0: $result["list"][$k]["type_format"] = "余额宝";
             //	break;
             case 1:
                 $list[$k]["type_format"] = "固定定存";
                 break;
             case 2:
                 $list[$k]["type_format"] = "浮动定存";
                 //	break;
                 //case 3: $result["list"][$k]["type_format"] = "票据";
                 //	break;
                 //case 4: $result["list"][$k]["type_format"] = "基金";
                 //	break;
         }
         $list[$k]["subscribing_amount_format"] = format_money_wan($v["subscribing_amount"]);
     }
     if ($list) {
         register_shutdown_function(array(&$this, 'export_csv'), $page + 1);
         $order_value = array('id' => '""', 'name' => '""', 'licai_sn' => '""', 'user_name' => '""', 'product_size' => '""', 'type_format' => '""', 'average_income_rate_format' => '""', 'show_time' => '""', 'member_count' => '""', 'subscribing_amount_format' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "编号,产品名称,理财代码,发起人,产品规模,类型,收益率,产品期限,参与人数,成交总额");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $order_value['id'] = '"' . iconv('utf-8', 'gbk', $v['id']) . '"';
             $order_value['name'] = '"' . iconv('utf-8', 'gbk', $v['name']) . '"';
             $order_value['licai_sn'] = '"' . iconv('utf-8', 'gbk', $v['licai_sn']) . '"';
             $order_value['user_name'] = '"' . iconv('utf-8', 'gbk', $v['user_name']) . '"';
             $order_value['product_size'] = '"' . iconv('utf-8', 'gbk', $v['product_size']) . '"';
             $order_value['average_income_rate_format'] = '"' . iconv('utf-8', 'gbk', $v['average_income_rate_format']) . '"';
             $order_value['type_format'] = '"' . iconv('utf-8', 'gbk', $v['type_format']) . '"';
             $order_value['show_time'] = '"' . iconv('utf-8', 'gbk', $v['show_time']) . '"';
             $order_value['member_count'] = '"' . iconv('utf-8', 'gbk', $v['member_count']) . '"';
             $order_value['subscribing_amount_format'] = '"' . iconv('utf-8', 'gbk', $v['subscribing_amount_format']) . '"';
             $content .= implode(",", $order_value) . "\n";
         }
         //
         header("Content-Disposition: attachment; filename=order_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
Example #4
0
 public function uc_expire_status()
 {
     if (!$GLOBALS['user_info']) {
         app_redirect(url("user#login"));
     }
     $id = intval($_REQUEST["id"]);
     $vo = $GLOBALS["db"]->getRow("select lco.* from " . DB_PREFIX . "licai_order lco\n\t\tleft join " . DB_PREFIX . "licai lc on lc.id= lco.licai_id  \n\t\twhere lco.id =" . $id . " and lc.user_id = " . $GLOBALS["user_info"]["id"]);
     $vo['before_interest_enddate'] = to_timespan($vo['before_interest_enddate']);
     $vo['before_interest_date'] = to_timespan($vo['before_interest_date']);
     $vo['end_interest_date'] = to_timespan($vo['end_interest_date']);
     $vo['begin_interest_date'] = to_timespan($vo['begin_interest_date']);
     $vo["money"] = $vo["money"] - $vo['redempte_money'] - $vo["site_buy_fee"];
     $money = $vo["money"];
     $vo["money_format"] = format_money_wan($vo["money"]);
     $licai_interest = get_licai_interest($vo['licai_id'], $money);
     $day_before = intval(($vo['before_interest_enddate'] - $vo['before_interest_date']) / 24 / 3600);
     $before_earn_money = $money * $day_before * $licai_interest['before_rate'] * 0.01 / 365;
     $day_begin = intval(($vo['end_interest_date'] - $vo['begin_interest_date']) / 24 / 3600);
     $begin_earn_money = $money * $day_begin * $licai_interest['interest_rate'] * 0.01 / 365;
     $vo['earn_money'] = round($before_earn_money + $begin_earn_money, 2);
     $vo['fee'] = round($money * ($day_before + $day_begin) * $licai_interest['redemption_fee_rate'] * 0.01 / 365, 2);
     $vo['organiser_fee'] = round($money * ($day_before + $day_begin) * $licai_interest['platform_rate'] * 0.01 / 365, 2);
     $GLOBALS['tmpl']->assign("vo", $vo);
     $GLOBALS['tmpl']->display("licai/licai_uc_expire_status.html");
 }