完善了管理员界面的功能,添加了首页的滚动公示牌
This commit is contained in:
@@ -11,6 +11,7 @@ use App\User;
|
||||
use App\Announcement;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Ticket;
|
||||
use App\Transaction;
|
||||
use Mews\Purifier\Purifier;
|
||||
|
||||
class AdminController extends Controller
|
||||
@@ -29,6 +30,8 @@ class AdminController extends Controller
|
||||
$data['cats'] = GoodCat::orderby('cat_name', 'asc')->get();
|
||||
$data['announcements'] = Announcement::orderby('id', 'dsc')->get();
|
||||
$data['reports'] = Ticket::where('type', '2')->orderby('id', 'dsc')->paginate(16);
|
||||
$data['users'] = User::orderby('id', 'asc')->paginate(16);
|
||||
$data['trans'] = Transaction::orderby('id', 'asc')->paginate(16);
|
||||
return View::make('admin.index')->with($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Http\Controllers\Controller;
|
||||
use App\GoodInfo;
|
||||
use App\GoodCat;
|
||||
use App\Announcement;
|
||||
use App\Transaction;
|
||||
|
||||
class ContentController extends Controller
|
||||
{
|
||||
@@ -25,6 +26,7 @@ class ContentController extends Controller
|
||||
$data['catgoods'][$cat->cat_name] = GoodInfo::where('cat_id', $cat->id)->where('baned', false)->inRandomOrder()->limit(4)->get();
|
||||
}
|
||||
$data['announces'] = Announcement::orderby('id', 'dsc')->limit(3)->get();
|
||||
$data['trans'] = Transaction::where('status', '>', 3)->orderby('id', 'dsc')->get();
|
||||
return View::make('welcome')->with($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,16 +23,6 @@ class MessageController extends Controller
|
||||
{
|
||||
public function showMessageView(Request $request)
|
||||
{
|
||||
$user_id = $request->session()->get('user_id');
|
||||
$post_data = 'user_id='.$user_id.'';
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, '127.0.0.1:6565/notify');
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return View::make('message.message');
|
||||
}
|
||||
|
||||
@@ -49,6 +39,16 @@ class MessageController extends Controller
|
||||
MessageContact::where('user_id', $user_id)
|
||||
->where('contact_id', $contact_id)
|
||||
->update(['unread_count' => 0]);
|
||||
$user_id = $request->session()->get('user_id');
|
||||
$post_data = 'user_id='.$user_id.'';
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, '127.0.0.1:6565/notify');
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return json_encode($messages);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,4 +32,5 @@ class Transaction extends Model
|
||||
{
|
||||
return $this->hasOne('App\Ticket', 'trans_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,4 +34,14 @@ class User extends Model
|
||||
return $this->nickname != "" ? $this->nickname : "一位先锋市场用户";
|
||||
}
|
||||
|
||||
public function getcoding()
|
||||
{
|
||||
$len=strlen($this->stuid);
|
||||
$ans = "";
|
||||
$ans = $ans . ($this->stuid)[0];
|
||||
for($i=1; $i<($len-1); $i++) $ans = $ans . '*';
|
||||
$ans = $ans . ($this->stuid)[$len-1];
|
||||
return $ans;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user