代码优化

This commit is contained in:
wong
2025-04-12 15:08:21 +08:00
parent 568de908e2
commit 9257716d9b
49 changed files with 1001 additions and 603 deletions

View File

@@ -262,13 +262,13 @@ export default function MomentsSyncPage() {
<div className="flex items-center justify-between mb-4">
<div className="flex items-center space-x-2">
<h3 className="font-medium">{task.name}</h3>
<Badge variant={task.status === "running" ? "success" : "secondary"}>
{task.status === "running" ? "进行中" : "已暂停"}
<Badge variant={task.status === 1 ? "success" : "secondary"}>
{task.status === 1 ? "进行中" : "已暂停"}
</Badge>
</div>
<div className="flex items-center space-x-2">
<Switch
checked={task.status === "running"}
checked={task.status === 1}
onCheckedChange={() => toggleTaskStatus(task.id, task.status)}
/>
<DropdownMenu>

View File

@@ -38,7 +38,7 @@ class AccountController extends BaseController
$params = [
'showNormalAccount' => $this->request->param('showNormalAccount', ''),
'keyword' => $this->request->param('keyword', ''),
'departmentId' => $this->request->param('companyId', ''),
'departmentId' => $this->request->param('departmentId', ''),
'pageIndex' => !empty($pageIndex) ? $pageIndex : $this->request->param('pageIndex', 0),
'pageSize' => !empty($pageSize) ? $pageSize : $this->request->param('pageSize',20)
];
@@ -59,8 +59,9 @@ class AccountController extends BaseController
}
if($isJob){
return json_encode(['code'=>200,'msg'=>'获取公司账号列表成功']);
return json_encode(['code'=>200,'msg'=>'获取公司账号列表成功','data'=>$response]);
}else{
return successJson($response);
}
} catch (\Exception $e) {
@@ -91,7 +92,7 @@ class AccountController extends BaseController
$realName = $this->request->param('realName', '');
$nickname = $this->request->param('nickname', '');
$memo = $this->request->param('memo', '');
$companyId = $this->request->param('companyId', 0);
$departmentId = $this->request->param('departmentId', 0);
// 参数验证
if (empty($userName)) {
@@ -110,7 +111,7 @@ class AccountController extends BaseController
if (empty($realName)) {
return errorJson('真实姓名不能为空');
}
if (empty($companyId)) {
if (empty($departmentId)) {
return errorJson('公司ID不能为空');
}
@@ -121,8 +122,8 @@ class AccountController extends BaseController
'realName' => $realName,
'nickname' => $nickname,
'memo' => $memo,
'departmentId' => $companyId,
'departmentIdArr' => empty($companyId) ? [914] : [914, $companyId]
'departmentId' => $departmentId,
'departmentIdArr' => empty($departmentId) ? [914] : [914, $departmentId]
];
// 设置请求头
@@ -148,12 +149,16 @@ class AccountController extends BaseController
* 获取部门列表
* @return \think\response\Json
*/
public function getDepartmentList()
public function getDepartmentList($isJob = false)
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
return errorJson('缺少授权信息');
if($isJob){
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
}else{
return errorJson('缺少授权信息');
}
}
try {
@@ -173,9 +178,17 @@ class AccountController extends BaseController
$this->processDepartments($response);
}
return successJson($response, '获取部门列表成功');
if($isJob){
return json_encode(['code'=>200,'msg'=>'获取部门列表成功','data'=>$response]);
}else{
return successJson($response, '获取部门列表成功');
}
} catch (\Exception $e) {
return errorJson('获取部门列表失败:' . $e->getMessage());
if($isJob){
return json_encode(['code'=>500,'msg'=>'获取部门列表失败:' . $e->getMessage()]);
}else{
return errorJson('获取部门列表失败:' . $e->getMessage());
}
}
}
@@ -411,7 +424,7 @@ class AccountController extends BaseController
$deleteTime = isset($item['deleteTime']) ? strtotime($item['deleteTime']) : null;
$data = [
'tenantId' => $item['id'],
'id' => $item['id'],
'accountType' => isset($item['accountType']) ? $item['accountType'] : 0,
'status' => isset($item['status']) ? $item['status'] : 0,
'tenantId' => isset($item['tenantId']) ? $item['tenantId'] : 0,
@@ -425,9 +438,9 @@ class AccountController extends BaseController
'creator' => isset($item['creator']) ? $item['creator'] : 0,
'creatorUserName' => isset($item['creatorUserName']) ? $item['creatorUserName'] : '',
'creatorRealName' => isset($item['creatorRealName']) ? $item['creatorRealName'] : '',
'companyId' => isset($item['departmentId']) ? $item['departmentId'] : 0,
'departmentId' => isset($item['departmentId']) ? $item['departmentId'] : 0,
'departmentName' => isset($item['departmentName']) ? $item['departmentName'] : '',
'privilegeIds' => isset($item['privilegeIds']) ? $item['privilegeIds'] : [],
'privilegeIds' => isset($item['privilegeIds']) ? json_encode($item['privilegeIds']) : json_encode([]),
'alive' => isset($item['alive']) ? $item['alive'] : false,
'hasXiakeAccount' => isset($item['hasXiakeAccount']) ? $item['hasXiakeAccount'] : false,
'isDeleted' => isset($item['isDeleted']) ? $item['isDeleted'] : false,
@@ -435,7 +448,7 @@ class AccountController extends BaseController
];
// 使用tenantId作为唯一性判断
$account = CompanyAccountModel::where('tenantId', $item['id'])->find();
$account = CompanyAccountModel::where('id', $item['id'])->find();
if ($account) {
$account->save($data);
} else {

View File

@@ -10,8 +10,13 @@ use Endroid\QrCode\ErrorCorrectionLevel;
class DeviceController extends BaseController
{
/************************ 设备管理相关接口 ************************/
/**
* 获取设备列表
* @param string $pageIndex 页码
* @param string $pageSize 每页数量
* @param bool $isJob 是否为定时任务调用
* @return \think\response\Json
*/
public function getlist($pageIndex = '',$pageSize = '',$isJob = false)
@@ -79,65 +84,6 @@ class DeviceController extends BaseController
}
}
/**
* 保存设备数据到数据库
* @param array $item 设备数据
*/
private function saveDevice($item)
{
$data = [
'id' => isset($item['id']) ? $item['id'] : '',
'userName' => isset($item['userName']) ? $item['userName'] : '',
'nickname' => isset($item['nickname']) ? $item['nickname'] : '',
'realName' => isset($item['realName']) ? $item['realName'] : '',
'groupName' => isset($item['groupName']) ? $item['groupName'] : '',
'wechatAccounts' => isset($item['wechatAccounts']) ? json_encode($item['wechatAccounts']) : json_encode([]),
'alive' => isset($item['alive']) ? $item['alive'] : false,
'lastAliveTime' => isset($item['lastAliveTime']) ? $item['lastAliveTime'] : null,
'companyId' => isset($item['tenantId']) ? $item['tenantId'] : 0,
'groupId' => isset($item['groupId']) ? $item['groupId'] : 0,
'currentAccountId' => isset($item['currentAccountId']) ? $item['currentAccountId'] : 0,
'imei' => $item['imei'],
'memo' => isset($item['memo']) ? $item['memo'] : '',
'createTime' => isset($item['createTime']) ? $item['createTime'] : null,
'isDeleted' => isset($item['isDeleted']) ? $item['isDeleted'] : false,
'deletedAndStop' => isset($item['deletedAndStop']) ? $item['deletedAndStop'] : false,
'deleteTime' => isset($item['deleteTime']) ? $item['deleteTime'] : null,
'rooted' => isset($item['rooted']) ? $item['rooted'] : false,
'xPosed' => isset($item['xPosed']) ? $item['xPosed'] : false,
'brand' => isset($item['brand']) ? $item['brand'] : '',
'model' => isset($item['model']) ? $item['model'] : '',
'operatingSystem' => isset($item['operatingSystem']) ? $item['operatingSystem'] : '',
'softwareVersion' => isset($item['softwareVersion']) ? $item['softwareVersion'] : '',
'extra' => isset($item['extra']) ? json_encode($item['extra']) : json_encode([]),
'phone' => isset($item['phone']) ? $item['phone'] : '',
'lastUpdateTime' => isset($item['lastUpdateTime']) ? $item['lastUpdateTime'] : null
];
// 使用imei作为唯一性判断
$device = DeviceModel::where('id', $item['id'])->find();
if ($device) {
$device->save($data);
} else {
// autoLike自动点赞
// momentsSync朋友圈同步
// autoCustomerDev自动开发客户
// groupMessageDeliver群消息推送
// autoGroup自动建群
$data['taskConfig'] = json_encode([
'autoLike' => true,
'momentsSync' => true,
'autoCustomerDev' => true,
'groupMessageDeliver' => true,
'autoGroup' => true,
]);
DeviceModel::create($data);
}
}
/**
* 生成设备二维码
* @param int $accountId 账号ID
@@ -184,7 +130,68 @@ class DeviceController extends BaseController
return errorJson('生成设备二维码失败:' . $e->getMessage());
}
}
/************************ 私有辅助方法 ************************/
/**
* 保存设备数据到数据库
* @param array $item 设备数据
*/
private function saveDevice($item)
{
$data = [
'id' => isset($item['id']) ? $item['id'] : '',
'userName' => isset($item['userName']) ? $item['userName'] : '',
'nickname' => isset($item['nickname']) ? $item['nickname'] : '',
'realName' => isset($item['realName']) ? $item['realName'] : '',
'groupName' => isset($item['groupName']) ? $item['groupName'] : '',
'wechatAccounts' => isset($item['wechatAccounts']) ? json_encode($item['wechatAccounts']) : json_encode([]),
'alive' => isset($item['alive']) ? $item['alive'] : false,
'lastAliveTime' => isset($item['lastAliveTime']) ? $item['lastAliveTime'] : null,
'tenantId' => isset($item['tenantId']) ? $item['tenantId'] : 0,
'groupId' => isset($item['groupId']) ? $item['groupId'] : 0,
'currentAccountId' => isset($item['currentAccountId']) ? $item['currentAccountId'] : 0,
'imei' => $item['imei'],
'memo' => isset($item['memo']) ? $item['memo'] : '',
'createTime' => isset($item['createTime']) ? $item['createTime'] : null,
'isDeleted' => isset($item['isDeleted']) ? $item['isDeleted'] : false,
'deletedAndStop' => isset($item['deletedAndStop']) ? $item['deletedAndStop'] : false,
'deleteTime' => isset($item['deleteTime']) ? $item['deleteTime'] : null,
'rooted' => isset($item['rooted']) ? $item['rooted'] : false,
'xPosed' => isset($item['xPosed']) ? $item['xPosed'] : false,
'brand' => isset($item['brand']) ? $item['brand'] : '',
'model' => isset($item['model']) ? $item['model'] : '',
'operatingSystem' => isset($item['operatingSystem']) ? $item['operatingSystem'] : '',
'softwareVersion' => isset($item['softwareVersion']) ? $item['softwareVersion'] : '',
'extra' => isset($item['extra']) ? json_encode($item['extra']) : json_encode([]),
'phone' => isset($item['phone']) ? $item['phone'] : '',
'lastUpdateTime' => isset($item['lastUpdateTime']) ? $item['lastUpdateTime'] : null
];
// 使用imei作为唯一性判断
$device = DeviceModel::where('id', $item['id'])->find();
if ($device) {
$device->save($data);
} else {
// autoLike自动点赞
// momentsSync朋友圈同步
// autoCustomerDev自动开发客户
// groupMessageDeliver群消息推送
// autoGroup自动建群
$data['taskConfig'] = json_encode([
'autoLike' => true,
'momentsSync' => true,
'autoCustomerDev' => true,
'groupMessageDeliver' => true,
'autoGroup' => true,
]);
DeviceModel::create($data);
}
}
/**
* 生成二维码图片base64格式
* @param string $data 二维码数据

View File

@@ -7,11 +7,16 @@ use think\facade\Request;
class FriendTaskController extends BaseController
{
/************************ 好友任务管理相关接口 ************************/
/**
* 获取添加好友记录列表
* @param int $pageIndex 页码
* @param int $pageSize 每页数量
* @param bool $isJob 是否为定时任务调用
* @return \think\response\Json
*/
public function getlist($pageIndex,$pageSize,$isJob = false)
public function getlist($pageIndex, $pageSize, $isJob = false)
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
@@ -113,6 +118,8 @@ class FriendTaskController extends BaseController
}
}
/************************ 私有辅助方法 ************************/
/**
* 保存添加好友记录到数据库
* @param array $item 添加好友记录数据

View File

@@ -7,7 +7,8 @@ use think\facade\Request;
class MessageController extends BaseController
{
/************************ 好友消息相关接口 ************************/
/**
* 获取微信好友列表
* @return \think\response\Json
@@ -114,55 +115,65 @@ class MessageController extends BaseController
}
}
/**
* 保存消息记录到数据库
* @param array $item 消息记录数据
* 用户聊天记录
* @return \think\response\Json
*/
private function saveMessage($item)
public function getMessageList()
{
// 检查消息是否已存在
$exists = WechatMessageModel::where('id', $item['id']) ->find();
// 如果消息已存在,直接返回
if ($exists) {
return;
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
return errorJson('缺少授权信息');
}
// 将毫秒时间戳转换为秒级时间戳
$createTime = isset($item['createTime']) ? strtotime($item['createTime']) : null;
$deleteTime = !empty($item['isDeleted']) ? strtotime($item['deleteTime']) : null;
$wechatTime = isset($item['wechatTime']) ? floor($item['wechatTime'] / 1000) : null;
try {
// 构建请求参数
$params = [
'keyword' => $this->request->param('keyword', ''),
'msgType' => $this->request->param('msgType', ''),
'accountId' => $this->request->param('accountId', ''),
'count' => $this->request->param('count', 100),
'messageId' => $this->request->param('messageId', ''),
'olderData' => $this->request->param('olderData', true),
'wechatAccountId' => $this->request->param('wechatAccountId', ''),
'wechatFriendId' => $this->request->param('wechatFriendId', ''),
'from' => $this->request->param('from', ''),
'to' => $this->request->param('to', ''),
'searchFrom' => $this->request->param('searchFrom', 'admin')
];
$data = [
'id' => $item['id'],
'type' => 1,
'accountId' => $item['accountId'],
'content' => $item['content'],
'createTime' => $createTime,
'deleteTime' => $deleteTime,
'isDeleted' => $item['isDeleted'] ?? false,
'isSend' => $item['isSend'] ?? true,
'msgId' => $item['msgId'],
'msgSubType' => $item['msgSubType'] ?? 0,
'msgSvrId' => $item['msgSvrId'] ?? '',
'msgType' => $item['msgType'],
'origin' => $item['origin'] ?? 0,
'recallId' => $item['recallId'] ?? false,
'sendStatus' => $item['sendStatus'] ?? 0,
'synergyAccountId' => $item['synergyAccountId'] ?? 0,
'tenantId' => $item['tenantId'],
'wechatAccountId' => $item['wechatAccountId'],
'wechatFriendId' => $item['wechatFriendId'],
'wechatTime' => $wechatTime
];
// 参数验证
if (empty($params['wechatAccountId'])) {
return errorJson('微信账号ID不能为空');
}
if (empty($params['wechatFriendId'])) {
return errorJson('好友ID不能为空');
}
// 创建新记录
WechatMessageModel::create($data);
// 设置请求头
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization, 'json');
// 发送请求获取聊天记录
$result = requestCurl($this->baseUrl . 'api/FriendMessage/searchMessage', $params, 'GET', $header, 'json');
$response = handleApiResponse($result);
// 保存数据到数据库
if (!empty($response)) {
foreach ($response as $item) {
$this->saveMessage($item);
}
}
return successJson($response);
} catch (\Exception $e) {
return errorJson('获取聊天记录失败:' . $e->getMessage());
}
}
/************************ 群聊消息相关接口 ************************/
/**
* 获取微信群聊列表
* @return \think\response\Json
@@ -268,8 +279,114 @@ class MessageController extends BaseController
}
}
/**
* 获取群聊消息列表
* @return \think\response\Json
*/
public function getChatroomMessages()
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
return errorJson('缺少授权信息');
}
try {
// 构建请求参数
$params = [
'keyword' => $this->request->param('keyword', ''),
'msgType' => $this->request->param('msgType', ''),
'accountId' => $this->request->param('accountId', ''),
'count' => $this->request->param('count', 100),
'messageId' => $this->request->param('messageId', ''),
'olderData' => $this->request->param('olderData', true),
'wechatId' => $this->request->param('wechatId', ''),
'wechatAccountId' => $this->request->param('wechatAccountId', ''),
'wechatChatroomId' => $this->request->param('wechatChatroomId', ''),
'from' => $this->request->param('from', strtotime(date('Y-m-d 00:00:00', strtotime('-1 days')))),
'to' => $this->request->param('to', strtotime(date('Y-m-d 00:00:00'))),
'searchFrom' => $this->request->param('searchFrom', 'admin')
];
// 参数验证
if (empty($params['wechatAccountId'])) {
return errorJson('微信账号ID不能为空');
}
if (empty($params['wechatChatroomId'])) {
return errorJson('群聊ID不能为空');
}
// 设置请求头
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization, 'json');
// 发送请求获取群聊消息
$result = requestCurl($this->baseUrl . 'api/ChatroomMessage/searchMessage', $params, 'GET', $header, 'json');
$response = handleApiResponse($result);
// 保存数据到数据库
if (!empty($response)) {
foreach ($response as $item) {
$res = $this->saveChatroomMessage($item);
if(!$res){
return errorJson('保存群聊消息失败');
}
}
}
return successJson($response);
} catch (\Exception $e) {
return errorJson('获取群聊消息失败:' . $e->getMessage());
}
}
/************************ 私有辅助方法 ************************/
/**
* 保存消息记录到数据库
* @param array $item 消息记录数据
*/
private function saveMessage($item)
{
// 检查消息是否已存在
$exists = WechatMessageModel::where('id', $item['id']) ->find();
// 如果消息已存在,直接返回
if ($exists) {
return;
}
// 将毫秒时间戳转换为秒级时间戳
$createTime = isset($item['createTime']) ? strtotime($item['createTime']) : null;
$deleteTime = !empty($item['isDeleted']) ? strtotime($item['deleteTime']) : null;
$wechatTime = isset($item['wechatTime']) ? floor($item['wechatTime'] / 1000) : null;
$data = [
'id' => $item['id'],
'type' => 1,
'accountId' => $item['accountId'],
'content' => $item['content'],
'createTime' => $createTime,
'deleteTime' => $deleteTime,
'isDeleted' => $item['isDeleted'] ?? false,
'isSend' => $item['isSend'] ?? true,
'msgId' => $item['msgId'],
'msgSubType' => $item['msgSubType'] ?? 0,
'msgSvrId' => $item['msgSvrId'] ?? '',
'msgType' => $item['msgType'],
'origin' => $item['origin'] ?? 0,
'recallId' => $item['recallId'] ?? false,
'sendStatus' => $item['sendStatus'] ?? 0,
'synergyAccountId' => $item['synergyAccountId'] ?? 0,
'tenantId' => $item['tenantId'],
'wechatAccountId' => $item['wechatAccountId'],
'wechatFriendId' => $item['wechatFriendId'],
'wechatTime' => $wechatTime
];
// 创建新记录
WechatMessageModel::create($data);
}
/**
* 保存群聊消息记录到数据库
@@ -354,126 +471,4 @@ class MessageController extends BaseController
// 如果没有匹配到格式,则返回原始内容
return $content;
}
/**
* 用户聊天记录
* @return \think\response\Json
*/
public function getMessageList()
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
return errorJson('缺少授权信息');
}
try {
// 构建请求参数
$params = [
'keyword' => $this->request->param('keyword', ''),
'msgType' => $this->request->param('msgType', ''),
'accountId' => $this->request->param('accountId', ''),
'count' => $this->request->param('count', 100),
'messageId' => $this->request->param('messageId', ''),
'olderData' => $this->request->param('olderData', true),
'wechatAccountId' => $this->request->param('wechatAccountId', ''),
'wechatFriendId' => $this->request->param('wechatFriendId', ''),
'from' => $this->request->param('from', ''),
'to' => $this->request->param('to', ''),
'searchFrom' => $this->request->param('searchFrom', 'admin')
];
// 参数验证
if (empty($params['wechatAccountId'])) {
return errorJson('微信账号ID不能为空');
}
if (empty($params['wechatFriendId'])) {
return errorJson('好友ID不能为空');
}
// 设置请求头
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization, 'json');
// 发送请求获取聊天记录
$result = requestCurl($this->baseUrl . 'api/FriendMessage/searchMessage', $params, 'GET', $header, 'json');
$response = handleApiResponse($result);
// 保存数据到数据库
if (!empty($response)) {
foreach ($response as $item) {
$this->saveMessage($item);
}
}
return successJson($response);
} catch (\Exception $e) {
return errorJson('获取聊天记录失败:' . $e->getMessage());
}
}
/**
* 获取群聊消息列表
* @return \think\response\Json
*/
public function getChatroomMessages()
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
return errorJson('缺少授权信息');
}
try {
// 构建请求参数
$params = [
'keyword' => $this->request->param('keyword', ''),
'msgType' => $this->request->param('msgType', ''),
'accountId' => $this->request->param('accountId', ''),
'count' => $this->request->param('count', 100),
'messageId' => $this->request->param('messageId', ''),
'olderData' => $this->request->param('olderData', true),
'wechatId' => $this->request->param('wechatId', ''),
'wechatAccountId' => $this->request->param('wechatAccountId', ''),
'wechatChatroomId' => $this->request->param('wechatChatroomId', ''),
'from' => $this->request->param('from', strtotime(date('Y-m-d 00:00:00', strtotime('-1 days')))),
'to' => $this->request->param('to', strtotime(date('Y-m-d 00:00:00'))),
'searchFrom' => $this->request->param('searchFrom', 'admin')
];
// 参数验证
if (empty($params['wechatAccountId'])) {
return errorJson('微信账号ID不能为空');
}
if (empty($params['wechatChatroomId'])) {
return errorJson('群聊ID不能为空');
}
// 设置请求头
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization, 'json');
// 发送请求获取群聊消息
$result = requestCurl($this->baseUrl . 'api/ChatroomMessage/searchMessage', $params, 'GET', $header, 'json');
$response = handleApiResponse($result);
// 保存数据到数据库
if (!empty($response)) {
foreach ($response as $item) {
$res = $this->saveChatroomMessage($item);
if(!$res){
return errorJson('保存群聊消息失败');
}
}
}
return successJson($response);
} catch (\Exception $e) {
return errorJson('获取群聊消息失败:' . $e->getMessage());
}
}
}

