Jelajahi Sumber

Merge branch 'gq' of http://git.9026.com/roobe/miao

Mike 8 tahun lalu
induk
melakukan
866e20cad7

+ 7 - 8
server/app/Http/Controllers/Admin/Dream/InfoController.php

xqd xqd xqd xqd xqd xqd
@@ -28,7 +28,7 @@ class InfoController extends Controller
     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']));
         }
@@ -77,7 +77,7 @@ class InfoController extends Controller
             $arr = [];
             foreach ($pics['url'] as $pic) {
                 $arr[] = [
-                    'pic'=>$pic,
+                    'pic'=>getenv('APP_URL').$pic,
                     'dream_id'=>$id,
                     'created_at'=>date("Y-m-d H:i:s"),
                     'updated_at'=>date("Y-m-d H:i:s"),
@@ -101,7 +101,6 @@ class InfoController extends Controller
      */
     public function update(Request $reqeust) {
         if($reqeust->method() == 'POST') {
-//            dd($reqeust->all());
             return $this->_updateSave();
         }
         $data = $this->repository->find($reqeust->get('id'));
@@ -133,8 +132,8 @@ class InfoController extends Controller
             //        删除以前图片 重新插入
             if (!empty($b)) {
                 foreach ($b as $old_pic){
-                    if (is_file('.'.$old_pic)) {
-                        unlink('.'.$old_pic);
+                    if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
+                        unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
                     }
                     BaseAttachmentModel::where('url',$old_pic)->delete();
                     DreamImages::where('pic',$old_pic)->delete();
@@ -143,7 +142,7 @@ class InfoController extends Controller
             $arr = [];                         //插入新的图片
             foreach ($a as $pic) {
                 $arr[] = [
-                    'pic'=>$pic,
+                    'pic'=>getenv('APP_URL').$pic,
                     'dream_id'=>request('id'),
                     'created_at'=>date('Y-m-d H:i:s'),
                     'updated_at'=>date('Y-m-d H:i:s'),
@@ -191,8 +190,8 @@ class InfoController extends Controller
             $old_pics = array_column($old_data_pics,'pic');
             if (!empty($old_pics)) {
                 foreach ($old_pics as $old_pic){
-                    if (is_file('.'.$old_pic)) {
-                        unlink('.'.$old_pic);
+                    if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
+                        unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
                     }
                     BaseAttachmentModel::where('url',$old_pic)->delete();
                 }

+ 6 - 6
server/app/Http/Controllers/Admin/Settings/SettingsController.php

xqd xqd xqd
@@ -45,7 +45,7 @@ class SettingsController extends Controller
         $data['category'] = 'banner';
         $data['key'] = '0';
         $data['pid'] = '0';
-        $data['value'] = $pic[0];
+        $data['value'] = getenv('APP_URL').$pic[0];
         $id = $this->repository->create($data);
         if($id) {
             $url[] = array('url'=>U( 'setting/banner/index'),'title'=>'返回列表');
@@ -80,9 +80,9 @@ class SettingsController extends Controller
         $old_pics =  $data2->value;
         $pic = (array) request('value');
         if (!empty($pic)) {
-            $data['value'] = $pic[0];
-            if (is_file('.'.$old_pics)) {
-                unlink('.'.$old_pics);
+            $data['value'] = getenv('APP_URL').$pic[0];
+            if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pics))) {
+                unlink('.'.str_replace(getenv('APP_URL'),'',$old_pics));
             }
         }
         $ok = $this->repository->update(request('id'),$data);
@@ -101,8 +101,8 @@ class SettingsController extends Controller
         $old_pics =  $data2->value;
         $bool = $this->repository->destroy($request->id);
         if($bool) {
-            if (is_file('.'.$old_pics)) {
-                unlink('.'.$old_pics);
+            if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pics))) {
+                unlink('.'.str_replace(getenv('APP_URL'),'',$old_pics));
             }
             return  $this->showMessage('操作成功');
         }else {

+ 5 - 5
server/app/Http/Controllers/Admin/User/InfoController.php

xqd xqd
@@ -85,7 +85,7 @@ class InfoController extends Controller
     private function _createSave(){
         $avatar =  request('avatar');
         $data = (array) request('data');
-        $data['avatar'] = $avatar;
+        $data['avatar'] = getenv('APP_URL').$avatar;
         $id = $this->repository->create($data);
         if($id) {
             $url[] = array('url'=>U( 'User/Info/index'),'title'=>'返回列表');
@@ -118,11 +118,11 @@ class InfoController extends Controller
         $old_avatar = $this->repository->find(request('id'))->avatar;
         $data = (array) request('data');
         if (!empty(request('avatar'))) {
-            if (is_file('.'.$old_avatar)) {
-                unlink('.'.$old_avatar);
-                BaseAttachmentModel::where('url',$old_avatar)->delete();
+            if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_avatar))) {
+                unlink('.'.str_replace(getenv('APP_URL'),'',$old_avatar));
             }
-            $data['avatar'] = request('avatar');
+            BaseAttachmentModel::where('url',$old_avatar)->delete();
+            $data['avatar'] = getenv('APP_URL').request('avatar');
         }
         $ok = $this->repository->update(request('id'),$data);
         if($ok) {

+ 0 - 1
server/app/Http/Controllers/Api/V1/IndexController.php

xqd
@@ -105,7 +105,6 @@ class IndexController extends Controller
         }
     }
 
-
     /**
      * @api {get}  /api/index/search 搜索
      * @apiDescription 搜索

+ 0 - 1
server/app/Repositories/Dream/Criteria/MultiWhere.php

xqd
@@ -44,7 +44,6 @@ class MultiWhere extends Criteria {
                     ->orwhere('name', 'like', $keywords);
             });
         }
-
          return $model;
     }
 

+ 13 - 10
server/resources/views/admin/dream/info/edit.blade.php

xqd xqd
@@ -86,10 +86,10 @@
                 </div>    
                 <div class="form-group">
                                     
-                 <label class="control-label col-sm-3">梦想倒计时</label>
+                 <label class="control-label col-sm-3">梦想结束时间</label>
                                     
                    <div class="col-sm-9">
-                     <input id="data_time" name="data[time]" class="form-control" value="{{ $data['time'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                     <input id="data_time" name="data[end_time]" class="form-control" value="{{ $data['end_time'] or ''}}" required="" aria-required="true"  placeholder="">
                     </div>
                                 
                 </div>    
@@ -110,16 +110,19 @@
                      <input id="data_mark" name="data[mark]" class="form-control" value="{{ $data['mark'] or ''}}" required="" aria-required="true"  placeholder=""> 
                     </div>
                                 
-                </div>    
+                </div>
                 <div class="form-group">
-                                    
-                 <label class="control-label col-sm-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=""> 
+                    <label class="control-label col-sm-3">梦想状态</label>
+
+                    <div class="col-sm-9">
+                        @foreach(dict()->get('dream_info','status') as $key=>$val)
+                            <label class="radio-inline">
+                                <input type="radio" name="data[status]" value="{{$key}}" @if(isset($data['status']) && $data['status'] == $key)checked="checked" @endif/>{{$val}}
+                            </label>
+                        @endforeach
                     </div>
-                                
-                </div>    
+
+                </div>
                 <div class="form-group">
                                     
                  <label class="control-label col-sm-3">梦想视频地址</label>

+ 3 - 1
server/resources/views/admin/dream/info/index.blade.php

xqd xqd
@@ -44,6 +44,7 @@
             <th class="sorting" data-sort="get_coin"> 获得梦想币 </th>
             <th class="sorting" data-sort="mark"> 梦想分 </th>
             <th class="sorting" data-sort="sign"> 梦想标签 </th>
+            <th class="sorting" data-sort="status"> 梦想状态 </th>
         						<th width="22%">相关操作</th>
         					</tr>
 						</thead>
@@ -55,10 +56,11 @@
             <td>{{ $item->user_id }}</td>
             <td>{{ $item->name }}</td>
             <td>{{ $item->coin }}</td>
-            <td>{{ $item->time }}</td>
+            <td>{{ date('Y-m-d',$item->end_time )}}</td>
             <td>{{ $item->get_coin }}</td>
             <td>{{ $item->mark }}</td>
             <td>{{ $item->sign }}</td>
+			<td>{{ dict()->get('dream_info','status',$item->status) }}</td>
 								<td>
 									<div class="btn-group">
 										<button data-toggle="dropdown"