gq 8 年之前
父節點
當前提交
ad2eac4a13

+ 149 - 9
server/app/Http/Controllers/Api/V1/MyController.php

xqd xqd xqd xqd xqd xqd
@@ -2,7 +2,10 @@
 
 namespace App\Http\Controllers\Api\V1;
 
+use App\Models\DreamInfoModel;
+use App\Models\ReplyCommentsInfo;
 use Illuminate\Http\Request;
+use App\Library\Protocol\ErrorCode;
 class MyController extends Controller
 {
     /**
@@ -165,30 +168,107 @@ class MyController extends Controller
      * @apiVersion 0.1.0
      * @apiSuccessExample {json} Success-Response:
      * HTTP/1.1 200 OK
+     *
+     * {
+     *"status": true,
+     *"status_code": 0,
+     *"message": "",
+     *"data": {
+     *"comments_infos": [
+     *{
+     * "id": 1,
+     *"dream_id": 2,
+     *"user_id": 2,
+     *"level": 2,
+     *"content": "啊哈", 评论内容
+     *"created_at": null, 评论时间
+     *"updated_at": null,
+     *"deleted_at": null,
+     *"dream_name": "去旅游去旅游2", 梦想介绍
+     *"dream_pic": "aaaaa", 梦想图片
+     * "progress": 0,   进度
+     *"reviewer": "22222",  评论者
+     *"reviewer_pic": "22222pic", 评论者头像
+    }
+    ]
+    }
+    }
      * @apiErrorExample {json} Error-Response:
      * HTTP/1.1 400 Bad Request
      */
     public function replyMy()
     {
         $user = $this->getUser();
-        return $this->api(compact('user'));
+//        梦想
+        $dreams = $user->UserDream;
+
+        if (count($dreams) == 0)
+            return $this->error(ErrorCode::DREAM_NOT_EXIST);
+
+        foreach ($dreams as $dream){
+            $comments_infos = $dream->DreamInfo;
+            if (count($comments_infos) > 0) {
+                foreach ($comments_infos as $k => $value) {
+                    $value->dream_name = $dream->dream;
+                    $value->dream_about = $dream->about;
+                    $value->dream_pic = count($dream->dreamImgsFirst) > 0 ? $dream->dreamImgsFirst->pic : '';
+                    $value->progress = $dream->money == 0 ? 0 :  floor($dream->get_money/$dream->money);
+                    $value->reviewer = $value->CommentUser->nickname;
+                    $value->reviewer_pic = $value->CommentUser->pic;
+                }
+            }
+        }
+
+        return $this->api(compact('comments_infos'));
     }
 
     /**
-     * @api {get} /api/my/my_reply 我的回复(myReply)
+     * @api {post} /api/my/my_reply 我的回复(myReply)
      * @apiDescription 我的回复(recharge)
      * @apiGroup Auth
+     * @apiParam {text}  content   回复内容
+     * @apiParam {int} comment_id   评论ID
      * @apiPermission Passport
      * @apiVersion 0.1.0
      * @apiSuccessExample {json} Success-Response:
+     * {
+    *"status": true,
+    *"status_code": 0,
+    *"message": "",
+    *"data": ""
+    *}
      * HTTP/1.1 200 OK
      * @apiErrorExample {json} Error-Response:
+     * {
+    *"status": false,
+    *"status_code": 1000,
+    *"message": "输入不正确",
+    *"data": null
+    *}
+     * {
+    *"status": false,
+    *"status_code": 600,
+    *"message": "保存用户数据失败",
+    *"data": null
+    *}
      * HTTP/1.1 400 Bad Request
      */
-    public function myReply()
+    public function myReply(Request $request)
     {
         $user = $this->getUser();
-        return $this->api(compact('user'));
+        $data = $request->except('_token');
+        $data['user_id'] = $user->id;
+
+        if (!$request->content)
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS);
+
+       $ok =  ReplyCommentsInfo::create($data);
+
+        if ($ok) {
+            return $this->api('');
+        }else{
+            return $this->error(ErrorCode::SAVE_USER_FAILED);
+        }
     }
 
     /**
@@ -198,6 +278,21 @@ class MyController extends Controller
      * @apiPermission Passport
      * @apiVersion 0.1.0
      * @apiSuccessExample {json} Success-Response:
+     * {
+    *"status": true,
+       * "status_code": 0,
+     * "message": "",
+     * "data": {
+     * "dreams": [
+     *{
+     *"id": 2,
+     * "dream": "去旅游去旅游2",
+     *"about": "欧冠胡234",
+     * "dream_pic": "aaaaa",
+     * "progress": 0,  进度
+     * ]
+     * }
+     * }
      * HTTP/1.1 200 OK
      * @apiErrorExample {json} Error-Response:
      * HTTP/1.1 400 Bad Request
@@ -205,7 +300,18 @@ class MyController extends Controller
     public function dream()
     {
         $user = $this->getUser();
-        return $this->api(compact('user'));
+//        梦想
+        $dreams = $user->UserDream;
+
+        if (count($dreams) == 0)
+            return $this->error(ErrorCode::DREAM_NOT_EXIST);
+
+        foreach ($dreams as $dream){
+            $dream->dream_pic = count($dream->dreamImgsFirst) > 0 ? $dream->dreamImgsFirst->pic : '';
+            $dream->progress = $dream->money == 0 ? 0 :  floor($dream->get_money/$dream->money);
+        }
+
+        return $this->api(compact('dreams'));
     }
 
     /**
@@ -243,8 +349,9 @@ class MyController extends Controller
     }
 
     /**
-     * @api {get} /api/my/add_dream 发布梦想(addDream)
-     * @apiDescription 发布梦想(recharge)
+     * @api {post} /api/my/add_dream 发布梦想(addDream)
+     * @apiDescription 发布梦想(addDream)
+       * @apiParam {string}  pic   梦想图片 数组
      * @apiGroup Auth
      * @apiPermission Passport
      * @apiVersion 0.1.0
@@ -253,10 +360,43 @@ class MyController extends Controller
      * @apiErrorExample {json} Error-Response:
      * HTTP/1.1 400 Bad Request
      */
