Browse Source

Merge branch 'master' of http://47.118.43.255:3000/jjhc/jucai

sandm 3 năm trước cách đây
mục cha
commit
7a745d2dfb

+ 29 - 1
app/Admin/Controllers/Content/BuyHouseBlacklistController.php

@@ -2,6 +2,7 @@
 
 namespace App\Admin\Controllers\Content;
 
+use App\Admin\Exports\Content\HouseBlacklistExport;
 use App\Http\Controllers\Controller;
 use App\Models\TalentHousePeople;
 use Encore\Admin\Controllers\HasResourceActions;
@@ -47,7 +48,7 @@ class BuyHouseBlacklistController extends Controller
         $grid->email('邮箱');
         $grid->id_card('证件号');
         $grid->end_time('拉黑截止时间');
-        $grid->comment('备注');
+        $grid->comment('备注')->style('max-width:400px');
         $grid->status('状态')->display(function () use ($status_text) {
             return $status_text[$this->status];
         });
@@ -58,6 +59,7 @@ class BuyHouseBlacklistController extends Controller
             } else {
                 $actions->append("<a href='" . admin_base_path('content/buy_house_blacklist/status') . "?id={$actions->row['id']}&status=1' class='btn btn-primary btn-xs status'>取消拉黑</a>");
             }
+            $actions->append("<a href='javascript:set_comment({$actions->row['id']})' class='btn btn-primary btn-xs comment'>修改备注</a>");
         });
 
         $grid->filter(function ($filter) {
@@ -72,7 +74,12 @@ class BuyHouseBlacklistController extends Controller
                     $query->where('status', '=', $this->input);
                 }
             }, '状态', 'status')->radio($status_option);
+            $filter->between('end_time', '拉黑截至时间')->datetime();
         });
+
+        $grid->disableExport(false); //显示导出按钮
+        $grid->exporter(new HouseBlacklistExport()); //传入自己在第1步创建的导出类
+
         return $grid;
     }
 
@@ -111,4 +118,25 @@ class BuyHouseBlacklistController extends Controller
 
         return redirect($url);
     }
+
+    /**
+     * 修改备注
+     */
+    public function comment(Request $request)
+    {
+        $id      = $request->id;
+        $comment = $request->comment;
+        $url     = empty($request->url) ? admin_base_path('content/buy_house_blacklist') : $request->url;
+
+        $result = TalentHousePeople::where('id', '=', $id)
+            ->update(['comment'=>$comment]);
+
+        if ($result) {
+            admin_toastr('审核成功', 'success');
+        } else {
+            admin_toastr('该信息不存在或已操作', 'error');
+        }
+
+        return redirect($url);
+    }
 }

+ 8 - 8
app/Admin/Controllers/Content/BuyHouseController.php

@@ -392,10 +392,10 @@ class BuyHouseController extends Controller
             ->where('is_draft', 2)
             ->orderByRaw(DB::raw("FIELD(talent_level,'第一层次','第二层次','第三层次','第四层次','第五层次','第六层次','第七层次') asc"));
         if ($status == 1) {
-            $filename = $house['name'].'审核不通过名单.xls';
-            $query    = $query->whereIn('status', [1, 3]);
+            $filename = $house['name'] . '审核不通过名单.xls';
+            $query    = $query->whereIn('status', [1, 3, 4]);
         } else {
-            $filename = $house['name'].'审核通过名单.xls';
+            $filename = $house['name'] . '审核通过名单.xls';
             $query    = $query->where('status', 2);
         }
         $data = $query->get();
@@ -444,19 +444,19 @@ class BuyHouseController extends Controller
      */
     public function image(Request $request)
     {
-        $src = $request->src;
+        $src          = $request->src;
         $photo_data[] = [
             'alt' => '',
             'pid' => 1,
             'src' => $src,
         ];
-        $photos = [
+        $photos       = [
             'title' => '图片信息',
-            'id' => 1,
+            'id'    => 1,
             'start' => 0,
-            'data' =>$photo_data
+            'data'  => $photo_data,
         ];
 
-        return view('admin.content.buy_house_image',['src'=>$src,'photos'=>$photos]);
+        return view('admin.content.buy_house_image', ['src' => $src, 'photos' => $photos]);
     }
 }

+ 89 - 0
app/Admin/Exports/Content/HouseBlacklistExport.php

