Quellcode durchsuchen

wesmiler 更新第5期更新代码合并

wesmiler vor 4 Jahren
Ursprung
Commit
8768114d9a

+ 4 - 0
app/api/controller/MemberController.php

@@ -1897,6 +1897,10 @@ class MemberController extends BaseController
         // 注销信息
         Member::where(['id' => $this->userId, 'user_type' => 2])
             ->update(['user_status' => -1, 'vip_auth' => 0, 'is_heart' => 0,'catch_time'=> date('Y-m-d H:i:s'), 'vip_expire' => 0, 'is_reg_profile' => 2, 'is_tuijian' => 0]);
+
+        // 进入资源库
+        PoolModel::distribute(0, $this->userId, 6);
+
         $cacheKey = "weixin:auth:" . session('openid');
         PRedis::del($cacheKey);
         session('userInfo', null);

+ 16 - 2
app/api/controller/TaskController.php

@@ -376,13 +376,15 @@ class TaskController extends Controller
         $result = PoolModel::alias('p')
 //            ->where('p.expire_at', '<', date('Y-m-d H:i:s'))
             ->where(['p.type' => 0, 'p.status' => 1])
-            ->field('id,sale_uid,user_id,followup_num,expire_at')
+            ->field('id,sale_uid,user_id,followup_num,follow_time,expire_at')
             ->limit(100)
             ->order('p.expire_at asc,p.id asc')
             ->select()
             ->each(function ($item, $k) use ($count, $datas) {
                 $userId = isset($item['user_id']) ? $item['user_id'] : 0;
                 $expireAt = isset($item['expire_at']) ? $item['expire_at'] : '';
+                $followTime = isset($item['follow_time']) ? $item['follow_time'] : '';
+                $followTime = $followTime && $followTime != '0000-00-00 00:00:00'? $followTime : '';
                 $updateData = ['updated_at' => date('Y-m-d H:i:s')];
 
                 // 到期数据处理
@@ -407,7 +409,7 @@ class TaskController extends Controller
 
                     // 到期未跟进
                     $updateData['stop_time'] = date('Y-m-d H:i:s');
-                    if($item['followup_num'] <= 0){
+                    if($item['followup_num'] <= 0 || ($followTime && $followTime <date('Y-m-d H:i:s'))){
                         $updateData['agency'] = 3;
                     }
                     $count++;
@@ -415,6 +417,18 @@ class TaskController extends Controller
                     // 今日坠海
                     $time = strtotime($expireAt);
                     $dayTime = strtotime(date('Y-m-d'));
+                    //
+                    if($followTime < date('Y-m-d',  $dayTime+ 86400) && $followTime >= date('Y-m-d')){
+                        $updateData['agency'] = 1;
+                        $item['expire_text'] = '今日需跟进';
+                    }else if($followTime < date('Y-m-d',  $dayTime+ 2*86400) && $followTime >= date('Y-m-d', $dayTime + 86400)){
+                        $updateData['agency'] = 2;
+                        $item['expire_text'] = '明日需跟进';
+                    }else if($followTime < date('Y-m-d')){
+                        $updateData['agency'] = 3;
+                        $item['expire_text'] = '到期未跟进';
+                    }
+
                     if($time >= time() && $time < $dayTime + 86400){
                         $item['expire_text'] = '今天坠海';
                         $updateData['agency'] = 4;

+ 1 - 0
data/lang/admin_menu.php

@@ -70,6 +70,7 @@ return array (
   'ADMIN_POOLS_CUSTOMIZED' => '已定制服务资源',
   'ADMIN_POOLS_DEFAULT' => '销售管理',
   'ADMIN_POOLS_INDEX' => '资源库',
+  'ADMIN_POOLS_LOGOUT' => '已注销资源',
   'ADMIN_POOLS_PHONE' => '电话注册资源',
   'ADMIN_POOLS_PRESALE' => '售前公海',
   'ADMIN_POOLS_RESERVE' => '储备资源',

+ 291 - 0
public/themes/admin_simpleboot3/admin/pools/logout.html

@@ -0,0 +1,291 @@
+<include file="public@header"/>
+</head>
+<style>
+    .form-inline .form-control {
+        margin: 10px 0;
+        vertical-align: middle;
+    }
+
+    .form-inline span {
+        margin-left: 5px;
+        vertical-align: middle;
+    }
+    .margin-left-10 {
+        margin-left: 10px;
+    }
+
+    .profile em {
+        font-style: normal;
+        color: #0b6cbc;
+    }
+
+    .profile em.red {
+        color: red;
+    }
+
+    span.sort {
+        color: red;
+        display: inline-block;
+        margin-left: 2px;
+        vertical-align: middle;
+    }
+    td img.avatar, td img.sex {
+        width: 24px;
+        height: 24px;
+        vertical-align: middle;
+        border-radius: 100%;
+    }
+    .form .form-control {
+        margin-bottom: 20px;
+    }
+    .form .control-label {
+        text-align: center;
+    }
+    .table-actions span {
+        margin-right: 10px;
+        font-weight: bold;
+    }
+    .table-actions span em {
+        font-style: normal;
+        color: red;
+    }
+    .layui-layer-page .layui-layer-content {
+        overflow: hidden !important;
+    }
+</style>
+<body>
+<div class="wrap js-check-wrap">
+    <ul class="nav nav-tabs">
+        <li class="active"><a>注销用户列表</a>
+        </li>
+    </ul>
+    <form id="search" class="well form-inline margin-top-20" method="post" action="{:url('admin/pools/logout')}">
+        <span>会员ID:</span>
+        <input class="form-control" type="text" name="uid" style="width: 150px;" value="{:input('request.uid')}"
+               placeholder="会员ID">
+        <span>用户昵称:</span>
+        <input class="form-control" type="text" name="user_nickname" style="width: 200px;"
+               value="{:input('request.user_nickname')}" placeholder="用户昵称"><br>
+        <span>用户姓名:</span>
+        <input class="form-control" type="text" name="real_name" style="width: 200px;"
+               value="{:input('request.real_name')}" placeholder="用户姓名">
+        <span>手机号:</span>
+        <input class="form-control" type="text" name="mobile" style="width: 200px;" value="{:input('request.mobile')}"
+               placeholder="手机号">
+
+        <input id="sort" type="hidden" name="sort" value="{$params.sort?$params.sort: 1}">
+        <input id="sortType" type="hidden" name="sort_type" value="{$params.sort_type?$params.sort_type: 'desc'}">
+        <input type="submit" class="btn btn-primary margin-left-10 " value="搜索"/>
+
+        <a class="btn btn-default margin-left-10" href="{:url('admin/pools/logout')}">清空</a>
+        <if condition="$is_admin eq 1">
+            <a class="btn btn-warning margin-left-10" href="{:url('admin/pools/export',['type'=>6])}">导出</a>
+        </if>
+    </form>
+    <form class="form-horizontal js-ajax-form margin-top-20" role="form">
+        <div class="table-actions">
+            <span>共计<em>{$total}</em>个资源</span>
+            <a class="btn btn-primary btn-sm" onclick="doDistribute()">分配用户</a>
+            <a class="btn btn-danger btn-sm" onclick="doDelete()">批量移除</a>
+        </div>
+        <table class="table table-hover table-bordered">
+            <thead>
+            <tr>
+                <th width="60"><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">全选</th>
+                <th>ID</th>
+                <th width="120">用户名</th>
+                <th>基本资料</th>
+                <th>姓名</th>
+                <th>手机号</th>
+                <th width="100">VIP会员</th>
+                <th width="100">充值过</th>
+                <th width="100">消费过</th>
+                <th width="180">注册时间 <span class="row sort join-time" data-status="{$params.sort == 1? $params.sort_type : 'desc'}" onclick="sort(this,1)"><if condition="$params.sort eq 1 && $params.sort_type eq 'asc'">&#8595;<else>&#8593;</if></span></th>
+                <th width="150">最后登录<span class="row sort last-time" data-status="{$params.sort == 2? $params.sort_type : 'desc'}" onclick="sort(this,2)"><if condition="$params.sort eq 2 && $params.sort_type eq 'asc'">&#8595;<else>&#8593;</if></span></th>
+            </tr>
+            </thead>
+            <tbody>
+            <foreach name="list" item="vo">
+                <tr>
+                    <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
+                               value="{$vo.id}" data-id="{$vo.user_id}" title="ID:{$vo.id}"></td>
+                    <td>{$vo.user_id}</td>
+                    <td>
+                        <img class="avatar" src="{$vo.avatar}"> <if condition="$vo['sex'] eq 1"><img class="sex" src="/static/images/male.png" alt=""><else><img class="sex" src="/static/images/fmale.png" alt=""></if> <span>{$vo['user_nickname']}</span>
+                    </td>
+                    <td>
+                        <p class="profile">{$vo.profile_text}</p>
+                    </td>
+                    <td>{$vo['real_name']}</td>
+                    <td>{$vo['mobile']? $vo['mobile']:'无'}</td>
+                    <td>
+                        <if condition="$vo['is_vip'] eq 1">
+                                <span style="color: green;">是</span>
+                            <else>
+                                <span style="color: red;">否</span>
+                        </if>
+                    </td>
+                    <td>
+                        <if condition="$vo['is_recharge'] eq 1">
+                            <span style="color: green;">是</span>
+                            <else>
+                                <span style="color: red;">否</span>
+                        </if>
+                    </td>
+                    <td>
+                        <if condition="$vo['is_cost'] eq 1">
+                            <span style="color: green;">是</span>
+                            <else>
+                                <span style="color: red;">否</span>
+                        </if>
+                    </td>
+                    <td>{$vo['create_time']}</td>
+                    <td>{$vo['last_login_time']}</td>
+            </foreach>
+            </tbody>
+        </table>
+        <div class="pagination">{$page}</div>
+
+        <div id="distribute" style="display: none; margin-top: 20px;">
+            <div class="form">
+                <form method="post" class="form-horizontal js-ajax-form margin-top-20" >
+                    <div class="form-group">
+                        <label class="col-sm-3 control-label"><span class="form-required">*</span>分配给销售</label>
+                        <div class="col-sm-6">
+                            <select class="form-control" id="sale" onchange="selectSale(this)">
+                                <option value="0">请选择</option>
+                                <foreach name="sales" item="vo">
+                                    <option value="{$vo.id}">{$vo.user_login}<if condition="$vo.real_name">[{$vo.real_name}]</if></option>
+                                </foreach>
+                            </select>
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <label class="col-sm-3 control-label"><span class="form-required"></span>到期时间(天)</label>
+                        <div class="col-sm-8">
+                            <input type="text" class="form-control" id="expire_at" name="expire_at" placeholder="默认取平台设置">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </form>
+</div>
+<script src="__STATIC__/js/admin.js"></script>
+<script src="__STATIC__/js/clipboard.min.js"></script>
+<script src="__STATIC__/js/layer/layer.js"></script>
+<script src="__STATIC__/js/position/position1.js" type="text/javascript"></script>
+<script src="__STATIC__/js/height/height.js" type="text/javascript"></script>
+<script>
+    var saleUid = 0;
+    /**
+     * 排序
+     * @param type
+     */
+    function sort(ele,type){
+        $("#sort").val(type);
+        var status = $(ele).attr('data-status');
+        $("#sortType").val(status=='desc'? 'asc': 'desc');
+        $(ele).html(status == 'desc'? '&#8595;' : '&#8593;');
+        $(ele).attr('data-status', status=='desc'? 'asc': 'desc');
+
+        $("#search").submit();
+
+    }
+
+    /**
+     * 选择销售用户
+     * @param ele
+     */
+    function selectSale(ele){
+        saleUid = $(ele).val();
+    }
+
+    /**
+     * 分配资源
+     * @returns {boolean}
+     */
+    function doDistribute(){
+        var ids = [];
+        $(".js-check:checked").each(function () {
+            var id = $(this).attr('data-id');
+            if (id > 0) {
+                ids.push(id);
+            }
+        });
+        if (ids.length <= 0) {
+            layer.msg('请先选择操作项');
+            return false;
+        }
+
+        layer.open({
+            type: 1, //1:页面层,2:iframe层,3:加载层,4:tips层。
+            title: '分配'+(ids.length)+'个资源给销售',
+            shadeClose: false, //不开启遮罩关闭,也就是说,点击弹出层其它地方不会关闭弹出框
+            shade: 0.8, //遮罩
+            offset: 'auto',
+            area: ['480px', '260px'],
+            content: $("#distribute"),
+            btn: ['确定分配','取消'],
+            btnAlign: 'c',
+            yes: function(){
+                if(saleUid<=0){
+                    layer.msg('请选择分配的销售用户')
+                    return false;
+                }
+                var expire_at = $("#expire_at").val();
+                if (confirm('确定批量分配选择项?不可恢复')) {
+                    $.post('/admin/pools/distribute', {ids: ids, sale_uid: saleUid, expire_at: expire_at, type: 4}, function (res) {
+                        if (res.code == 1) {
+                            layer.msg(res.msg)
+                            setTimeout(function () {
+                                location.reload();
+                            }, 2000)
+                        } else {
+                            layer.msg(res.msg);
+                        }
+                    }, "json")
+                }
+            },
+            cancel: function(){
+
+            }
+        });
+
+        return false;
+    }
+
+    /**
+     * 清除
+     * @returns {boolean}
+     */
+    function doDelete() {
+        var ids = [];
+        $(".js-check:checked").each(function () {
+            var id = $(this).val();
+            if (id > 0) {
+                ids.push(id);
+            }
+        });
+        if (ids.length <= 0) {
+            layer.msg('请先选择操作项');
+            return false;
+        }
+        if (confirm('确定批量移除选择项到售前公海?不可恢复')) {
+            $.post('/admin/pools/clear', {ids: ids, type: 4}, function (res) {
+                if (res.code == 1) {
+                    layer.msg(res.msg)
+                    setTimeout(function () {
+                        location.reload();
+                    }, 1200)
+                } else {
+                    layer.msg(res.msg)
+                }
+            }, "json")
+        }
+
+    }
+</script>
+
+</body>
+</html>

+ 24 - 15
public/themes/admin_simpleboot3/admin/sales/agency.html

@@ -68,6 +68,9 @@
     span.expired {
         color: red;
     }
+    .js-bootstrap-date {
+        line-height: 22px !important;
+    }
 </style>
 <body>
 <div class="wrap js-check-wrap">
@@ -162,13 +165,13 @@
                     </td>
                     <td><span id="follow-num{$vo.pool_id}">{$vo['followup_num']}</span></td>
                     <td>
-                        <a onclick="setTag('{$vo.pool_id}','{$vo.real_name}','{$vo.intention}')" >{$vo.intention_text? $vo.intention_text: '设置'}</a>
+                        {$vo.intention_text? $vo.intention_text: '-'}
                     </td>
                     <td>{$vo['create_time']}</td>
                     <td><span <if condition="$vo.is_expired">class="expired"</if>>{$vo['expire_text']}</span></td>
                     <td><span id="follow-time{$vo.pool_id}">{$vo['last_follow_time']? $vo['last_follow_time'] : '-'}</span></td>
                     <td>
-                        <a onclick="setAgency('{$vo.pool_id}','{$vo.real_name}','{$vo.remark}','{$vo.agency}')" >跟进</a>
+                        <a onclick="setTag('{$vo.pool_id}','{$vo.real_name}','{$vo.remark}','{$vo.intention}','{$vo.follow_time}')" >跟进</a>
                     </td>
             </foreach>
             </tbody>
@@ -182,9 +185,9 @@
                         <label class="col-sm-3 control-label"><span class="form-required">*</span>选择标签</label>
                         <div class="col-sm-8">
                             <foreach name="tags" item="vo" key="k">
-                            <label for="input-tag{$k}" class="radio-inline">
+                            <!--<label for="input-tag{$k}" class="radio-inline">
                                 <input type="radio" id="input-tag{$k}" name="tag" onchange="selectTag(this)" value="{$k}" data-name="{$vo}">{$vo}
-                            </label>
+                            </label>-->
                             </foreach>
                         </div>
                     </div>
@@ -202,16 +205,22 @@
                         </div>
                     </div>
                     <div class="form-group">
-                        <label class="col-sm-3 control-label"><span class="form-required">*</span>跟进情况</label>
+                        <label class="col-sm-3 control-label"><span class="form-required">*</span>意向情况</label>
                         <div class="col-sm-8">
-                            <foreach name="agencys" item="vo" key="k">
-                                <label for="input-agency{$k}" class="radio-inline">
-                                    <input type="radio" id="input-agency{$k}" name="agency" onchange="selectAgency(this)" value="{$k}">{$vo}
+                            <foreach name="tags" item="vo" key="k">
+                                <label for="input-tag{$k}" class="radio-inline">
+                                    <input type="radio" id="input-tag{$k}" name="tag" onchange="selectTag(this)" value="{$k}">{$vo}
                                 </label>
                             </foreach>
                         </div>
                     </div>
                     <div class="form-group">
+                        <label class="col-sm-3 control-label"><span class="form-required">*</span>下次跟进时间</label>
+                        <div class="col-sm-8">
+                            <input class="form-control js-bootstrap-date" type="date" id="follow_time" name="follow_time">
+                        </div>
+                    </div>
+                    <div class="form-group">
                         <label class="col-sm-3 control-label"><span class="form-required"></span>备注</label>
                         <div class="col-sm-8">
                                 <textarea class="form-control" id="remark" name="content" maxlength="150" style="height: 80px;" placeholder="跟进备注"></textarea>
@@ -265,7 +274,7 @@
      * 设置标签
      * @returns {boolean}
      */
-    function setTag(pool_id,real_name,tagId){
+    function setTag1(pool_id,real_name,tagId){
         $("input[name=tag]").attr('checked', false);
         $("#input-tag"+tagId).attr('checked', "checked");
         layer.open({
@@ -310,13 +319,13 @@
      * 设置跟进情况
      * @returns {boolean}
      */
-    function setAgency(pool_id,real_name,remark,agencyId){
-        console.log(5346)
+    function setTag(pool_id,real_name,remark,tagId, follow_time){
         $("input[name=agency]").attr('checked', false);
-        $("#input-agency"+agencyId).prop('checked', "true");
+        $("#input-tag"+tagId).prop('checked', "true");
         console.log(agency)
         console.log($("#real_name"))
         $("#real_name").val(real_name);
+        $("#follow_time").val(follow_time? follow_time : '');
         $("#remark").text(remark);
 
         layer.open({
@@ -330,14 +339,14 @@
             btn: ['确定设置','取消'],
             btnAlign: 'c',
             yes: function(){
-                if(agencyId<=0){
+                if(tagId<=0){
                     layer.msg('请选择跟进情况')
                     return false;
                 }
                 remark = $("#remark").val();
-                console.log(remark)
+                follow_time = $("#follow_time").val();
                 if (confirm('确定设置跟进情况吗?请谨慎操作')) {
-                    $.post('/admin/sales/setAgency', {pool_id: pool_id, agencyId: agencyId, remark: remark}, function (res) {
+                    $.post('/admin/sales/setAgency', {pool_id: pool_id, tagId: tagId, follow_time: follow_time, remark: remark}, function (res) {
                         if (res.code == 1) {
                             layer.msg(res.msg)
                             $("#follow-num"+pool_id).text(res.data.num);

+ 2 - 2
public/themes/admin_simpleboot3/admin/sales/index.html

@@ -156,13 +156,13 @@
                     </td>
                     <td><span id="follow-num{$vo.pool_id}">{$vo['followup_num']}</span></td>
                     <td>
-                        <a onclick="setTag('{$vo.pool_id}','{$vo.real_name}','{$vo.intention}')" >{$vo.intention_text? $vo.intention_text: '设置'}</a>
+                        {$vo.intention_text? $vo.intention_text: '-'}
                     </td>
                     <td>{$vo['create_time']}</td>
                     <td><span <if condition="$vo.is_expired">class="expired"</if>>{$vo['expire_text']}</span></td>
                     <td><span id="follow-time{$vo.pool_id}">{$vo['last_follow_time']? $vo['last_follow_time'] : '-'}</span></td>
                     <td>
-                        <a onclick="setAgency('{$vo.pool_id}','{$vo.real_name}','{$vo.remark}','{$vo.agency}')" >跟进</a>
+                        <a onclick="setAgency('{$vo.pool_id}','{$vo.real_name}','{$vo.remark}','{$vo.intention}')" >跟进</a>
                     </td>
             </foreach>
             </tbody>

+ 2 - 2
public/themes/admin_simpleboot3/admin/sales/tips.html

@@ -162,13 +162,13 @@
                     </td>
                     <td><span id="follow-num{$vo.pool_id}">{$vo['followup_num']}</span></td>
                     <td>
-                        <a onclick="setTag('{$vo.pool_id}','{$vo.real_name}','{$vo.intention}')" >{$vo.intention_text? $vo.intention_text: '设置'}</a>
+                        {$vo.intention_text? $vo.intention_text: '-'}
                     </td>
                     <td>{$vo['create_time']}</td>
                     <td><span <if condition="$vo.is_expired">class="expired"</if>>{$vo['expire_text']}</span></td>
                     <td><span id="follow-time{$vo.pool_id}">{$vo['last_follow_time']? $vo['last_follow_time'] : '-'}</span></td>
                     <td>
-                        <a onclick="setAgency('{$vo.pool_id}','{$vo.real_name}','{$vo.remark}','{$vo.agency}')" >跟进</a>
+                        <a onclick="setAgency('{$vo.pool_id}','{$vo.real_name}','{$vo.remark}','{$vo.intention}')" >跟进</a>
                     </td>
             </foreach>
             </tbody>

+ 124 - 2
vendor/thinkcmf/cmf-app/src/admin/controller/PoolsController.php

@@ -370,6 +370,123 @@ class PoolsController extends AdminBaseController
     }
 
     /**
+     * 注销用户资源
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function logout(){
+        $content = hook_one('admin_pools_logout_view');
+
+        if (!empty($content)) {
+            return $content;
+        }
+
+        $params = input();
+        $params['pageSize'] = 30;
+        $params['sort'] = isset($params['sort'])? $params['sort'] : 0;
+        $params['sort_type'] = isset($params['sort_type'])? $params['sort_type'] : 'desc';
+        $sort = $params['sort']==1? "u.create_time {$params['sort_type']}" : "u.last_login_time {$params['sort_type']}";
+        $list  = PoolModel::alias('p')
+            ->leftJoin('user u','p.user_id=u.id')
+            ->leftJoin('user s','s.id=p.sale_uid')
+            ->leftJoin('user_profile up','up.userid=u.id')
+//            ->where('u.user_status','=', -1)
+            ->where(['u.user_type'=> 2,'p.sale_uid'=> 0,'p.type'=>6,'p.status'=>1])
+            ->where(function($query) use($params){
+                $uid = isset($params['uid'])? $params['uid'] : 0;
+                if($uid){
+                    $query->where(['u.id'=> $uid]);
+                }
+
+                $nickname = isset($params['user_nickname'])? trim($params['user_nickname']) : '';
+                if($nickname){
+                    $query->where('u.user_nickname','like',"{$nickname}%");
+                }
+
+                $realname = isset($params['real_name'])? trim($params['real_name']) : '';
+                if($realname){
+                    $query->where('u.real_name','like',"{$realname}%");
+                }
+
+                $mobile = isset($params['mobile'])? trim($params['mobile']) : '';
+                if($mobile){
+                    $query->where('u.mobile','like',"{$mobile}%");
+                }
+            })
+            ->field('p.id,p.user_id,u.openid,u.user_nickname,u.real_name,u.avatar,u.create_time,u.last_login_time,u.vip_auth,u.vip_expire,u.user_status,u.mobile,up.graduate,up.age,u.birthday,u.sex,up.married,up.education,up.city')
+            ->order($sort);
+
+        $total = $list->count('p.id');
+        $list =  $list->paginate(  $params['pageSize'], false, ['query' => request()->param()]);
+
+        // 获取分页显示
+        $page = $list->render();
+        $datas = $list ? $list->toArray() : [];
+        if ($datas) {
+            $educations = config('weixin.educations');
+            $marrieds = config('weixin.marrieds');
+            foreach ($datas['data'] as $k => &$item) {
+                $item['avatar'] = $item['avatar']? getPrevierUrl($item['avatar']):'';
+
+                $isVip = isset($item['vip_auth'])? $item['vip_auth'] : 0;
+                $vipExpire = isset($item['vip_expire'])? $item['vip_expire'] : 0;
+                $item['is_vip'] = $isVip && time() < $vipExpire? 1 : 0;
+
+                // 是否充值和消费过
+                $item['is_recharge'] = UserRechargeLog::check($item['id'], 2);
+                $item['is_cost'] = AccountLog::check($item['id']);
+
+                $profile = [];
+                $birthday = isset($item['birthday'])? $item['birthday'] : 0;
+                $year = $birthday? date('Y', $birthday) : '';
+                if($year){
+                    $profile[] =  '<em class="red">'.(date('Y') - $year).'</em>岁(<em class="primary">'.$year.'</em>)';
+                }
+
+                $married = isset($item['married'])? $item['married'] : 0;
+                $marriedText = isset($marrieds[$married])? $marrieds[$married] : '';
+                if($marriedText){
+                    $profile[] = $marriedText;
+                }
+
+                $education = isset($item['education'])? $item['education'] : 0;
+                $educationText = $education && isset($educations[$education])? $educations[$education] : '';
+                if($educationText){
+                    $profile[] = $educationText;
+                }
+
+                if(isset($item['graduate']) && $item['graduate']){
+                    $profile[] = $item['graduate'];
+                }
+
+                $city = isset($item['city'])? $item['city'] : '';
+                if($city){
+                    $profile[] = $city;
+                }
+
+                $item['profile_text'] = $profile? join(' ', $profile) : '';
+
+
+                $item['create_time'] = $item['create_time']? date('Y-m-d H:i:s', $item['create_time']) : '';
+                $item['last_login_time'] = $item['last_login_time']? date('Y-m-d H:i:s', $item['last_login_time']) : '';
+
+            }
+            unset($item);
+        }
+
+        PRedis::set("caches:export:pools", $params, 86400);
+        $this->assign('params', $params);
+        $this->assign('total', $total);
+        $this->assign('list', $datas['data']);
+        $this->assign('is_admin', cmf_get_current_admin_id());
+        $this->assign('sales', UserModel::getSales());
+        $this->assign('page', $page);
+        return $this->fetch();
+    }
+
+    /**
      * 电话注册资源
      * @return mixed
      * @throws \think\db\exception\DataNotFoundException
@@ -776,8 +893,13 @@ class PoolsController extends AdminBaseController
             ->leftJoin('user s','s.id=p.sale_uid')
             ->leftJoin('user_profile up','up.userid=u.id')
             ->where(function($query) use ($type){
-                $query->where('u.user_status','>=', 0)
-                    ->where(['u.user_type'=> 2,'p.sale_uid'=> 0,'p.type'=> $type,'p.status'=>1]);
+                if($type == 6){
+                    $query->where(['u.user_type'=> 2,'p.sale_uid'=> 0,'p.type'=> $type,'p.status'=>1]);
+                }else{
+                    $query->where('u.user_status','>=', 0)
+                        ->where(['u.user_type'=> 2,'p.sale_uid'=> 0,'p.type'=> $type,'p.status'=>1]);
+                }
+
 
                 if($type == 3){
                     $query->where(['up.idcard_check'=>2]);

+ 15 - 5
vendor/thinkcmf/cmf-app/src/admin/controller/SalesController.php

@@ -370,7 +370,7 @@ class SalesController extends AdminBaseController
                     $query->where('u.mobile','like',"{$mobile}%");
                 }
             })
-            ->field('p.id,p.user_id,u.openid,u.user_nickname,u.real_name,u.avatar,u.vip_auth,u.vip_expire,u.user_status,u.mobile,up.graduate,up.age,u.birthday,u.sex,up.married,up.education,up.city,p.id as pool_id,p.intention,p.followup_num,p.agency,p.remark,p.create_time,p.last_follow_time,p.expire_at')
+            ->field('p.id,p.user_id,u.openid,u.user_nickname,u.real_name,u.avatar,u.vip_auth,u.vip_expire,u.user_status,u.mobile,up.graduate,up.age,u.birthday,u.sex,up.married,up.education,up.city,p.id as pool_id,p.intention,p.followup_num,p.agency,p.remark,p.create_time,p.follow_time,p.last_follow_time,p.expire_at')
             ->order($sort)
             ->paginate(30, false, ['query' => request()->param()]);
         
@@ -447,6 +447,7 @@ class SalesController extends AdminBaseController
 
                 $intention = isset($item['intention'])? $item['intention'] : 0;
                 $item['intention_text'] = $intention && isset($tags[$intention])? $tags[$intention] : '';
+                $item['follow_time'] = $item['follow_time'] && $item['follow_time'] != '0000-00-00 00:00:00'? date('Y/m/d', strtotime($item['follow_time'])) : date('Y/m/d');
 
             }
             unset($item);
@@ -523,18 +524,27 @@ class SalesController extends AdminBaseController
             $this->error("非法操作!", '');
         }
 
-        $agencyId = input('agencyId', 0);
+        $tagId = input('tagId', 0);
         $remark = input('remark','');
-        if($agencyId <= 0){
-            $this->error("请设置跟进情况!", '');
+        $followTime = input('follow_time','');
+        $followTime = $followTime? str_replace('/','-', $followTime) : 0;
+        if($tagId <= 0){
+            $this->error("请设置意向标签!", '');
         }
 
         $time = date('Y-m-d H:i:s');
+        $dateTime = strtotime(date('Y-m-d'));
         $where = ['sale_uid'=> session('ADMIN_ID'),'id'=> $poolId,'type'=>0];
         $info = PoolModel::where($where)->find();
         $expireAt = isset($info['expired_at'])? $info['expired_at'] : '';
         $followNum = isset($info['followup_num'])? $info['followup_num'] : 0;
-        if(PoolModel::where($where)->update(['agency'=> $agencyId,'remark'=> $remark,'last_follow_time'=> $time])){
+        $data = ['intention'=> $tagId,'remark'=> $remark,'follow_time'=> $followTime,'last_follow_time'=> $time];
+        if($followTime < date('Y-m-d', $dateTime + 86400)){
+            $data['agency'] = 1;
+        }else if($followTime < date('Y-m-d', $dateTime + 2*86400) && $followTime >= date('Y-m-d', $dateTime + 86400)){
+            $data['agency'] = 2;
+        }
+        if(PoolModel::where($where)->update($data)){
             PoolModel::where($where)->setInc('followup_num', 1);
             $this->success('设置跟进情况成功!', '',['num'=> $followNum+1, 'time'=> $time]);
         }else{

+ 2 - 1
vendor/thinkcmf/cmf-app/src/user/controller/AdminIndexController.php

@@ -1383,7 +1383,8 @@ class AdminIndexController extends AdminBaseController
             $ids = $this->request->param('ids/a');
 
             Db::name('user')->where('id', 'in', $ids)->update(['user_status' => -1, 'catch_time' => date('Y-m-d H:i:s')]);
-
+            // 资源库
+            PoolModel::distributeMore(0, $ids, 6);
             $this->success("注销成功!");
 
         }