Browse Source

no message

kuaifan 5 years atrás
parent
commit
0548619bd3

+ 6 - 6
app/Http/Controllers/Api/DocsController.php

@@ -565,7 +565,7 @@ class DocsController extends Controller
     }
 
     /**
-     * 保存章节内容
+     * {post} 保存章节内容
      *
      * @apiParam {Number} id                章节数据ID
      * @apiParam {Object} [D]               Request Payload 提交
@@ -580,7 +580,7 @@ class DocsController extends Controller
             $user = $user['data'];
         }
         //
-        $id = intval(Request::input('id'));
+        $id = intval(Base::getPostValue('id'));
         $row = Base::DBC2A(DB::table('docs_section')->where('id', $id)->first());
         if (empty($row)) {
             return Base::retError('文档不存在或已被删除!');
@@ -592,9 +592,9 @@ class DocsController extends Controller
         if ($row['lockdate'] + 60 > Base::time() && $row['lockname'] != $user['username']) {
             return Base::retError(['已被会员【%】锁定!', Users::nickname($row['lockname'])]);
         }
-        $D = Base::getContentsParse('D');
+        $content = Base::getPostValue('content');
         if ($row['type'] == 'document') {
-            $data = Base::json2array($D['content']);
+            $data = Base::json2array($content);
             $isRep = false;
             preg_match_all("/<img\s*src=\"data:image\/(png|jpg|jpeg);base64,(.*?)\"/s", $data['content'], $matchs);
             foreach ($matchs[2] as $key => $text) {
@@ -608,13 +608,13 @@ class DocsController extends Controller
                 }
             }
             if ($isRep == true) {
-                $D['content'] = Base::array2json($data);
+                $content = Base::array2json($data);
             }
         }
         DB::table('docs_content')->insert([
             'bookid' => $row['bookid'],
             'sid' => $id,
-            'content' => $D['content'],
+            'content' => $content,
             'username' => $user['username'],
             'indate' => Base::time()
         ]);

+ 5 - 5
app/Http/Controllers/Api/ProjectController.php

@@ -1429,7 +1429,7 @@ class ProjectController extends Controller
     }
 
     /**
-     * 项目任务-修改
+     * {post} 项目任务-修改
      *
      * @apiParam {Number} taskid            任务ID
      * @apiParam {String} act               修改字段|操作类型
@@ -1460,8 +1460,8 @@ class ProjectController extends Controller
             $user = $user['data'];
         }
         //
-        $act = trim(Request::input('act'));
-        $taskid = intval(Request::input('taskid'));
+        $act = trim(Base::getPostValue('act'));
+        $taskid = intval(Base::getPostValue('taskid'));
         $task = Base::DBC2A(DB::table('project_task')
             ->where([
                 ['delete', '=', 0],
@@ -1512,7 +1512,7 @@ class ProjectController extends Controller
             }
         }
         //
-        $content = Base::newTrim(Request::input('content'));
+        $content = Base::newTrim(Base::getPostValue('content'));
         $message = "";
         $upArray = [];
         $logArray = [];
@@ -1930,7 +1930,7 @@ class ProjectController extends Controller
              */
             case 'subtask': {
                 if (!is_array($content)) {
-                    return Base::retError('参数错误!');
+                    $content = [];
                 }
                 $content = Base::array2string($content);
                 if ($content == $task['subtask']) {

+ 16 - 17
app/Http/Controllers/Api/ReportController.php

@@ -39,7 +39,7 @@ class ReportController extends Controller
     }
 
     /**
-     * 获取模板、保存、发送、删除
+     * {post} 获取模板、保存、发送、删除
      *
      * @apiParam {String} type           类型
      * - 日报
@@ -65,9 +65,9 @@ class ReportController extends Controller
             $user = $user['data'];
         }
         //
-        $id = intval(Request::input('id'));
-        $act = trim(Request::input('act'));
-        $type = trim(Request::input('type'));
+        $id = intval(Base::getPostValue('id'));
+        $act = trim(Base::getPostValue('act'));
+        $type = trim(Base::getPostValue('type'));
         if (!in_array($type, ['日报', '周报'])) {
             return Base::retError('参数错误!');
         }
@@ -130,14 +130,13 @@ class ReportController extends Controller
             DB::table('report_content')->where('rid', $reportDetail['id'])->delete();
             return Base::retSuccess('删除成功!');
         } elseif ($act == 'submit') {
-            $D = Base::getContentsParse('D');
-            if (mb_strlen($D['title']) < 2 || mb_strlen($D['title']) > 100) {
+            if (mb_strlen(Base::getPostValue('title')) < 2 || mb_strlen(Base::getPostValue('title')) > 100) {
                 return Base::retError('标题限制2-100个字!');
             }
             if (empty($reportDetail)) {
                 DB::table('report_lists')->insert([
                     'username' => $user['username'],
-                    'title' => $D['title'],
+                    'title' => Base::getPostValue('title'),
                     'type' => $type,
                     'status' => '未发送',
                     'date' => $type=='日报'?date("Ymd"):date("W"),
@@ -149,14 +148,14 @@ class ReportController extends Controller
                 return Base::retError('系统繁忙,请稍后再试!');
             }
             //
-            $D['ccuser'] = explode(",", $D['ccuser']);
-            $send = $reportDetail['status'] == '已发送' ? 1 : intval(Request::input('send'));
+            $ccuserArr = explode(",", Base::getPostValue('ccuser'));
+            $send = $reportDetail['status'] == '已发送' ? 1 : intval(Base::getPostValue('send'));
             $ccuserAgain = $reportDetail['status'] == '已发送';
             if ($send) {
                 DB::table('report_ccuser')->where(['rid' => $reportDetail['id']])->update(['cc' => 0]);
-                foreach ($D['ccuser'] AS $ck => $cuser) {
+                foreach ($ccuserArr AS $ck => $cuser) {
                     if (!$cuser) {
-                        unset($D['ccuser'][$ck]);
+                        unset($ccuserArr[$ck]);
                         continue;
                     }
                     DB::table('report_ccuser')->updateOrInsert(['rid' => $reportDetail['id'], 'username' => $cuser], ['cc' => 1]);
@@ -165,17 +164,17 @@ class ReportController extends Controller
             }
             //
             DB::table('report_lists')->where('id', $reportDetail['id'])->update([
-                'title' => $D['title'],
+                'title' => Base::getPostValue('title'),
                 'status' => $send ? '已发送' : '未发送',
-                'ccuser' => Base::array2string($D['ccuser'])
+                'ccuser' => Base::array2string($ccuserArr)
             ]);
-            DB::table('report_content')->updateOrInsert(['rid' => $reportDetail['id']], ['content' => $D['content']]);
+            DB::table('report_content')->updateOrInsert(['rid' => $reportDetail['id']], ['content' => Base::getPostValue('content')]);
             //
             $reportDetail = array_merge($reportDetail, [
                 'ccuserAgain' => $ccuserAgain,
-                'ccuser' => $D['ccuser'],
-                'title' => $D['title'],
-                'content' => $D['content'],
+                'ccuser' => $ccuserArr,
+                'title' => Base::getPostValue('title'),
+                'content' => Base::getPostValue('content'),
             ]);
         }
         if (empty($reportDetail)) {

+ 3 - 0
app/Http/Middleware/VerifyCsrfToken.php

@@ -18,6 +18,9 @@ class VerifyCsrfToken extends Middleware
         //上传项目文件
         'api/project/files/upload/',
 
+        //修改项目任务
+        'api/project/task/edit/',
+
         //汇报提交
         'api/report/template/',
 

+ 23 - 2
app/Module/Base.php

@@ -1781,9 +1781,30 @@ class Base
     {
         parse_str(Request::getContent(), $input);
         if ($key) {
-            $input = isset($input[$key])?$input[$key]:array();
+            $input = isset($input[$key]) ? $input[$key] : array();
         }
-        return is_array($input)?$input:array($input);
+        return is_array($input) ? $input : array($input);
+    }
+
+    /**
+     * php://input 字符串解析到变量并获取指定值
+     * @param $key
+     * @param null $default
+     * @return mixed|null
+     */
+    public static function getContentValue($key, $default = null)
+    {
+        global $_A;
+        if (!isset($_A["__static_input_content"])) {
+            parse_str(Request::getContent(), $input);
+            $_A["__static_input_content"] = $input;
+        }
+        return isset($_A["__static_input_content"][$key]) ? $_A["__static_input_content"][$key] : $default;
+    }
+
+    public static function getPostValue($key, $default = null)
+    {
+        return self::getContentValue($key, $default);
     }
 
     /**

+ 1 - 1
package.json

@@ -1,5 +1,5 @@
 {
-    "version": "1.4.18",
+    "version": "1.4.19",
     "name": "wookteam",
     "private": true,
     "scripts": {

+ 1 - 0
resources/assets/js/main/components/project/archived.vue

@@ -119,6 +119,7 @@
                                     onOk: () => {
                                         $A.apiAjax({
                                             url: 'project/task/edit',
+                                            method: 'post',
                                             data: {
                                                 act: 'unarchived',
                                                 taskid: params.row.id,

+ 1 - 0
resources/assets/js/main/components/project/gantt/index.vue

@@ -531,6 +531,7 @@
                         };
                         $A.apiAjax({
                             url: 'project/task/edit',
+                            method: 'post',
                             data: ajaxData,
                             error: () => {
                                 this.items[item.id].time = item.backTime;

+ 1 - 0
resources/assets/js/main/components/project/header/archived.vue

@@ -116,6 +116,7 @@
                                     onOk: () => {
                                         $A.apiAjax({
                                             url: 'project/task/edit',
+                                            method: 'post',
                                             data: {
                                                 act: 'unarchived',
                                                 taskid: params.row.id,

+ 16 - 9
resources/assets/js/main/components/project/task/detail/detail.vue

@@ -64,10 +64,10 @@
                 </ul>
                 <div class="detail-h2 detail-subtask-icon detail-icon">
                     <strong class="active">{{$L('子任务')}}</strong>
-                    <Tooltip class="detail-button" theme="light" :delay="300" placement="top" transfer>
-                        <div slot="content" class="project-task-detail-button-batch" @click="subtaskBatchAdd">{{$L('批量添加子任务')}}</div>
+                    <div class="detail-button">
+                        <Button class="detail-button-batch" size="small" @click="subtaskBatchAdd">{{$L('批量添加子任务')}}</Button>
                         <Button class="detail-button-btn" size="small" @click="handleTask('subtaskAdd')">{{$L('添加子任务')}}</Button>
-                    </Tooltip>
+                    </div>
                 </div>
                 <div class="detail-subtask-box">
                     <div v-if="detail.subtask.length == 0" class="detail-subtask-none" @click="handleTask('subtaskAdd')">{{$L('暂无子任务')}}</div>
@@ -471,7 +471,7 @@
                     loading: true,
                     onOk: () => {
                         if (this.inputValue) {
-                            let tempArray = this.inputValue.split(/[\s\n]/);
+                            let tempArray = this.inputValue.split(/\n/);
                             tempArray.forEach((detail) => {
                                 detail = detail.trim();
                                 detail && this.detail.subtask.push({
@@ -752,6 +752,7 @@
                 let runTime = Math.round(new Date().getTime());
                 $A.apiAjax({
                     url: 'project/task/edit',
+                    method: 'post',
                     data: ajaxData,
                     complete: () => {
                         this.$set(this.loadData, ajaxData.act, false);
@@ -866,10 +867,6 @@
             }
         }
     }
-    .project-task-detail-button-batch {
-        font-size: 12px;
-        cursor: pointer;
-    }
 </style>
 <style lang="scss" scoped>
     .project-task-detail-window {
@@ -936,14 +933,24 @@
                         right: 12px;
                         top: 50%;
                         transform: translate(0, -50%);
-                        .detail-button-btn {
+                        &:hover {
+                            .detail-button-batch {
+                                display: inline-block;
+                            }
+                        }
+                        .detail-button-btn,
+                        .detail-button-batch {
                             font-size: 12px;
                             opacity: 0.5;
                             transition: all 0.3s;
+                            margin-left: 3px;
                             &:hover {
                                 opacity: 1;
                             }
                         }
+                        .detail-button-batch {
+                            display: none;
+                        }
                     }
                 }
                 .detail-icon {

+ 13 - 5
resources/assets/js/main/components/report/add.vue

@@ -129,7 +129,12 @@
             getData() {
                 this.loadIng++;
                 $A.apiAjax({
-                    url: 'report/template?id=' + this.id + '&type=' + this.type,
+                    url: 'report/template',
+                    method: 'post',
+                    data: {
+                        id: this.id,
+                        type: this.type,
+                    },
                     complete: () => {
                         this.loadIng--;
                     },
@@ -144,11 +149,14 @@
             handleSubmit(send = false) {
                 this.loadIng++;
                 $A.apiAjax({
-                    url: 'report/template?act=submit&id=' + this.id + '&type=' + this.type + '&send=' + (send === true ? 1 : 0),
+                    url: 'report/template',
                     method: 'post',
-                    data: {
-                        D: this.dataDetail
-                    },
+                    data: Object.assign(this.dataDetail, {
+                        act: 'submit',
+                        id: this.id,
+                        type: this.type,
+                        send: (send === true ? 1 : 0),
+                    }),
                     complete: () => {
                         this.loadIng--;
                     },

+ 14 - 2
resources/assets/js/main/components/report/my.vue

@@ -259,7 +259,13 @@
                     loading: true,
                     onOk: () => {
                         $A.apiAjax({
-                            url: 'report/template?act=send&id=' + row.id + '&type=' + row.type,
+                            url: 'report/template',
+                            method: 'post',
+                            data: {
+                                act: 'send',
+                                id: row.id,
+                                type: row.type,
+                            },
                             error: () => {
                                 this.$Modal.remove();
                                 alert(this.$L('网络繁忙,请稍后再试!'));
@@ -306,7 +312,13 @@
                     loading: true,
                     onOk: () => {
                         $A.apiAjax({
-                            url: 'report/template?act=delete&id=' + row.id + '&type=' + row.type,
+                            url: 'report/template',
+                            method: 'post',
+                            data: {
+                                act: 'delete',
+                                id: row.id,
+                                type: row.type,
+                            },
                             error: () => {
                                 this.$Modal.remove();
                                 alert(this.$L('网络繁忙,请稍后再试!'));

+ 1 - 0
resources/assets/js/main/mixins/task.js

@@ -8,6 +8,7 @@ export default {
             this.$set(taskDetail, 'complete', !!complete);
             $A.apiAjax({
                 url: 'project/task/edit',
+                method: 'post',
                 data: {
                     act: complete ? 'complete' : 'unfinished',
                     taskid: taskDetail.id,

+ 5 - 4
resources/assets/js/main/pages/docs/edit.vue

@@ -751,11 +751,12 @@
                     case "save":
                         this.bakContent = $A.jsonStringify(this.docContent);
                         $A.apiAjax({
-                            url: 'docs/section/save?id=' + this.getSid(),
+                            url: 'docs/section/save',
                             method: 'post',
-                            data: {
-                                D: Object.assign(this.docDetail, {content: this.bakContent})
-                            },
+                            data: Object.assign(this.docDetail, {
+                                id: this.getSid(),
+                                content: this.bakContent
+                            }),
                             error: () => {
                                 this.bakContent = '';
                                 alert(this.$L('网络繁忙,保存失败!'));