zhanglinxin 1 year ago
parent
commit
c843f0e2aa

+ 1 - 1
application/api/controller/Approve.php

@@ -155,7 +155,7 @@ class Approve extends Base
         $status = input('status') ?: 0;
         $remark = input('remark') ?: '';
         $maintain_user_id = input('maintain_user_id') ?: 0;
-        $params = compact("id", "status", "remark", "maintain_user_id");
+        $params = compact("status", "remark", "maintain_user_id");
         $user = $this->user;
         ApproveService::make($id, $params, $user, 'audit');
         $this->success('确认成功');

+ 1 - 1
application/api/controller/Approveinfo.php

@@ -556,7 +556,7 @@ class Approveinfo extends Base
         $id = input('id') ?: 0;
         $comment_score = input('comment_score') ?: 0;
         $comment = input('comment') ?: '';
-        $params = compact("id", "comment_score", "comment");
+        $params = compact("comment_score", "comment");
         $user = $this->user;
         ApproveInfoService::make($id, $params, $user, 'comment');
         $this->success('评价成功');

+ 1 - 1
application/common.php

@@ -215,7 +215,7 @@ function mk_time($type,$date){
  * @param $content
  */
 function user_log($dir,$content){
-    $log_dir=RUNTIME_PATH.'/'.$dir;
+    $log_dir=dirname($_SERVER['DOCUMENT_ROOT']).'/runtime/'.$dir;
     if(!is_dir($log_dir)){
         mkdir($log_dir,0777,true);
     }

+ 19 - 25
application/common/service/ApproveInfoService.php

@@ -138,12 +138,14 @@ class ApproveInfoService
                 $info_id = $info->id;
 
                 // 添加对应模块
-                $module_data = self::create_module($module, $params, $info_id, [], 'create');
-                $info->module_id = $module_data['module_id'];
+                $result = self::create_module($module, $params, $info_id, [], 'create');
+                $info->module_id = $result['module_id'];
                 $info->save();
 
                 // 添加审批抄送
                 self::create_approve($approve_user, $copy_user, $userid, $info_id, 'create');
+
+                user_log('approve',json_encode($result,JSON_UNESCAPED_UNICODE));
             }
             Db::commit();
         } catch (Exception $e) {
@@ -152,9 +154,14 @@ class ApproveInfoService
             except('出现错误:' . $e->getMessage());
         }
 
+        // 4=领用申请 冻结库存
+        if ($module == CommonConstant::MODULE_4) {
+
+        }
+
         if ($way == CommonConstant::create) {
+            // 9=合同呈批申请 生成合同编号
             if ($module == CommonConstant::MODULE_9) {
-                // 生成合同编号
                 $contract_no = CommonService::get_contract_no($params['type']);
                 $info->save(['reason' => $contract_no]);
             }
@@ -311,9 +318,8 @@ class ApproveInfoService
             $module_result = $model::create($data);
             $module_id = $module_result->id;
         }
-        $module_data = $data;
-        $result = compact("module_id", "module_data", "other");
-        return $result;
+        $module_info = $data;
+        return compact("module_id", "module_info", "other");
     }
 
     /**
@@ -323,6 +329,7 @@ class ApproveInfoService
      * @param integer $module 模块类型
      * @param array $params 数据
      * @param string $type 类型:create=申请,update=重新发起
+     * @return array
      **/
     public static function create_goods($info_id, $module, $params, $type)
     {
@@ -1175,29 +1182,16 @@ class ApproveInfoService
                 }
                 // TODO 没有判断评价状态
 
+                // 更新维修信息
                 $params['comment_status'] = CommonConstant::IS_WHO_1;
-                self::comment($info, $params);
+                try {
+                    ApproveMaintain::where('info_id', $info->id)->update($params);
+                } catch (Exception $e) {
+                    except('出现错误:' . $e->getMessage());
+                }
                 break;
         }
         return true;
     }
 
-    /**
-     * 评分
-     *
-     * @param mixed $info 申请信息
-     * @param array $params 数组
-     **/
-    public static function comment($info, $params)
-    {
-        try {
-            $data = $params;
-            // 更新维修信息
-            ApproveMaintain::where('info_id', $info->id)->update($data);
-        } catch (Exception $e) {
-            except('出现错误:' . $e->getMessage());
-        }
-        return true;
-    }
-
 }

+ 9 - 20
application/common/service/ApproveService.php

@@ -447,10 +447,15 @@ class ApproveService
                     except('您没有权限操作');
                 }
                 // TODO 没有判断反馈状态
-            
+
+                // 更新维修信息
                 $params['maintain_user_id'] = $info->maintain_user_id;
                 $params['feedback_status'] = CommonConstant::IS_WHO_1;
-                self::feedback($info, $params);
+                try {
+                    ApproveMaintain::where('info_id', $info->id)->update($params);
+                } catch (Exception $e) {
+                    except('出现错误:' . $e->getMessage());
+                }
                 break;
         }
         return true;
@@ -590,6 +595,7 @@ class ApproveService
 
             // 编辑审批申请
             if ($module == CommonConstant::MODULE_9) {
+                // 9=合同呈批 不编辑合同编号
                 unset($data['reason']);
             }
             $info->save($data);
@@ -612,7 +618,7 @@ class ApproveService
      **/
     public static function create_approve_info_log($approve, $info, $params)
     {
-        $info['module_info'] = $params['module_data'];
+        $info['module_info'] = $params['module_info'];
         $info['other'] = $params['other'] ? $params['other']['data'] : [];
 
         $data = [
@@ -624,21 +630,4 @@ class ApproveService
         return true;
     }
 
-    /**
-     * 上传反馈结果
-     *
-     * @param mixed $info 申请信息
-     * @param array $params 数组
-     **/
-    public static function feedback($info, $params)
-    {
-        try {
-            // 更新维修信息
-            ApproveMaintain::where('info_id', $info->id)->update($params);
-        } catch (Exception $e) {
-            except('出现错误:' . $e->getMessage());
-        }
-        return true;
-    }
-
 }