gq %!s(int64=8) %!d(string=hai) anos
pai
achega
c450534335

+ 3 - 3
server/app/Http/Controllers/Admin/Interaction/InfoController.php

xqd xqd
@@ -11,10 +11,11 @@ class InfoController extends Controller
 {
     public function view(Request $request)
     {
-        $dream = DreamInfoModel::find($request->id);
+        $dream = DreamInfoModel::where('id',$request->id)->with('interactions')->first();
         $list = $dream->interactions;
         foreach ($list as $item){
-            $item->comms =   $item->comments;
+            $comments = CommentInfoModel::where('interaction_id',$item->id)->orderBy('created_at')->get();
+            $item->comms =  $comments;
         }
         return view('admin.dream.interaction.view',compact('list'));
     }
@@ -30,6 +31,5 @@ class InfoController extends Controller
             $url[] = array('url'=>U( 'Dream/Info/index'),'title'=>'返回列表');
             return $this->showWarning('操作失败',$url);
         }
-//        dd($data);
     }
 }

+ 136 - 0
server/app/Http/Controllers/Admin/User/Cash/OutController.php

xqd
@@ -0,0 +1,136 @@
+<?php
+/**
+ *  提现列表
+ *  @author  system
+ *  @version    1.0
+ *  @date 2017-06-30 18:18:37
+ *
+ */
+namespace App\Http\Controllers\Admin\User\Cash;
+use App\Http\Controllers\Admin\Controller;
+use Illuminate\Http\Request;
+use App\Repositories\Base\Criteria\OrderBy;
+use App\Repositories\User\Cash\Criteria\MultiWhere;
+use App\Repositories\User\Cash\OutRepository;
+
+class OutController extends Controller
+{
+    private $repository;
+
+    public function __construct(OutRepository $repository) {
+        if(!$this->repository) $this->repository = $repository;
+    }
+
+    function index(Request $reqeust) {
+        $search['keyword'] = $reqeust->input('keyword');
+        $query = $this->repository->pushCriteria(new MultiWhere($search));
+        $request = $reqeust->all();
+        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+        $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
+        }
+        $list = $query->paginate();
+        return view('admin.user.cash.out.index',compact('list'));
+    }
+
+
+    function check(Request $reqeust) {
+        $request = $reqeust->all();
+        $search['keyword'] = $reqeust->input('keyword');
+        $orderby = array();
+        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+            $orderby[$request['sort_field']] = $request['sort_field_by'];
+        }
+        $list = $this->repository->search($search,$orderby);
+        return view('admin.user.cash.out.check',compact('list'));
+    }
+
+
+    /**
+     * 添加
+     * 
+     */
+    public function create(Request $reqeust)
+    {
+        if($reqeust->method() == 'POST') {
+            return $this->_createSave();
+        }
+        return view('admin.user.cash.out.edit');
+    }
+
+    /**
+     * 保存修改
+     */
+    private function _createSave(){
+        $data = (array) request('data');
+        $id = $this->repository->create($data);
+        if($id) {
+            $url[] = array('url'=>U( 'User/Cash/Out/index'),'title'=>'返回列表');
+            $url[] = array('url'=>U( 'User/Cash/Out/create'),'title'=>'继续添加');
+            $this->showMessage('添加成功',$url);
+        }else{
+            $url[] = array('url'=>U( 'User/Cash/Out/index'),'title'=>'返回列表');
+            return $this->showWarning('添加失败',$url);
+        }
+    }
+    
+    /**
+     * 
+     * 修改
+     * 
+     * 
+     */
+    public function update(Request $reqeust) {
+        if($reqeust->method() == 'POST') {
+            return $this->_updateSave();
+        }
+        $data = $this->repository->find($reqeust->get('id'));
+        return view('admin.user.cash.out.edit',compact('data'));
+    }
+
+    /**
+     * 保存修改
+     */
+    private function _updateSave() {
+        $data = (array) request('data');
+        $ok = $this->repository->update(request('id'),$data);
+        if($ok) {
+            $url[] = array('url'=>U( 'User/Cash/Out/index'),'title'=>'返回列表');
+            return $this->showMessage('操作成功',urldecode(request('_referer')));
+        }else{
+            $url[] = array('url'=>U( 'User/Cash/Out/index'),'title'=>'返回列表');
+            return $this->showWarning('操作失败',$url);
+        }
+    }
+
+    public function view(Request $reqeust) {
+        $data = $this->repository->find(request('id'));
+        return view('admin.user.cash.out.view',compact('data'));
+    }
+
+
+    /**
+     *
+     * 状态改变
+     *
+     */
+    public function status(Request $reqeust) {
+        $ok = $this->repository->updateStatus(request('id'),request('status'));
+        if($ok) {
+            return $this->showMessage('操作成功');
+        }else{
+            return $this->showWarning('操作失败');
+        }
+    }
+    
+    /**
+     * 删除
+     */
+    public function destroy(Request $reqeust) {
+        $bool = $this->repository->destroy($reqeust->get('id'));
+        if($bool) {
+            return  $this->showMessage('操作成功');
+        }else{
+            return  $this->showWarning("操作失败");
+        }
+    }
+}

