Exemple #1
0
 public function expAction()
 {
     $orderid = reqstr('orderid', '');
     $username = reqstr('username', '');
     $id = reqstr('id', '');
     $where = '1=1 and flag=1';
     if (!empty($orderid)) {
         $where .= " and orderid='" . $orderid . "'";
     }
     if (!empty($username)) {
         $where .= ' and username='******',');
         $where .= " and id in (" . $id . ")";
     }
     $page = reqnum("page", 1);
     $pagesize = reqnum("pagesize", 1000);
     $m = new Psys_UserModel();
     $list = $m->GetList($where, '', $page, $pagesize, "id,username,mark,goodsid,num,ctime", 'rhi_mallorder');
     global $G_X;
     $filestr = 'charge' . date('YmdHis') . uniqid() . '.csv';
     $filename = PUBLIC_PATH . $G_X['prjstr'] . DIRECTORY_SEPARATOR . $filestr;
     //设置文件名
     if (!file_exists($filename)) {
         touch($filename);
         chmod($filename, 0777);
     }
     $fp = fopen($filename, 'w');
     $title = array("序号", "电话号码", '发放号码', '商品id', '数目', '兑换时间');
     foreach ($title as &$value) {
         $value = iconv('utf-8', 'gb2312', $value);
     }
     fputcsv($fp, $title);
     if ($list['allrow']) {
         foreach ($list['allrow'] as &$row) {
             $row['ctime'] = date('Y-m-d H:i:s', $row['ctime']);
             if (fputcsv($fp, $row)) {
                 $m->UpdateOne(array('ifuse' => 1), array('id' => $row['id']), 'rhi_mallorder');
             }
         }
     }
     fclose($fp);
     // 		header('Content-Type: application/octet-stream');
     // 		header('Content-Disposition: attachment; filename=' . $filestr);
     // 		header('Content-Transfer-Encoding: binary');
     // 		header('Content-Length: ' . filesize($fileName));
     // 		readfile($filename);
     return array('status' => 1, 'filename' => $filestr);
 }
Exemple #2
0
 public function tasksAction()
 {
     $appkey = reqstr('appkey', '');
     $username = reqstr('username', '');
     $taskid = reqstr('taskid', '');
     $indate = reqstr('indate', 0);
     $todate = reqstr('todate', 0);
     $where = '1=1 ';
     if (!empty($appkey)) {
         $where .= " and appkey='" . $appkey . "'";
     }
     if (!empty($taskid)) {
         $where .= ' and taskid=' . $taskid;
     }
     if (!empty($username)) {
         $where .= " and username='******'";
     }
     if ($todate > 0) {
         $where .= ' and ctime > ' . strtotime($indate);
     }
     if ($indate > 0) {
         $where .= ' and ctime <= ' . strtotime($todate);
     }
     $page = reqnum("page", 1);
     $pagesize = reqnum("pagesize", 10);
     $applist = array('61' => '开心消消乐', '49' => '消灭星星2015', '47' => '萌宠泡泡龙', '68' => '凤凰视频', '69' => '哪吒看书', '70' => '微看点');
     $m = new Psys_UserModel();
     $list = $m->GetList($where, 'id DESC', $page, $pagesize, "*", 'rhi_usertask');
     foreach ($list['allrow'] as $key => &$var) {
         MsgInfoConst::GetAppKey($var['appkey'], $err);
         $var['appkey'] = $err['msg'];
         $var['taskid'] = $applist[$var['taskid']];
     }
     $s_arr = $arr_xip_fw[$appkey];
     self::inidate($list['allnum'], $page, $pagesize, count($list['allrow']));
     $this->smarty->assign('appkeys', MsgInfoConst::$appkey_arr);
     //站点列表
     $this->smarty->assign('tasks', $applist);
     //站点列表
     $this->smarty->assign('list', $list['allrow']);
     $this->smarty->assign('psys_base_url', PSYS_BASE_URL);
     $this->forward = "tasks";
 }