@@ -0,0 +1,89 @@
+<?php
+
+namespace App\Admin\Exports\Content;
+
+use App\Admin\Exports\ViewExport;
+use App\Models\TalentHouse;
+use App\Models\TalentHouseApply;
+use Illuminate\Contracts\View\View;
+use Illuminate\Support\Collection;
+
+class HouseBlacklistExport extends ViewExport
+{
+    /**
+     * 设置文件名
+     * @return string
+     */
+    public function getFilename(): string
+    {
+        return "house_black_list.xlsx";
+    }
+
+    /**
+     * 渲染对应的视图
+     * @param Collection $data 导出的数据
+     * @return View
+     */
+    public function getView(Collection $data): View
+    {
+        //获取用户id
+        $user_ids = [];
+        foreach ($data as $v) {
+            $user_ids[] = $v['user_id'];
+        }
+
+        //获取用户信息
+        $apply      = TalentHouseApply::whereIn('user_id', $user_ids)->where('status', 2)->get()->toArray();
+        $apply_list = [];
+        $house_ids  = [];
+        foreach ($apply as $v) {
+            $house_ids[]                 = $v['house_id'];
+            $apply_list[$v['user_id']][] = $v;
+        }
+        //获取项目信息
+        $house      = TalentHouse::whereIn('id', array_unique($house_ids))->get()->toArray();
+        $house_list = [];
+        foreach ($house as $v) {
+            $house_list[$v['id']] = $v['name'];
+        }
+
+        //处理数据
+        $no  = 1;
+        $res = [];
+        foreach ($data as $v) {
+            if (empty($apply_list[$v['user_id']])) {
+                //用户未报名
+                $res[] = [
+                    'no'                   => $no,
+                    'name'                 => $v['realname'],
+                    'id_card'              => $v['id_card'],
+                    'talent_level'         => '',
+                    'comment'              => $v['comment'],
+                    'house_name'           => '',
+                    'end_time'             => $v['end_time'],
+                    'company'              => '',
+                    'talent_card_validity' => '',
+                ];
+                $no++;
+            } else {
+                //用户已报名
+                foreach ($apply_list[$v['user_id']] as $item) {
+                    $res[] = [
+                        'no'                   => $no,
+                        'name'                 => $v['realname'],
+                        'id_card'              => $v['id_card'],
+                        'talent_level'         => $item['talent_level'],
+                        'comment'              => $v['comment'],
+                        'house_name'           => $house_list[$item['house_id']],
+                        'end_time'             => $v['end_time'],
+                        'company'              => $item['company'],
+                        'talent_card_validity' => $item['talent_card_validity'],
+                    ];
+                    $no++;
+                }
+            }
+        }
+
+        return view('admin.content.export_house_blacklist', ['data' => $res]);
+    }
+}

+ 1 - 0
app/Admin/routes.php