View File

@@ -6,6 +6,8 @@ use think\facade\Request;
class MomentsController extends BaseController
{
/************************ 朋友圈发布相关接口 ************************/
/**
* 发布朋友圈
* @return \think\response\Json
@@ -99,7 +101,9 @@ class MomentsController extends BaseController
return errorJson('发布朋友圈失败:' . $e->getMessage());
}
}
/************************ 朋友圈任务管理相关接口 ************************/
/**
* 获取朋友圈任务列表
* @return \think\response\Json

View File

@@ -13,11 +13,11 @@ class WechatChatroomController extends BaseController
* 获取微信群聊列表
* @return \think\response\Json
*/
public function getlist($pageIndex = '',$pageSize = '',$authorization = '',$isJob = false)
public function getlist($pageIndex = '',$pageSize = '',$isJob = false)
{
// 获取授权token
$authorization = !empty($authorization) ? $authorization : trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
if($isJob){
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
}else{

View File

@@ -7,66 +7,20 @@ use app\api\model\WechatAccountModel;
class WechatController extends BaseController
{
/**
* 保存微信账号数据到数据库
* @param array $item 微信账号数据
* 获取微信账号列表
* @param string $pageIndex 页码
* @param string $pageSize 每页大小
* @param bool $isJob 是否为任务调用
* @return \think\response\Json
*/
private function saveWechatAccount($item)
{
$data = [
'id' => $item['id'],
'wechatId' => $item['wechatId'],
'deviceAccountId' => $item['deviceAccountId'],
'imei' => $item['imei'],
'deviceMemo' => $item['deviceMemo'],
'accountUserName' => $item['accountUserName'],
'accountRealName' => $item['accountRealName'],
'accountNickname' => $item['accountNickname'],
'keFuAlive' => $item['keFuAlive'],
'deviceAlive' => $item['deviceAlive'],
'wechatAlive' => $item['wechatAlive'],
'yesterdayMsgCount' => $item['yesterdayMsgCount'],
'sevenDayMsgCount' => $item['sevenDayMsgCount'],
'thirtyDayMsgCount' => $item['thirtyDayMsgCount'],
'totalFriend' => $item['totalFriend'],
'maleFriend' => $item['maleFriend'],
'femaleFriend' => $item['femaleFriend'],
'wechatGroupName' => $item['wechatGroupName'],
'tenantId' => $item['tenantId'],
'nickname' => $item['nickname'],
'alias' => $item['alias'],
'avatar' => $item['avatar'],
'gender' => $item['gender'],
'region' => $item['region'],
'signature' => $item['signature'],
'bindQQ' => $item['bindQQ'],
'bindEmail' => $item['bindEmail'],
'bindMobile' => $item['bindMobile'],
'currentDeviceId' => $item['currentDeviceId'],
'isDeleted' => $item['isDeleted'],
'deleteTime' => $item['deleteTime'],
'groupId' => $item['groupId'],
'memo' => $item['memo'],
'wechatVersion' => $item['wechatVersion'],
'labels' => !empty($item['labels']) ? json_encode($item['labels']) : json_encode([]),
'updateTime' => time()
];
$account = WechatAccountModel::where('id', $item['id'])->find();
if ($account) {
$account->save($data);
} else {
WechatAccountModel::create($data);
}
}
public function getlist($pageIndex = '',$pageSize = '',$isJob = false)
public function getlist($pageIndex = '', $pageSize = '', $isJob = false)
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
if($isJob){
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
}else{
if ($isJob) {
return json_encode(['code' => 500, 'msg' => '缺少授权信息']);
} else {
return errorJson('缺少授权信息');
}
}
@@ -99,17 +53,75 @@ class WechatController extends BaseController
$this->saveWechatAccount($item);
}
}
if($isJob){
return json_encode(['code'=>200,'msg'=>'获取微信账号列表成功','data'=>$response]);
}else{
if ($isJob) {
return json_encode(['code' => 200, 'msg' => '获取微信账号列表成功', 'data' => $response]);
} else {
return successJson($response);
}
} catch (\Exception $e) {
if($isJob){
return json_encode(['code'=>500,'msg'=>'获取微信账号列表失败:' . $e->getMessage()]);
}else{
if ($isJob) {
return json_encode(['code' => 500, 'msg' => '获取微信账号列表失败:' . $e->getMessage()]);
} else {
return errorJson('获取微信账号列表失败:' . $e->getMessage());
}
}
}
/**
* 保存微信账号数据到数据库
* @param array $item 微信账号数据
*/
private function saveWechatAccount($item)
{
$createTime = isset($item['createTime']) ? strtotime($item['createTime']) : 0;
$deleteTime = !empty($item['isDeleted']) ? strtotime($item['deleteTime']) : 0;
$data = [
'id' => $item['id'],
'wechatId' => $item['wechatId'],
'deviceAccountId' => $item['deviceAccountId'],
'imei' => $item['imei'],
'deviceMemo' => $item['deviceMemo'],
'accountUserName' => $item['accountUserName'],
'accountRealName' => $item['accountRealName'],
'accountNickname' => $item['accountNickname'],
'keFuAlive' => $item['keFuAlive'],
'deviceAlive' => $item['deviceAlive'],
'wechatAlive' => $item['wechatAlive'],
'yesterdayMsgCount' => $item['yesterdayMsgCount'],
'sevenDayMsgCount' => $item['sevenDayMsgCount'],
'thirtyDayMsgCount' => $item['thirtyDayMsgCount'],
'totalFriend' => $item['totalFriend'],
'maleFriend' => $item['maleFriend'],
'femaleFriend' => $item['femaleFriend'],
'wechatGroupName' => $item['wechatGroupName'],
'tenantId' => $item['tenantId'],
'nickname' => $item['nickname'],
'alias' => $item['alias'],
'avatar' => $item['avatar'],
'gender' => $item['gender'],
'region' => $item['region'],
'signature' => $item['signature'],
'bindQQ' => $item['bindQQ'],
'bindEmail' => $item['bindEmail'],
'bindMobile' => $item['bindMobile'],
'currentDeviceId' => $item['currentDeviceId'],
'isDeleted' => $item['isDeleted'],
'groupId' => $item['groupId'],
'memo' => $item['memo'],
'wechatVersion' => $item['wechatVersion'],
'labels' => !empty($item['labels']) ? json_encode($item['labels']) : json_encode([]),
'createTime' => $createTime,
'deleteTime' => $deleteTime,
'updateTime' => time()
];
$account = WechatAccountModel::where('id', $item['id'])->find();
if ($account) {
$account->save($data);
} else {
WechatAccountModel::create($data);
}
}
}

View File

@@ -10,19 +10,23 @@ class WechatFriendController extends BaseController
{
/**
* 获取微信好友列表数据
* @param string $pageIndex 页码
* @param string $pageSize 每页大小
* @param string $preFriendId 上一个好友ID
* @param bool $isJob 是否为任务调用
* @return \think\response\Json
*/
public function getlist($pageIndex = '',$pageSize = '',$preFriendId = '',$isJob = false)
public function getlist($pageIndex = '', $pageSize = '', $preFriendId = '', $isJob = false)
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
if($isJob){
return json_encode(['code'=>500,'msg'=>'缺少授权信息']);
}else{
return errorJson('缺少授权信息');
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
if ($isJob) {
return json_encode(['code' => 500, 'msg' => '缺少授权信息']);
} else {
return errorJson('缺少授权信息');
}
}
}
try {
// 构建请求参数
@@ -37,19 +41,20 @@ class WechatFriendController extends BaseController
'groupId' => null,
'isDeleted' => null,
'isPass' => null,
'keyword' => input('keyword', ''),
'keyword' => input('keyword', ''),
'labels' => '[]',
'pageIndex' => !empty($pageIndex) ? $pageIndex : input('pageIndex', 0),
'pageSize' => !empty($pageSize) ? $pageSize : input('pageSize', 20),
'preFriendId' => !empty($preFriendId) ? $preFriendId : input('preFriendId', ''),
'wechatAccountKeyword' => input('wechatAccountKeyword', '')
];
// 设置请求头
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization);
// 发送请求获取好友列表
$result = requestCurl($this->baseUrl . 'api/WechatFriend/friendlistData', $params, 'POST', $header,'json');
$result = requestCurl($this->baseUrl . 'api/WechatFriend/friendlistData', $params, 'POST', $header, 'json');
$response = handleApiResponse($result);
// 保存数据到数据库
@@ -59,17 +64,16 @@ class WechatFriendController extends BaseController
}
}
if($isJob){
return json_encode(['code'=>200,'msg'=>'success','data'=>$response]);
}else{
if ($isJob) {
return json_encode(['code' => 200, 'msg' => 'success', 'data' => $response]);
} else {
return successJson($response);
}
} catch (\Exception $e) {
if($isJob){
return json_encode(['code'=>500,'msg'=>'获取微信好友列表失败:' . $e->getMessage()]);
}else{
if ($isJob) {
return json_encode(['code' => 500, 'msg' => '获取微信好友列表失败:' . $e->getMessage()]);
} else {
return errorJson('获取微信好友列表失败:' . $e->getMessage());
}
}
@@ -117,12 +121,12 @@ class WechatFriendController extends BaseController
'country' => $item['country'],
'privince' => isset($item['privince']) ? $item['privince'] : '',
'city' => isset($item['city']) ? $item['city'] : '',
'createTime' =>isset($item['createTime']) ? $item['createTime'] : '',
'createTime' => isset($item['createTime']) ? $item['createTime'] : '',
'updateTime' => time()
];
// 使用三个字段的组合作为唯一性判断
$friend = WechatFriendModel::where('id',$item['id'])->find();
// 使用ID作为唯一性判断
$friend = WechatFriendModel::where('id', $item['id'])->find();
if ($friend) {
$friend->save($data);

View File

@@ -7,5 +7,5 @@ use think\Model;
class CompanyAccountModel extends Model
{
// 设置表名
protected $name = 'company_account';
protected $table = 's2_company_account';
}

View File

@@ -6,5 +6,5 @@ use think\Model;
class CompanyModel extends Model {
// 设置表名
protected $name = 'company';
protected $table = 's2_department';
}

View File

@@ -6,5 +6,5 @@ use think\Model;
class DeviceModel extends Model {
// 设置表名
protected $name = 'device';
protected $table = 's2_device';
}

View File

@@ -7,5 +7,5 @@ use think\Model;
class FriendTaskModel extends Model
{
// 设置表名
protected $name = 'friend_task';
protected $table = 's2_friend_task';
}

View File

@@ -7,5 +7,5 @@ use think\Model;
class WechatAccountModel extends Model
{
// 设置表名
protected $name = 'wechat_account';
protected $table = 's2_wechat_account';
}

View File

@@ -7,5 +7,5 @@ use think\Model;
class WechatChatroomMemberModel extends Model
{
// 设置表名
protected $name = 'wechat_chatroom_member';
protected $table = 's2_wechat_chatroom_member';
}

View File

@@ -7,5 +7,5 @@ use think\Model;
class WechatChatroomModel extends Model
{
// 设置表名
protected $name = 'wechat_chatroom';
protected $table = 's2_wechat_chatroom';
}

View File

@@ -7,5 +7,5 @@ use think\Model;
class WechatFriendModel extends Model
{
// 设置表名
protected $name = 'wechat_friend';
protected $table = 's2_wechat_friend';
}

View File

@@ -7,5 +7,5 @@ use think\Model;
class WechatMessageModel extends Model
{
// 设置表名
protected $name = 'wechat_message';
protected $table = 's2_wechat_message';
}

View File

@@ -10,12 +10,13 @@
// +----------------------------------------------------------------------
return [
'device:list' => 'app\command\DeviceListCommand', // 设备列表
'wechatFriends:list' => 'app\command\WechatFriendCommand', // 微信好友列表
'wechatChatroom:list' => 'app\command\WechatChatroomCommand', // 微信群列表
'friendTask:list' => 'app\command\FriendTaskCommand', // 添加好友任务列表
'wechatList:list' => 'app\command\WechatListCommand', // 微信客服列表
'account:list' => 'app\command\AccountListCommand', // 公司账号列表
'message:friendsList' => 'app\command\MessageFriendsListCommand', // 微信好友列表
'message:chatroomList' => 'app\command\MessageChatroomListCommand', // 微信群聊列表
'device:list' => 'app\command\DeviceListCommand', // 设备列表
'wechatFriends:list' => 'app\command\WechatFriendCommand', // 微信好友列表
'wechatChatroom:list' => 'app\command\WechatChatroomCommand', // 微信群列表
'friendTask:list' => 'app\command\FriendTaskCommand', // 添加好友任务列表
'wechatList:list' => 'app\command\WechatListCommand', // 微信客服列表
'account:list' => 'app\command\AccountListCommand', // 公司账号列表
'message:friendsList' => 'app\command\MessageFriendsListCommand', // 微信好友消息列表 √
'message:chatroomList' => 'app\command\MessageChatroomListCommand', // 微信群聊消息列表 √
'department:list' => 'app\command\DepartmentListCommand', // 部门列表 √
];

View File

@@ -0,0 +1,57 @@
<?php
namespace app\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Log;
use think\Queue;
use app\job\DepartmentListJob;
class DepartmentListCommand extends Command
{
protected function configure()
{
$this->setName('department:list')
->setDescription('获取部门列表,并根据分页自动处理下一页');
}
protected function execute(Input $input, Output $output)
{
$output->writeln('开始处理部门列表任务...');
try {
// 初始页码
$pageIndex = 0;
$pageSize = 100; // 每页获取100条记录
// 将第一页任务添加到队列
$this->addToQueue($pageIndex, $pageSize);
$output->writeln('部门列表任务已添加到队列');
} catch (\Exception $e) {
Log::error('部门列表任务添加失败:' . $e->getMessage());
$output->writeln('部门列表任务添加失败:' . $e->getMessage());
return false;
}
return true;
}
/**
* 添加任务到队列
* @param int $pageIndex 页码
* @param int $pageSize 每页大小
*/
protected function addToQueue($pageIndex, $pageSize)
{
$data = [
'pageIndex' => $pageIndex,
'pageSize' => $pageSize
];
// 添加到队列,设置任务名为 account_list
Queue::push(DepartmentListJob::class, $data, 'department_list');
}
}

View File

@@ -8,6 +8,7 @@ use think\console\Output;
use think\facade\Log;
use think\Queue;
use app\job\FriendTaskJob;
use think\facade\Cache;
class FriendTaskCommand extends Command
{
@@ -22,11 +23,13 @@ class FriendTaskCommand extends Command
$output->writeln('开始处理添加好友任务...');
try {
// 初始页码
$pageIndex = 0;
$pageSize = 100; // 每页获取100条记录
// 从缓存获取初始页码缓存10分钟有效
$pageIndex = Cache::get('friendTaskPage', 21);
$output->writeln('从缓存获取页码:' . $pageIndex);
// 将第一页任务添加到队列
$pageSize = 1000; // 每页获取1000条记录
// 将任务添加到队列
$this->addToQueue($pageIndex, $pageSize);
$output->writeln('添加好友任务已添加到队列');

View File

@@ -8,6 +8,7 @@ use think\console\Output;
use think\facade\Log;
use think\Queue;
use app\job\WechatChatroomJob;
use think\facade\Cache;
class WechatChatroomCommand extends Command
{
@@ -22,11 +23,13 @@ class WechatChatroomCommand extends Command
$output->writeln('开始处理微信聊天室列表任务...');
try {
// 初始页码
$pageIndex = 0;
// 从缓存获取初始页码缓存10分钟有效
$pageIndex = Cache::get('chatroomPage', 0);
$output->writeln('从缓存获取页码:' . $pageIndex);
$pageSize = 100; // 每页获取100条记录
// 将第一页任务添加到队列
// 将任务添加到队列
$this->addToQueue($pageIndex, $pageSize);
$output->writeln('微信聊天室列表任务已添加到队列');
@@ -51,7 +54,7 @@ class WechatChatroomCommand extends Command
'pageSize' => $pageSize
];
// 添加到队列,设置任务名为 device_list
// 添加到队列,设置任务名为 wechat_chatroom
Queue::push(WechatChatroomJob::class, $data, 'wechat_chatroom');
}
}

View File

@@ -24,8 +24,8 @@ class WechatFriendCommand extends Command
try {
// 从缓存获取初始页码和上次处理的好友ID缓存10分钟有效
$pageIndex = Cache::get('friendsPage', 0);
$preFriendId = Cache::get('preFriendId', '');
$pageIndex = Cache::get('friendsPage', 21);
$preFriendId = Cache::get('preFriendId', 19426090);
$output->writeln('从缓存获取页码:' . $pageIndex . '上次处理的好友ID' . ($preFriendId ?: '无'));

View File

@@ -12,7 +12,7 @@ class User extends Model
* 数据表名
* @var string
*/
protected $table = 'tk_users';
protected $table = 'ck_users';
/**
* 主键

View File

@@ -10,7 +10,7 @@ use think\Model;
class Conversation extends Model
{
// 设置表名
protected $name = 'coze_conversation';
protected $table = 'ck_coze_conversation';
// 设置主键
protected $pk = 'id';

View File

@@ -6,7 +6,7 @@ use think\Model;
class Message extends Model
{
protected $name = 'coze_message';
protected $table = 'ck_coze_message';
protected $pk = 'id';
// 自动写入时间戳

View File

@@ -10,7 +10,7 @@ use think\Model;
class Workspace extends Model
{
// 设置当前模型对应的完整数据表名称
protected $name = 'coze_workspace';
protected $table = 'ck_coze_workspace';
// 设置主键
protected $pk = 'id';

View File

@@ -161,6 +161,9 @@ class WorkbenchController extends Controller
'momentsSync' => function($query) {
$query->field('workbenchId,syncInterval,syncCount,syncType,startTime,endTime,accountType,devices,contentLibraries');
},
'user' => function($query) {
$query->field('username');
},
// 'groupPush' => function($query) {
// $query->field('workbenchId,pushInterval,pushContent,pushTime,devices,targetGroups');
// },

View File

@@ -0,0 +1,25 @@
<?php
namespace app\cunkebao\model;
use think\Model;
/**
* 用户模型
*/
class User extends Model
{
protected $pk = 'id';
protected $name = 'users';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
// 定义关联的工作台
public function workbench()
{
return $this->hasMany('Workbench', 'id', 'userId');
}
}

View File

@@ -55,4 +55,9 @@ class Workbench extends Model
return $this->hasOne('WorkbenchGroupCreate', 'workbenchId', 'id');
}
// 用户关联
public function user()
{
return $this->hasOne('User', 'id', 'userId');
}
}

View File

@@ -0,0 +1,115 @@
<?php
namespace app\job;
use think\queue\Job;
use think\facade\Log;
use think\Queue;
use think\facade\Config;
use app\api\controller\AccountController;
class DepartmentListJob
{
/**
* 队列任务处理
* @param Job $job 队列任务
* @param array $data 任务数据
* @return void
*/
public function fire(Job $job, $data)
{
try {
// 如果任务执行成功后删除任务
if ($this->processDepartmentList($data, $job->attempts())) {
$job->delete();
Log::info('部门列表任务执行成功,页码:' . $data['pageIndex']);
} else {
if ($job->attempts() > 3) {
// 超过重试次数,删除任务
Log::error('部门列表任务执行失败,已超过重试次数,页码:' . $data['pageIndex']);
$job->delete();
} else {
// 任务失败,重新放回队列
Log::warning('部门列表任务执行失败,重试次数:' . $job->attempts() . ',页码:' . $data['pageIndex']);
$job->release(Config::get('queue.failed_delay', 10));
}
}
} catch (\Exception $e) {
// 出现异常,记录日志
Log::error('部门列表任务异常:' . $e->getMessage());
if ($job->attempts() > 3) {
$job->delete();
} else {
$job->release(Config::get('queue.failed_delay', 10));
}
}
}
/**
* 处理部门列表获取
* @param array $data 任务数据
* @param int $attempts 重试次数
* @return bool
*/
protected function processDepartmentList($data, $attempts)
{
// 获取参数
$pageIndex = isset($data['pageIndex']) ? $data['pageIndex'] : 0;
$pageSize = isset($data['pageSize']) ? $data['pageSize'] : 100;
Log::info('开始获取部门列表,页码:' . $pageIndex . ',页大小:' . $pageSize);
// 实例化控制器
$accountController = new AccountController();
// 构建请求参数
$params = [
'pageIndex' => $pageIndex,
'pageSize' => $pageSize
];
// 设置请求信息
$request = request();
$request->withGet($params);
// 调用公司账号列表获取方法
$result = $accountController->getDepartmentList(true);
$response = json_decode($result,true);
// 判断是否成功
if ($response['code'] == 200) {
$data = $response['data'];
// 判断是否有下一页
if (!empty($data) && count($data['results']) > 0) {
// 有下一页,将下一页任务添加到队列
$nextPageIndex = $pageIndex + 1;
$this->addNextPageToQueue($nextPageIndex, $pageSize);
Log::info('添加下一页任务到队列,页码:' . $nextPageIndex);
}
return true;
} else {
$errorMsg = isset($response['msg']) ? $response['msg'] : '未知错误';
Log::error('获取部门列表失败:' . $errorMsg);
return false;
}
}
/**
* 添加下一页任务到队列
* @param int $pageIndex 页码
* @param int $pageSize 每页大小
*/
protected function addNextPageToQueue($pageIndex, $pageSize)
{
$data = [
'pageIndex' => $pageIndex,
'pageSize' => $pageSize
];
// 添加到队列,设置任务名为 account_list
Queue::push(self::class, $data, 'department_list');
}
}

View File

@@ -6,6 +6,7 @@ use think\queue\Job;
use think\facade\Log;
use think\Queue;
use think\facade\Config;
use think\facade\Cache;
use app\api\controller\FriendTaskController;
class FriendTaskJob
@@ -73,9 +74,8 @@ class FriendTaskJob
$request->withGet($params);
// 调用添加好友任务获取方法
$result = $friendTaskController->getlist($pageIndex,$pageSize,true);
$response = json_decode($result,true);
$result = $friendTaskController->getlist($pageIndex, $pageSize, true);
$response = json_decode($result, true);
// 判断是否成功
if ($response['code'] == 200) {
@@ -83,10 +83,18 @@ class FriendTaskJob
// 判断是否有下一页
if (!empty($data) && count($data['results']) > 0) {
// 更新缓存中的页码设置10分钟过期
Cache::set('friendTaskPage', $pageIndex + 1, 600);
Log::info('更新缓存,下一页页码:' . ($pageIndex + 1) . '缓存时间10分钟');
// 有下一页,将下一页任务添加到队列
$nextPageIndex = $pageIndex + 1;
$this->addNextPageToQueue($nextPageIndex, $pageSize);
Log::info('添加下一页任务到队列,页码:' . $nextPageIndex);
} else {
// 没有下一页重置缓存设置10分钟过期
Cache::set('friendTaskPage', 0, 600);
Log::info('获取完成重置缓存缓存时间10分钟');
}
return true;

View File

@@ -6,6 +6,7 @@ use think\queue\Job;
use think\facade\Log;
use think\Queue;
use think\facade\Config;
use think\facade\Cache;
use app\api\controller\WechatChatroomController;
class WechatChatroomJob
@@ -74,7 +75,6 @@ class WechatChatroomJob
// 调用设备列表获取方法
$result = $wechatChatroomController->getlist($pageIndex,$pageSize,true);
$response = json_decode($result,true);
// 判断是否成功
@@ -83,10 +83,18 @@ class WechatChatroomJob
// 判断是否有下一页
if (!empty($data) && count($data['results']) > 0) {
// 更新缓存中的页码设置10分钟过期
Cache::set('chatroomPage', $pageIndex + 1, 600);
Log::info('更新缓存,下一页页码:' . ($pageIndex + 1) . '缓存时间10分钟');
// 有下一页,将下一页任务添加到队列
$nextPageIndex = $pageIndex + 1;
$this->addNextPageToQueue($nextPageIndex, $pageSize);
Log::info('添加下一页任务到队列,页码:' . $nextPageIndex);
} else {
// 没有下一页重置缓存设置10分钟过期
Cache::set('chatroomPage', 0, 600);
Log::info('获取完成重置缓存缓存时间10分钟');
}
return true;

View File

@@ -55,7 +55,7 @@ class WechatListJob
{
// 获取参数
$pageIndex = isset($data['pageIndex']) ? $data['pageIndex'] : 0;
$pageSize = isset($data['pageSize']) ? $data['pageSize'] : 100;
$pageSize = isset($data['pageSize']) ? $data['pageSize'] : 1000;
Log::info('开始获取微信客服列表,页码:' . $pageIndex . ',页大小:' . $pageSize);

View File

@@ -35,10 +35,10 @@ class BaseController extends Api
$device = Cache::get($cacheKey);
// 如果缓存不存在,则从数据库获取
if (!$device) {
$device = Db::name('device_user')
$device = Db::table('ck_device_user')
->alias('du')
->join('device d', 'd.id = du.deviceId','left')
->join('wechat_account wa', 'd.id = wa.currentDeviceId','left')
->join('s2_device d', 'd.id = du.deviceId','left')
->join('s2_wechat_account wa', 'd.id = wa.currentDeviceId','left')
->where([
'du.userId' => $this->userInfo['id'],
'du.companyId' => $this->userInfo['companyId']

View File

@@ -54,11 +54,11 @@ class CustomerController extends Api
// }
// 构建查询
$query = Db::name('device_user')
$query = Db::table('ck_device_user')
->alias('du')
->join('device d', 'd.id = du.deviceId','left')
->join('wechat_account wa', 'wa.imei = d.imei','left')
->join('wechat_friend wf', 'wf.ownerWechatId = wa.wechatId','left')
->join('s2_device d', 'd.id = du.deviceId','left')
->join('s2_wechat_account wa', 'wa.imei = d.imei','left')
->join('s2_wechat_friend wf', 'wf.ownerWechatId = wa.wechatId','left')
->where($where)
->field('d.id as deviceId,d.imei,wf.*')
->group('wf.wechatId'); // 防止重复数据

View File

@@ -78,7 +78,7 @@ class SystemConfigController extends BaseController
// 更新数据库
$result = Db::name('device')
$result = Db::table('s2_device')
->where('id', $deviceId)
->update([
'taskConfig' => $taskConfig,

View File

@@ -6,7 +6,7 @@ use think\Model;
class FlowPackageModel extends Model
{
protected $name = 'flow_package';
protected $table = 'ck_flow_package';
// 定义字段自动转换
protected $type = [

View File

@@ -10,7 +10,7 @@ use think\Model;
class FlowPackageOrderModel extends Model
{
// 设置表名
protected $name = 'flow_package_order';
protected $table = 'ck_flow_package_order';
// 自动写入时间戳
protected $autoWriteTimestamp = true;

View File

@@ -6,7 +6,7 @@ use think\Model;
class UserFlowPackageModel extends Model
{
protected $name = 'user_flow_package';
protected $table = 'ck_user_flow_package';
/**
* 获取用户当前有效的流量套餐
*

View File

@@ -6,6 +6,6 @@ use think\Model;
class WechatFriendModel extends Model
{
protected $name = 'wechat_friend';
protected $table = 'ck_wechat_friend';
}

View File

@@ -6,6 +6,6 @@ use think\Model;
class WechatMessageModel extends Model
{
protected $name = 'wechat_message';
protected $table = 'ck_wechat_message';
}

555
Server/composer.lock generated
View File

@@ -18,7 +18,13 @@
"type": "zip",
"url": "https://api.github.com/repos/adbario/php-dot-notation/zipball/081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae",
"reference": "081e2cca50c84bfeeea2e3ef9b2c8d206d80ccae",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-json": "*",
@@ -61,17 +67,23 @@
},
{
"name": "alibabacloud/credentials",
"version": "1.2.2",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/aliyun/credentials-php.git",
"reference": "410338b1831f7547a40071af3a9adea27b2fe6e5"
"reference": "cd0f65127d010ce3be5ced13fa9b69218dcfc555"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aliyun/credentials-php/zipball/410338b1831f7547a40071af3a9adea27b2fe6e5",
"reference": "410338b1831f7547a40071af3a9adea27b2fe6e5",
"shasum": ""
"url": "https://api.github.com/repos/aliyun/credentials-php/zipball/cd0f65127d010ce3be5ced13fa9b69218dcfc555",
"reference": "cd0f65127d010ce3be5ced13fa9b69218dcfc555",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"adbario/php-dot-notation": "^2.2",
@@ -137,24 +149,30 @@
"issues": "https://github.com/aliyun/credentials-php/issues",
"source": "https://github.com/aliyun/credentials-php"
},
"time": "2025-03-04T07:38:54+00:00"
"time": "2025-03-03T12:51:01+00:00"
},
{
"name": "alibabacloud/darabonba-openapi",
"version": "0.2.14",
"version": "0.2.13",
"source": {
"type": "git",
"url": "https://github.com/alibabacloud-sdk-php/darabonba-openapi.git",
"reference": "80abdf8969ae97f7acfe22211e14c2336ee861ce"
"reference": "0213396384e2c064eefd614f3dd53636a63f987f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/darabonba-openapi/zipball/80abdf8969ae97f7acfe22211e14c2336ee861ce",
"reference": "80abdf8969ae97f7acfe22211e14c2336ee861ce",
"shasum": ""
"url": "https://api.github.com/repos/alibabacloud-sdk-php/darabonba-openapi/zipball/0213396384e2c064eefd614f3dd53636a63f987f",
"reference": "0213396384e2c064eefd614f3dd53636a63f987f",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/credentials": "^1.2.2",
"alibabacloud/credentials": "^1.1",
"alibabacloud/gateway-spi": "^1",
"alibabacloud/openapi-util": "^0.1.10|^0.2.1",
"alibabacloud/tea-utils": "^0.2.21",
@@ -180,9 +198,9 @@
"description": "Alibaba Cloud OpenApi Client",
"support": {
"issues": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/issues",
"source": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/tree/0.2.14"
"source": "https://github.com/alibabacloud-sdk-php/darabonba-openapi/tree/0.2.13"
},
"time": "2025-03-12T11:57:35+00:00"
"time": "2024-07-15T13:11:36+00:00"
},
{
"name": "alibabacloud/dysmsapi-20170525",
@@ -196,7 +214,13 @@
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/Dysmsapi-20170525/zipball/43c4ba11cbc0fec26a373ce2c8f3572cfcad32b5",
"reference": "43c4ba11cbc0fec26a373ce2c8f3572cfcad32b5",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/darabonba-openapi": "^0.2.5",
@@ -239,7 +263,13 @@
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/endpoint-util/zipball/f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
"reference": "f3fe88a25d8df4faa3b0ae14ff202a9cc094e6c5",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">5.5"
@@ -281,7 +311,13 @@
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/alibabacloud-gateway-spi/zipball/7440f77750c329d8ab252db1d1d967314ccd1fcb",
"reference": "7440f77750c329d8ab252db1d1d967314ccd1fcb",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/credentials": "^1.1",
@@ -321,7 +357,13 @@
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/openapi-util/zipball/870e59984f05e104aa303c85b8214e339ba0a0ac",
"reference": "870e59984f05e104aa303c85b8214e339ba0a0ac",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/tea": "^3.1",
@@ -367,7 +409,13 @@
"type": "zip",
"url": "https://api.github.com/repos/aliyun/tea-php/zipball/1619cb96c158384f72b873e1f85de8b299c9c367",
"reference": "1619cb96c158384f72b873e1f85de8b299c9c367",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"adbario/php-dot-notation": "^2.4",
@@ -432,7 +480,13 @@
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-utils/zipball/5039e45714c6456186d267f5d81a4b260a652495",
"reference": "5039e45714c6456186d267f5d81a4b260a652495",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"alibabacloud/tea": "^3.1",
@@ -473,7 +527,13 @@
"type": "zip",
"url": "https://api.github.com/repos/alibabacloud-sdk-php/tea-xml/zipball/3e0c000bf536224eebbac913c371bef174c0a16a",
"reference": "3e0c000bf536224eebbac913c371bef174c0a16a",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">5.5"
@@ -516,7 +576,13 @@
"type": "zip",
"url": "https://api.github.com/repos/aliyun/aliyun-oss-php-sdk/zipball/483dd0b8bff5d47f0e4ffc99f6077a295c5ccbb5",
"reference": "483dd0b8bff5d47f0e4ffc99f6077a295c5ccbb5",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3"
@@ -561,7 +627,13 @@
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/5a91b62b9d37cee635bbf8d553f4546057250bee",
"reference": "5a91b62b9d37cee635bbf8d553f4546057250bee",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-iconv": "*",
@@ -611,7 +683,13 @@
"type": "zip",
"url": "https://api.github.com/repos/endroid/qr-code/zipball/6062677d3404e0ded40647b8f62ec55ff9722eb7",
"reference": "6062677d3404e0ded40647b8f62ec55ff9722eb7",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"bacon/bacon-qr-code": "^1.0.3",
@@ -674,17 +752,23 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "7.9.3",
"version": "7.9.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77"
"reference": "d281ed313b989f213357e3be1a179f02196ac99b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
"reference": "7b2f29fe81dc4da0ca0ea7d42107a0845946ea77",
"shasum": ""
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/d281ed313b989f213357e3be1a179f02196ac99b",
"reference": "d281ed313b989f213357e3be1a179f02196ac99b",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-json": "*",
@@ -780,7 +864,7 @@
],
"support": {
"issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.9.3"
"source": "https://github.com/guzzle/guzzle/tree/7.9.2"
},
"funding": [
{
@@ -796,7 +880,7 @@
"type": "tidelift"
}
],
"time": "2025-03-27T13:37:11+00:00"
"time": "2024-07-24T11:22:20+00:00"
},
{
"name": "guzzlehttp/promises",
@@ -810,7 +894,13 @@
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/7c69f28996b0a6920945dd20b3857e499d9ca96c",
"reference": "7c69f28996b0a6920945dd20b3857e499d9ca96c",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.2.5 || ^8.0"
@@ -893,7 +983,13 @@
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/c2270caaabe631b3b44c85f99e5a04bbb8060d16",
"reference": "c2270caaabe631b3b44c85f99e5a04bbb8060d16",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.2.5 || ^8.0",
@@ -1009,7 +1105,13 @@
"type": "zip",
"url": "https://api.github.com/repos/vinkla/hashids/zipball/b6c61142bfe36d43740a5419d11c351dddac0458",
"reference": "b6c61142bfe36d43740a5419d11c351dddac0458",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.1.3"
@@ -1079,7 +1181,13 @@
"type": "zip",
"url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/96d5f80680b04803c4f1b69d6e01735e876b80c7",
"reference": "96d5f80680b04803c4f1b69d6e01735e876b80c7",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.6|^7.0"
@@ -1133,7 +1241,13 @@
"type": "zip",
"url": "https://api.github.com/repos/lizhichao/sm/zipball/687a012a44a5bfd4d9143a0234e1060543be455a",
"reference": "687a012a44a5bfd4d9143a0234e1060543be455a",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.6"
@@ -1177,17 +1291,23 @@
},
{
"name": "myclabs/php-enum",
"version": "1.8.5",
"version": "1.8.4",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "e7be26966b7398204a234f8673fdad5ac6277802"
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/e7be26966b7398204a234f8673fdad5ac6277802",
"reference": "e7be26966b7398204a234f8673fdad5ac6277802",
"shasum": ""
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/a867478eae49c9f59ece437ae7f9506bfaa27483",
"reference": "a867478eae49c9f59ece437ae7f9506bfaa27483",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-json": "*",
@@ -1196,7 +1316,7 @@
"require-dev": {
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "1.*",
"vimeo/psalm": "^4.6.2 || ^5.2"
"vimeo/psalm": "^4.6.2"
},
"type": "library",
"autoload": {
@@ -1218,13 +1338,13 @@
}
],
"description": "PHP Enum implementation",
"homepage": "https://github.com/myclabs/php-enum",
"homepage": "http://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"support": {
"issues": "https://github.com/myclabs/php-enum/issues",
"source": "https://github.com/myclabs/php-enum/tree/1.8.5"
"source": "https://github.com/myclabs/php-enum/tree/1.8.4"
},
"funding": [
{
@@ -1236,7 +1356,7 @@
"type": "tidelift"
}
],
"time": "2025-01-14T11:49:03+00:00"
"time": "2022-08-04T09:53:51+00:00"
},
{
"name": "phpoffice/phpexcel",
@@ -1250,7 +1370,13 @@
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-mbstring": "*",
@@ -1305,112 +1431,6 @@
"abandoned": "phpoffice/phpspreadsheet",
"time": "2018-11-22T23:07:24+00:00"
},
{
"name": "phrity/net-uri",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/sirn-se/phrity-net-uri.git",
"reference": "3f458e0c4d1ddc0e218d7a5b9420127c63925f43"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sirn-se/phrity-net-uri/zipball/3f458e0c4d1ddc0e218d7a5b9420127c63925f43",
"reference": "3f458e0c4d1ddc0e218d7a5b9420127c63925f43",
"shasum": ""
},
"require": {
"php": "^7.4 | ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0 | ^2.0"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.0",
"phpunit/phpunit": "^9.0 | ^10.0",
"squizlabs/php_codesniffer": "^3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Phrity\\Net\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sören Jensen",
"email": "sirn@sirn.se",
"homepage": "https://phrity.sirn.se"
}
],
"description": "PSR-7 Uri and PSR-17 UriFactory implementation",
"homepage": "https://phrity.sirn.se/net-uri",
"keywords": [
"psr-17",
"psr-7",
"uri",
"uri factory"
],
"support": {
"issues": "https://github.com/sirn-se/phrity-net-uri/issues",
"source": "https://github.com/sirn-se/phrity-net-uri/tree/1.3.0"
},
"time": "2023-08-21T10:33:06+00:00"
},
{
"name": "phrity/util-errorhandler",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sirn-se/phrity-util-errorhandler.git",
"reference": "483228156e06673963902b1cc1e6bd9541ab4d5e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sirn-se/phrity-util-errorhandler/zipball/483228156e06673963902b1cc1e6bd9541ab4d5e",
"reference": "483228156e06673963902b1cc1e6bd9541ab4d5e",
"shasum": ""
},
"require": {
"php": "^7.4 | ^8.0"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.0",
"phpunit/phpunit": "^9.0 | ^10.0 | ^11.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Phrity\\Util\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sören Jensen",
"email": "sirn@sirn.se",
"homepage": "https://phrity.sirn.se"
}
],
"description": "Inline error handler; catch and resolve errors for code block.",
"homepage": "https://phrity.sirn.se/util-errorhandler",
"keywords": [
"error",
"warning"
],
"support": {
"issues": "https://github.com/sirn-se/phrity-util-errorhandler/issues",
"source": "https://github.com/sirn-se/phrity-util-errorhandler/tree/1.1.1"
},
"time": "2024-09-12T06:49:16+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.3",
@@ -1423,7 +1443,13 @@
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.0 || ^8.0",
@@ -1465,20 +1491,26 @@
},
{
"name": "psr/http-factory",
"version": "1.1.0",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
"reference": "e616d01114759c4c489f93b099585439f795fe35"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": ""
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
"reference": "e616d01114759c4c489f93b099585439f795fe35",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.1",
"php": ">=7.0.0",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
@@ -1502,7 +1534,7 @@
"homepage": "https://www.php-fig.org/"
}
],
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
@@ -1514,23 +1546,29 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory"
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
},
"time": "2024-04-15T12:06:14+00:00"
"time": "2023-04-10T20:10:41+00:00"
},
{
"name": "psr/http-message",
"version": "1.1",
"version": "2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba"
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba",
"shasum": ""
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.2 || ^8.0"
@@ -1538,7 +1576,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
"dev-master": "2.0.x-dev"
}
},
"autoload": {
@@ -1553,7 +1591,7 @@
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
@@ -1567,9 +1605,9 @@
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/1.1"
"source": "https://github.com/php-fig/http-message/tree/2.0"
},
"time": "2023-04-04T09:50:52+00:00"
"time": "2023-04-04T09:54:51+00:00"
},
{
"name": "psr/log",
@@ -1583,7 +1621,13 @@
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.0"
@@ -1633,7 +1677,13 @@
"type": "zip",
"url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
"reference": "120b605dfeb996808c31b6477290a714d356e822",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.6"
@@ -1677,19 +1727,25 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918",
"reference": "605389f2a7e5625f273b53960dc46aeaf9c62918",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.1"
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "2.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
@@ -1744,7 +1800,13 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/7aaab725bb58f0e18aa12c61bdadd4793ab4c32b",
"reference": "7aaab725bb58f0e18aa12c61bdadd4793ab4c32b",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.9"
@@ -1801,7 +1863,13 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.2"
@@ -1880,7 +1948,13 @@
"type": "zip",
"url": "https://api.github.com/repos/symfony/property-access/zipball/c8f10191183be9bb0d5a1b8364d3891f1bde07b6",
"reference": "c8f10191183be9bb0d5a1b8364d3891f1bde07b6",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.3.9",
@@ -1934,28 +2008,31 @@
},
{
"name": "textalk/websocket",
"version": "1.6.3",
"version": "1.5.8",
"source": {
"type": "git",
"url": "https://github.com/Textalk/websocket-php.git",
"reference": "67de79745b1a357caf812bfc44e0abf481cee012"
"reference": "d05dbaa97500176447ffb1f1800573f23085ab13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Textalk/websocket-php/zipball/67de79745b1a357caf812bfc44e0abf481cee012",
"reference": "67de79745b1a357caf812bfc44e0abf481cee012",
"shasum": ""
"url": "https://api.github.com/repos/Textalk/websocket-php/zipball/d05dbaa97500176447ffb1f1800573f23085ab13",
"reference": "d05dbaa97500176447ffb1f1800573f23085ab13",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^7.4 | ^8.0",
"phrity/net-uri": "^1.0",
"phrity/util-errorhandler": "^1.0",
"psr/http-message": "^1.0",
"psr/log": "^1.0 | ^2.0 | ^3.0"
"php": "^7.2 | ^8.0",
"psr/log": "^1 | ^2 | ^3"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.0",
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^8.0|^9.0",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
@@ -1973,15 +2050,16 @@
"name": "Fredrik Liljegren"
},
{
"name": "Sören Jensen"
"name": "Sören Jensen",
"email": "soren@abicart.se"
}
],
"description": "WebSocket client and server",
"support": {
"issues": "https://github.com/Textalk/websocket-php/issues",
"source": "https://github.com/Textalk/websocket-php/tree/1.6.3"
"source": "https://github.com/Textalk/websocket-php/tree/1.5.8"
},
"time": "2022-11-07T18:59:33+00:00"
"time": "2022-04-26T06:28:24+00:00"
},
{
"name": "topthink/framework",
@@ -1995,7 +2073,13 @@
"type": "zip",
"url": "https://api.github.com/repos/top-think/framework/zipball/ecf1a90d397d821ce2df58f7d47e798c17eba3ad",
"reference": "ecf1a90d397d821ce2df58f7d47e798c17eba3ad",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=5.6.0",
@@ -2040,17 +2124,23 @@
},
{
"name": "topthink/think-helper",
"version": "v3.1.10",
"version": "v3.1.11",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-helper.git",
"reference": "ac66cc0859a12cd5d73258f50f338aadc95e9b46"
"reference": "1d6ada9b9f3130046bf6922fe1bd159c8d88a33c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-helper/zipball/ac66cc0859a12cd5d73258f50f338aadc95e9b46",
"reference": "ac66cc0859a12cd5d73258f50f338aadc95e9b46",
"shasum": ""
"url": "https://api.github.com/repos/top-think/think-helper/zipball/1d6ada9b9f3130046bf6922fe1bd159c8d88a33c",
"reference": "1d6ada9b9f3130046bf6922fe1bd159c8d88a33c",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": ">=7.1.0"
@@ -2080,9 +2170,9 @@
"description": "The ThinkPHP6 Helper Package",
"support": {
"issues": "https://github.com/top-think/think-helper/issues",
"source": "https://github.com/top-think/think-helper/tree/v3.1.10"
"source": "https://github.com/top-think/think-helper/tree/v3.1.11"
},
"time": "2024-11-21T01:47:51+00:00"
"time": "2025-04-07T06:55:59+00:00"
},
{
"name": "topthink/think-installer",
@@ -2096,7 +2186,13 @@
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-installer/zipball/38ba647706e35d6704b5d370c06f8a160b635f88",
"reference": "38ba647706e35d6704b5d370c06f8a160b635f88",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"composer-plugin-api": "^1.0||^2.0"
@@ -2141,7 +2237,13 @@
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-queue/zipball/d9b8f38c7af8ad770257b0d7db711ce8b12a6969",
"reference": "d9b8f38c7af8ad770257b0d7db711ce8b12a6969",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"topthink/framework": "5.1.*",
@@ -2181,23 +2283,30 @@
},
{
"name": "topthink/think-worker",
"version": "v2.0.11",
"version": "v2.0.12",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-worker.git",
"reference": "bee4408caf10a48df6a91e17f5b64f72a25bf1f8"
"reference": "922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/top-think/think-worker/zipball/bee4408caf10a48df6a91e17f5b64f72a25bf1f8",
"reference": "bee4408caf10a48df6a91e17f5b64f72a25bf1f8",
"shasum": ""
"url": "https://api.github.com/repos/top-think/think-worker/zipball/922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f",
"reference": "922d8c95e2f095e0da66d18b9e3fbbfd8de70a3f",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"ext-fileinfo": "*",
"topthink/framework": "^5.1.18",
"topthink/think-installer": "^2.0",
"workerman/gateway-worker": "^3.0.0",
"workerman/workerman": "^3.3.0"
"workerman/workerman": "^3.5.0"
},
"type": "think-extend",
"extra": {
@@ -2228,9 +2337,9 @@
"description": "workerman extend for thinkphp5.1",
"support": {
"issues": "https://github.com/top-think/think-worker/issues",
"source": "https://github.com/top-think/think-worker/tree/2.0"
"source": "https://github.com/top-think/think-worker/tree/v2.0.12"
},
"time": "2018-09-14T05:56:22+00:00"
"time": "2019-03-08T11:22:34+00:00"
},
{
"name": "workerman/gateway-worker",
@@ -2244,7 +2353,13 @@
"type": "zip",
"url": "https://api.github.com/repos/walkor/GatewayWorker/zipball/a615036c482d11f68b693998575e804752ef9068",
"reference": "a615036c482d11f68b693998575e804752ef9068",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"workerman/workerman": ">=3.5.0"
@@ -2292,7 +2407,13 @@
"type": "zip",
"url": "https://api.github.com/repos/walkor/workerman/zipball/3cc0adae51ba36db38b11e7996c64250d356dbe7",
"reference": "3cc0adae51ba36db38b11e7996c64250d356dbe7",
"shasum": ""
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"php": "^5.3||^7.0"
@@ -2354,5 +2475,5 @@
"php": ">=5.6.0"
},
"platform-dev": [],
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.3.0"
}

View File

@@ -30,7 +30,7 @@ return [
// 数据库编码默认采用utf8
'charset' => env('database.charset', 'utf8mb4'),
// 数据库表前缀
'prefix' => Env::get('database.prefix', 'tk_'),
'prefix' => Env::get('database.prefix', ''),
// 数据库调试模式
'debug' => env('database.debug', true),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)

View File

@@ -1,3 +1,4 @@
/vendor
composer.phar
composer.lock
.DS_Store

View File

@@ -217,6 +217,12 @@ class Lang
}
}
if (preg_match('/^([a-z\d\-]+)/i', $langSet, $matches)) {
$langSet = strtolower($matches[1]);
} else {
$langSet = $this->range;
}
if (empty($this->allowLangList) || in_array($langSet, $this->allowLangList)) {
// 合法的语言
$this->range = $langSet ?: $this->range;

View File

@@ -37,24 +37,24 @@ use think\db\Query;
* @method $this limit(mixed $offset, integer $length = null) static 查询LIMIT
* @method $this order(mixed $field, string $order = null) static 查询ORDER
* @method $this orderRaw(string $field, array $bind = []) static 查询ORDER
* @method $this cache(mixed $key = null , integer|\DateTime $expire = null, string $tag = null) static 设置查询缓存
* @method $this cache(mixed $key = null, integer|\DateTime $expire = null, string $tag = null) static 设置查询缓存
* @method mixed value(string $field, mixed $default = null) static 获取某个字段的值
* @method array column(string $field, string $key = '') static 获取某个列的值
* @method $this find(mixed $data = null) static 查询单个记录
* @method $this findOrFail(mixed $data = null) 查询单个记录
* @method Collection|$this[] select(mixed $data = null) static 查询多个记录
* @method $this get(mixed $data = null,mixed $with = [],bool $cache = false, bool $failException = false) static 查询单个记录 支持关联预载入
* @method $this getOrFail(mixed $data = null,mixed $with = [],bool $cache = false) static 查询单个记录 不存在则抛出异常
* @method $this get(mixed $data = null, mixed $with = [], bool $cache = false, bool $failException = false) static 查询单个记录 支持关联预载入
* @method $this getOrFail(mixed $data = null, mixed $with = [], bool $cache = false) static 查询单个记录 不存在则抛出异常
* @method $this findOrEmpty(mixed $data = null) static 查询单个记录 不存在则返回空模型
* @method Collection|$this[] all(mixed $data = null,mixed $with = [],bool $cache = false) static 查询多个记录 支持关联预载入
* @method $this withAttr(array $name,\Closure $closure = null) static 动态定义获取器
* @method Collection|$this[] all(mixed $data = null, mixed $with = [], bool $cache = false) static 查询多个记录 支持关联预载入
* @method $this withAttr(array $name, \Closure $closure = null) static 动态定义获取器
* @method $this withJoin(string|array $with, string $joinType = '') static
* @method $this withCount(string|array $relation, bool $subQuery = true) static 关联统计
* @method $this withSum(string|array $relation, string $field, bool $subQuery = true) static 关联SUM统计
* @method $this withMax(string|array $relation, string $field, bool $subQuery = true) static 关联MAX统计
* @method $this withMin(string|array $relation, string $field, bool $subQuery = true) static 关联Min统计
* @method $this withAvg(string|array $relation, string $field, bool $subQuery = true) static 关联Avg统计
* @method Paginator|$this paginate() static 分页
* @method Paginator|$this paginate(int|array $listRows = null, int|bool $simple = false, array $config = []) static 分页
*/
abstract class Model implements \JsonSerializable, \ArrayAccess
{

View File

@@ -684,7 +684,7 @@ class Request
unset($_GET[$this->config['var_pathinfo']]);
unset($this->get[$this->config['var_pathinfo']]);
} elseif ($this->isCli()) {
// CLI模式下 view.php module/controller/action/params/...
// CLI模式下 index.php module/controller/action/params/...
$pathinfo = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : '';
} elseif ('cli-server' == PHP_SAPI) {
$pathinfo = strpos($this->server('REQUEST_URI'), '?') ? strstr($this->server('REQUEST_URI'), '?', true) : $this->server('REQUEST_URI');

View File

@@ -489,7 +489,7 @@
var err_line = $('.line-' + LINE, ol[0])[0];
err_line.className = err_line.className + ' line-error';
$.getScript('//cdn.bootcss.com/prettify/r298/prettify.min.js', function(){
$.getScript('//cdn.bootcdn.net/ajax/libs/prettify/r298/prettify.min.js', function(){
prettyPrint();
// Firefox浏览器一个很诡异的问题