| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace App\Http\Controllers\Api\stock;
- use App\Http\Controllers\Api\driverApp;
- use App\Services\Api\MessageService;
- /**
- * 消息管理
- * Class MessageController
- * @package App\Http\Controllers\Api
- */
- class MessageController extends driverApp
- {
- /**
- * 站内消息窗口记录
- * @return array
- */
- public function index()
- {
- $kw = request()->post('kw','');
- $datas = MessageService::make()->getGroupList($this->driverId,2, $kw);
- return message(1010, true, $datas);
- }
- /**
- * 站内推送消息历史
- * @return array|mixed
- */
- public function history()
- {
- $params = request()->post();
- $pageSize = request()->post('pageSize', 20);
- $params['user_type'] = 2;
- $datas = MessageService::make()->getDataList($this->driverId, $params, $pageSize);
- return message(1010, true, $datas);
- }
- /**
- * 消息参数
- * @return array
- */
- public function getSetting()
- {
- $datas = MessageService::make()->getMessageSetting($this->driverId,2);
- if(empty($datas)){
- $datas = [
- 'receive_app'=> 1,
- 'receive_custom'=> 1,
- 'receive_order'=> 1,
- 'receive_account'=> 1,
- ];
- }
- return message(1010, true, $datas);
- }
- /**
- * 修改消息设置参数
- * @return array
- */
- public function setSetting()
- {
- $params = request()->post();
- if(!$result = MessageService::make()->setSetting($this->driverId, $params,2)){
- return message(1020, false);
- }else{
- return message(1019, true);
- }
- }
- /**
- * 设置已读
- * @return array
- */
- public function setRead()
- {
- $params = request()->all();
- $type = isset($params['type'])? intval($params['type']) : 1;
- if(!$result = MessageService::make()->setRead($this->driverId, $type, 2)){
- return message(1020, false);
- }else{
- return message(1019, true);
- }
- return message(1020, false);
- }
- }
|