Просмотр исходного кода

Revert "【程序目录】优化代码"

This reverts commit 3ef09698c81d19303bcf932d8176c88840aefe98.
吴昊天 1 год назад
Родитель
Сommit
ddb7e29034

+ 2 - 2
crmeb/app/adminapi/controller/UpgradeController.php

@@ -734,8 +734,8 @@ class UpgradeController
      */
     public function upData()
     {
-        $data['new_version'] = 'CRMEB-BZ v5.4.0';
-        $data['new_code'] = '540.1';
+        $data['new_version'] = 'CRMEB-BZ-BETA v5.4.0';
+        $data['new_code'] = '540';
         $data['update_sql'] = [
             [
                 'code' => '540',

+ 5 - 7
crmeb/app/adminapi/controller/v1/agent/Division.php

@@ -141,13 +141,11 @@ class Division extends AuthController
         if ((int)$data['uid'] == 0) $data['uid'] = $data['image']['uid'];
         $userInfo = $userServices->getUserInfo($data['uid'], 'is_division,is_agent,is_staff');
         if (!$userInfo) throw new AdminException(100100);
-        if ($data['edit'] == 0) {
-            if ($userInfo['is_division']) throw new AdminException('此用户是事业部,请勿添加为代理商');
-            if ($userInfo['is_agent']) throw new AdminException('此用户是代理商,无法重复添加');
-            if ($userInfo['is_staff']) throw new AdminException('此用户是下级员工,无法添加为代理商');
-            $divisionUserInfo = $userServices->count(['uid' => (int)$data['division_id'], 'is_division' => 1, 'division_id' => $data['division_id']]);
-            if (!$divisionUserInfo) throw new AdminException(100100);
-        }
+        if ($userInfo['is_division']) throw new AdminException('此用户是事业部,请勿添加为代理商');
+        if ($userInfo['is_agent']) throw new AdminException('此用户是代理商,无法重复添加');
+        if ($userInfo['is_staff']) throw new AdminException('此用户是下级员工,无法添加为代理商');
+        $divisionUserInfo = $userServices->count(['uid' => (int)$data['division_id'], 'is_division' => 1, 'division_id' => $data['division_id']]);
+        if (!$divisionUserInfo) throw new AdminException(100100);
         $this->services->divisionAgentSave($data);
         return app('json')->success(100000);
     }

+ 1 - 8
crmeb/app/adminapi/controller/v1/marketing/StoreBargain.php

@@ -153,14 +153,7 @@ class StoreBargain extends AuthController
     {
         /** @var StoreBargainUserServices $bargainUserService */
         $bargainUserService = app()->make(StoreBargainUserServices::class);
-        if ($status == 0) {
-            $bargainUserService->userBargainStatusFail($id, false);
-        } else {
-            $info = $this->services->get($id);
-            if ($info['stop_time'] < time()) {
-                return app('json')->fail('活动已结束,无法继续上架');
-            }
-        }
+        $bargainUserService->userBargainStatusFail($id, false);
         $this->services->update($id, ['status' => $status]);
         return app('json')->success(100001);
     }

+ 0 - 6
crmeb/app/adminapi/controller/v1/marketing/StoreCombination.php

@@ -161,12 +161,6 @@ class StoreCombination extends AuthController
      */
     public function set_status($id, $status)
     {
-        if ($status == 1) {
-            $info = $this->services->get($id);
-            if ($info['stop_time'] < time()) {
-                return app('json')->fail('活动已结束,无法继续上架');
-            }
-        }
         $this->services->update($id, ['is_show' => $status]);
         return app('json')->success($status == 0 ? 100014 : 100015);
     }

+ 0 - 6
crmeb/app/adminapi/controller/v1/marketing/StoreSeckill.php

@@ -120,12 +120,6 @@ class StoreSeckill extends AuthController
      */
     public function set_status($id, $status)
     {
-        if ($status == 1) {
-            $info = $this->services->get($id);
-            if ($info['stop_time'] < time()) {
-                return app('json')->fail('活动已结束,无法继续上架');
-            }
-        }
         $this->services->update($id, ['status' => $status]);
         return app('json')->success(100014);
     }

+ 1 - 1
crmeb/app/adminapi/controller/v1/order/StoreOrderInvoice.php

@@ -193,7 +193,7 @@ class StoreOrderInvoice extends AuthController
             $data['invoice_type'] = 82;
             $data['is_enterprise'] = 0;
         } else {
-            $data['invoice_type'] = $info['type'] == 1 ? 82 : 81;
+            $data['invoice_type'] = 81;
             $data['tax_id'] = $info['duty_number'];
             $data['is_enterprise'] = 1;
         }

+ 1 - 1
crmeb/app/api/controller/v1/order/StoreOrderController.php

@@ -267,7 +267,7 @@ class StoreOrderController
             //创建订单jspay支付
             /** @var StoreOrderSuccessServices $success */
             $success = app()->make(StoreOrderSuccessServices::class);
-            $payPriceStatus = $success->zeroYuanPayment($orderInfo, $uid);
+            $payPriceStatus = $success->zeroYuanPayment($orderInfo, $uid, $paytype);
             if ($payPriceStatus)//0元支付成功
                 return app('json')->status('success', '支付成功', ['order_id' => $orderInfo['order_id'], 'key' => $orderInfo['unique']]);
             else

+ 0 - 5
crmeb/app/model/order/StoreOrder.php

@@ -634,9 +634,4 @@ class StoreOrder extends BaseModel
     {
         $query->where('agent_brokerage', '>', $value);
     }
-
-    public function searchVirtualTypeAttr($query, $value)
-    {
-        if ($value !== '') $query->where('virtual_type', $value);
-    }
 }