+ 5 - 0
server/app/Models/DreamInfoModel.php

xqd
@@ -69,4 +69,9 @@ class DreamInfoModel extends BaseModel
         return $this->hasMany('App\Models\InteractionInfo','dream_id');
     }
 
+    public function allInteraction()
+    {
+        return $this->hasManyThrough('App\Models\CommentInfoModel', 'App\Models\InteractionInfo','dream_id','interaction_id');
+    }
+
 }

+ 41 - 0
server/app/Models/UserCashOutModel.php

xqd
@@ -0,0 +1,41 @@
+<?php
+namespace App\Models;
+use App\Models\BaseModel;
+/**
+ *  @description 提现列表
+ *  @author  system;
+ *  @version    1.0
+ *  @date 2017-06-30 18:18:37
+ *
+ */
+class UserCashOutModel extends BaseModel
+{
+    /**
+     * 数据表名
+     *
+     * @var string
+     *
+     */
+    protected $table = 'user_cash_out';
+    /**
+    主键
+     */
+    protected $primaryKey = 'id';
+
+    //分页
+    protected $perPage = PAGE_NUMS;
+
+    /**
+     * 可以被集体附值的表的字段
+     *
+     * @var string
+     */
+    protected $fillable = [
+                           'user_id',
+                           'bank_id',
+                           'status',
+                           'cash',
+                           'comments'
+                          ];
+
+}

+ 45 - 0
server/app/Repositories/User/Cash/Criteria/MultiWhere.php

xqd
@@ -0,0 +1,45 @@
+<?php
+/**
+ * User: Mike
+ * Email: m@9026.com
+ * Date: 2017/1/12
+ * Time: 17:52
+ */
+
+namespace App\Repositories\User\Cash\Criteria;
+
+
+
+
+use App\Repositories\Base\Criteria;
+use App\Repositories\Contracts\RepositoryInterface as Repository;
+
+class MultiWhere extends Criteria {
+
+    private $search = [];
+
+    /**
+     * MultiWhere constructor.
+     * @param array $search
+     *
+     */
+    public function __construct(array $search)
+    {
+        $this->search = $search;
+    }
+
+    /**
+    * @param $model
+    * @param RepositoryInterface $repository
+    * @return mixed
+    */
+    public function apply($model, Repository $repository)
+    {
+          if(isset($this->search['deleted_at']) && $this->search['deleted_at']) {
+                                    $model = $model->where('deleted_at',$this->search['deleted_at']);
+                                 }
+
+         return $model;
+    }
+
+}

+ 21 - 0
server/app/Repositories/User/Cash/OutRepository.php

xqd
@@ -0,0 +1,21 @@
+<?php
+/**
+ *   提现列表
+ *  @author  system
+ *  @version    1.0
+ *  @date 2017-06-30 18:18:37
+ *
+ */
+namespace App\Repositories\User\Cash;
+
+use App\Repositories\Base\Repository;
+
+
+class OutRepository extends Repository {
+
+    public function model() {
+        return \App\Models\UserCashOutModel::class;
+    }
+
+    
+}

+ 92 - 0
server/resources/views/admin/user/cash/out/check.blade.php

