From e07d834ad6206378e3d6db8609d31e06898e42ec Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Fri, 18 Jul 2025 17:17:28 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E5=8E=BB=E9=99=A4md5=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=EF=BC=8C=E4=BA=A4=E7=94=B1=E5=89=8D=E7=AB=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/common/service/AuthService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/application/common/service/AuthService.php b/Server/application/common/service/AuthService.php index aac5fbd1d..c6a24a271 100644 --- a/Server/application/common/service/AuthService.php +++ b/Server/application/common/service/AuthService.php @@ -49,7 +49,7 @@ class AuthService throw new \Exception('用户不存在或已禁用', 403); } - if ($user->passwordMd5 !== md5($password)) { + if ($user->passwordMd5 !== $password) { throw new \Exception('账号或密码错误', 403); } From 3cc2e3ed624505189fd981dd8ce73a1681088063 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 14:43:30 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E9=A2=84=E9=98=B2=E6=80=A7=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=A5=BD=E5=8F=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/command.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Server/application/command.php b/Server/application/command.php index 2dcd31788..570c76a4c 100644 --- a/Server/application/command.php +++ b/Server/application/command.php @@ -32,4 +32,5 @@ return [ 'sync:wechatData' => 'app\command\SyncWechatDataToCkbTask', // 同步微信数据到存客宝 'sync:allFriends' => 'app\command\SyncAllFriendsCommand', // 同步所有在线好友 'workbench:trafficDistribute' => 'app\command\WorkbenchTrafficDistributeCommand', // 工作台流量分发任务 + 'switch:friends' => 'app\command\SwitchFriendsCommand', ]; From 90359b8119ccc1a739f0e70f0572c89adaaa78cc Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 14:58:26 +0800 Subject: [PATCH 03/20] =?UTF-8?q?[]=20=E7=94=A8=E6=88=B7=E6=97=85=E7=A8=8B?= =?UTF-8?q?-=E8=AE=B0=E5=BD=95=E7=94=A8=E6=88=B7=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/MessageController.php | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/Server/application/api/controller/MessageController.php b/Server/application/api/controller/MessageController.php index da0337413..12d732c15 100644 --- a/Server/application/api/controller/MessageController.php +++ b/Server/application/api/controller/MessageController.php @@ -425,15 +425,31 @@ class MessageController extends BaseController } } } - - - - - - - // 创建新记录 - WechatMessageModel::create($data); + $res = WechatMessageModel::create($data); + + // 1 文字 3图片 47动态图片 34语言 43视频 42名片 40/20链接 49文件 + if (!empty($res) && empty($item['isSend']) && in_array($item['msgType'],[1,3,20,34,40,42,43,47,49])){ + $friend = Db::name('wechat_friendship')->where('id',$item['wechatFriendId'])->find(); + if (!empty($friend)){ + $trafficPoolId = Db::name('traffic_pool')->where('identifier',$friend['wechatId'])->value('id'); + if (!empty($trafficPoolId)){ + $data = [ + 'type' => 4, + 'companyId' => $friend['companyId'], + 'trafficPoolId' => $trafficPoolId, + 'source' => 0, + 'uniqueId' => $res['id'], + 'sourceData' => json_encode([]), + 'remark' => '用户发送了消息', + 'createTime' => time(), + 'updateTime' => time() + ]; + Db::name('user_portrait')->insert($data); + } + } + } + } /** From 96a5c3228670d11ff547337bb162652cd61ebafa Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 14:59:00 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E7=AB=AF=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/PasswordLoginController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Server/application/common/controller/PasswordLoginController.php b/Server/application/common/controller/PasswordLoginController.php index c5cce3d4d..6d461cf49 100644 --- a/Server/application/common/controller/PasswordLoginController.php +++ b/Server/application/common/controller/PasswordLoginController.php @@ -53,7 +53,11 @@ class PasswordLoginController extends BaseController throw new \Exception('用户不存在或已禁用', 403); } - if ($user->passwordMd5 !== md5($password)) { + if($typeId == 2){ + $password = md5($password); + } + + if ($user->passwordMd5 !== $password) { throw new \Exception('账号或密码错误', 403); } From de35417b236f4556bff40a90526a547e78336226 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 14:59:43 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/common/service/AuthService.php | 2 +- Server/application/cunkebao/config/route.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Server/application/common/service/AuthService.php b/Server/application/common/service/AuthService.php index c6a24a271..aac5fbd1d 100644 --- a/Server/application/common/service/AuthService.php +++ b/Server/application/common/service/AuthService.php @@ -49,7 +49,7 @@ class AuthService throw new \Exception('用户不存在或已禁用', 403); } - if ($user->passwordMd5 !== $password) { + if ($user->passwordMd5 !== md5($password)) { throw new \Exception('账号或密码错误', 403); } diff --git a/Server/application/cunkebao/config/route.php b/Server/application/cunkebao/config/route.php index ba1ed01e6..081733f9d 100644 --- a/Server/application/cunkebao/config/route.php +++ b/Server/application/cunkebao/config/route.php @@ -102,6 +102,7 @@ Route::group('v1/', function () { }); + //数据统计相关 Route::group('dashboard',function (){ Route::get('', 'app\cunkebao\controller\StatsController@baseInfoStats'); Route::get('plan-stats', 'app\cunkebao\controller\StatsController@planStats'); From 5aa48354a2b380af40ad02552cd5d969344235cf Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 15:00:10 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=BA=93=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ContentLibraryController.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Server/application/cunkebao/controller/ContentLibraryController.php b/Server/application/cunkebao/controller/ContentLibraryController.php index 6c522a6d1..0d28937c7 100644 --- a/Server/application/cunkebao/controller/ContentLibraryController.php +++ b/Server/application/cunkebao/controller/ContentLibraryController.php @@ -415,7 +415,7 @@ class ContentLibraryController extends Controller // 关键词搜索 if (!empty($keyword)) { - $where[] = ['content', 'like', '%' . $keyword . '%']; + $where[] = ['content|title', 'like', '%' . $keyword . '%']; } // 查询数据 @@ -440,22 +440,22 @@ class ContentLibraryController extends Controller } // 获取发送者信息 - if ($item['type'] == 'moment' && $item['friendId']) { + if ($item['type'] == 'moment' && !empty($item['friendId'])) { $friendInfo = Db::name('wechat_friendship') ->alias('wf') ->join('wechat_account wa', 'wf.wechatId = wa.wechatId') ->where('wf.id', $item['friendId']) ->field('wa.nickname, wa.avatar') ->find(); - $item['senderNickname'] = $friendInfo['nickname'] ?: ''; - $item['senderAvatar'] = $friendInfo['avatar'] ?: ''; - }else if ($item['type'] == 'group_message' && $item['wechatChatroomId']) { + $item['senderNickname'] = !empty($friendInfo['nickname']) ? $friendInfo['nickname'] : ''; + $item['senderAvatar'] = !empty( $friendInfo['avatar']) ? $friendInfo['avatar'] : ''; + }else if ($item['type'] == 'group_message' && !empty($item['wechatChatroomId'])) { $friendInfo = Db::table('s2_wechat_chatroom_member') ->field('nickname, avatar') ->where('wechatId', $item['wechatId']) ->find(); - $item['senderNickname'] = $friendInfo['nickname'] ?: ''; - $item['senderAvatar'] = $friendInfo['avatar'] ?: ''; + $item['senderNickname'] = !empty($friendInfo['nickname']) ? $friendInfo['nickname'] : ''; + $item['senderAvatar'] = !empty($friendInfo['avatar']) ? $friendInfo['avatar'] : ''; } } unset($item); From 550d993626601f39d67ac921cbfea4f28ad93b0b Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 15:00:35 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cunkebao/controller/plan/PlanSceneV1Controller.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Server/application/cunkebao/controller/plan/PlanSceneV1Controller.php b/Server/application/cunkebao/controller/plan/PlanSceneV1Controller.php index 055cf9ea7..c4cd7e081 100644 --- a/Server/application/cunkebao/controller/plan/PlanSceneV1Controller.php +++ b/Server/application/cunkebao/controller/plan/PlanSceneV1Controller.php @@ -407,7 +407,13 @@ class PlanSceneV1Controller extends BaseController $posterWeChatMiniProgram = new PosterWeChatMiniProgram(); $result = $posterWeChatMiniProgram->generateMiniProgramCodeWithScene($taskId); - return ResponseHelper::success($result, '获取小程序码成功'); + $result = json_decode($result, true); + if ($result['code'] == 200){ + return ResponseHelper::success($result['data'], '获取小程序码成功'); + }else{ + return ResponseHelper::error('获取小程序失败:' . $result['msg']); + } + } From c6b22ae362a881deb6de2eae4d9aee398b21802d Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 15:01:02 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=94=9F?= =?UTF-8?q?=E6=88=90=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/PosterWeChatMiniProgram.php | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index 753beed25..14ee0df99 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -27,34 +27,32 @@ class PosterWeChatMiniProgram extends Controller $taskId = request()->param('id'); - $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); - - // scene参数长度限制为32位 - // $scene = 'taskId=' . $taskId; - $scene = 'id=' . $taskId; - - // 调用接口生成小程序码 - $response = $app->app_code->getUnlimit($scene, [ - 'page' => 'pages/poster/index', // 必须是已经发布的小程序页面 - 'width' => 430, // 二维码的宽度,默认430 - // 'auto_color' => false, // 自动配置线条颜色 - // 'line_color' => ['r' => 0, 'g' => 0, 'b' => 0], // 颜色设置 - // 'is_hyaline' => false, // 是否需要透明底色 - ]); - - // 保存小程序码到文件 - if ($response instanceof StreamResponse) { - // $filename = 'minicode_' . $taskId . '.png'; - // $response->saveAs('path/to/codes', $filename); - // return 'path/to/codes/' . $filename; + try { + $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); + // scene参数长度限制为32位 + // $scene = 'taskId=' . $taskId; + $scene = 'id=' . $taskId; + // 调用接口生成小程序码 + $response = $app->app_code->getUnlimit($scene, [ + 'page' => 'pages/poster/index', // 必须是已经发布的小程序页面 + 'width' => 430, // 二维码的宽度,默认430 + // 'auto_color' => false, // 自动配置线条颜色 + // 'line_color' => ['r' => 0, 'g' => 0, 'b' => 0], // 颜色设置 + // 'is_hyaline' => false, // 是否需要透明底色 + ]); + // 保存小程序码到文件 + if ($response instanceof StreamResponse) { + // $filename = 'minicode_' . $taskId . '.png'; + // $response->saveAs('path/to/codes', $filename); + // return 'path/to/codes/' . $filename; - $img = $response->getBody()->getContents();//获取图片二进制流 - $img_base64 = 'data:image/png;base64,' .base64_encode($img);//转化base64 - return $img_base64; + $img = $response->getBody()->getContents();//获取图片二进制流 + $img_base64 = 'data:image/png;base64,' . base64_encode($img);//转化base64 + return json_encode(['code' => 200, 'data' => $img_base64]); + } + }catch (\Exception $e) { + return json_encode(['code' => 500,'data' => '','msg' => $e->getMessage()]); } - - // return false; - return null; } // getPhoneNumber From 8d12f5a06a4107009b2dad4d723307c8933be5e5 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 15:01:40 +0800 Subject: [PATCH 09/20] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/wechat/GetWechatsOnDevicesV1Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/application/cunkebao/controller/wechat/GetWechatsOnDevicesV1Controller.php b/Server/application/cunkebao/controller/wechat/GetWechatsOnDevicesV1Controller.php index e41cdfc68..15f1714b5 100644 --- a/Server/application/cunkebao/controller/wechat/GetWechatsOnDevicesV1Controller.php +++ b/Server/application/cunkebao/controller/wechat/GetWechatsOnDevicesV1Controller.php @@ -196,7 +196,7 @@ class GetWechatsOnDevicesV1Controller extends BaseController // 关键词搜索(同时搜索微信号和昵称) if (!empty($keyword = $this->request->param('keyword'))) { - $where[] = ['exp', "w.alias LIKE '%{$keyword}%' OR w.nickname LIKE '%{$keyword}%'"]; + $where[] = ["w.wechatId|w.alias|w.nickname", 'LIKE', '%' . $keyword . '%']; } $where['w.wechatId'] = array('in', implode(',', $wechatIds)); From c619291e84ec035031557666a2cd54b191bce0dc Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 15:25:17 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../command/SwitchFriendsCommand.php | 51 +++++++++++++++++-- Server/application/common.php | 26 ++++++++++ 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/Server/application/command/SwitchFriendsCommand.php b/Server/application/command/SwitchFriendsCommand.php index d153f3728..2ea775121 100644 --- a/Server/application/command/SwitchFriendsCommand.php +++ b/Server/application/command/SwitchFriendsCommand.php @@ -26,6 +26,9 @@ class SwitchFriendsCommand extends Command protected function execute(Input $input, Output $output) { + // 清理可能损坏的缓存数据 + $this->clearCorruptedCache($output); + //处理流量分过期数据 $expUserData = Db::name('workbench_traffic_config_item') ->where('expTime','<=',time()) @@ -122,7 +125,15 @@ class SwitchFriendsCommand extends Command $output->writeln('开始执行好友切换任务...'); do { - $friends = Cache::get($cacheKey, []); + try { + $friends = Cache::get($cacheKey, []); + } catch (\Exception $e) { + // 如果缓存数据损坏,清空缓存并记录错误 + $output->writeln('缓存数据损坏,正在清空缓存: ' . $e->getMessage()); + Cache::rm($cacheKey); + $friends = []; + } + $toSwitch = []; foreach ($friends as $friend) { if (isset($friend['time']) && $friend['time'] < $now) { @@ -196,7 +207,15 @@ class SwitchFriendsCommand extends Command } // 过滤掉已切换的,保留未切换和新进来的 - $newFriends = Cache::get($cacheKey, []); + try { + $newFriends = Cache::get($cacheKey, []); + } catch (\Exception $e) { + // 如果缓存数据损坏,清空缓存并记录错误 + $output->writeln('缓存数据损坏,正在清空缓存: ' . $e->getMessage()); + Cache::rm($cacheKey); + $newFriends = []; + } + $updated = []; foreach ($newFriends as $friend) { $friendId = !empty($friend['friendId']) ? $friend['friendId'] : $friend['id']; @@ -210,7 +229,13 @@ class SwitchFriendsCommand extends Command return ($a['time'] ?? 0) <=> ($b['time'] ?? 0); }); - $success = Cache::set($cacheKey, $updated); + try { + $success = Cache::set($cacheKey, $updated); + } catch (\Exception $e) { + // 如果缓存设置失败,记录错误并继续 + $output->writeln('缓存设置失败: ' . $e->getMessage()); + $success = false; + } $retry++; } while (!$success && $retry < $maxRetry); @@ -222,4 +247,24 @@ class SwitchFriendsCommand extends Command $output->writeln('缓存已更新并排序'); } + /** + * 清理损坏的缓存数据 + * @param Output $output + */ + private function clearCorruptedCache(Output $output) + { + $cacheKey = 'allotWechatFriend'; + try { + // 尝试读取缓存,如果失败则清空 + $testData = Cache::get($cacheKey, []); + if (!is_array($testData)) { + $output->writeln('缓存数据格式错误,正在清空缓存'); + Cache::rm($cacheKey); + } + } catch (\Exception $e) { + $output->writeln('检测到损坏的缓存数据,正在清空: ' . $e->getMessage()); + Cache::rm($cacheKey); + } + } + } \ No newline at end of file diff --git a/Server/application/common.php b/Server/application/common.php index d412b53a7..5b6987ae2 100644 --- a/Server/application/common.php +++ b/Server/application/common.php @@ -526,3 +526,29 @@ function dump() { call_user_func_array(['app\\common\\helper\\Debug', 'dump'], func_get_args()); } + +if (!function_exists('artificialAllotWechatFriend')) { + function artificialAllotWechatFriend($friend = []) + { + if (empty($friend)) { + return false; + } + + //记录切换好友 + $cacheKey = 'allotWechatFriend'; + $cacheFriend = $friend; + $cacheFriend['time'] = time() + 120; + $maxRetry = 5; + $retry = 0; + do { + $cacheFriendData = Cache::get($cacheKey, []); + // 去重:移除同friendId的旧数据 + $cacheFriendData = array_filter($cacheFriendData, function($item) use ($cacheFriend) { + return $item['friendId'] !== $cacheFriend['friendId']; + }); + $cacheFriendData[] = $cacheFriend; + $success = Cache::set($cacheKey, $cacheFriendData); + $retry++; + } while (!$success && $retry < $maxRetry); + } +} \ No newline at end of file From 7342e60de161db84879643959fda78a4ebdbca2d Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:19:50 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/PasswordLoginController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/application/common/controller/PasswordLoginController.php b/Server/application/common/controller/PasswordLoginController.php index 6d461cf49..74058fe4a 100644 --- a/Server/application/common/controller/PasswordLoginController.php +++ b/Server/application/common/controller/PasswordLoginController.php @@ -53,9 +53,9 @@ class PasswordLoginController extends BaseController throw new \Exception('用户不存在或已禁用', 403); } - if($typeId == 2){ - $password = md5($password); - } + + $password = md5($password); + if ($user->passwordMd5 !== $password) { throw new \Exception('账号或密码错误', 403); From aab08b2816504f6a43d53ce5b79a4af542598acd Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:26:27 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cunkebao/controller/plan/PosterWeChatMiniProgram.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index 14ee0df99..64b3c4632 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -34,7 +34,7 @@ class PosterWeChatMiniProgram extends Controller $scene = 'id=' . $taskId; // 调用接口生成小程序码 $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], // 颜色设置 @@ -88,7 +88,8 @@ class PosterWeChatMiniProgram extends Controller if (!$trafficPool) { Db::name('traffic_pool')->insert([ 'identifier' => $result['phone_info']['phoneNumber'], - 'mobile' => $result['phone_info']['phoneNumber'] + 'mobile' => $result['phone_info']['phoneNumber'], + 'createTime' => time() ]); } // 2. 写入 ck_task_customer: 以 task_id ~~identifier~~ phone 为条件,如果存在则忽略,使用类似laravel的firstOrcreate(但我不知道thinkphp5.1里的写法) From ebc6a4d82daf8dda04861e20ebf5229208e9e44c Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:32:35 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cunkebao/controller/plan/PosterWeChatMiniProgram.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index 64b3c4632..7aa834cca 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -31,7 +31,7 @@ class PosterWeChatMiniProgram extends Controller $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); // scene参数长度限制为32位 // $scene = 'taskId=' . $taskId; - $scene = 'id=' . $taskId; + $scene = $taskId; // 调用接口生成小程序码 $response = $app->app_code->getUnlimit($scene, [ 'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面 From b4575eb0df2cb34127369b8845a19dae5224c931 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:36:21 +0800 Subject: [PATCH 14/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cunkebao/controller/plan/PosterWeChatMiniProgram.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index 7aa834cca..ec43d668e 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -30,8 +30,8 @@ class PosterWeChatMiniProgram extends Controller try { $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); // scene参数长度限制为32位 - // $scene = 'taskId=' . $taskId; - $scene = $taskId; + $scene = 'taskId=' . $taskId; + // $scene = 'id=' . $taskId; // 调用接口生成小程序码 $response = $app->app_code->getUnlimit($scene, [ 'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面 From a3ea85687b4b4c7104e57cce982378662d5db740 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:38:47 +0800 Subject: [PATCH 15/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cunkebao/controller/plan/PosterWeChatMiniProgram.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index ec43d668e..b0e1f39fa 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -30,10 +30,10 @@ class PosterWeChatMiniProgram extends Controller try { $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); // scene参数长度限制为32位 - $scene = 'taskId=' . $taskId; - // $scene = 'id=' . $taskId; + //$scene = 'taskId=' . $taskId; + $scene = $taskId; // 调用接口生成小程序码 - $response = $app->app_code->getUnlimit($scene, [ + $response = $app->app_code->getUnlimit($taskId, [ 'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面 'width' => 430, // 二维码的宽度,默认430 // 'auto_color' => false, // 自动配置线条颜色 From 8136eae1eea84e64c94a33a741aadecbc73eeef7 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:41:31 +0800 Subject: [PATCH 16/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cunkebao/controller/plan/PosterWeChatMiniProgram.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index b0e1f39fa..240a8c1f2 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -31,9 +31,9 @@ class PosterWeChatMiniProgram extends Controller $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); // scene参数长度限制为32位 //$scene = 'taskId=' . $taskId; - $scene = $taskId; + $scene = strval($taskId); // 调用接口生成小程序码 - $response = $app->app_code->getUnlimit($taskId, [ + $response = $app->app_code->getUnlimit($scene, [ 'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面 'width' => 430, // 二维码的宽度,默认430 // 'auto_color' => false, // 自动配置线条颜色 From b78cee37395081c46e5351a44200ff4151b581c7 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:47:29 +0800 Subject: [PATCH 17/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cunkebao/controller/plan/PosterWeChatMiniProgram.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index 240a8c1f2..f1a83c420 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -31,7 +31,7 @@ class PosterWeChatMiniProgram extends Controller $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); // scene参数长度限制为32位 //$scene = 'taskId=' . $taskId; - $scene = strval($taskId); + $scene = sprintf("%s", $taskId); // 调用接口生成小程序码 $response = $app->app_code->getUnlimit($scene, [ 'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面 From ffc12e4721fd211857006bbcd340b47138b2c0fc Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:49:15 +0800 Subject: [PATCH 18/20] 1 --- .../cunkebao/controller/plan/PosterWeChatMiniProgram.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index f1a83c420..a3d5596b7 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -31,7 +31,7 @@ class PosterWeChatMiniProgram extends Controller $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); // scene参数长度限制为32位 //$scene = 'taskId=' . $taskId; - $scene = sprintf("%s", $taskId); + $scene = '=' . $taskId; // 调用接口生成小程序码 $response = $app->app_code->getUnlimit($scene, [ 'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面 From 5065e65273aa4c63f7afd500dd6affe8bf0c8126 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Sat, 19 Jul 2025 17:55:24 +0800 Subject: [PATCH 19/20] 1 --- .../cunkebao/controller/plan/PosterWeChatMiniProgram.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php index a3d5596b7..b05b981f0 100644 --- a/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php +++ b/Server/application/cunkebao/controller/plan/PosterWeChatMiniProgram.php @@ -25,13 +25,16 @@ class PosterWeChatMiniProgram extends Controller // 生成小程序码,存客宝-操盘手调用 public function generateMiniProgramCodeWithScene($taskId = '') { - $taskId = request()->param('id'); + if (empty($taskId)){ + return json_encode(['code' => 500,'data' => '','msg' => '任务id不能为空']); + } + try { $app = Factory::miniProgram(self::MINI_PROGRAM_CONFIG); // scene参数长度限制为32位 //$scene = 'taskId=' . $taskId; - $scene = '=' . $taskId; + $scene = sprintf("%s", $taskId); // 调用接口生成小程序码 $response = $app->app_code->getUnlimit($scene, [ 'page' => 'pages/poster/index2', // 必须是已经发布的小程序页面 From 1f843d76ae705108e6e497ba9e966774700a0b20 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Mon, 21 Jul 2025 11:11:12 +0800 Subject: [PATCH 20/20] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/application/cunkebao/config/route.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Server/application/cunkebao/config/route.php b/Server/application/cunkebao/config/route.php index 081733f9d..69290e148 100644 --- a/Server/application/cunkebao/config/route.php +++ b/Server/application/cunkebao/config/route.php @@ -40,7 +40,7 @@ Route::group('v1/', function () { Route::get('scenes-detail', 'app\cunkebao\controller\plan\GetPlanSceneListV1Controller@detail'); Route::post('create', 'app\cunkebao\controller\plan\PostCreateAddFriendPlanV1Controller@index'); Route::get('list', 'app\cunkebao\controller\plan\PlanSceneV1Controller@index'); - Route::get('copy', 'app\cunkebao\controller\plan\PlanSceneV1Controller@copy'); + Route::get('copy', 'app\cunkebao\controller\plan\GetCreateAddFriendPlanV1Controller@copy'); Route::delete('delete', 'app\cunkebao\controller\plan\PlanSceneV1Controller@delete'); Route::post('updateStatus', 'app\cunkebao\controller\plan\PlanSceneV1Controller@updateStatus'); Route::get('detail', 'app\cunkebao\controller\plan\GetAddFriendPlanDetailV1Controller@index'); @@ -56,6 +56,9 @@ Route::group('v1/', function () { Route::get('types', 'app\cunkebao\controller\traffic\GetPotentialTypeSectionV1Controller@index'); Route::get('sources', 'app\cunkebao\controller\traffic\GetTrafficSourceSectionV1Controller@index'); Route::get('statistics', 'app\cunkebao\controller\traffic\GetPoolStatisticsV1Controller@index'); + + + Route::get('list', 'app\cunkebao\controller\TrafficController@getList'); }); // 工作台相关