Showing 17 of 123 total issues

Method info has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function info(Request $request)
    {
        $userId = $request->session()->get('user_id');
        $color = ['', 'green', 'blue', 'purple', 'pinkpurple', 'red'];
        $params = $request->all();
Severity: Minor
Found in app/Http/Controllers/CustomController.php - About 1 hr to fix

    Method getDefaultRight has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getDefaultRight()
        {
            return [
                [
                    'key'  => 9999,
    Severity: Minor
    Found in app/Services/RightService.php - About 1 hr to fix

      Function add has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function add($params, $operUserId) {
              $customModel = new Customer();
      
              $result = ['status'=>1, 'error'=>''];
              $params['add_user_id'] = $operUserId;
      Severity: Minor
      Found in app/Services/CustomerEditService.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method handle has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handle($request, Closure $next)
          {
              $userId = $request->session()->get('user_id', 0);
      
              if (empty($userId)) {
      Severity: Minor
      Found in app/Http/Middleware/AuthMiddleware.php - About 1 hr to fix

        Method getLogListByCustomerId has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getLogListByCustomerId($customerId, $limit) {
                $dictModel = new SystemDict();
                $userModel = new SystemUser();
                $followUserArray = $userModel->getAllUserWithDelMap();
                $dict = $dictModel->getListByGroup($dictModel::GROUP_CUSTOM);
        Severity: Minor
        Found in app/Models/CustomerLog.php - About 1 hr to fix

          Method get has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get($customId, $followUserId, $operUserId = 0, $assignType = 0) {
                  $customModel = new Customer();
                  $custom = $customModel->find($customId);
                  $oldFollowUserId = $custom->follow_user_id;
                  if (empty($custom) || $oldFollowUserId == $followUserId) {
          Severity: Minor
          Found in app/Services/CustomerService.php - About 1 hr to fix

            Function handle has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                public function handle($config) {
                    echo PHP_EOL;
                    // 获取今天还有分配名额的用户
                    $customService = app(CustomerService::class);
                    $userService = app(UserService::class);
            Severity: Minor
            Found in app/Services/AssignRule/Rule1.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method addNotices has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function addNotices(Request $request) {
                    $userId = $request->session()->get('user_id');
                    $params = $request->all();
                    $customId = $params['id'];
                    $notices = $params['notices'];
            Severity: Minor
            Found in app/Http/Controllers/CustomController.php - About 1 hr to fix

              Function handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function handle() {
                      echo date('Y-m-d H:i:s') . ' start.......'.PHP_EOL;
                      // 取到所有分配规则
                      $model = new CustomerRuleConfig();
                      $rules = $model->get();
              Severity: Minor
              Found in app/Console/Commands/Assign.php - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Method _createWhere has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function _createWhere($params) {
                      $query = $this->leftJoin('customer', 'customer_backs.custom_id', '=', 'customer.id')->where('customer_backs.status', 1);
                      if (isset($params['customId']) && !empty($params['customId'])) {
                          $query = $query->where('customer_backs.custom_id', $params['customId']);
                      }
              Severity: Minor
              Found in app/Models/CustomerBack.php - About 1 hr to fix

                Method handle has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function handle($config) {
                        echo PHP_EOL;
                        // 获取今天还有分配名额的用户
                        $customService = app(CustomerService::class);
                        $userService = app(UserService::class);
                Severity: Minor
                Found in app/Services/AssignRule/Rule1.php - About 1 hr to fix

                  Method handle has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function handle() {
                          echo date('Y-m-d H:i:s') . ' start.......'.PHP_EOL;
                          // 取到所有分配规则
                          $model = new CustomerRuleConfig();
                          $rules = $model->get();
                  Severity: Minor
                  Found in app/Console/Commands/Assign.php - About 1 hr to fix

                    Function _createWhere has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function _createWhere($params) {
                            $query = $this->leftJoin('customer', 'customer_backs.custom_id', '=', 'customer.id')->where('customer_backs.status', 1);
                            if (isset($params['customId']) && !empty($params['customId'])) {
                                $query = $query->where('customer_backs.custom_id', $params['customId']);
                            }
                    Severity: Minor
                    Found in app/Models/CustomerBack.php - About 55 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function getLogListByCustomerId has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getLogListByCustomerId($customerId, $limit) {
                            $dictModel = new SystemDict();
                            $userModel = new SystemUser();
                            $followUserArray = $userModel->getAllUserWithDelMap();
                            $dict = $dictModel->getListByGroup($dictModel::GROUP_CUSTOM);
                    Severity: Minor
                    Found in app/Models/CustomerLog.php - About 55 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function addChannelCustomer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function addChannelCustomer($custom) {
                            $id = 0;
                            $hasInfo = Customer::where('source', $custom['source'])->where('channel_id', $custom['channel_id'])->get()->toArray();
                            // 判断客户已经存在
                            if (empty($hasInfo)) {
                    Severity: Minor
                    Found in app/Services/CustomerService.php - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function login has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function login(Request $request)
                        {
                            $params = $request->all();
                            $userName = $params['username'];
                            $password = $params['password'];
                    Severity: Minor
                    Found in app/Http/Controllers/UserController.php - About 45 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Method saveLog has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function saveLog($type, $id, $before, $after, $userId = 0, $remark = '') {
                    Severity: Minor
                    Found in app/Models/SystemLog.php - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language