xqd
@@ -0,0 +1,92 @@
+@extends('admin.layout')
+
+@section('content')
+	<div class="wrapper wrapper-content animated fadeInRight">
+		<div class="row">
+			<div class="col-sm-12">
+				<div class="ibox float-e-margins">
+					<div class="ibox-title">
+						<h5>提现列表</h5>
+						<div class="ibox-tools">
+							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+							</a>
+						</div>
+					</div>
+					<div class="ibox-content">
+						<div class="row">
+							<form method="GET" action="" accept-charset="UTF-8">
+
+								<div class="col-sm-4">
+									<div class="input-group">
+										<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control">
+								<span class="input-group-btn">
+									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								</span>
+									</div>
+								</div>
+							</form>
+							@if(role('User/Cash/Out/create'))
+								<div class="col-sm-3 pull-right">
+									<a href="{{ U('User/Cash/Out/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+								</div>
+							@endif
+						</div>
+
+						<table class="table table-striped table-bordered table-hover dataTables-example dataTable dataCheckTable">
+							<thead>
+							<tr>
+								<th><input class="btSelectAll" name="btSelectAll" type="checkbox"></th>
+								
+            <th class="sorting" data-sort="id"> 提现记录id </th>
+            <th class="sorting" data-sort="user_id"> 提现用户id </th>
+            <th class="sorting" data-sort="bank_id"> 绑定的提现方式id </th>
+            <th class="sorting" data-sort="status"> 提现状态: 0, 申请提现; 1,审核通过; 2,已打款; 3,审核未通过 </th>
+            <th class="sorting" data-sort="cash"> 提现金额 </th>
+            <th class="sorting" data-sort="created_at">  </th>
+            <th class="sorting" data-sort="updated_at">  </th>
+								<th width="22%">相关操作</th>
+							</tr>
+							</thead>
+							<tbody>
+							@if(isset($list))
+								@foreach($list as $key => $item)
+									<tr>
+									<td><input data-json='{!! json_encode($item) !!}'  name="btSelectItem" class="data_key" type="checkbox" value="{{ $item->id or 0 }}" /></td>
+									
+            <td>{{ $item->id }}</td>
+            <td>{{ $item->user_id }}</td>
+            <td>{{ $item->bank_id }}</td>
+            <td>{{ $item->status }}</td>
+            <td>{{ $item->cash }}</td>
+            <td>{{ $item->created_at }}</td>
+            <td>{{ $item->updated_at }}</td>
+									<td>
+										@if(role('User/Cash/Out/view'))
+											<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('User/Cash/Out/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+										@endif
+									</td>
+								</tr>
+								@endforeach
+							@endif
+
+							</tbody>
+						</table>
+						<div class="row">
+							<div class="col-sm-6">
+								<div class="dataTables_info" id="DataTables_Table_0_info"
+									 role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+							</div>
+							<div class="col-sm-6">
+								<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+									{!! $list->setPath('')->appends(Request::all())->render() !!}
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	@include('admin.tools.check_script');
+
+@endsection

+ 109 - 0
server/resources/views/admin/user/cash/out/edit.blade.php

xqd
@@ -0,0 +1,109 @@
+@extends('admin.layout')
+
+@section('content')
+
+<?php
+    if(!isset($data)) $data = array();
+    if(!$data && session("data")){
+        $data = session("data");
+    }
+    if(!$data && session('_old_input')){
+        $data = session("_old_input");
+    }
+?>
+<div class="wrapper wrapper-content animated fadeInRight">
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>提现列表</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+                    @if(role('User/Cash/Out/index'))
+				    <div class="row">
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('User/Cash/Out/index')}}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+    					</div>
+					</div>
+                    @endif
+
+		            <div class="row">
+                        <div class="col-lg-10">
+                            <form name="form_product" id="form-validation" action="" class="form-horizontal form-validation" accept-charset="UTF-8" method="post">
+
+                                    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">提现用户id</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_user_id" name="data[user_id]" class="form-control" value="{{ $data['user_id'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">绑定的提现方式id</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_bank_id" name="data[bank_id]" class="form-control" value="{{ $data['bank_id'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">提现状态: 0, 申请提现; 1,审核通过; 2,已打款; 3,审核未通过</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_status" name="data[status]" class="form-control" value="{{ $data['status'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">提现金额</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_cash" name="data[cash]" class="form-control" value="{{ $data['cash'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">审核未通过原因, 备注等</label>
+                                    
+                   <div class="col-sm-9">
+                     <textarea name="data[comments]" id="editorcomments" required="" aria-required="true" class="form-control" rows="10">{{ $data['comments'] or ''}}</textarea>
+                                       
+                     {!! editor('editorcomments', ['position' => 'ali', 'folder' => 'upload/common'], ['themeType' => 'simple', 'height' => '300px']) !!}
+                                            
+                    </div>
+                                
+                </div>
+                                
+                                <div class="form-group">
+                                    <label class="control-label col-sm-3">&nbsp;</label>
+                                    <div class="col-sm-9">
+                                        <input type="hidden" name="_referer" value="<?php echo urlencode(request()->server('HTTP_REFERER'));?>"/>
+                                        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
+                                        <input type="submit" class="btn btn-success" style="margin-right:20px;">
+                                        <input type="reset" class="btn btn-default" >
+                                    </div>
+                                </div>
+        
+                            </form>
+                        </div>
+                        <!-- /.col-lg-10 -->
+                    </div>
+                    <!-- /.row -->
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+
+@endsection

+ 105 - 0
server/resources/views/admin/user/cash/out/index.blade.php

xqd
@@ -0,0 +1,105 @@
+@extends('admin.layout') 
+
+@section('content')
+<div class="wrapper wrapper-content animated fadeInRight">
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>提现列表</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+				    <div class="row">
+				        <form method="GET" action="" accept-charset="UTF-8">
+
+				        <div class="col-sm-4">
+				            <div class="input-group">
+								<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control"> 
+								<span class="input-group-btn">
+									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								</span>
+    						</div>
+				        </div>
+				        </form>
+						@if(role('User/Cash/Out/create'))
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('User/Cash/Out/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+    					</div>
+						@endif
+					</div>
+					
+					<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
+						<thead>
+    						<tr>
+								
+            <th class="sorting" data-sort="id"> id </th>
+            <th class="sorting" data-sort="user_id"> 提现用户 </th>
+            <th class="sorting" data-sort="bank_id"> 绑定的提现方式 </th>
+            <th class="sorting" data-sort="status"> 提现状态</th>
+            <th class="sorting" data-sort="cash"> 提现金额 </th>
+            <th class="sorting" data-sort="created_at"> 提现时间 </th>
+        						<th width="22%">相关操作</th>
+        					</tr>
+						</thead>
+						<tbody>
+						@if(isset($list))
+							@foreach($list as $key => $item)							<tr>
+								
+            <td>{{ $item->id }}</td>
+            <td>{{ $item->user_id }}</td>
+            <td>{{ $item->bank_id }}</td>
+            <td>{{ $item->status }}</td>
+            <td>{{ $item->cash }}</td>
+            <td>{{ $item->created_at }}</td>
+								<td>
+									<div class="btn-group">
+										<button data-toggle="dropdown"
+											class="btn btn-warning btn-sm dropdown-toggle"
+											aria-expanded="false">
+											操作 <span class="caret"></span>
+										</button>
+										<ul class="dropdown-menu">
+
+
+											@if(role('User/Cash/Out/update'))
+											<li><a href="{{ U('User/Cash/Out/update',['id'=>$item->id])}}" class="font-bold">修改</a></li>
+											@endif
+
+											@if(role('User/Cash/Out/destroy'))
+											<li class="divider"></li>
+											<li><a href="{{ U('User/Cash/Out/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作?');">删除</a></li>
+											@endif
+
+										</ul>
+									</div>
+								@if(role('User/Cash/Out/view'))
+										<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('User/Cash/Out/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+									@endif
+								</td>
+							</tr>
+							@endforeach
+							@endif
+
+						</tbody>
+					</table>
+					<div class="row">
+						<div class="col-sm-6">
+							<div class="dataTables_info" id="DataTables_Table_0_info"
+								role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+						</div>
+						<div class="col-sm-6">
+						<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+						{!! $list->setPath('')->appends(Request::all())->render() !!}
+						</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+</div>
+@endsection

+ 74 - 0
server/resources/views/admin/user/cash/out/view.blade.php

xqd
@@ -0,0 +1,74 @@
+@extends('admin.layout')
+
+@section('content')
+<div class="row">
+    <div class="ibox-content">
+        <div class="list-group">
+                                 
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">提现记录id</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['id'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">提现用户id</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['user_id'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">绑定的提现方式id</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['bank_id'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">提现状态: 0, 申请提现; 1,审核通过; 2,已打款; 3,审核未通过</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['status'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">提现金额</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['cash'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">审核未通过原因, 备注等</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['comments'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading"></h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['created_at'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading"></h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['updated_at'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading"></h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['deleted_at'] or ''}}</p>
+                                                 
+               </div>
+        </div>
+    </div>
+</div>
+@endsection