Commit 2a7ddcec by 朱继来

自营样片导出添加字段

parent 044bd655
Showing with 13 additions and 2 deletions
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Model\UserSampleApplyModel;
use App\Model\UserSampleInviteModel;
use DB;
use Excel;
......@@ -19,6 +20,7 @@ Class ExportController extends Controller
public function selfSampleExport($request)
{
$UserSampleApplyModel = new UserSampleApplyModel();
$UserSampleInviteModel = new UserSampleInviteModel();
$data = $UserSampleApplyModel->lists($request, 1);
foreach ($data as $k=>$v) {
......@@ -31,10 +33,19 @@ Class ExportController extends Controller
$cellData[$k]['order_sn'] = $v['order_sn'];
$cellData[$k]['goods_id'] = $v['goods_id'];
$cellData[$k]['goods_name'] = $v['goods_name'];
$cellData[$k]['create_time'] = $v['create_time'];
$invite = $UserSampleInviteModel->where('user_id', $v['user_id'])->select('invitee_mobile')->get()->toArray();
if (!empty($invite)) {
$cellData[$k]['invitee'] = implode(',', array_column($invite, 'invitee_mobile'));
} else {
$cellData[$k]['invitee'] = '';
}
$cellData[$k]['create_time'] = $v['create_time'];
}
$headerCell = ['用户ID', '用户账户', '邀请人数', '已申请样片数', '剩余领取次数', '订单ID', '订单编号', '样片ID', '样片名称', '最近一次领取时间'];
$headerCell = ['用户ID', '用户账户', '邀请人数', '已申请样片数', '剩余领取次数', '订单ID', '订单编号', '样片ID', '样片名称', '邀请用户', '最近一次领取时间'];
$fileName ='自营样片领取记录导出'.date('_YmdHis');
$sheetName = '自营样片';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment