Browse Source

fix:注释不需要的

super-yimizi 16 hours ago
parent
commit
799edfdf94

+ 4 - 4
application/admin/view/commission/agent/team.html

@@ -21,10 +21,10 @@
                                             <th>状态</th>
                                             <th>状态</th>
                                             <th>团队人数/分销商人数</th>
                                             <th>团队人数/分销商人数</th>
                                             <th>一级团队人数/一级分销商人数</th>
                                             <th>一级团队人数/一级分销商人数</th>
-                                            <th>二级团队人数/二级分销商人数</th>
+                                            <!-- <th>二级团队人数/二级分销商人数</th> -->
                                             <th>团队分销总额/团队分销订单</th>
                                             <th>团队分销总额/团队分销订单</th>
                                             <th>一级分销总额/一级分销订单</th>
                                             <th>一级分销总额/一级分销订单</th>
-                                            <th>二级分销总额/二级分销订单</th>
+                                            <!-- <th>二级分销总额/二级分销订单</th> -->
                                             <th>自购分销总金额/订单数</th>
                                             <th>自购分销总金额/订单数</th>
                                             <th>累计佣金</th>
                                             <th>累计佣金</th>
                                             <th>消费金额</th>
                                             <th>消费金额</th>
@@ -72,10 +72,10 @@
                                             </td>
                                             </td>
                                             <td style="text-align:center;">{$currentAgent.child_user_count_all|default=0}人/{$currentAgent.child_agent_count_all|default=0}人</td>
                                             <td style="text-align:center;">{$currentAgent.child_user_count_all|default=0}人/{$currentAgent.child_agent_count_all|default=0}人</td>
                                             <td style="text-align:center;">{$currentAgent.child_user_count_first|default=0}人/{$currentAgent.child_agent_count_first|default=0}人</td>
                                             <td style="text-align:center;">{$currentAgent.child_user_count_first|default=0}人/{$currentAgent.child_agent_count_first|default=0}人</td>
-                                            <td style="text-align:center;">{$currentAgent.child_user_count_second|default=0}人/{$currentAgent.child_agent_count_second|default=0}人</td>
+                                            <!-- <td style="text-align:center;">{$currentAgent.child_user_count_second|default=0}人/{$currentAgent.child_agent_count_second|default=0}人</td> -->
                                             <td style="text-align:center;">{$currentAgent.child_order_money_all|default=0}元/{$currentAgent.child_order_count_all|default=0}单</td>
                                             <td style="text-align:center;">{$currentAgent.child_order_money_all|default=0}元/{$currentAgent.child_order_count_all|default=0}单</td>
                                             <td style="text-align:center;">{$currentAgent.child_order_money_first|default=0}元/{$currentAgent.child_order_count_first|default=0}单</td>
                                             <td style="text-align:center;">{$currentAgent.child_order_money_first|default=0}元/{$currentAgent.child_order_count_first|default=0}单</td>
-                                            <td style="text-align:center;">{$currentAgent.child_order_money_second|default=0}元/{$currentAgent.child_order_count_second|default=0}单</td>
+                                            <!-- <td style="text-align:center;">{$currentAgent.child_order_money_second|default=0}元/{$currentAgent.child_order_count_second|default=0}单</td> -->
                                             <td style="text-align:center;">{$currentAgent.self_order_money|default=0}元/{$currentAgent.self_order_count|default=0}单</td>
                                             <td style="text-align:center;">{$currentAgent.self_order_money|default=0}元/{$currentAgent.self_order_count|default=0}单</td>
                                             <td style="text-align:center;">{$currentAgent.total_income|default=0}元</td>
                                             <td style="text-align:center;">{$currentAgent.total_income|default=0}元</td>
                                             <td style="text-align:center;">{$currentAgent.user.total_consume|default=0}元</td>
                                             <td style="text-align:center;">{$currentAgent.user.total_consume|default=0}元</td>

+ 2 - 2
application/admin/view/commission/level/add.html

@@ -77,7 +77,7 @@
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
-            <div class="form-group">
+            <!-- <div class="form-group">
                 <label class="control-label col-xs-12 col-sm-2">二级佣金比例:</label>
                 <label class="control-label col-xs-12 col-sm-2">二级佣金比例:</label>
                 <div class="col-xs-12 col-sm-8">
                 <div class="col-xs-12 col-sm-8">
                     <div class="input-group">
                     <div class="input-group">
@@ -94,7 +94,7 @@
                         <span class="input-group-addon">%</span>
                         <span class="input-group-addon">%</span>
                     </div>
                     </div>
                 </div>
                 </div>
-            </div>
+            </div> -->
         </div>
         </div>
     </div>
     </div>
     <div class="form-group layer-footer">
     <div class="form-group layer-footer">