@@ -344,6 +344,7 @@ Route::group([
         $router->resource('buy_house_news', BuyHouseNewsController::class)->names('content.buy_house_news');
         $router->any('buy_house_blacklist', 'BuyHouseBlacklistController@index')->name('content.buy_house_blacklist');
         $router->any('buy_house_blacklist/status', 'BuyHouseBlacklistController@status')->name('content.buy_house_blacklist.status');
+        $router->any('buy_house_blacklist/comment', 'BuyHouseBlacklistController@comment')->name('content.buy_house_blacklist.comment');
         $router->get('buy_house_log', 'BuyHouseLogController@index')->name('content.buy_house_log');
         $router->get('buy_house_log/detail', 'BuyHouseLogController@detail')->name('content.buy_house_log.detail');
         $router->get('buy_house_check_log', 'BuyHouseCheckLogController@index')->name('content.buy_house_log');

+ 1 - 3
app/Http/Controllers/Api/Wechat/TestController.php

@@ -136,9 +136,7 @@ class TestController extends ApiBaseController
 
     public function smsTest(SmsService $smsService)
     {
-//        $res = SmsTemplate::buyHouseCheck('rs');
-        $smsService->sendSms('13313826760', 'sms_buyhouse_check', []);
-//        dd($res);
+        SmsTemplate::buyHouseCheck('rs');
 //        $smsService->sendSms('13313826760', Smser::TEMPLATE_JOBFAIR_APPLY_ERROR, ['jobfair_name'=>'职业名称']);
 //        $smsService->sendSms('13313826760', 'sms_buyhouse_supply', ['name' => '林武', 'month' => 7, 'day' => 23]);
     }

+ 4 - 1
app/Http/Controllers/Web/Content/BuyhouseController.php

@@ -467,9 +467,12 @@ class BuyhouseController extends WebBaseController
         $info->status             = 1;
 
         //审核状态
+        if ($info->rs_check_status == 1 && $info->type == 1) {
+            SmsTemplate::buyHouseCheck('rs');
+        }
         if ($info->rs_check_status == 3) {
             $info->rs_check_status = 1;
-            if ($info->type == 2) {
+            if ($info->type == 1) {
                 SmsTemplate::buyHouseCheck('rs');
             }
         }

+ 2 - 3
app/Models/SmsTemplate.php

@@ -56,14 +56,13 @@ class SmsTemplate extends Model
 
     public static function buyHouseCheck($key)
     {
-        $arr = ['rs' => '13313826760', 'zj' => '15377968035', 'zr' => '18850292263'];
+        $arr = ['rs' => '15280619456', 'zj' => '15959855789', 'zr' => '13600796567'];
         if (empty($arr[$key])) {
             return false;
         }
 
         $smsService = new SmsService();
-        $smsService->sendSms('13313826760', 'sms_buyhouse_check', []);
-//        dd($res);
+        $smsService->sendSms($arr[$key], 'sms_buyhouse_check', ['var' => '您好']);
 
         return true;
     }

+ 37 - 0
resources/views/admin/content/buy_house_blacklist.blade.php

@@ -40,6 +40,35 @@
         </div>
     </div>
 </div>
+<div class="modal fade" id="comment" tabindex="-1" role="dialog" aria-labelledby="ModalLabel">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
+                </button>
+                <h4 class="modal-title" id="myModalLabel12">修改备注</h4>
+            </div>
+            <div class="modal-body">
+                <div class="modal-body">
+                    <form method="get" action="{{admin_base_path('content/buy_house_blacklist/comment')}}" id="commentForm" class="form-horizontal" accept-charset="UTF-8" pjax-container="1" id="dialog-form-5cc19c85d0a5f">
+                        <div class="box-body fields-group">
+                            <div class="form-group  ">
+                                <label for="reason" class="col-sm-2  control-label">备注</label>
+                                <div class="col-sm-8">
+                                    <textarea name="comment" class="form-control" rows="5" placeholder="输入备注"></textarea>
+                                </div>
+                            </div>
+                        </div>
+                        <input type="hidden" name="id" id="comment_id" value="" />
+                    </form>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" id="dialog-submit-5cc19c85d0a5f" class="btn btn-primary" data-loading-text="提交中..."><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>确认</button>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
 <script>
     this.vtip = function() {
         this.xOffset = -10; // x distance from mouse
@@ -108,4 +137,12 @@
     $(document).off("click","#audit .btn-primary").on('click',"#audit .btn-primary",function () {
         $('#auditForm').submit();
     });
+    function set_comment(id) {
+        $('#comment_id').val(id);
+        $('#comment').addClass('in');
+        $('#comment').css('display', 'block');
+    }
+    $(document).off("click","#comment .btn-primary").on('click',"#comment .btn-primary",function () {
+        $('#commentForm').submit();
+    });
 </script>

+ 55 - 0
resources/views/admin/content/export_house_blacklist.blade.php

@@ -0,0 +1,55 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+      xmlns:x="urn:schemas-microsoft-com:office:excel"
+      xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+    <meta http-equiv=Content-Type content="text/html; charset=utf-8">
+    <meta name=ProgId content=Excel.Sheet>
+    <meta name=Generator content="Microsoft Excel 15">
+    <style>
+        table {
+            mso-displayed-decimal-separator: "\.";
+            mso-displayed-thousand-separator: "\,";
+        }
+        th {
+            color:red;
+        }
+        td {
+            text-align: center;
+            vnd.ms-excel.numberformat:@;
+        }
+    </style>
+</head>
+
+<body>
+
+<div align=center x:publishsource="Excel">
+    <table border=1 cellpadding=0 cellspacing=0 style='border-collapse:collapse;table-layout:fixed;'>
+        <tr>
+            <th>序号</th>
+            <th>姓名</th>
+            <th>身份证</th>
+            <th>人才层次</th>
+            <th>备注</th>
+            <th>项目名称</th>
+            <th>拉黑截止时间</th>
+            <th>工作单位</th>
+            <th>人才证有效期</th>
+        </tr>
+        @foreach($data as $v)
+            <tr>
+                <td>{{$v['no']}}</td>
+                <td>{{$v['name']}}</td>
+                <td>{{$v['id_card']}}</td>
+                <td>{{$v['talent_level']}}</td>
+                <td>{{$v['comment']}}</td>
+                <td>{{$v['house_name']}}</td>
+                <td>{{$v['end_time']}}</td>
+                <td>{{$v['company']}}</td>
+                <td>{{$v['talent_card_validity']}}</td>
+            </tr>
+        @endforeach
+    </table>
+</div>
+</body>
+</html>