-    public function addDream()
+    public function addDream(Request $request)
     {
         $user = $this->getUser();
-        return $this->api(compact('user'));
+
+        $validator = \Validator::make($request->all(),
+            [
+                'dream'  => 'required',
+                'about'  => 'required',
+                'money'  => 'required|integer',
+            ],
+            [
+                'dream.required'  => '梦想标题必填',
+                'about.required'  => '梦想介绍必填',
+                'money.required'  => '梦想币必填',
+                'money.integer'  => '梦想币必须是正整数',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+        $data = $request->except('_token','pic');
+        $data['created_at'] = date('Y-m-d H:i:s');
+        $data['updated_at'] = date('Y-m-d H:i:s');
+        $dream_id = DreamInfoModel::insertGetId($data);
+
+        if ($dream_id) {
+            $data1['dream_id'] = $dream_id;
+            $data1['user_id'] = $user->id;
+            $data1['created_at'] = date('Y-m-d H:i:s');
+            $data1['updated_at'] = date('Y-m-d H:i:s');
+        }
+        $arr = $request->pic;
+
+        if (is_array($arr)) {
+
+        }
+        return $arr;
     }
 
     /**

+ 435 - 0
server/app/Library/Logger/Logger.php

xqd
@@ -0,0 +1,435 @@
+<?php
+namespace App\Library\Logger;
+
+/**
+ * Created by PhpStorm.
+ * User: lhz
+ * Date: 2016-5-31
+ * Time: 8:50
+ * 日志器
+ */
+
+use Fluent\Logger\FluentLogger;
+
+class Logger {
+    //常量定义
+    const DEBUG     = 0b00000001; //Debug: debug-level messages
+    const INFO      = 0b00000010; //Informational: informational messages
+    const NOTICE    = 0b00000100; //Notice: normal but significant condition
+    const WARNING   = 0b00001000; //Warning: warning conditions
+    const ERROR     = 0b00010000; //Error: error conditions
+    const FATAL     = 0b00100000; //Critical: critical conditions
+    const ALERT     = 0b01000000; //Alert: action must be taken immediately
+    const EMERGENCY = 0b10000000; //Emergency: system is unusable
+    const PRE_DEFINE_ALL    = self::EMERGENCY | self::ALERT | self::FATAL | self::ERROR | self::WARNING | self::NOTICE | self::INFO | self::DEBUG;
+    const PRE_DEFINE_ERROR  = self::EMERGENCY | self::ALERT | self::FATAL | self::ERROR;
+    const PRE_DEFINE_WARN   = self::PRE_DEFINE_ERROR | self::WARNING;
+    const PRE_DEFINE_INFO   = self::WARNING | self::NOTICE | self::INFO | self::DEBUG;
+
+    const DEVELOP   = 'development';
+    const PRODUCT   = 'production';
+
+    //单例对象
+    static $_instance           = NULL;
+
+    //邮件
+    static $_mailer             = NULL;
+
+    //fluentd
+    private $_fluentd           = NULL;
+
+    //日志句柄
+    private $_fp                = NULL;
+
+    //日志级别
+    private $_level             = self::FATAL;
+
+    //应用环境
+    private $_env               = self::DEVELOP;
+
+    //项目ID
+    private $_project           = '';
+
+    //邮件错误通知开关
+    private $_mailSwitch        = 'auto';//auto表示自动,级别在error及以上发邮件;on表示全部发送邮件;off表示关闭邮件警告
+
+    //debug_backtrace开关
+    private $_debugBackTrace    = true;
+
+    //日志类型枚举
+    private $_TYPES      = [
+        self::DEBUG     => 'DEBUG',
+        self::INFO      => 'INFO',
+        self::NOTICE    => 'NOTICE',
+        self::WARNING   => 'WARNING',
+        self::ERROR     => 'ERROR',
+        self::FATAL     => 'FATAL',
+        self::ALERT     => 'ALERT',
+        self::EMERGENCY => 'EMERGENCY',
+    ];
+
+    //日志类型分类
+    private $_CATEGORIES    = [
+        self::DEBUG     => 'INFO',
+        self::INFO      => 'INFO',
+        self::NOTICE    => 'INFO',
+        self::WARNING   => 'INFO',
+        self::ERROR     => 'ERROR',
+        self::FATAL     => 'ERROR',
+        self::ALERT     => 'ERROR',
+        self::EMERGENCY => 'ERROR',
+    ];
+
+    public function __construct($path = NULL)
+    {
+        $this->setPath($path);
+        $this->setLevel(self::EMERGENCY | self::ALERT | self::FATAL | self::ERROR | self::WARNING);
+    }
+
+    private function __clone() {
+    }
+
+    private function _formatMsg($msg, $type, $file = null, $line = null) {
+        $extra = '';
+        if ($this->_debugBackTrace && $file === null && $line === null) {
+            $traceLevel = 10;
+            $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, $traceLevel);
+            $cnt = count($trace);
+            if ($cnt > 0) {
+                foreach ($trace as $l) {
+                    if (isset($l['file']) && isset($l['line'])) {
+                        $extra .= sprintf("%s(%d)\n", $l['file'], $l['line']);
+                    }
+                }
+                $file = $trace[$cnt-1]['file'];
+                $line = $trace[$cnt-1]['line'];
+            }
+        }
+        if ($file === null) {
+            $file = __FILE__;
+        }
+        if ($line === null) {
+            $line = __LINE__;
+        }
+
+        return sprintf("%s [%-5s] [%-25s :%5d] %s\n%s\n", date('Y-m-d H:i:s'), $this->_TYPES[$type], substr($file, -24), $line, $msg, $extra);
+    }
+
+    private function _sendFluentd($data, $type, $errFile = null, $errLine = null) {
+        $tag = sprintf("%s.%s.%s", $this->_project, $this->_CATEGORIES[$type], $this->_TYPES[$type]);
+
+        $subject = sprintf("[%s][%s]%s", $this->_project, $this->_TYPES[$type], substr($data, 0, 40));
+
+        $reqMicro = explode('.', $_SERVER['REQUEST_TIME_FLOAT']);
+        $reqTime = new \DateTime(date('Y-m-d H:i:s.' . $reqMicro[1], $_SERVER['REQUEST_TIME']));
+        $curMicro = microtime(true);
+        $tMicro = sprintf("%06d", ($curMicro - floor($curMicro)) * 1000000);
+        $curTime = new \DateTime(date('Y-m-d H:i:s.' . $tMicro, $curMicro));
+
+        $msg = [
+            'title'         => $subject,
+            'server_name'   => $_SERVER['SERVER_NAME'],
+            'server_ip'     => $_SERVER['SERVER_ADDR'],
+            'server_port'   => $_SERVER['SERVER_PORT'],
+            'client_ip'     => $_SERVER['REMOTE_ADDR'],
+            'request_uri'   => $_SERVER['REQUEST_URI'],
+            'request_time'  => $reqTime->format('Y-m-d H:i:s.u'),
+            'current_time'  => $curTime->format('Y-m-d H:i:s.u'),
+            'server_info'   => print_r($_SERVER, true),
+            'get_info'      => print_r($_GET, true),
+            'post_info'     => print_r($_POST, true),
+            'data'          => $data,
+            'trace'         => $this->_formatMsg($data, $type, $errFile, $errLine),
+        ];
+
+        $this->_fluentd->post($tag, $msg);
+    }
+
+    private function _write($msg, $type, $errFile = null, $errLine = null) {
+        if ($type & $this->_level) {
+            if (is_object($msg) || is_array($msg)) {
+                $data = print_r($msg, true);
+            } else {
+                $data = strval($msg);
+            }
+
+            //发送fluentd
+            if ($this->_fluentd !== null) {
+                $this->_sendFluentd($data, $type, $errFile, $errLine);
+            }
+
+            $data = $this->_formatMsg($data, $type, $errFile, $errLine);
+
+            //记录日志
+            fwrite($this->_fp, $data);
+
+            //发送邮件
+//            if ($this->_mailSwitch == 'on' ||
+//                ($this->_mailSwitch == 'auto' &&
+//                    ($type & self::ERROR || $type & self::FATAL))) {
+//                if (self::$_mailer !== null) {
+//                    $subject = sprintf("[ERROR_MAIL][%s][%s]Error info from logger", $this->_TYPES[$type], $this->_project);
+//                    self::$_mailer->subject($subject);
+//                    self::$_mailer->msgHTML($data);
+//                    if (!self::$_mailer->send()) {//邮件发送失败,写日志
+//                        $err = self::$_mailer->ErrorInfo();
+//                        fwrite($this->_fp, $this->_formatMsg($err, self::ERROR));
+//                    }
+//                }
+//            }
+
+        }
+    }
+
+    private function parseArgs($args) {
+        $ret = "";
+        foreach ($args as $arg) {
+            if (is_object($arg) || is_array($arg)) {
+                $data = print_r($arg, true);
+            } else {
+                $data = strval($arg);
+            }
+            $ret .= $data . " ";
+        }
+        return $ret;
+    }
+
+    /**
+     * @param string $path
+     * @return Logger|null
+     * 单例对象,参数为日志路径
+     */
+    public static function getInstance($path = '') {
+        if (!(self::$_instance instanceof self)) {
+            self::$_instance = new self($path);
+        }
+        return self::$_instance;
+    }
+
+    /**
+     * @param string $path
+     * @throws Exception
+     * 设置log路径,默认标准输出
+     */
+    public function setPath($path = '') {
+        if (empty($path)) {
+            $this->_fp = fopen('php://stdout', 'w');
+        } else {
+            if (is_dir($path)) {
+                throw new \Exception('Cannot be a path, must be a file ' . $path);
+            }
+            $dn = dirname($path);
+            if (!file_exists($dn)) {
+                @mkdir($dn, 0777, true);
+            }
+            if (!file_exists($path)) {
+                @touch($path);
+            }
+            if (!is_writable($path)) {
+                throw new \Exception('Log file cannot be written! ' . $path);
+            }
+            $this->_fp = fopen($path, 'a');
+        }
+    }
+
+    /**
+     * @param string $host
+     * @param int $port
+     * @param array $options
+     * 配置fluentd
+     */
+    public function setFluentd($host = '127.0.0.1', $port = 24224, $options = []) {
+        $this->_fluentd = new FluentLogger($host, $port, $options);
+    }
+
+    /**
+     * @param $val [development | production]
+     * 设置应用环境,默认development
+     * 关联日志级别
+     */
+    public function setEnv($val) {
+        if ($val == self::DEVELOP) {
+            $this->_env = $val;
+            $this->setLevel(self::EMERGENCY | self::ALERT | self::FATAL | self::ERROR | self::WARNING | self::NOTICE | self::INFO | self::DEBUG);
+        } elseif ($val == self::PRODUCT) {
+            $this->_env = $val;
+            $this->setLevel(self::EMERGENCY | self::ALERT | self::FATAL | self::ERROR | self::WARNING);
+        }
+    }
+
+    /**
+     * @param $val
+     * 设置日志级别,默认self::EMERGENCY | self::ALERT | self::FATAL | self::ERROR | self::WARNING
+     */
+    public function setLevel($val) {
+        $this->_level = $val;
+    }
+
+    /**
+     * @param $val true/false
+     * debug back trace开关,默认打开
+     */
+    public function setDebugBackTrace($val) {
+        $this->_debugBackTrace = $val;
+    }
+
+    public function setMailer(Mailer $mailer) {
+        self::$_mailer = $mailer;
+    }
+
+    /**
+     * @param $mail array
+     * key as mail address
+     * value as mail name
+     */
+    public function addMailTo($mail) {
+        foreach ($mail as $addr => $name) {
+            if (strpos($addr, '@') !== false) {
+                self::$_mailer->addAddress($addr, $name);
+            } elseif (strpos($name, '@') !== false) {
+                self::$_mailer->addAddress($name);
+            }
+        }
+    }
+
+    public function setProjectId($projectId) {
+        $this->_project = $projectId;
+    }
+
+    /**
+     * @param null $msg
+     * 调试输出
+     */
+    public function Debug() {
+        if (func_num_args() == 0) {
+            return;
+        }
+        $args = func_get_args();
+        $msg = $this->parseArgs($args);
+
+        $this->_write($msg, self::DEBUG);
+    }
+
+    /**
+     * @param null $msg
+     * 信息输出
+     */
+    public function Info() {
+        if (func_num_args() == 0) {
+            return;
+        }
+        $args = func_get_args();
+        $msg = $this->parseArgs($args);
+
+        $this->_write($msg, self::INFO);
+    }
+
+    /**
+     * @param null $msg
+     * 注意输出
+     */
+    public function Notice() {
+        if (func_num_args() == 0) {
+            return;
+        }
+        $args = func_get_args();
+        $msg = $this->parseArgs($args);
+
+        $this->_write($msg, self::NOTICE);
+    }
+
+    /**
+     * @param null $msg
+     * 警告输出
+     */
+    public function Warning() {
+        if (func_num_args() == 0) {
+            return;
+        }
+        $args = func_get_args();
+        $msg = $this->parseArgs($args);
+
+        $this->_write($msg, self::WARNING);
+    }
+
+    /**
+     * @param null $msg
+     * 错误输出
+     */
+    public function Error() {
+        if (func_num_args() == 0) {
+            return;
+        }
+        $args = func_get_args();
+        $msg = $this->parseArgs($args);
+
+        $this->_write($msg, self::ERROR);
+    }
+
+    /**
+     * @param null $msg
+     * 致命错误输出
+     */
+    public function Fatal() {
+        if (func_num_args() == 0) {
+            return;
+        }
+        $args = func_get_args();
+        $msg = $this->parseArgs($args);
+
+        $this->_write($msg, self::FATAL);
+    }
+
+    /**
+     * @param null $msg
+     * 警报错误输出
+     */
+    public function Alert() {
+        if (func_num_args() == 0) {
+            return;
+        }
+        $args = func_get_args();
+        $msg = $this->parseArgs($args);
+
+        $this->_write($msg, self::ALERT);
+    }
+
+    /**
+     * @param null $msg
+     * 紧急错误输出
+     */
+    public function Emergency() {
+        if (func_num_args() == 0) {
+            return;
+        }
+        $args = func_get_args();
+        $msg = $this->parseArgs($args);
+
+        $this->_write($msg, self::EMERGENCY);
+    }
+
+    /**
+     * @param $errno
+     * @param $errstr
+     * @param $errfile
+     * @param $errline
+     * 系统错误捕获器
+     */
+    public function cbErrorHandler($errno, $errstr, $errfile, $errline) {
+        switch ($errno) {
+            case E_ERROR:
+            case E_USER_ERROR:
+            case E_CORE_ERROR:
+                $errType = self::FATAL;
+                break;
+            case E_WARNING:
+            case E_USER_WARNING:
+            case E_CORE_WARNING:
+                $errType = self::ERROR;
+                break;
+            default:
+                $errType = self::WARNING;
+        }
+        $this->_write($errstr, $errType, $errfile, $errline);
+    }
+}

+ 119 - 0
server/app/Library/Protocol/ErrorCode.php

xqd
@@ -0,0 +1,119 @@
+<?php
+namespace App\Library\Protocol;
+
+final class ErrorCode {
+	//错误常量定义
+	const ATTACHMENT_DELETE_FAILED = 605;
+	const ATTACHMENT_MOVE_FAILED = 604;
+	const ATTACHMENT_RECORD_DELETE_FAILED = 606;
+	const ATTACHMENT_MKDIR_FAILED = 601;
+	const SAVE_USER_FAILED = 600;
+	const ATTACHMENT_SAVE_FAILED = 603;
+	const ATTACHMENT_UPLOAD_INVALID = 602;
+	const ATTACHMENT_SIZE_EXCEEDED = 1201;
+	const ILLEGAL_REQUEST = 701;
+	const ATTACHMENT_NOT_EXIST = 1203;
+	const ATTACHMENT_MIME_NOT_ALLOWED = 1202;
+	const MERCHANT_CREDIT_NOT_ENOUGH = 1304;
+	const MEMBER_CREDIT_NOT_ENOUGH = 1305;
+	const MERCHANT_NOT_EXIST = 1300;
+	const DREAM_NOT_EXIST = 1308;
+	const FAVORITE_NOT_EXIST = 1900;
+	const MERCHANT_ADD_MEMBER_FAILED = 1301;
+	const MERCHANT_STATUS_NOT_OK = 1302;
+	const MERCHANT_BALANCE_NOT_ENOUGH = 1303;
+	const PAY_TYPE_UNSUPPORTED = 2000;
+	const MEMBER_NOT_EXIST = 1500;
+	const MEMBER_BALANCE_NOT_ENOUGH = 1501;
+	const MERCHANT_SERVICE_NOT_EXIST = 1400;
+	const MERCHANT_SERVICE_ADD_FAILED = 1401;
+	const CONTENT_GET_DETAIL_FAILED = 1402;
+	const MERCHANT_SERVICE_STATUS_INVALID = 1403;
+	const MERCHANT_SERVICE_EXPIRED = 1404;
+	const CANT_ADD_SERVICE_SAME_MERCHANT = 1405;
+	const SERVICE_STATUS_INVALID_CHANGE = 1406;
+	const SERVICE_COST_OVERFLOW_BALANCE = 1407;
+	const CREATE_SERVICE_OVER_MAX = 1408;
+	const SAVE_MODEL_FAILED = 700;
+	const REMOVE_MODEL_FAILED = 701;
+	const MODEL_NOT_EXIST = 702;
+	const ATTACHMENT_UPLOAD_FAILED = 1200;
+	const PROTO_PATH_NOT_EXIST = 100;
+	const PROTO_TRY_TO_SET_VALUE_ON_NULL = 101;
+	const ACTIVITY_NOT_EXIST = 1700;
+	const ORDER_GENERATE_FAILED = 1800;
+	const CONSUME_LOG_NOT_EXIST = 1600;
+	const SERVICE_CODE_FAILED= 1610;
+	const PHONE_NUMBER_ALREADY_REGISTERED = 1100;
+	const INCORRECT_VERIFY_CODE = 1101;
+	const INCORRECT_USER_OR_PASS = 1102;
+	const VERIFY_CODE_TOO_MUCH = 1103;
+	const LOGOUT_FAILED = 1104;
+	const USER_DOES_NOT_EXIST = 1105;
+	const USER_DOES_EXIST = 1106;
+	const DELETE_OP_FAILED = 1001;
+	const CLIENT_WRONG_PARAMS = 1000;
+
+	//错误常量枚举
+	private static $_msg = [
+		self::ATTACHMENT_DELETE_FAILED => '删除附件文件失败',
+		self::ATTACHMENT_MOVE_FAILED => '移动附件失败',
+		self::ATTACHMENT_RECORD_DELETE_FAILED => '删除附件记录失败',
+		self::ATTACHMENT_MKDIR_FAILED => '创建附件目录失败',
+		self::SAVE_USER_FAILED => '保存用户数据失败',
+		self::ATTACHMENT_SAVE_FAILED => '保存附件失败',
+		self::ATTACHMENT_UPLOAD_INVALID => '上传附件文件无效',
+		self::ATTACHMENT_SIZE_EXCEEDED => '附件大小超过限制',
+		self::ILLEGAL_REQUEST => '非法请求',
+		self::ATTACHMENT_NOT_EXIST => '附件不存在',
+		self::ATTACHMENT_MIME_NOT_ALLOWED => '附件类型不允许',
+		self::MEMBER_CREDIT_NOT_ENOUGH => '会员卡金不足',
+		self::MERCHANT_CREDIT_NOT_ENOUGH => '商户卡金不足',
+		self::MERCHANT_NOT_EXIST => '商户不存在',
+		self::DREAM_NOT_EXIST => '商户不存在',
+		self::FAVORITE_NOT_EXIST => '收藏不存在',
+		self::MERCHANT_ADD_MEMBER_FAILED => '添加会员失败',
+		self::MERCHANT_STATUS_NOT_OK => '申请成功,客服会在3个工作日内与您取得联系!',
+		self::MERCHANT_BALANCE_NOT_ENOUGH => '商户余额不足',
+		self::PAY_TYPE_UNSUPPORTED => '不支持的支付方式',
+		self::MEMBER_NOT_EXIST => '会员不存在',
+		self::MEMBER_BALANCE_NOT_ENOUGH => '会员余额不足',
+		self::SERVICE_COST_OVERFLOW_BALANCE => '余额不足,请充值',
+		self::CREATE_SERVICE_OVER_MAX => '服务数量达到系统上限',
+		self::MERCHANT_SERVICE_STATUS_INVALID => '服务状态不正确',
+		self::CONTENT_GET_DETAIL_FAILED => '获取内容详情失败',
+		self::MERCHANT_SERVICE_ADD_FAILED => '发出服务失败',
+		self::MERCHANT_SERVICE_NOT_EXIST => '服务不存在',
+		self::SERVICE_STATUS_INVALID_CHANGE => '服务状态转换无效',
+		self::CANT_ADD_SERVICE_SAME_MERCHANT => '服务发出方与创建方一致',
+		self::MERCHANT_SERVICE_EXPIRED => '服务已过期',
+		self::SAVE_MODEL_FAILED => '保存模型失败',
+		self::REMOVE_MODEL_FAILED => '删除模型失败',
+		self::MODEL_NOT_EXIST => '模型不存在',
+		self::ATTACHMENT_UPLOAD_FAILED => '附件上传失败',
+		self::PROTO_PATH_NOT_EXIST => '指定API路径不存在',
+		self::PROTO_TRY_TO_SET_VALUE_ON_NULL => '企图操作NULL对象并赋值',
+		self::ACTIVITY_NOT_EXIST => '活动不存在',
+		self::ORDER_GENERATE_FAILED => '生成订单失败',
+		self::CONSUME_LOG_NOT_EXIST => '消费记录不存在',
+		self::LOGOUT_FAILED => '退出失败',
+		self::SERVICE_CODE_FAILED=>'验证码错误',
+		self::USER_DOES_EXIST => '手机已经注册',
+		self::USER_DOES_NOT_EXIST => '用户不存在',
+		self::INCORRECT_USER_OR_PASS => '用户名或密码不正确',
+		self::PHONE_NUMBER_ALREADY_REGISTERED => '该手机号已注册',
+		self::INCORRECT_VERIFY_CODE => '输入验证码错误',
+		self::VERIFY_CODE_TOO_MUCH => '24小时内验证码发送过多',
+		self::DELETE_OP_FAILED => '删除操作失败',
+		self::CLIENT_WRONG_PARAMS => '输入不正确',
+	];
+
+	public static function message($code) {
+		if (isset(self::$_msg[$code])) {
+			return self::$_msg[$code];
+		} else {
+			return null;
+		}
+	}
+
+}

+ 129 - 0
server/app/Library/Protocol/api.php

xqd
@@ -0,0 +1,129 @@
+<?php
+namespace App\Library\Protocol;
+
+class ApiException extends \Exception {
+    function __construct($code, $message = '')
+    {
+        if (empty($message)) {
+            $message = ErrorCode::message($code);
+            if ($message === null) {
+                $message = $code;
+                $code = 0;
+            }
+        }
+        parent::__construct($message, $code);
+    }
+}
+
+final class _Api {
+
+    public $id;
+    public $path;
+    public $method;
+    public $header;
+    public $payload;
+    public $response;
+    public $desc;
+
+    public function __construct($data) {
+        $this->id = (int) $data['id'];
+        $this->path = (string) $data['path'];
+        $this->method = (string) strtolower($data['method']);
+        if ($data['header'] == 'null') {
+            $this->header = null;
+        } else {
+            $klass = sprintf("%s\\%s", __NAMESPACE__, $data['header']);
+            $this->header = new $klass;
+        }
+        if ($data['payload'] == 'null') {
+            $this->payload = null;
+        } else {
+            $klass = sprintf("%s\\%s", __NAMESPACE__, $data['payload']);
+            $this->payload = new $klass;
+        }
+        if ($data['response'] == 'null') {
+            $this->response = null;
+        } else {
+            $klass = sprintf("%s\\%s", __NAMESPACE__, $data['response']);
+            $this->response = new $klass;
+        }
+        $this->desc = (string) $data['desc'];
+    }
+
+    public function setHeader($data) {
+        if ($this->header === null) {
+            throw new ApiException(ErrorCode::PROTO_TRY_TO_SET_VALUE_ON_NULL);
+        }
+        if (is_array($data) || $data instanceof $this->header) {
+            return $this->header->set($data);
+        }
+        return false;
+    }
+
+    public function setPayload($data) {
+        if ($this->payload === null) {
+            return false;
+        }
+        if (is_array($data) || $data instanceof $this->payload) {
+            return $this->payload->set($data);
+        }
+        return $this;
+    }
+
+    public function setResponse($data, $value = null) {
+        if ($this->response === null) {
+            throw new ApiException(ErrorCode::PROTO_TRY_TO_SET_VALUE_ON_NULL);
+        }
+        if (is_array($data) || $data instanceof $this->response) {
+            $this->response->set($data);
+        } elseif (is_string($data)) {
+            $this->response->set([$data => $value]);
+        }
+        return $this;
+    }
+
+    public function parse() {
+        return $this->response->iterate();
+    }
+}
+
+final class Api {
+	private static $api = [
+		'/api/token/get' => [
+			'payload' => 'token_req_info',
+			'header' => 'app_info',
+			'id' => '2',
+			'path' => '/api/token/get',
+			'method' => 'post',
+			'response' => 'token_info',
+			'desc' => '获取服务端token',
+		],
+		'/api/servers/list' => [
+			'payload' => 'null',
+			'header' => 'app_info',
+			'id' => '1',
+			'path' => '/api/servers/list',
+			'method' => 'post',
+			'response' => 'service_list',
+			'desc' => '获取当前客户端可用服务端列表',
+		],
+		'/api/token/refresh' => [
+			'payload' => 'token_info',
+			'header' => 'app_info',
+			'id' => '3',
+			'path' => '/api/token/refresh',
+			'method' => 'post',
+			'response' => 'token_info',
+			'desc' => '刷新服务端token',
+		],
+	];
+
+	public static function get($path) {
+		if (!isset(self::$api[$path])) {
+			throw new ApiException(ErrorCode::PROTO_PATH_NOT_EXIST);
+		}
+
+		return new _Api(self::$api[$path]);
+	}
+
+}

+ 177 - 0
server/app/Library/Protocol/proto.php

xqd
@@ -0,0 +1,177 @@
+<?php
+namespace App\Library\Protocol;
+
+abstract class _Payload {
+
+    public function __construct(array $data = null) {
+        if ($data != null) {
+            $this->set($data);
+        }
+    }
+
+    public function set($data) {
+        //TODO: recursive set data
+        if ($data === null) {
+
+            return false;
+        } elseif (is_array($data)) {
+            foreach ($data as $k => $v) {
+                if (property_exists(get_class($this), $k)) {
+                    $t = sprintf("_%s", $k);
+                    if (property_exists(get_class($this), $t)) {
+                        $tp = $this->{$t};
+                        $type = $tp['type'];
+                        $this->{$k} = $this->cast($v, $type);
+                    }
+                }
+            }
+        } elseif (is_object($data) && $data instanceof $this) {
+            foreach ($data as $k => $v) {
+                $t = sprintf("_%s", $k);
+                if (property_exists(get_class($this), $t)) {
+                    $this->{$k} = $v;
+                }
+            }
+        } else {
+
+            return false;
+        }
+        return true;
+    }
+
+    public function cast($value, $type) {
+        switch ($type) {
+            case 'integer':
+                $ret = (int) $value;
+                break;
+            case 'float':
+                $ret = (double) $value;
+                break;
+            case 'string':
+                $ret = (string) $value;
+                break;
+            case 'boolean':
+                $ret = (boolean) $value;
+                break;
+            default:
+                if (preg_match('/^(array\[([A-Za-z_]+)\]|dict\[([A-Za-z_]+)\]([A-Za-z_]+))$/', $type, $matches)) {
+                    $ret = [];
+                    if (substr($matches[0], 0, 4) === 'dict') {
+                        foreach ($value as $k => $v) {
+                            $key = $this->cast($k, $matches[3]);
+                            $value = $this->cast($v, $matches[4]);
+                            $ret[$key] = $value;
+                        }
+                    } else {
+                        foreach ($value as $k => $v) {
+                            $ret[] = $this->cast($v, $matches[2]);
+                        }
+                    }
+                } elseif (is_object($value)) {
+                    $klass = sprintf("%s\\%s", __NAMESPACE__, $type);
+                    if ($value instanceof $klass) {
+                        $ret = $this->iterate($value);
+                    } else {
+                        $ret = $value;
+                    }
+                } else {
+                    $ret = $value;
+                }
+                break;
+        }
+        return $ret;
+    }
+
+    public function iterate($object = null) {
+        $ret = [];
+        if ($object === null) {
+            $object = $this;
+        }
+        foreach ($object as $k => $v) {
+            $t = sprintf("_%s", $k);
+            if (property_exists(get_class($object), $t)) {
+                $tp = $this->{$t};
+                $type = $tp['type'];
+                $ret[$k] = $this->cast($v, $type);
+            }
+        }
+        return $ret;
+    }
+
+}
+
+/*
+#token结构
+*/
+final class token_info extends _Payload {
+	public $token = "";
+	protected $_token = [
+		'type' => 'string',
+		'required' => true,
+	];
+}
+
+/*
+#可用服务信息结构
+*/
+final class service_info extends _Payload {
+	public $name = "";
+	protected $_name = [
+		'type' => 'string',
+		'required' => true,
+	];
+	public $auth = 0;
+	protected $_auth = [
+		'type' => 'integer',
+		'required' => true,
+	];
+}
+
+/*
+#appid-appkey结构
+*/
+final class app_info extends _Payload {
+	public $appid = "";
+	protected $_appid = [
+		'type' => 'string',
+		'required' => true,
+	];
+}
+
+/*
+#单id结构
+*/
+final class struct_id extends _Payload {
+	public $id = 0;
+	protected $_id = [
+		'type' => 'integer',
+		'required' => true,
+	];
+}
+
+/*
+#可用服务列表
+*/
+final class service_list extends _Payload {
+	public $service = [];
+	protected $_service = [
+		'type' => 'array[service_info]',
+		'required' => true,
+	];
+}
+
+/*
+#请求token参数
+*/
+final class token_req_info extends _Payload {
+	public $server_id = "";
+	protected $_server_id = [
+		'type' => 'string',
+		'required' => true,
+	];
+	public $user_id = 0;
+	protected $_user_id = [
+		'type' => 'integer',
+		'required' => true,
+	];
+}

+ 21 - 0
server/app/Models/CommentInfoModel.php

xqd
@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class CommentInfoModel extends Model
+{
+    protected $table = 'comments_info';
+    protected $fillable = [
+        'dream_id',
+        'user_id',
+        'level',
+        'content',
+    ];
+
+    public function CommentUser()
+    {
+        return $this->belongsTo('App\Models\UserInfoModel','user_id','id');
+    }
+}

+ 15 - 0
server/app/Models/DreamInfoModel.php

xqd
@@ -50,5 +50,20 @@ class DreamInfoModel extends BaseModel
         return $this->belongsToMany('App\Models\UserInfoModel','user_dream','dream_id','user_id');
     }
 
