コード例 #1
0
 public function run()
 {
     OfficalNoticePart::create(['offical_id' => 1, 'type' => 'text', 'content' => '官方通知,请小卡萨吉和事杀菌']);
     OfficalNoticePart::create(['offical_id' => 1, 'type' => 'url', 'content' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg']);
     OfficalNoticePart::create(['offical_id' => 2, 'type' => 'text', 'content' => '官方通知,请小卡萨吉和事杀菌']);
     OfficalNoticePart::create(['offical_id' => 2, 'type' => 'url', 'content' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg']);
     OfficalNoticePart::create(['offical_id' => 3, 'type' => 'text', 'content' => '官方通知,请小卡萨吉和事杀菌']);
     OfficalNoticePart::create(['offical_id' => 3, 'type' => 'url', 'content' => 'http://7xl6gj.com1.z0.glb.clouddn.com/19.2.jpg']);
 }
コード例 #2
0
ファイル: NoticeController.php プロジェクト: Jv-Juven/gift
 public function offical()
 {
     if (!Sentry::check()) {
         return Response::json(array('errCode' => 10, 'message' => '请登录'));
     }
     $user = Sentry::getUser();
     $offical_id = Input::get('offical_id');
     if (!isset($offical_id)) {
         return Response::json(array('errCode' => 2, 'message' => '请选择需要查看官方详情'));
     }
     $offical = OfficalNotice::find($offical_id);
     if (!isset($offical)) {
         return Response::json(array('errCode' => 3, 'message' => '该官方消息不存在'));
     }
     $offical_parts = OfficalNoticePart::where('offical_id', '=', $offical->id)->orderBy('created_at', 'asc')->get();
     if (count($offical_parts) == 0) {
         return Response::json(array('errCode' => 4, 'message' => '[数据库没插数据]官方消息没内容'));
     }
     return Response::json(array('errCode' => 0, 'message' => '返回官方通知后详细信息', 'offical' => $offical, 'offical_parts' => $offical_parts));
 }