12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * Created by PhpStorm.
- * User: shensong
- * Date: 2022/11/14
- * Time: 17:05
- */
- namespace App\Http\Controllers\Api;
- use App\Http\Controllers\Controller;
- use App\Service\ChatGroup\ChatGroupMassMsgService;
- use Illuminate\Http\Request;
- class ChatGroupMsgController extends Controller
- {
- public function getMessage(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required|string',
- 'rule_id' => 'required|integer',
- 'chat_id' => 'required',
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $params['corpid'] = $request->input('corpid');
- $params['rule_id'] = $request->input('rule_id');
- $params['chat_id'] = $request->input('chat_id');
- # 消息处理成可发送的数据结构
- $errno = 0;
- $msgInfo = ChatGroupMassMsgService::getChatMessage($params, $errno);
- if($errno) return self::returnValue([], $errno);
- return self::returnValue(['data' => $msgInfo]);
- }
- public function report(Request $request)
- {
- $validator = \Validator::make($request->all(),[
- 'corpid' => 'required',
- 'chat_id' => 'required',
- 'rule_id' => 'required|integer'
- ]);
- if ($validator->fails()) {
- return self::returnValue($validator->getMessageBag(), 1102);
- }
- $params['corpid'] = $request->input('corpid');
- $params['chat_id'] = $request->input('chat_id');
- $params['rule_id'] = $request->input('rule_id');
- $params['status'] = $request->input('status', 1);
- $type = $request->input('type', 1);
- $errmsg = $request->input('errmsg');
- $errno = 0;
- ChatGroupMassMsgService::report($params, $errno, $type, $errmsg);
- return self::returnValue([], $errno);
- }
- }
|