Browse Source

fix:agent

super-yimizi 11 hours ago
parent
commit
619613859b

+ 1 - 1
application/api/controller/commission/AgentApply.php

@@ -124,7 +124,7 @@ class AgentApply extends Base
             ])->find();
             ])->find();
             
             
             if (!$parentAgent) {
             if (!$parentAgent) {
-                $this->error('邀请码无效或代理商状态异常');
+                $this->error('邀请码错误');
             }
             }
             
             
             // 获取上级用户信息
             // 获取上级用户信息

+ 19 - 14
application/common/Service/Commission/Agent.php

@@ -404,22 +404,27 @@ class Agent
         foreach ($childAgentLevelArray as &$agentLevel) {
         foreach ($childAgentLevelArray as &$agentLevel) {
             if (!empty($agentLevel)) {
             if (!empty($agentLevel)) {
                 $agentLevel = json_decode($agentLevel, true);
                 $agentLevel = json_decode($agentLevel, true);
-                array_walk($agentLevel, function ($count, $level) use (&$childAgentLevelCount) {
-                    if (isset($childAgentLevelCount[$level])) {
-                        $childAgentLevelCount[$level] += $count;
-                    } else {
-                        $childAgentLevelCount[$level] = $count;
-                    }
-                });
+                if (is_array($agentLevel)) {
+                    array_walk($agentLevel, function ($count, $level) use (&$childAgentLevelCount) {
+                        if (isset($childAgentLevelCount[$level])) {
+                            $childAgentLevelCount[$level] += $count;
+                        } else {
+                            $childAgentLevelCount[$level] = $count;
+                        }
+                    });
+                }
             }
             }
         }
         }
-        array_walk($childAgentLevel1Array, function ($count, $level) use (&$childAgentLevelCount) {
-            if (isset($childAgentLevelCount[$level])) {
-                $childAgentLevelCount[$level] += $count;
-            } else {
-                $childAgentLevelCount[$level] = $count;
-            }
-        });
+        // 确保 $childAgentLevel1Array 是数组
+        if (is_array($childAgentLevel1Array) && !empty($childAgentLevel1Array)) {
+            array_walk($childAgentLevel1Array, function ($count, $level) use (&$childAgentLevelCount) {
+                if (isset($childAgentLevelCount[$level])) {
+                    $childAgentLevelCount[$level] += $count;
+                } else {
+                    $childAgentLevelCount[$level] = $count;
+                }
+            });
+        }
         return $childAgentLevelCount;
         return $childAgentLevelCount;
     }
     }
 
 

+ 1 - 1
application/common/model/commission/Agent.php

@@ -17,7 +17,7 @@ class Agent  extends Model
     protected $type = [
     protected $type = [
         'become_time' => 'timestamp',
         'become_time' => 'timestamp',
         'expire_time' => 'timestamp',
         'expire_time' => 'timestamp',
-        'child_agent_level_1' => 'json',
+        'child_agent_level_first' => 'json',
         'child_agent_level_all' => 'json',
         'child_agent_level_all' => 'json',
     ];
     ];
     protected $append = [
     protected $append = [

+ 11 - 7
public/assets/js/backend/feedback.js

@@ -37,16 +37,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'id', title: __('Id')},
                         {
                         {
-                            field: 'user.username', title: __('User_id'),operate: 'LIKE',
+                            field: 'user.username', title: __('User_id'), width: 150, operate: 'LIKE',
                             formatter: function (value, row, index) {
                             formatter: function (value, row, index) {
-                                // 显示用户头像和用户名
-                                var avatar = row.user && row.user.avatar ? row.user.avatar : '/assets/img/avatar.png';
+                                // 显示用户头像、用户名和手机号,样式与agent保持一致
+                                var avatarUrl = row.user && row.user.avatar ? Fast.api.cdnurl(row.user.avatar) : Fast.api.cdnurl('/assets/img/avatar.png');
                                 var username = row.user && row.user.username ? row.user.username : '游客';
                                 var username = row.user && row.user.username ? row.user.username : '游客';
+                                var phone = row.user && row.user.mobile ? row.user.mobile : '';
                                 
                                 
-                                return '<div style="display:flex;align-items:center;">' + 
-                                       '<img src="' + avatar + '" style="width:40px;height:40px;border-radius:50%;margin-right:10px;" />' +
-                                       '<span style="color:#a55bff;">' + username + '</span>' +
-                                       '</div>';
+                                var html = '<div style="display:flex;align-items:center;">';
+                                html += '<img src="' + avatarUrl + '" style="width:40px;height:40px;border-radius:50%;margin-right:10px;" />';
+                                html += '<div>';
+                                html += '<div style="color:#337ab7;font-weight:bold;">' + username + '</div>';
+                                html += '<div style="color:#6c757d;font-size:12px;">' + phone + '</div>';
+                                html += '</div></div>';
+                                return html;
                             }
                             }
                         },
                         },
                         {field: 'type', title: __('Type'), searchList: feedbackTypeList,formatter: Controller.api.formatter.type},
                         {field: 'type', title: __('Type'), searchList: feedbackTypeList,formatter: Controller.api.formatter.type},