dataLists(new CustomerLists()); } /** * @notes 同步企业微信客户 */ public function sync() { $result = CustomerLogic::triggerBackgroundSync(); if ($result === false) { return $this->fail(CustomerLogic::getError()); } $msg = is_array($result) && isset($result['message']) ? (string) $result['message'] : '已提交同步'; return $this->success($msg, $result); } /** * @notes 获取统计信息 */ public function stats() { $stats = CustomerLogic::getStats(); return $this->data($stats); } /** * @notes 获取标签维度统计(按 group 分组、按客户数倒序,供前端筛选下拉 + 标签面板共用) */ public function tagStats() { return $this->data(CustomerLogic::getTagStats()); } /** * @notes 今日进入分布(用于页面"今日新增"卡片的迷你柱/最近进入时间/渠道 Top5) */ public function todayArrival() { return $this->data(CustomerLogic::getTodayArrivalStats()); } /** * @notes 今日进入明细流水(每一次 add_external_contact 推送 = 一行,按时间倒序分页) */ public function todayArrivalList() { $pageNo = (int) $this->request->get('page_no', 1); $pageSize = (int) $this->request->get('page_size', 20); return $this->data(CustomerLogic::getTodayArrivalList($pageNo, $pageSize)); } /** * @notes 获取同步设置 */ public function getSyncSettings() { $settings = CustomerLogic::getSyncSettings(); return $this->data($settings); } /** * @notes 保存同步设置 */ public function saveSyncSettings() { $params = (new CustomerValidate())->post()->goCheck('syncSettings'); $result = CustomerLogic::saveSyncSettings($params); if ($result === false) { return $this->fail(CustomerLogic::getError()); } return $this->success('保存成功'); } }