+    public function DreamInfo()
+    {
+        return $this->hasMany('App\Models\CommentInfoModel','dream_id','id');
+    }
+
+    public function dreamImgs()
+    {
+        return $this->hasMany('App\Models\dreamImages','dream_id','id');
+    }
+
+    public function dreamImgsFirst()
+    {
+        return $this->hasOne('App\Models\dreamImages','dream_id','id');
+    }
+
 
 }

+ 18 - 0
server/app/Models/ReplyCommentsInfo.php

xqd
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ReplyCommentsInfo extends Model
+{
+    protected $table = 'reply_comments_info';
+
+    protected $fillable = [
+        'comment_id',
+        'user_id',
+        'content',
+        'level',
+    ] ;
+
+}

+ 11 - 0
server/app/Models/dreamImages.php

xqd
@@ -0,0 +1,11 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class dreamImages extends Model
+{
+    protected $table = 'dream_images';
+    protected $fillable = ['dream_id','title','pic'];
+}

+ 36 - 0
server/database/migrations/2017_04_02_062004_create_comments_info_table.php

xqd
@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateCommentsInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('comments_info', function (Blueprint $table) {
+            $table->increments('id');
+            $table->integer('dream_id')->comment('梦想ID');
+            $table->integer('user_id')->comment('评价用户');
+            $table->tinyInteger('level')->default(0)->comment('评论星级');
+            $table->text('content')->comment('评论内容');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('comments_info');
+    }
+}