+ 1 - 1
crmeb/app/model/product/product/StoreCategory.php

@@ -96,6 +96,6 @@ class StoreCategory extends BaseModel
      */
     public function searchIdAttr($query, $value, $data)
     {
-        if ($value) $query->whereIn('id', is_array($value) ? $value : (string)$value);
+        if ($value) $query->whereIn('id', $value);
     }
 }

+ 1 - 1
crmeb/app/model/product/product/StoreProduct.php

@@ -311,7 +311,7 @@ class StoreProduct extends BaseModel
                 $query->where(['is_show' => 0, 'is_del' => 0]);
                 break;
             case 3:
-                $query->where(['is_del' => 0, 'vip_product' => 0]);
+                $query->where(['is_del' => 0]);
                 break;
             case 4:
                 $query->where(['is_del' => 0])->where(function ($query) {

+ 4 - 12
crmeb/app/services/activity/bargain/StoreBargainServices.php

@@ -100,28 +100,20 @@ class StoreBargainServices extends BaseServices
         /** @var StoreBargainUserHelpServices $storeBargainUserHelpServices */
         $storeBargainUserHelpServices = app()->make(StoreBargainUserHelpServices::class);
         $countHelpAll = $storeBargainUserHelpServices->getHelpAllCount([['bargain_id', 'in', $ids]]);
-        $stopIds = [];
         foreach ($list as &$item) {
             $item['count_people_all'] = $countAll[$item['id']] ?? 0;//参与人数
             $item['count_people_help'] = $countHelpAll[$item['id']] ?? 0;//帮忙砍价人数
             $item['count_people_success'] = $countSuccess[$item['id']] ?? 0;//砍价成功人数
             $item['stop_status'] = $item['stop_time'] < time() ? 1 : 0;
             if ($item['status']) {
-                if ($item['start_time'] > time()) {
+                if ($item['start_time'] > time())
                     $item['start_name'] = '未开始';
-                } else if ($item['stop_time'] < time()) {
+                else if ($item['stop_time'] < time())
                     $item['start_name'] = '已结束';
-                    $item['status'] = 0;
-                    $stopIds[] = $item['id'];
-                } else if ($item['stop_time'] > time() && $item['start_time'] < time()) {
+                else if ($item['stop_time'] > time() && $item['start_time'] < time()) {
                     $item['start_name'] = '进行中';
                 }
-            } else {
-                $item['start_name'] = '已结束';
-            }
-        }
-        if ($stopIds) {
-            $this->dao->batchUpdate($stopIds, ['status' => 0]);
+            } else $item['start_name'] = '已结束';
         }
         return compact('list', 'count');
     }

+ 4 - 12
crmeb/app/services/activity/combination/StoreCombinationServices.php

@@ -136,28 +136,20 @@ class StoreCombinationServices extends BaseServices
         $countAll = $storePinkServices->getPinkCount([]);
         $countTeam = $storePinkServices->getPinkCount(['k_id' => 0, 'status' => 2]);
         $countPeople = $storePinkServices->getPinkCount(['k_id' => 0]);
-        $stopIds = [];
         foreach ($list as &$item) {
             $item['count_people'] = $countPeople[$item['id']] ?? 0;//拼团数量
             $item['count_people_all'] = $countAll[$item['id']] ?? 0;//参与人数
             $item['count_people_pink'] = $countTeam[$item['id']] ?? 0;//成团数量
             $item['stop_status'] = $item['stop_time'] < time() ? 1 : 0;
             if ($item['is_show']) {
-                if ($item['start_time'] > time()) {
+                if ($item['start_time'] > time())
                     $item['start_name'] = '未开始';
-                } else if ($item['stop_time'] < time()) {
+                else if ($item['stop_time'] < time())
                     $item['start_name'] = '已结束';
-                    $item['is_show'] = 0;
-                    $stopIds[] = $item['id'];
-                } else if ($item['stop_time'] > time() && $item['start_time'] < time()) {
+                else if ($item['stop_time'] > time() && $item['start_time'] < time()) {
                     $item['start_name'] = '进行中';
                 }
-            } else {
-                $item['start_name'] = '已结束';
-            }
-        }
-        if ($stopIds) {
-            $this->dao->batchUpdate($stopIds, ['is_show' => 0]);
+            } else $item['start_name'] = '已结束';
         }
         return compact('list', 'count');
     }

