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', '