+ 36 - 0
server/database/migrations/2017_04_02_062004_create_reply_comments_info_table.php

xqd
@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateReplyCommentsInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('reply_comments_info', function (Blueprint $table) {
+            $table->increments('id');
+            $table->integer('comment_id')->comment('评论ID');
+            $table->integer('user_id')->comment('当前登录用户ID');
+            $table->tinyInteger('level')->default(0)->comment('回复星级');
+            $table->text('content')->comment('回复内容');
+            $table->timestamps();
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('reply_comments_info');
+    }
+}

+ 50 - 50
server/database/seeds/AdminMenusTableSeeder.php

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -28,8 +28,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => 'fa-globe',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             2 => 
@@ -43,8 +43,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => 'fa-magic',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             3 => 
@@ -58,8 +58,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => 'fa-globe',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             4 => 
@@ -88,8 +88,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             6 => 
@@ -103,8 +103,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 2,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             7 => 
@@ -118,8 +118,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 2,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             8 => 
@@ -133,8 +133,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 2,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             9 => 
@@ -148,8 +148,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             10 => 
@@ -163,8 +163,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             11 => 
@@ -178,8 +178,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             12 => 
@@ -193,8 +193,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             13 => 
@@ -208,8 +208,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             14 => 
@@ -223,8 +223,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             15 => 
@@ -238,8 +238,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             16 => 
@@ -253,8 +253,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             17 => 
@@ -268,8 +268,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             18 => 
@@ -283,8 +283,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             19 => 
@@ -298,7 +298,7 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 2,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
                 'updated_at' => '2017-05-10 09:00:40',
                 'deleted_at' => NULL,
             ),