+ 3 - 9
crmeb/app/services/activity/seckill/StoreSeckillServices.php

@@ -206,17 +206,14 @@ class StoreSeckillServices extends BaseServices
         [$page, $limit] = $this->getPageValue();
         $list = $this->dao->getList($where, $page, $limit);
         $count = $this->dao->count($where + ['is_del' => 0]);
-        $stopIds = [];
         foreach ($list as &$item) {
             $item['store_name'] = $item['title'];
             if ($item['status']) {
-                if ($item['start_time'] > time()) {
+                if ($item['start_time'] > time())
                     $item['start_name'] = '未开始';
-                } else if (bcadd($item['stop_time'], '86400') < time()) {
+                else if (bcadd($item['stop_time'], '86400') < time())
                     $item['start_name'] = '已结束';
-                    $item['status'] = 0;
-                    $stopIds[] = $item['id'];
-                } else if (bcadd($item['stop_time'], '86400') > time() && $item['start_time'] < time()) {
+                else if (bcadd($item['stop_time'], '86400') > time() && $item['start_time'] < time()) {
                     $item['start_name'] = '进行中';
                 }
             } else $item['start_name'] = '已结束';
@@ -224,9 +221,6 @@ class StoreSeckillServices extends BaseServices
             $item['_stop_time'] = $end_time;
             $item['stop_status'] = $item['stop_time'] + 86400 < time() ? 1 : 0;
         }
-        if ($stopIds) {
-            $this->dao->batchUpdate($stopIds, ['status' => 0]);
-        }
         return compact('list', 'count');
     }
 

+ 1 - 1
crmeb/app/services/order/StoreOrderDeliveryServices.php

@@ -626,7 +626,7 @@ class StoreOrderDeliveryServices extends BaseServices
             }
             $orderInfo->delivery_id = $data['delivery_id'];
         }
-        if (true) {
+        if ($data['express_record_type'] != 3) {
             $data['status'] = 1;
             $orderInfo->delivery_type = $data['delivery_type'];
             $orderInfo->delivery_name = $data['delivery_name'];

+ 1 - 1
crmeb/app/services/order/StoreOrderInvoiceServices.php

@@ -271,7 +271,7 @@ class StoreOrderInvoiceServices extends BaseServices
             $data['tax_id'] = '';
             $data['is_enterprise'] = 0;
         } else {
-            $data['invoice_type'] = $info['type'] == 1 ? 82 : 81;
+            $data['invoice_type'] = 81;
             $data['tax_id'] = $info['duty_number'];
             $data['is_enterprise'] = 1;
         }

+ 1 - 10
crmeb/app/services/order/StoreOrderServices.php

@@ -796,15 +796,6 @@ HTML;
             if ($order['two_brokerage'] > 0) {
                 $data['two_brokerage'] = bcmul((string)$order['two_brokerage'], $percent, 2);
             }
-            if ($order['staff_brokerage'] > 0) {
-                $data['staff_brokerage'] = bcmul((string)$order['staff_brokerage'], $percent, 2);
-            }
-            if ($order['agent_brokerage'] > 0) {
-                $data['agent_brokerage'] = bcmul((string)$order['agent_brokerage'], $percent, 2);
-            }
-            if ($order['division_brokerage'] > 0) {
-                $data['division_brokerage'] = bcmul((string)$order['division_brokerage'], $percent, 2);
-            }
         }
         /** @var StoreOrderStatusServices $services */
         $services = app()->make(StoreOrderStatusServices::class);
