<?php
 namespace App\Http\Controllers\Main; use App\Http\Controllers\BaseController; use App\Types\NoteTipStatus; use Illuminate\Support\Facades\Input; use TechOnline\Laravel\Dao\ModelUtil; use TechOnline\Laravel\Http\Request; use TechOnline\Laravel\Http\Response; use TechSoft\Laravel\Member\Interfaces\MemberLoginCheck; use TechSoft\Laravel\Member\MemberUtil; class MemberTipController extends BaseController implements MemberLoginCheck { public function index() { if (Request::isPost()) { $data = []; $data['tipEnable'] = (intval(Input::get('tipEnable')) ? true : false); $data['defaultTipValue'] = trim(Input::get('defaultTipValue')); MemberUtil::update($this->memberUserId(), $data); return Response::send(0, '设置成功', null, '[reload]'); } return $this->_view('memberTip.index'); } public function recv() { $pageSize = 10; $option = []; $option['order'] = ['id', 'desc']; $option['where'] = []; $option['where']['status'] = NoteTipStatus::SUCCESS; $option['where']['memberUserId'] = $this->memberUserId(); if (Request::isPost()) { $page = intval(Input::get('page', 1)); $paginateData = ModelUtil::paginate('note_tip', $page, $pageSize, $option); $html = null; if (!empty($paginateData['records'])) { ModelUtil::join($paginateData['records'], 'noteId', '_note', 'note', 'id'); ModelUtil::join($paginateData['records'], 'tipMemberUserId', '_tipMemberUser', 'member_user', 'id'); $html = $this->_viewRender('memberTip.recvItems', [ 'records' => $paginateData['records'], ]); } return Response::send(0, null, [ 'html' => $html, 'page' => $page, 'pageSize' => $pageSize, 'total' => $paginateData['total'], ]); } $page = 1; $paginateData = ModelUtil::paginate('note_tip', $page, $pageSize, $option); ModelUtil::join($paginateData['records'], 'noteId', '_note', 'note', 'id'); ModelUtil::join($paginateData['records'], 'tipMemberUserId', '_tipMemberUser', 'member_user', 'id'); return $this->_view('memberTip.recv', [ 'records' => $paginateData['records'], 'page' => $page, 'pageSize' => $pageSize, 'total' => $paginateData['total'], ]); } }