|
...
|
...
|
@@ -2,7 +2,55 @@ |
|
|
|
|
|
|
|
namespace App\Http\Controllers\Bside;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Logic\Bside\MailLogic;
|
|
|
|
use App\Models\Mail as MailModel;
|
|
|
|
use App\Models\MailUser as MailUserModel;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
class MailController extends BaseController
|
|
|
|
{
|
|
|
|
const STATUS_ZERO = 0; //状态为未读状态
|
|
|
|
const STATUS_ONE = 1; //状态为已读状态
|
|
|
|
/**
|
|
|
|
* @name :当前用户站内信列表
|
|
|
|
* @return void
|
|
|
|
* @author :liyuhang
|
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function lists(){
|
|
|
|
$mailModel = new MailModel();
|
|
|
|
//获取当前用户下的所有站内信
|
|
|
|
$this->map['user_list'] = ['like','%,'.$this->uid.',%'];
|
|
|
|
$this->map['status'] = $this::STATUS_ZERO;
|
|
|
|
$lists = $mailModel->lists($this->map,$this->page,$this->row);
|
|
|
|
if(!empty($lists)){
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
//获取用户已读还是未读
|
|
|
|
$info = MailUserModel::read(['mail_id'=>$v['id'],'user_id'=>$this->uid]);
|
|
|
|
if($info !== false){
|
|
|
|
$v['read_status'] = $this::STATUS_ONE;//
|
|
|
|
}
|
|
|
|
$lists[$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->response('success',Code::SUCCESS,$lists);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :获取站内信详情
|
|
|
|
* @return void
|
|
|
|
* @author :liyuhang
|
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function info(Request $request,MailLogic $mailLogic){
|
|
|
|
$request->validate([
|
|
|
|
'id'=>['required']
|
|
|
|
],[
|
|
|
|
'id.required' => 'ID不能为空'
|
|
|
|
]);
|
|
|
|
$info = $mailLogic->mail_info();
|
|
|
|
$this->response('success',Code::SUCCESS,$info);
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|