@@ -2591,7 +2582,7 @@ HTML;
         }
         // 判断是否开启小程序订单管理
         $orderData['order_shipping_open'] = false;
-        if (sys_config('order_shipping_open', 0) && $order['pay_price'] > 0 && $order['is_channel'] == 1 && $order['pay_type'] == 'weixin' && MiniOrderService::isManaged()) {
+        if (sys_config('order_shipping_open', 0) && $order['is_channel'] == 1 && $order['pay_type'] == 'weixin' && MiniOrderService::isManaged()) {
             // 判断是否存在子未收货子订单
             if ($order['pid'] > 0) {
                 if ($this->checkSubOrderNotTake((int)$order['pid'], (int)$order['id'])) {

+ 1 - 1
crmeb/app/services/order/StoreOrderTakeServices.php

@@ -572,7 +572,7 @@ class StoreOrderTakeServices extends BaseServices
         //自定义事件-佣金到账
         event('CustomEventListener', ['order_brokerage', [
             'uid' => $spread_uid,
-            'order_id' => $orderInfo['order_id'] ?? '',
+            'order_id' => $orderInfo['order_id'],
             'phone' => $spreadPhone,
             'brokeragePrice' => $brokeragePrice,
             'goodsName' => $goodsName,

+ 1 - 1
crmeb/app/services/other/export/ExportServices.php

@@ -218,7 +218,7 @@ class ExportServices extends BaseServices
         $export = $fileKey = [];
         /** @var StoreOrderServices $orderServices */
         $orderServices = app()->make(StoreOrderServices::class);
-        $data = $orderServices->getOrderList(['status' => 1, 'shipping_type' => 1, 'virtual_type' => 0])['data'];
+        $data = $orderServices->getOrderList(['status' => 1, 'shipping_type' => 1])['data'];
         if (!empty($data)) {
             $i = 0;
             foreach ($data as $item) {

+ 0 - 21
crmeb/app/services/system/config/SystemConfigServices.php

@@ -782,27 +782,6 @@ class SystemConfigServices extends BaseServices
                             }
                             $i++;
                         }
-                    } else {
-                        $sonData = $this->dao->getColumn(['level' => 1, 'link_id' => $data['id']], 'menu_name,link_value');
-                        if ($sonData) {
-                            $sonValue = [];
-                            foreach ($sonData as $sv) {
-                                $sonValue[$sv['link_value']][] = $sv['menu_name'];
-                            }
-                            $i = 0;
-                            foreach ($sonValue as $pk => $pv) {
-                                $label = $data['menu_name'];
-                                if ($i == 1) $label = $data['menu_name'] . '@';
-                                if ($i == 2) $label = $data['menu_name'] . '#';
-                                if (!isset($relateRule[$label])) {
-                                    $relateRule[$label]['show_value'] = (int)$pk;
-                                }
-                                foreach ($pv as $pvv) {
-                                    $relateRule[$label]['son_type'][$pvv] = '';
-                                }
-                                $i++;
-                            }
-                        }
                     }
                     if (isset($relateRule[$key])) {
                         $role = $relateRule[$key];

+ 0 - 1
crmeb/app/services/user/UserExtractServices.php

@@ -96,7 +96,6 @@ class UserExtractServices extends BaseServices
         $list = $this->dao->getExtractList($where, $field, $page, $limit);
         foreach ($list as &$item) {
             $item['nickname'] = $item['user']['nickname'] ?? '';
-            $item['receive_price'] = bcsub((string)$item['extract_price'], (string)$item['extract_fee'], 2);
         }
         $count = $this->dao->count($where);
         return compact('list', 'count');