作者 SHW\戥岁。。

加入购物车

... ... @@ -3,6 +3,7 @@
namespace app\admin\controller\litestore;
use app\admin\model\litestore\Litestoregoodsspec;
use app\api\model\Goods;
use app\common\controller\Backend;
use app\admin\model\litestore\Litestorespec as SpecModel;
use app\admin\model\litestore\Litestorespecvalue as SpecValueModel;
... ... @@ -272,16 +273,23 @@ class Litestoregoods extends Backend
/**
* 导出
*/
public function clubpeople(){
//1.从数据库中导出需要进行要导出的数据
$list =Db::query('SELECT stu_list.stu_name,stu_list.stu_department,stu_list.stu_phone,stu_list.stu_email,stu_list.stu_profess
,club_branch.* FROM club_branch INNER JOIN stu_list ON club_branch.stu_number = stu_list.stu_number
where club_branch.club_id=:acc order by club_branch.club_branch_name ',['acc'=>$clubid]);
public function clubpeople()
{
//1.从数据库中导出需要进行要导出的数据
// $list = Db::query('SELECT stu_list.stu_name,stu_list.stu_department,stu_list.stu_phone,stu_list.stu_email,stu_list.stu_profess
// ,club_branch.* FROM club_branch INNER JOIN stu_list ON club_branch.stu_number = stu_list.stu_number
// where club_branch.club_id=:acc order by club_branch.club_branch_name ', ['acc' => $clubid]);
$goods = new Goods();
$list = $goods->select()->each(function (&$item){
// $;
});
if (empty($list)){
$this->error('没有可导出的数据');
}
// foreach ()
//重要补助
//重要补助
//2.加载PHPExcle类库
vendor('PHPExcel.PHPExcel');
//3.实例化PHPExcel类
... ... @@ -308,29 +316,29 @@ class Litestoregoods extends Backend
$objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('E')->setWidth(20);
$objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('F')->setWidth(30);
for($i=0;$i<count($list);$i++){
$objPHPExcel->getActiveSheet()->setCellValue('A'.($i+2),$list[$i]['club_branch_name']);//ID
$objPHPExcel->getActiveSheet()->setCellValue('B'.($i+2),$list[$i]['club_position']);//标签码
$objPHPExcel->getActiveSheet()->setCellValue('C'.($i+2),$list[$i]['stu_number']);//防伪码
$objPHPExcel->getActiveSheet()->setCellValue('D'.($i+2),$list[$i]['stu_name']);//ID
$objPHPExcel->getActiveSheet()->setCellValue('E'.($i+2),$list[$i]['stu_phone']);//标签码
$objPHPExcel->getActiveSheet()->setCellValue('F'.($i+2),$list[$i]['stu_email']);//ID
$objPHPExcel->getActiveSheet()->setCellValue('G'.($i+2),$list[$i]['stu_department']);//标签码
$objPHPExcel->getActiveSheet()->setCellValue('H'.($i+2),$list[$i]['stu_profess']);//防伪码
for ($i = 0; $i < count($list); $i++) {
$objPHPExcel->getActiveSheet()->setCellValue('A' . ($i + 2), $list[$i]['club_branch_name']);//ID
$objPHPExcel->getActiveSheet()->setCellValue('B' . ($i + 2), $list[$i]['club_position']);//标签码
$objPHPExcel->getActiveSheet()->setCellValue('C' . ($i + 2), $list[$i]['stu_number']);//防伪码
$objPHPExcel->getActiveSheet()->setCellValue('D' . ($i + 2), $list[$i]['stu_name']);//ID
$objPHPExcel->getActiveSheet()->setCellValue('E' . ($i + 2), $list[$i]['stu_phone']);//标签码
$objPHPExcel->getActiveSheet()->setCellValue('F' . ($i + 2), $list[$i]['stu_email']);//ID
$objPHPExcel->getActiveSheet()->setCellValue('G' . ($i + 2), $list[$i]['stu_department']);//标签码
$objPHPExcel->getActiveSheet()->setCellValue('H' . ($i + 2), $list[$i]['stu_profess']);//防伪码
}
//7.设置保存的Excel表格名称
$filename = $club_name.'人员名单'.date('ymd',time()).'.xls';
$filename = $club_name . '人员名单' . date('ymd', time()) . '.xls';
//8.设置当前激活的sheet表格名称;
$objPHPExcel->getActiveSheet()->setTitle('人员名单');
//9.设置浏览器窗口下载表格
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header('Content-Disposition:inline;filename="'.$filename.'"');
header('Content-Disposition:inline;filename="' . $filename . '"');
//生成excel文件
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
//下载文件在浏览器窗口
$objWriter->save('php://output');
exit;
}
}
}
... ...
... ... @@ -408,10 +408,6 @@ class Classification extends Api
->where('user_id', $this->auth->id)
->where('goods_id', $item['goods_id'])
->sum('number');
// $item['goods_cart_id'] = Db::name('cart')
// ->where('user_id', $this->auth->id)
// ->where('goods_id', $item['goods_id'])
// ->value('id');
} else {
$item['cart_number'] = 0;
}
... ...
... ... @@ -242,7 +242,7 @@ return [
// 验证码位数
'length' => 4,
// 验证成功后是否重置
'reset' => true
'reset' => true,
],
// +----------------------------------------------------------------------
// | Token设置
... ... @@ -290,7 +290,7 @@ return [
//插件纯净模式,插件启用后是否删除插件目录的application、public和assets文件夹
'addon_pure_mode' => true,
//允许跨域的域名,多个以,分隔
'cors_request_domain' => 'localhost,127.0.0.1',
'cors_request_domain' => 'localhost,127.0.0.1,http://temporaryfood.n.broing.cn',
//版本号
'version' => '1.2.2.20211011_beta',
//API接口地址
... ...