+ 69 - 5
application/api/controller/AiMeasurement.php

@@ -23,6 +23,66 @@ class AiMeasurement extends Api
         'connect_timeout' => 30
         'connect_timeout' => 30
     ];
     ];
 
 
+    // AI测量日志配置
+    private $logConfig = null;
+
+    /**
+     * 获取AI测量日志配置
+     */
+    private function getLogConfig()
+    {
+        if ($this->logConfig === null) {
+            $log_path = RUNTIME_PATH . 'log/ai_measurement/';
+            if (!is_dir($log_path)) {
+                @mkdir($log_path, 0755, true);
+            }
+
+            $this->logConfig = [
+                'logger' => [
+                    'enable' => true,
+                    'file' => $log_path . 'ai_measurement.log',
+                    'level' => config('app_debug') ? 'debug' : 'info',
+                    'type' => 'daily',
+                    'max_file' => 30,
+                ]
+            ];
+        }
+        return $this->logConfig;
+    }
+
+    /**
+     * 写入AI测量日志
+     * @param string $level 日志级别: info, error, debug, warning
+     * @param string $message 日志消息
+     * @param array $context 上下文数据
+     */
+    private function writeLog($level, $message, $context = [])
+    {
+        $config = $this->getLogConfig();
+        $log_path = dirname($config['logger']['file']);
+        $log_file = $config['logger']['file'];
+        
+        // 如果是daily类型,添加日期后缀
+        if ($config['logger']['type'] === 'daily') {
+            $log_file = $log_path . '/ai_measurement_' . date('Y-m-d') . '.log';
+        }
+
+        $log_content = [
+            'timestamp' => date('Y-m-d H:i:s'),
+            'level' => strtoupper($level),
+            'message' => $message,
+            'context' => $context
+        ];
+
+        $log_text = '[' . $log_content['timestamp'] . '] ' . $log_content['level'] . ': ' . $log_content['message'];
+        if (!empty($context)) {
+            $log_text .= ' ' . json_encode($context, JSON_UNESCAPED_UNICODE);
+        }
+        $log_text .= PHP_EOL;
+
+        file_put_contents($log_file, $log_text, FILE_APPEND | LOCK_EX);
+    }
+
     /**
     /**
      * 开始AI身体测量分析
      * 开始AI身体测量分析
      */
      */
@@ -614,12 +674,12 @@ class AiMeasurement extends Api
             $logData = [
             $logData = [
                 'url' => $apiUrl,
                 'url' => $apiUrl,
                 'height' => $heightValue . 'cm',
                 'height' => $heightValue . 'cm',
-                'image1_preview' => isset($requestData['image1']) ? substr($requestData['image1'], 0, 50) . '...' : null,
-                'image2_preview' => isset($requestData['image2']) ? substr($requestData['image2'], 0, 50) . '...' : null,
-                'image3_preview' => isset($requestData['image3']) ? substr($requestData['image3'], 0, 50) . '...' : null,
+                'image1' => isset($requestData['image1']) ? substr($requestData['image1'], 0, 50) . '...' : null,
+                'image2' => isset($requestData['image2']) ? substr($requestData['image2'], 0, 50) . '...' : null,
+                'image3' => isset($requestData['image3']) ? substr($requestData['image3'], 0, 50) . '...' : null,
                 'request_data_size' => strlen(json_encode($requestData)) . ' bytes'
                 'request_data_size' => strlen(json_encode($requestData)) . ' bytes'
             ];
             ];
-            \think\Log::info('Calling third party AI service: ' . json_encode($logData));
+            $this->writeLog('info', 'Calling third party AI service', $logData);
             
             
             // 发送POST请求
             // 发送POST请求
             $ch = curl_init();
             $ch = curl_init();
@@ -647,7 +707,11 @@ class AiMeasurement extends Api
                 throw new \Exception('请求第三方AI服务失败: ' . $error);
                 throw new \Exception('请求第三方AI服务失败: ' . $error);
             }
             }
             
             
-            \think\Log::info('Third party AI service response: ' .$response);
+            $this->writeLog('info', 'Third party AI service response received', [
+                'response_size' => strlen($response) . ' bytes',
+                'http_code' => $httpCode,
+                'response_preview' => substr($response, 0, 200) . '...'
+            ]);
             
             
             // 检查响应内容
             // 检查响应内容
             if (empty($response)) {
             if (empty($response)) {

+ 12 - 12
public/assets/js/backend/commission/agent.js

@@ -762,12 +762,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                             var agentCount = row.agent.child_agent_count_first || 0;
                             var agentCount = row.agent.child_agent_count_first || 0;
                             return userCount + '人/' + agentCount + '人';
                             return userCount + '人/' + agentCount + '人';
                         }},
                         }},
