public function export_csv($page = 1)
 {
     $pagesize = 10;
     set_time_limit(0);
     $limit = ($page - 1) * intval($pagesize) . "," . intval($pagesize);
     $where = " 1=1 ";
     //定义条件
     if (trim($_REQUEST['user_id']) != '') {
         $where .= " and ur.user_id = " . intval($_REQUEST['user_id']);
     }
     if (trim($_REQUEST['is_pay']) != '') {
         $where .= " and ur.is_pay = " . intval($_REQUEST['is_pay']);
     }
     $sql = "select u.user_name as user_name,u.id as user_id,u.email as email,u.ex_real_name as ex_real_name,u.ex_account_bank as ex_account_bank,u.ex_account_info as ex_account_info,u.ex_contact as ex_contact,u.mobile as mobile, ur.money as money,ur.user_bank_id from " . DB_PREFIX . "user as u LEFT JOIN " . DB_PREFIX . "user_refund as ur on ur.user_id = u.id where " . $where . " limit " . $limit;
     $list = $GLOBALS['db']->getAll($sql);
     if ($list) {
         register_shutdown_function(array(&$this, 'export_csv'), $page + 1);
         $refund_value = array('user_name' => '""', 'email' => '""', 'bank_info' => '""', 'mobile' => '""', 'money' => '""');
         if ($page == 1) {
             $content = iconv("utf-8", "gbk", "会员名,邮箱,银行账户,手机,提现金额");
             $content = $content . "\n";
         }
         foreach ($list as $k => $v) {
             $refund_value['user_name'] = '"' . iconv('utf-8', 'gbk', $list[$k]['user_name']) . '"';
             $refundr_value['email'] = '"' . iconv('utf-8', 'gbk', $list[$k]['email']) . '"';
             //				$refund_value['ex_real_name'] = '"' . iconv('utf-8','gbk',$list[$k]['ex_real_name']) . '"';
             //				$refund_value['ex_account_bank'] = '"' . iconv('utf-8','gbk',$list[$k]['ex_account_bank']) . '"';
             //				$refund_value['ex_account_info'] = '"' . iconv('utf-8','gbk',$list[$k]['ex_account_info']) . '"';
             //				$refund_value['ex_contact'] = '"' . iconv('utf-8','gbk',$list[$k]['ex_contact']) . '"';
             $refund_value['bank_info'] = '"' . iconv('utf-8', 'gbk', get_carray_info($list[$k]['user_bank_id'], $list[$k]['user_id'])) . '"';
             $refund_value['mobile'] = '"' . iconv('utf-8', 'gbk', $list[$k]['mobile']) . '"';
             $refund_value['money'] = '"' . iconv('utf-8', 'gbk', $list[$k]['money']) . '"';
             $content .= implode(",", $refund_value) . "\n";
         }
         //
         header("Content-Disposition: attachment; filename=refund_list.csv");
         echo $content;
     } else {
         if ($page == 1) {
             $this->error(L("NO_RESULT"));
         }
     }
 }
Ejemplo n.º 2
0
 public function msg_carray_money_result($type, $dest, $refund_data)
 {
     $user_info = $GLOBALS['db']->getRow("select *,id as user_id from " . DB_PREFIX . "user where id=" . $dest);
     if ($this->is_wx && $user_info['wx_openid'] && $refund_data) {
         $user_info['carray_money'] = $refund_data['money'];
         $user_info['carray_bank'] = get_carray_info($refund_data['user_bank_id']);
         $user_info['carray_create_time'] = to_date($refund_data['create_time']);
         $user_info['carray_end_time'] = to_date(get_gmtime());
         if ($refund_data['is_pay'] == 1) {
             $user_info['result'] = '申请通过,请等待收款!';
         } else {
             $user_info['result'] = '申请拒绝,如有疑问请咨询客服!';
         }
         $this->user_info = $user_info;
         //调用OPENTM201490080 ,订单支付成功
         $msg_data['title'] = "提现审核结果通知";
         $msg_data['dest'] = $user_info['wx_openid'];
         $msg_data['user_id'] = $user_info['user_id'];
         $msg_data['is_html'] = 0;
         $msg_data['send_type'] = 2;
         $this->msg_reply('wx', 'OPENTM202425107', $msg_data);
     }
 }