|
|
@@ -74,6 +74,12 @@ use Hyperf\Amqp\Producer;
|
|
|
use App\Amqp\Producer\MqProducer;
|
|
|
use App\Model\Web;
|
|
|
|
|
|
+
|
|
|
+use App\Model\GroupMemberImp;
|
|
|
+use App\Model\GroupImp;
|
|
|
+use App\Model\GroupTalkImp;
|
|
|
+use App\Model\GroupTalkMessagerImp;
|
|
|
+
|
|
|
#[RpcService(name: "NewsService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
|
class NewsService implements NewsServiceInterface
|
|
|
{
|
|
|
@@ -815,6 +821,19 @@ class NewsService implements NewsServiceInterface
|
|
|
public function upArticleStatus(array $data): array
|
|
|
{
|
|
|
$articleData = Article::where(['id' => $data['id']])->first();
|
|
|
+ //发送10次
|
|
|
+ for ($i = 0; $i < 10; $i++) {
|
|
|
+ $this->sendMessage([
|
|
|
+ 'talk_type' => 100,
|
|
|
+ 'title' => $i . $articleData['title'],
|
|
|
+ 'content' => '审核通过',
|
|
|
+ 'messageType' => 2,
|
|
|
+ 'user_id' => $articleData['admin_user_id'],
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ var_dump($data['status'], 'status');
|
|
|
+ return Result::success();
|
|
|
+
|
|
|
if ($data['status'] == 1) {
|
|
|
$this->sendMessage([
|
|
|
'talk_type' => 101,
|
|
|
@@ -4206,6 +4225,7 @@ class NewsService implements NewsServiceInterface
|
|
|
|
|
|
public function getNoticeList(array $data): array
|
|
|
{
|
|
|
+
|
|
|
$where = [];
|
|
|
//title
|
|
|
if (isset($data['title']) && !empty($data['title'])) {
|
|
|
@@ -4743,8 +4763,11 @@ class NewsService implements NewsServiceInterface
|
|
|
if (empty($notice)) {
|
|
|
return Result::error("公告不存在", 0);
|
|
|
}
|
|
|
+ //$chat_ids 去除掉$data['user_id']
|
|
|
+ $chat_ids = json_decode($notice['re_user_ids'], true);
|
|
|
+ $chat_ids = array_diff($chat_ids, [$notice['user_id']]);
|
|
|
//如果公告的状态是2,且是群聊公告,且状态是1,则创建群聊,第一次审核通过的时候处理成群聊
|
|
|
- if ($data['status'] == 2 && $notice['is_group'] == 1 && $notice['status'] == 1 && empty($notice['group_id'])) {
|
|
|
+ if ($data['status'] == 2 && $notice['is_group'] == 1 && ($notice['status'] == 1 || $notice['status'] == 3) && empty($notice['group_id'])) {
|
|
|
//chat_group
|
|
|
$group_id = PublicData::uuid();
|
|
|
$groupData = [
|
|
|
@@ -4754,7 +4777,6 @@ class NewsService implements NewsServiceInterface
|
|
|
'profile' => $notice['profile'] ?? 0,
|
|
|
];
|
|
|
var_dump($groupData, '-----------------groupData-------');
|
|
|
-
|
|
|
$groupResult = ChatGroups::insertGetId($groupData);
|
|
|
var_dump($groupResult, '-----------------groupid-------');
|
|
|
$groupMemberData = [
|
|
|
@@ -4764,9 +4786,7 @@ class NewsService implements NewsServiceInterface
|
|
|
'leader' => 2,
|
|
|
];
|
|
|
$groupMemberResult = ChatGroupsMember::insertGetId($groupMemberData);
|
|
|
- //$chat_ids 去除掉$data['user_id']
|
|
|
- $chat_ids = json_decode($notice['re_user_ids'], true);
|
|
|
- $chat_ids = array_diff($chat_ids, [$notice['user_id']]);
|
|
|
+
|
|
|
//插入群成员表
|
|
|
$groupMemberDataUser = [];
|
|
|
$chatData = [];
|
|
|
@@ -4801,11 +4821,67 @@ class NewsService implements NewsServiceInterface
|
|
|
];
|
|
|
var_dump($chatData, '-----------------chatData-------');
|
|
|
$chatResult = ChatRecords::insert($chatData);
|
|
|
-
|
|
|
+ //处理imp
|
|
|
+ $group = [
|
|
|
+ 'type' => 1,
|
|
|
+ 'name' => $notice['group_name'] ?? '',
|
|
|
+ 'profile' => '',
|
|
|
+ 'avatar' => '',
|
|
|
+ 'creator_id' => $notice['user_id'],
|
|
|
+ ];
|
|
|
+ $groupResult = GroupImp::insertGetId($group);
|
|
|
+ var_dump($groupResult, '获取imp group_id');
|
|
|
+ $groupMember = [
|
|
|
+ 'user_id' => $notice['user_id'],
|
|
|
+ 'group_id' => $groupResult,
|
|
|
+ 'leader' => 1,
|
|
|
+ 'join_time' => Date('Y-m-d H:i:s')
|
|
|
+ ];
|
|
|
+ $groupMemberResult = GroupMemberImp::insertGetId($groupMember);
|
|
|
+ $talk_session = [
|
|
|
+ 'user_id' => $notice['user_id'],
|
|
|
+ 'to_from_id' => $groupResult,
|
|
|
+ 'talk_mode' => 2,
|
|
|
+ 'created_at' => Date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at' => Date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ $talk_session_result = GroupTalkImp::insertGetId($talk_session);
|
|
|
+ //被通知人员处理
|
|
|
+ foreach ($chat_ids as $key => $value) {
|
|
|
+ $groupMemberdata[] = [
|
|
|
+ 'user_id' => $value,
|
|
|
+ 'group_id' => $groupResult,
|
|
|
+ 'leader' => 3,
|
|
|
+ 'join_time' => Date('Y-m-d H:i:s')
|
|
|
+ ];
|
|
|
+ $talk_sessionData[] = [
|
|
|
+ 'user_id' => $value,
|
|
|
+ 'to_from_id' => $groupResult,
|
|
|
+ 'talk_mode' => 2,
|
|
|
+ 'created_at' => Date('Y-m-d H:i:s'),
|
|
|
+ 'updated_at' => Date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ $groupResult1 = GroupMemberImp::insert($groupMemberdata);
|
|
|
+ $talk_sessionResult = GroupTalkImp::insert($talk_sessionData);
|
|
|
+ $group_id = $groupResult;
|
|
|
//更新result的 group_id
|
|
|
$data['group_id'] = $group_id;
|
|
|
Notice::where(['id' => $data['id']])->update($data);
|
|
|
}
|
|
|
+ if (($data['status'] == 1 || $data['status'] == 3) && $notice['is_group'] == 1 && $notice['status'] == 2 && !empty($notice['group_id'])) {
|
|
|
+ //删除掉信息
|
|
|
+ GroupImp::where('id', $notice['group_id'])->delete();
|
|
|
+ GroupMemberImp::where('group_id', $notice['group_id'])->delete();
|
|
|
+ GroupTalkImp::where('to_from_id', $notice['group_id'])->delete();
|
|
|
+ foreach ($chat_ids as $key => $value) {
|
|
|
+ }
|
|
|
+ //聊天记录删除
|
|
|
+
|
|
|
+ //如果是群聊公告,且已经有群聊id,则更新公告的group_id
|
|
|
+ $data['group_id'] = null;
|
|
|
+ Notice::where(['id' => $data['id']])->update($data);
|
|
|
+ }
|
|
|
$result = Notice::where('id', $data['id'])->update($data);
|
|
|
$noticeInfo = Notice::where('id', $data['id'])->first();
|
|
|
if ($data['status'] == 2) {
|
|
|
@@ -4886,7 +4962,6 @@ class NewsService implements NewsServiceInterface
|
|
|
|
|
|
//20250226 产品列表
|
|
|
|
|
|
-
|
|
|
// 20250306 -------招聘--------fr
|
|
|
/*
|
|
|
* 招聘列表
|