123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php namespace App\Http\Controllers\Admin;
- use App\Models\Custom as Custom;
- use App\Models\Product as Product;
- use App\Models\Orders as Orders;
- use App\Models\RegimentActive as RegimentActive;
- use App\Models\RegimentRecord as Model;
- use PhpOffice\PhpSpreadsheet\IOFactory;
- use PhpOffice\PhpSpreadsheet\Spreadsheet;
- use PhpOffice\PhpSpreadsheet\Style\Alignment;
- use PhpOffice\PhpSpreadsheet\Style\Fill;
- /**
- * 客户签到记录
- *
- * @author jun
- *
- */
- class RegimentRecord extends Auth{
- protected function _initialize(){
- parent::_initialize();
- $this->assign('breadcrumb1','拼团活动');
- $this->assign('breadcrumb2','拼团记录');
- }
- /**
- * 列表页
- *
- * */
- public function index(Model $Model, Product $Product, RegimentActive $RegimentActive, Custom $Custom,Orders $Orders){
- // 接收参数
- $name = request('name','');
- // 查询条件
- $map = [];
- // 组合条件
- if( $name ) $map[] = ['regiment_record.name','=',$name];
- $select = [
- 'regiment_record.*',
- 'regiment.status as regiment_status',
- 'regiment_active.name as active_name',
- 'product.name as product_name',
- 'custom.username as username',
- ];
- // 查询数据
- $list = $Model->query()
- ->join('regiment','regiment.id','=','regiment_record.regiment_id')
- ->join('regiment_active','regiment_active.id','=','regiment_record.active_id')
- ->join('product','product.id','=','regiment_record.product_id')
- ->join('custom','custom.uid','=','regiment_record.custom_uid')
- ->where($map)
- ->select($select)
- ->orderByDesc('id')
- ->paginate(config('page_num',10));
- // 循环处理数据
- foreach($list as &$v){
- $v['product_code'] = $Product->idToCode($v['product_id']);
- $v['active_code'] = $RegimentActive->idToCode($v['active_id']);
- $v['custom_code'] = $Custom->idToCode($v['custom_uid']);
- $v['order_code'] = $Orders->idToCode($v['order_id']);
- }
- // 分配数据
- $this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
- $this->assign('list',$list);
- // 加载模板
- return $this->fetch();
- }
- }
|