- {allocationRecords.length > 0 ? (
- allocationRecords.map(record => (
-
-
-
-
-
- {record.accountName}
+ {loading && allocationRecords.length === 0 ? (
+
+ ) : allocationRecords.length > 0 ? (
+ <>
+ {allocationRecords.map(record => {
+ // 从remarks中提取账号信息,格式可能是 "账号名 - 其他信息" 或直接是账号名
+ const accountName = record.remarks || `账号${record.wechatAccountId || record.id}`;
+
+ return (
+
+
+
+
+
+ {accountName}
+
+
+ {formatDateTime(record.createTime)}
+
+
-
- {record.createTime}
+
+ +{formatNumber(Math.abs(record.tokens))}
-
-
- {record.amount}
-
-
- ))
+ );
+ })}
+
+ >
) : (
暂无分配记录
diff --git a/Cunkebao/src/pages/mobile/mine/wechat-accounts/detail/api.ts b/Cunkebao/src/pages/mobile/mine/wechat-accounts/detail/api.ts
index 7a9a1ce3..10dfb60a 100644
--- a/Cunkebao/src/pages/mobile/mine/wechat-accounts/detail/api.ts
+++ b/Cunkebao/src/pages/mobile/mine/wechat-accounts/detail/api.ts
@@ -49,6 +49,8 @@ export function transferWechatFriends(params: {
wechatId: string;
devices: number[];
inherit: boolean;
+ greeting?: string;
+ firstMessage?: string;
}) {
return request("/v1/wechats/transfer-friends", params, "POST");
}
diff --git a/Cunkebao/src/pages/mobile/mine/wechat-accounts/detail/index.tsx b/Cunkebao/src/pages/mobile/mine/wechat-accounts/detail/index.tsx
index 333eb353..1f6e9e28 100644
--- a/Cunkebao/src/pages/mobile/mine/wechat-accounts/detail/index.tsx
+++ b/Cunkebao/src/pages/mobile/mine/wechat-accounts/detail/index.tsx
@@ -47,6 +47,8 @@ const WechatAccountDetail: React.FC = () => {
const [showTransferConfirm, setShowTransferConfirm] = useState(false);
const [selectedDevices, setSelectedDevices] = useState
([]);
const [inheritInfo, setInheritInfo] = useState(true);
+ const [greeting, setGreeting] = useState("");
+ const [firstMessage, setFirstMessage] = useState("");
const [transferLoading, setTransferLoading] = useState(false);
const [searchQuery, setSearchQuery] = useState("");
const [activeTab, setActiveTab] = useState("overview");
@@ -294,6 +296,10 @@ const WechatAccountDetail: React.FC = () => {
const handleTransferFriends = () => {
setSelectedDevices([]);
setInheritInfo(true);
+ // 设置默认打招呼内容,使用当前微信账号昵称
+ const nickname = accountInfo?.nickname || "未知";
+ setGreeting(`这个是${nickname}的新号,之前那个号没用了,重新加一下您`);
+ setFirstMessage("");
setShowTransferConfirm(true);
};
@@ -321,7 +327,9 @@ const WechatAccountDetail: React.FC = () => {
await transferWechatFriends({
wechatId: id,
devices: selectedDevices.map(device => device.id),
- inherit: inheritInfo
+ inherit: inheritInfo,
+ greeting: greeting.trim(),
+ firstMessage: firstMessage.trim()
});
Toast.show({
@@ -330,6 +338,7 @@ const WechatAccountDetail: React.FC = () => {
});
setShowTransferConfirm(false);
setSelectedDevices([]);
+ setFirstMessage("");
navigate("/scenarios");
} catch (error) {
console.error("好友转移失败:", error);
@@ -1049,6 +1058,38 @@ const WechatAccountDetail: React.FC = () => {
+
+ {/* 打招呼 */}
+
+
打招呼
+
+ setGreeting(e.target.value)}
+ rows={3}
+ maxLength={200}
+ showCount
+ style={{ resize: "none" }}
+ />
+
+
+
+ {/* 通过后首次消息 */}
+
+
好友通过后的首次消息
+
+ setFirstMessage(e.target.value)}
+ rows={3}
+ maxLength={200}
+ showCount
+ style={{ resize: "none" }}
+ />
+
+
@@ -1068,6 +1109,10 @@ const WechatAccountDetail: React.FC = () => {
onClick={() => {
setShowTransferConfirm(false);
setSelectedDevices([]);
+ // 重置为默认打招呼内容
+ const nickname = accountInfo?.nickname || "未知";
+ setGreeting(`这个是${nickname}的新号,之前那个号没用了,重新加一下您`);
+ setFirstMessage("");
}}
>
取消
diff --git a/Server/application/chukebao/controller/AccountsController.php b/Server/application/chukebao/controller/AccountsController.php
index c69d9534..d65e998d 100644
--- a/Server/application/chukebao/controller/AccountsController.php
+++ b/Server/application/chukebao/controller/AccountsController.php
@@ -29,6 +29,7 @@ class AccountsController extends BaseController
$query = Db::table('s2_company_account')
->alias('a')
+ ->join('users u', 'a.id = u.s2_accountId')
->where([
['a.departmentId', '=', $companyId],
['a.status', '=', 0],
@@ -48,6 +49,7 @@ class AccountsController extends BaseController
$total = (clone $query)->count();
$list = $query->field([
'a.id',
+ 'u.id as uid',
'a.userName',
'a.realName',
'a.nickname',
diff --git a/Server/application/chukebao/controller/AiChatController.php b/Server/application/chukebao/controller/AiChatController.php
index 4090d578..7b4dd78e 100644
--- a/Server/application/chukebao/controller/AiChatController.php
+++ b/Server/application/chukebao/controller/AiChatController.php
@@ -562,7 +562,7 @@ class AiChatController extends BaseController
$data = [
'tokens' => $tokenCount * 20,
'type' => 0,
- 'form' => 1,
+ 'form' => 13,
'wechatAccountId' => $params['wechatAccountId'],
'friendIdOrGroupId' => $params['friendId'],
'remarks' => $remarks,
@@ -816,7 +816,7 @@ class AiChatController extends BaseController
$data = [
'tokens' => $res['data']['token'],
'type' => 0,
- 'form' => 1,
+ 'form' => 13,
'wechatAccountId' => $wechatAccountId,
'friendIdOrGroupId' => $friendId,
'remarks' => $remarks,
diff --git a/Server/application/chukebao/controller/TokensRecordController.php b/Server/application/chukebao/controller/TokensRecordController.php
index af49f99a..03b7a2ee 100644
--- a/Server/application/chukebao/controller/TokensRecordController.php
+++ b/Server/application/chukebao/controller/TokensRecordController.php
@@ -100,9 +100,6 @@ class TokensRecordController extends BaseController
return ResponseHelper::error('类型参数错误,0为减少,1为增加');
}
- if (!in_array($form, [0, 1, 2, 3, 4, 5])) {
- return ResponseHelper::error('来源参数错误');
- }
// 重试机制,最多重试3次
$maxRetries = 3;
@@ -130,7 +127,7 @@ class TokensRecordController extends BaseController
Db::startTrans();
try {
// 使用悲观锁获取用户当前tokens余额,确保并发安全
- $userInfo = TokensCompany::where('companyId', $companyId)->lock(true)->find();
+ $userInfo = TokensCompany::where(['companyId'=> $companyId,'userId' => $userId])->lock(true)->find();
if (!$userInfo) {
throw new \Exception('用户不存在');
}
diff --git a/Server/application/chukebao/controller/WechatChatroomController.php b/Server/application/chukebao/controller/WechatChatroomController.php
index 8461904b..9c33baed 100644
--- a/Server/application/chukebao/controller/WechatChatroomController.php
+++ b/Server/application/chukebao/controller/WechatChatroomController.php
@@ -185,7 +185,7 @@ class WechatChatroomController extends BaseController
$data = [
'tokens' => $res['data']['token'],
'type' => 0,
- 'form' => 3,
+ 'form' => 14,
'wechatAccountId' => $wechatAccountId,
'friendIdOrGroupId' => $groupId,
'remarks' => $remarks,
diff --git a/Server/application/common/controller/Attachment.php b/Server/application/common/controller/Attachment.php
index 39e7984f..b3ffabbf 100644
--- a/Server/application/common/controller/Attachment.php
+++ b/Server/application/common/controller/Attachment.php
@@ -51,7 +51,8 @@ class Attachment extends Controller
'data' => [
'id' => $existFile['id'],
'name' => $existFile['name'],
- 'url' => $existFile['source']
+ 'url' => $existFile['source'],
+ 'size' => isset($existFile['size']) ? $existFile['size'] : 0
]
]);
}
@@ -97,7 +98,8 @@ class Attachment extends Controller
'data' => [
'id' => $attachment->id,
'name' => $attachmentData['name'],
- 'url' => $attachmentData['source']
+ 'url' => $attachmentData['source'],
+ 'size' => $attachmentData['size']
]
]);
diff --git a/Server/application/common/controller/PaymentService.php b/Server/application/common/controller/PaymentService.php
index 7df8f23d..c8a030e6 100644
--- a/Server/application/common/controller/PaymentService.php
+++ b/Server/application/common/controller/PaymentService.php
@@ -9,6 +9,7 @@ use app\common\util\PaymentUtil;
use think\facade\Env;
use think\facade\Request;
use app\common\model\Order;
+use app\common\model\User;
/**
* 支付服务(内部调用)
@@ -495,6 +496,13 @@ class PaymentService
switch ($order['orderType']) {
case 1:
// 处理购买算力
+ // 查询用户信息,判断是否为管理员(需要同时匹配userId和companyId)
+ $user = User::where([
+ 'id' => $order->userId,
+ 'companyId' => $order->companyId
+ ])->find();
+ $isAdmin = (!empty($user) && isset($user->isAdmin) && $user->isAdmin == 1) ? 1 : 0;
+
$token = TokensCompany::where(['companyId' => $order->companyId,'userId' => $order->userId])->find();
$goodsSpecs = json_decode($order->goodsSpecs, true);
if (!empty($token)) {
@@ -507,6 +515,7 @@ class PaymentService
$tokensCompany->userId = $order->userId;
$tokensCompany->companyId = $order->companyId;
$tokensCompany->tokens = $goodsSpecs['tokens'];
+ $tokensCompany->isAdmin = $isAdmin;
$tokensCompany->createTime = time();
$tokensCompany->updateTime = time();
$tokensCompany->save();
diff --git a/Server/application/cunkebao/config/route.php b/Server/application/cunkebao/config/route.php
index 056667da..041d596a 100644
--- a/Server/application/cunkebao/config/route.php
+++ b/Server/application/cunkebao/config/route.php
@@ -130,6 +130,7 @@ Route::group('v1/', function () {
Route::get('get-item-detail', 'app\cunkebao\controller\ContentLibraryController@getItemDetail'); // 获取内容库素材详情
Route::post('update-item', 'app\cunkebao\controller\ContentLibraryController@updateItem'); // 更新内容库素材
Route::any('aiEditContent', 'app\cunkebao\controller\ContentLibraryController@aiEditContent');
+ Route::post('import-excel', 'app\cunkebao\controller\ContentLibraryController@importExcel'); // 导入Excel表格(支持图片)
});
// 好友相关
@@ -162,6 +163,7 @@ Route::group('v1/', function () {
Route::get('queryOrder', 'app\cunkebao\controller\TokensController@queryOrder'); // 查询订单(扫码付款)
Route::get('orderList', 'app\cunkebao\controller\TokensController@getOrderList'); // 获取订单列表
Route::get('statistics', 'app\cunkebao\controller\TokensController@getTokensStatistics'); // 获取算力统计
+ Route::post('allocate', 'app\cunkebao\controller\TokensController@allocateTokens'); // 分配token(仅管理员)
});
diff --git a/Server/application/cunkebao/controller/StatsController.php b/Server/application/cunkebao/controller/StatsController.php
index 3855da66..ecbd26e7 100644
--- a/Server/application/cunkebao/controller/StatsController.php
+++ b/Server/application/cunkebao/controller/StatsController.php
@@ -29,7 +29,7 @@ class StatsController extends Controller
$where = [
['departmentId','=',$this->request->userInfo['companyId']]
];
- if (!empty($this->request->userInfo['isAdmin'])){
+ if (empty($this->request->userInfo['isAdmin'])){
$where[] = ['id','=',$this->request->userInfo['s2_accountId']];
}
$accounts = Db::table('s2_company_account')->where($where)->column('id');
@@ -407,7 +407,7 @@ class StatsController extends Controller
$where = [
['departmentId','=',$companyId]
];
- if (!empty($this->request->userInfo['isAdmin'])){
+ if (empty($this->request->userInfo['isAdmin'])){
$where[] = ['id','=',$this->request->userInfo['s2_accountId']];
}
$accounts = Db::table('s2_company_account')->where($where)->column('id');
diff --git a/Server/application/cunkebao/controller/TokensController.php b/Server/application/cunkebao/controller/TokensController.php
index 6594f577..8934c3cf 100644
--- a/Server/application/cunkebao/controller/TokensController.php
+++ b/Server/application/cunkebao/controller/TokensController.php
@@ -4,10 +4,12 @@ namespace app\cunkebao\controller;
use app\common\controller\PaymentService;
use app\common\model\Order;
+use app\common\model\User;
use app\cunkebao\model\TokensPackage;
use app\chukebao\model\TokensCompany;
use app\chukebao\model\TokensRecord;
use library\ResponseHelper;
+use think\Db;
use think\facade\Env;
class TokensController extends BaseController
@@ -149,6 +151,7 @@ class TokensController extends BaseController
// 构建查询条件
$where = [
+ ['userId', '=', $userId],
['companyId', '=', $companyId]
];
@@ -257,13 +260,14 @@ class TokensController extends BaseController
public function getTokensStatistics()
{
try {
+ $userId = $this->getUserInfo('id');
$companyId = $this->getUserInfo('companyId');
if (empty($companyId)) {
return ResponseHelper::error('公司信息获取失败');
}
// 获取公司算力余额
- $tokensCompany = TokensCompany::where('companyId', $companyId)->find();
+ $tokensCompany = TokensCompany::where(['companyId' => $companyId,'userId' => $userId])->find();
$remainingTokens = $tokensCompany ? intval($tokensCompany->tokens) : 0;
// 获取今日开始和结束时间戳
@@ -276,6 +280,7 @@ class TokensController extends BaseController
// 统计今日消费(type=0表示消费)
$todayUsed = TokensRecord::where([
+ ['userId', '=', $userId],
['companyId', '=', $companyId],
['type', '=', 0], // 0为减少(消费)
['createTime', '>=', $todayStart],
@@ -285,6 +290,7 @@ class TokensController extends BaseController
// 统计本月消费
$monthUsed = TokensRecord::where([
+ ['userId', '=', $userId],
['companyId', '=', $companyId],
['type', '=', 0], // 0为减少(消费)
['createTime', '>=', $monthStart],
@@ -294,6 +300,7 @@ class TokensController extends BaseController
// 计算总算力(当前剩余 + 历史总消费)
$totalConsumed = TokensRecord::where([
+ ['userId', '=', $userId],
['companyId', '=', $companyId],
['type', '=', 0]
])->sum('tokens');
@@ -301,13 +308,14 @@ class TokensController extends BaseController
// 总充值算力
$totalRecharged = TokensRecord::where([
+ ['userId', '=', $userId],
['companyId', '=', $companyId],
['type', '=', 1] // 1为增加(充值)
])->sum('tokens');
$totalRecharged = intval($totalRecharged);
// 计算预计可用天数(基于过去一个月的平均消耗)
- $estimatedDays = $this->calculateEstimatedDays($companyId, $remainingTokens);
+ $estimatedDays = $this->calculateEstimatedDays($userId,$companyId, $remainingTokens);
return ResponseHelper::success([
'totalTokens' => $totalRecharged, // 总算力(累计充值)
@@ -325,11 +333,12 @@ class TokensController extends BaseController
/**
* 计算预计可用天数(基于过去一个月的平均消耗)
+ * @param int $userId 用户ID
* @param int $companyId 公司ID
* @param int $remainingTokens 当前剩余算力
* @return int 预计可用天数,-1表示无法计算(无消耗记录或余额为0)
*/
- private function calculateEstimatedDays($companyId, $remainingTokens)
+ private function calculateEstimatedDays($userId,$companyId, $remainingTokens)
{
// 如果余额为0或负数,无法计算
if ($remainingTokens <= 0) {
@@ -340,6 +349,7 @@ class TokensController extends BaseController
$oneMonthAgo = time() - (30 * 24 * 60 * 60); // 30天前的时间戳
$totalConsumed = TokensRecord::where([
+ ['userId', '=', $userId],
['companyId', '=', $companyId],
['type', '=', 0], // 只统计减少的记录
['createTime', '>=', $oneMonthAgo]
@@ -365,4 +375,161 @@ class TokensController extends BaseController
return $estimatedDays;
}
+
+ /**
+ * 分配token(仅管理员可用)
+ * @return \think\response\Json
+ */
+ public function allocateTokens()
+ {
+ try {
+ $userId = $this->getUserInfo('id');
+ $companyId = $this->getUserInfo('companyId');
+ $targetUserId = (int)$this->request->param('targetUserId', 0);
+ $tokens = (int)$this->request->param('tokens', 0);
+ $remarks = $this->request->param('remarks', '');
+
+ // 验证参数
+ if (empty($targetUserId)) {
+ return ResponseHelper::error('目标用户ID不能为空');
+ }
+
+ if ($tokens <= 0) {
+ return ResponseHelper::error('分配的token数量必须大于0');
+ }
+
+ if (empty($companyId)) {
+ return ResponseHelper::error('公司信息获取失败');
+ }
+
+ // 验证当前用户是否为管理员
+ $currentUser = User::where([
+ 'id' => $userId,
+ 'companyId' => $companyId
+ ])->find();
+
+ if (empty($currentUser)) {
+ return ResponseHelper::error('用户信息不存在');
+ }
+
+ if (empty($currentUser->isAdmin) || $currentUser->isAdmin != 1) {
+ return ResponseHelper::error('只有管理员才能分配token');
+ }
+
+ // 验证目标用户是否存在且属于同一公司
+ $targetUser = User::where([
+ 'id' => $targetUserId,
+ 'companyId' => $companyId
+ ])->find();
+
+ if (empty($targetUser)) {
+ return ResponseHelper::error('目标用户不存在或不属于同一公司');
+ }
+
+ // 检查分配者的token余额
+ $allocatorTokens = TokensCompany::where([
+ 'companyId' => $companyId,
+ 'userId' => $userId
+ ])->find();
+
+ $allocatorBalance = $allocatorTokens ? intval($allocatorTokens->tokens) : 0;
+
+ if ($allocatorBalance < $tokens) {
+ return ResponseHelper::error('token余额不足,当前余额:' . $allocatorBalance);
+ }
+
+ // 开始事务
+ Db::startTrans();
+
+ try {
+ // 1. 减少分配者的token
+ if (!empty($allocatorTokens)) {
+ $allocatorTokens->tokens = $allocatorBalance - $tokens;
+ $allocatorTokens->updateTime = time();
+ $allocatorTokens->save();
+ $allocatorNewBalance = $allocatorTokens->tokens;
+ } else {
+ // 如果分配者没有记录,创建一条(余额为0)
+ $allocatorTokens = new TokensCompany();
+ $allocatorTokens->userId = $userId;
+ $allocatorTokens->companyId = $companyId;
+ $allocatorTokens->tokens = 0;
+ $allocatorTokens->isAdmin = 1;
+ $allocatorTokens->createTime = time();
+ $allocatorTokens->updateTime = time();
+ $allocatorTokens->save();
+ $allocatorNewBalance = 0;
+ }
+
+ // 2. 记录分配者的减少记录
+ $targetUserAccount = $targetUser->account ?? $targetUser->phone ?? '用户ID[' . $targetUserId . ']';
+ $allocatorRecord = new TokensRecord();
+ $allocatorRecord->companyId = $companyId;
+ $allocatorRecord->userId = $userId;
+ $allocatorRecord->type = 0; // 0为减少
+ $allocatorRecord->form = 1001; // 1001表示分配
+ $allocatorRecord->wechatAccountId = 0;
+ $allocatorRecord->friendIdOrGroupId = $targetUserId;
+ $allocatorRecord->remarks = !empty($remarks) ? $remarks : '分配给' . $targetUserAccount;
+ $allocatorRecord->tokens = $tokens;
+ $allocatorRecord->balanceTokens = $allocatorNewBalance;
+ $allocatorRecord->createTime = time();
+ $allocatorRecord->save();
+
+ // 3. 增加接收者的token
+ $receiverTokens = TokensCompany::where([
+ 'companyId' => $companyId,
+ 'userId' => $targetUserId
+ ])->find();
+
+ if (!empty($receiverTokens)) {
+ $receiverTokens->tokens = intval($receiverTokens->tokens) + $tokens;
+ $receiverTokens->updateTime = time();
+ $receiverTokens->save();
+ $receiverNewBalance = $receiverTokens->tokens;
+ } else {
+ // 如果接收者没有记录,创建一条
+ $receiverTokens = new TokensCompany();
+ $receiverTokens->userId = $targetUserId;
+ $receiverTokens->companyId = $companyId;
+ $receiverTokens->tokens = $tokens;
+ $receiverTokens->isAdmin = (!empty($targetUser->isAdmin) && $targetUser->isAdmin == 1) ? 1 : 0;
+ $receiverTokens->createTime = time();
+ $receiverTokens->updateTime = time();
+ $receiverTokens->save();
+ $receiverNewBalance = $tokens;
+ }
+
+ // 4. 记录接收者的增加记录
+ $adminAccount = $currentUser->account ?? $currentUser->phone ?? '管理员';
+ $receiverRecord = new TokensRecord();
+ $receiverRecord->companyId = $companyId;
+ $receiverRecord->userId = $targetUserId;
+ $receiverRecord->type = 1; // 1为增加
+ $receiverRecord->form = 1001; // 1001表示分配
+ $receiverRecord->wechatAccountId = 0;
+ $receiverRecord->friendIdOrGroupId = $userId;
+ $receiverRecord->remarks = !empty($remarks) ? '管理员分配:' . $remarks : '管理员分配';
+ $receiverRecord->tokens = $tokens;
+ $receiverRecord->balanceTokens = $receiverNewBalance;
+ $receiverRecord->createTime = time();
+ $receiverRecord->save();
+
+ Db::commit();
+
+ return ResponseHelper::success([
+ 'allocatorBalance' => $allocatorNewBalance,
+ 'receiverBalance' => $receiverNewBalance,
+ 'allocatedTokens' => $tokens
+ ], '分配成功');
+
+ } catch (\Exception $e) {
+ Db::rollback();
+ return ResponseHelper::error('分配失败:' . $e->getMessage());
+ }
+
+ } catch (\Exception $e) {
+ return ResponseHelper::error('分配失败:' . $e->getMessage());
+ }
+ }
}
\ No newline at end of file
diff --git a/Server/application/cunkebao/controller/wechat/PostTransferFriends.php b/Server/application/cunkebao/controller/wechat/PostTransferFriends.php
index 6bb0007a..99ef4d7b 100644
--- a/Server/application/cunkebao/controller/wechat/PostTransferFriends.php
+++ b/Server/application/cunkebao/controller/wechat/PostTransferFriends.php
@@ -13,9 +13,12 @@ class PostTransferFriends extends BaseController
{
$wechatId = $this->request->param('wechatId', '');
$inherit = $this->request->param('inherit', '');
+ $greeting = $this->request->param('greeting', '');
+ $firstMessage = $this->request->param('firstMessage', '');
$devices = $this->request->param('devices', []);
$companyId = $this->getUserInfo('companyId');
+
if (empty($wechatId)){
return ResponseHelper::error('迁移的微信不能为空');
}
@@ -23,13 +26,16 @@ class PostTransferFriends extends BaseController
if (empty($devices)){
return ResponseHelper::error('迁移的设备不能为空');
}
+ if (empty($greeting)){
+ return ResponseHelper::error('打招呼不能为空');
+ }
if (!is_array($devices)){
return ResponseHelper::error('迁移的设备必须为数组');
}
$wechat = Db::name('wechat_customer')->alias('wc')
->join('wechat_account wa', 'wc.wechatId = wa.wechatId')
- ->where(['wc.wechatId' => $wechatId, 'wc.companyId' => $companyId])
+ ->where(['wc.wechatId' => $wechatId])
->field('wa.*')
->find();
@@ -53,11 +59,6 @@ class PostTransferFriends extends BaseController
'id' => 'poster-3',
'name' => '点击咨询',
'src' => 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/%E7%82%B9%E5%87%BB%E5%92%A8%E8%AF%A2-FTiyAMAPop2g9LvjLOLDz0VwPg3KVu.gif'
- ],
- '$posters' => [
- 'id' => 'poster-3',
- 'name' => '点击咨询',
- 'src' => 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/%E7%82%B9%E5%87%BB%E5%92%A8%E8%AF%A2-FTiyAMAPop2g9LvjLOLDz0VwPg3KVu.gif'
]
];
$reqConf = [
@@ -66,18 +67,38 @@ class PostTransferFriends extends BaseController
'endTime' => '18:00',
'remarkType' => 'phone',
'addFriendInterval' => 60,
- 'greeting' => '您好,我是'. $wechat['nickname'] .'的辅助客服,请通过'
+ 'greeting' => !empty($greeting) ? $greeting :'这个是'. $wechat['nickname'] .'的新号,之前那个号没用了,重新加一下您'
];
+ if (!empty($firstMessage)){
+ $msgConf = [
+ [
+ 'day' => 0,
+ 'messages' => [
+ [
+ 'id' => 1,
+ 'type' => 'text',
+ 'content' => $firstMessage,
+ 'intervalUnit' => 'seconds',
+ 'sendInterval' => 5,
+ ]
+ ]
+ ]
+ ];
+ }else{
+ $msgConf = [];
+ }
+
// 使用容器获取控制器实例,而不是直接实例化
$createAddFriendPlan = app('app\cunkebao\controller\plan\PostCreateAddFriendPlanV1Controller');
$taskId = Db::name('customer_acquisition_task')->insertGetId([
'name' => '迁移好友('. $wechat['nickname'] .')',
'sceneId' => 10,
- 'sceneConf' => json_encode($sceneConf),
- 'reqConf' => json_encode($reqConf),
+ 'sceneConf' => json_encode($sceneConf,256),
+ 'reqConf' => json_encode($reqConf,256),
'tagConf' => json_encode([]),
+ 'msgConf' => json_encode($msgConf,256),
'userId' => $this->getUserInfo('id'),
'companyId' => $companyId,
'status' => 0,