diff --git a/Server/application/cunkebao/controller/plan/PlanSceneV1Controller.php b/Server/application/cunkebao/controller/plan/PlanSceneV1Controller.php index d9bc41c32..dca653500 100644 --- a/Server/application/cunkebao/controller/plan/PlanSceneV1Controller.php +++ b/Server/application/cunkebao/controller/plan/PlanSceneV1Controller.php @@ -23,6 +23,7 @@ class PlanSceneV1Controller extends BaseController $params = $this->request->param(); $page = isset($params['page']) ? intval($params['page']) : 1; $limit = isset($params['limit']) ? intval($params['limit']) : 10; + $keyword = isset($params['keyword']) ? trim($params['keyword']) : ''; $sceneId = $this->request->param('sceneId',''); $where = [ 'deleteTime' => 0, @@ -37,6 +38,10 @@ class PlanSceneV1Controller extends BaseController $where['sceneId'] = $sceneId; } + if(!empty($keyword)){ + $where[] = ['name', 'like', '%' . $keyword . '%']; + } + $total = Db::name('customer_acquisition_task')->where($where)->count(); $list = Db::name('customer_acquisition_task') @@ -62,7 +67,7 @@ class PlanSceneV1Controller extends BaseController $val['passRate'] = number_format($passRate,2); } - $lastTime = Db::name('task_customer')->where(['task_id'=>$val['id']])->max('updated_at'); + $lastTime = Db::name('task_customer')->where(['task_id'=>$val['id']])->max('updateTime'); $val['lastUpdated'] = !empty($lastTime) ? date('Y-m-d H:i', $lastTime) : '--'; @@ -379,7 +384,13 @@ class PlanSceneV1Controller extends BaseController } - + /** + * 获取微信小程序码 + * @return \think\response\Json + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ public function getWxMinAppCode() { $params = $this->request->param(); @@ -399,4 +410,62 @@ class PlanSceneV1Controller extends BaseController return ResponseHelper::success($result, '获取小程序码成功'); } + + /** + * 获取已获客/已添加用户 + * @return \think\response\Json + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\exception\DbException + */ + public function getUserList(){ + $type = $this->request->param('type',1); + $planId = $this->request->param('planId',''); + $page = $this->request->param('page',1); + $pageSize = $this->request->param('pageSize',10); + $keyword = $this->request->param('keyword',''); + + if (!in_array($type, [1, 2])) { + return ResponseHelper::error('类型错误'); + } + + if (empty($planId)){ + return ResponseHelper::error('获客场景id不能为空'); + } + + $task = Db::name('customer_acquisition_task')->where(['id' => $planId, 'deleteTime' => 0])->find(); + if(empty($task)) { + return ResponseHelper::error('活动不存在'); + } + $query = Db::name('task_customer')->where(['task_id' => $task['id']]); + + if ($type == 2){ + $query = $query->where('status',4); + } + + if (!empty($keyword)) { + $query = $query->where('name|phone|tags|siteTags', 'like', '%' . $keyword . '%'); + } + + $total = $query->count(); + $list = $query->page($page, $pageSize)->order('id', 'desc')->select(); + + foreach ($list as &$item) { + $item['tags'] = json_decode($item['tags'], true); + $item['siteTags'] = json_decode($item['siteTags'], true); + $item['createTime'] = date('Y-m-d H:i:s', $item['createTime']); + $item['updateTime'] = date('Y-m-d H:i:s', $item['updateTime']); + } + + + + $data = [ + 'total' => $total, + 'list' => $list, + ]; + return ResponseHelper::success($data,'获取成功'); + } + + + } \ No newline at end of file diff --git a/Server/application/cunkebao/controller/plan/PostCreateAddFriendPlanV1Controller.php b/Server/application/cunkebao/controller/plan/PostCreateAddFriendPlanV1Controller.php index 011d3fae5..a2f9d3dbe 100644 --- a/Server/application/cunkebao/controller/plan/PostCreateAddFriendPlanV1Controller.php +++ b/Server/application/cunkebao/controller/plan/PostCreateAddFriendPlanV1Controller.php @@ -249,7 +249,7 @@ class PostCreateAddFriendPlanV1Controller extends Controller 'phone' => $phone, 'tags' => json_encode([], JSON_UNESCAPED_UNICODE), 'siteTags' => json_encode([], JSON_UNESCAPED_UNICODE), - 'created_at' => time(), + 'createTime' => time(), ]; } } diff --git a/Server/application/cunkebao/controller/plan/PostExternalApiV1Controller.php b/Server/application/cunkebao/controller/plan/PostExternalApiV1Controller.php index 44e7a337d..1d4c6a5a9 100644 --- a/Server/application/cunkebao/controller/plan/PostExternalApiV1Controller.php +++ b/Server/application/cunkebao/controller/plan/PostExternalApiV1Controller.php @@ -231,7 +231,7 @@ class PostExternalApiV1Controller extends Controller // 更新数据库中的站点标签 Db::name('task_customer')->where('id', $taskCustomerId)->update([ 'siteTags' => json_encode($uniqueSiteTags, JSON_UNESCAPED_UNICODE), - 'updated_at' => time() + 'updateTime' => time() ]); } catch (\Exception $e) { diff --git a/Server/application/cunkebao/controller/plan/PostUpdateAddFriendPlanV1Controller.php b/Server/application/cunkebao/controller/plan/PostUpdateAddFriendPlanV1Controller.php index b47c4faa2..9d5e3b62d 100644 --- a/Server/application/cunkebao/controller/plan/PostUpdateAddFriendPlanV1Controller.php +++ b/Server/application/cunkebao/controller/plan/PostUpdateAddFriendPlanV1Controller.php @@ -220,7 +220,7 @@ class PostUpdateAddFriendPlanV1Controller extends Controller 'phone' => $phone, 'tags' => json_encode([], JSON_UNESCAPED_UNICODE), 'siteTags' => json_encode([], JSON_UNESCAPED_UNICODE), - 'created_at' => time(), + 'createTime' => time(), ]; } } diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index 075a52174..4ce512f7f 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -35,7 +35,7 @@ class PosterWeChatMiniProgram extends Controller // 调用接口生成小程序码 $response = $app->app_code->getUnlimit($scene, [ - 'page' => 'pages/poster/index', // 必须是已经发布的小程序页面 + 'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面 'width' => 430, // 二维码的宽度,默认430 // 'auto_color' => false, // 自动配置线条颜色 // 'line_color' => ['r' => 0, 'g' => 0, 'b' => 0], // 颜色设置