-                        {field: 'agent.child_user_count_second', title: __('二级团队人数/二级分销商人数'), width: 220, align: 'center', formatter: function(value, row, index) {
-                            if (!row.agent) return '0人/0人';
-                            var userCount = row.agent.child_user_count_second || 0;
-                            var agentCount = row.agent.child_agent_count_second || 0;
-                            return userCount + '人/' + agentCount + '人';
-                        }},
+                        // {field: 'agent.child_user_count_second', title: __('二级团队人数/二级分销商人数'), width: 220, align: 'center', formatter: function(value, row, index) {
+                        //     if (!row.agent) return '0人/0人';
+                        //     var userCount = row.agent.child_user_count_second || 0;
+                        //     var agentCount = row.agent.child_agent_count_second || 0;
+                        //     return userCount + '人/' + agentCount + '人';
+                        // }},
                         {field: 'agent.child_order_money_all', title: __('团队分销总额/团队分销订单'), width: 220, align: 'center', formatter: function(value, row, index) {
                         {field: 'agent.child_order_money_all', title: __('团队分销总额/团队分销订单'), width: 220, align: 'center', formatter: function(value, row, index) {
                             if (!row.agent) return '0元/0单';
                             if (!row.agent) return '0元/0单';
                             var money = row.agent.child_order_money_all || 0;
                             var money = row.agent.child_order_money_all || 0;
@@ -780,12 +780,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                             var count = row.agent.child_order_count_first || 0;
                             var count = row.agent.child_order_count_first || 0;
                             return money + '元/' + count + '单';
                             return money + '元/' + count + '单';
                         }},
                         }},
-                        {field: 'agent.child_order_money_second', title: __('二级分销总额/二级分销订单'), width: 220, align: 'center', formatter: function(value, row, index) {
-                            if (!row.agent) return '0元/0单';
-                            var money = row.agent.child_order_money_second || 0;
-                            var count = row.agent.child_order_count_second || 0;
-                            return money + '元/' + count + '单';
-                        }},
+                        // {field: 'agent.child_order_money_second', title: __('二级分销总额/二级分销订单'), width: 220, align: 'center', formatter: function(value, row, index) {
+                        //     if (!row.agent) return '0元/0单';
+                        //     var money = row.agent.child_order_money_second || 0;
+                        //     var count = row.agent.child_order_count_second || 0;
+                        //     return money + '元/' + count + '单';
+                        // }},
                         {field: 'agent.child_order_money_0', title: __('自购分销总金额/订单数'), width: 220, align: 'center', formatter: function(value, row, index) {
                         {field: 'agent.child_order_money_0', title: __('自购分销总金额/订单数'), width: 220, align: 'center', formatter: function(value, row, index) {
                             if (!row.agent) return '0元/0单';
                             if (!row.agent) return '0元/0单';
                             // 自购数据可能存储在其他字段中,这里使用0级别或者特定字段
                             // 自购数据可能存储在其他字段中,这里使用0级别或者特定字段

+ 20 - 20
public/assets/js/backend/commission/level.js

@@ -40,26 +40,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                             }
                             }
                             return (value.commission_1 || '0.00') + '%';
                             return (value.commission_1 || '0.00') + '%';
                         }},
                         }},
-                        {field: 'commission_rules', title: __('二级佣金比例'), operate: false, formatter: function(value, row, index) {
-                            if (typeof value === 'string') {
-                                try {
-                                    value = JSON.parse(value);
-                                } catch (e) {
-                                    value = {};
-                                }
-                            }
-                            return (value.commission_2 || '0.00') + '%';
-                        }},
-                        {field: 'commission_rules', title: __('三级佣金比例'), operate: false, formatter: function(value, row, index) {
-                            if (typeof value === 'string') {
-                                try {
-                                    value = JSON.parse(value);
-                                } catch (e) {
-                                    value = {};
-                                }
-                            }
-                            return (value.commission_3 || '0.00') + '%';
-                        }},
+                        // {field: 'commission_rules', title: __('二级佣金比例'), operate: false, formatter: function(value, row, index) {
+                        //     if (typeof value === 'string') {
+                        //         try {
+                        //             value = JSON.parse(value);
+                        //         } catch (e) {
+                        //             value = {};
+                        //         }
+                        //     }
+                        //     return (value.commission_2 || '0.00') + '%';
+                        // }},
+                        // {field: 'commission_rules', title: __('三级佣金比例'), operate: false, formatter: function(value, row, index) {
+                        //     if (typeof value === 'string') {
+                        //         try {
+                        //             value = JSON.parse(value);
+                        //         } catch (e) {
+                        //             value = {};
+                        //         }
+                        //     }
+                        //     return (value.commission_3 || '0.00') + '%';
+                        // }},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, 
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, 
                          buttons: [
                          buttons: [
                              {
                              {