@@ -313,8 +313,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 3,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             21 => 
@@ -328,7 +328,7 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 2,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
                 'updated_at' => '2017-05-10 09:00:57',
                 'deleted_at' => NULL,
             ),
@@ -343,8 +343,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             23 => 
@@ -358,8 +358,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             24 => 
@@ -373,8 +373,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             25 => 
@@ -388,8 +388,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             26 => 
@@ -403,8 +403,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             27 => 
@@ -418,8 +418,8 @@ class AdminMenusTableSeeder extends Seeder
                 'level' => 1,
                 'ico' => '',
                 'mark' => '',
-                'created_at' => '0000-00-00 00:00:00',
-                'updated_at' => '0000-00-00 00:00:00',
+                'created_at' => '2017-01-04 18:32:17',
+                'updated_at' => '2017-01-04 18:32:17',
                 'deleted_at' => NULL,
             ),
             28 => 

文件差異過大導致無法顯示
+ 182 - 182
server/database/seeds/BaseAreaTableSeeder.php


+ 2 - 2
server/routes/api.php

xqd xqd
@@ -106,7 +106,7 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'my.reply_my',
         'uses' => 'MyController@replyMy',
     ]);
-    $api->get('my/my_reply', [
+    $api->post('my/my_reply', [
         'as' => 'my.my_reply',
         'uses' => 'MyController@myReply',
     ]);
@@ -123,7 +123,7 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'my.setting',
         'uses' => 'MyController@setting',
     ]);
-    $api->get('my/add_dream', [
+    $api->post('my/add_dream', [
         'as' => 'my.add_dream',
         'uses' => 'MyController@addDream',
     ]);

部分文件因文件數量過多而無法顯示