Sfoglia il codice sorgente

Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

# Conflicts:
#	template/admin/src/main.js
From-wh 2 anni fa
parent
commit
b82ff43db1

+ 6 - 5
crmeb/app/adminapi/controller/Common.php

@@ -60,7 +60,7 @@ class Common extends AuthController
         $res = $res ? json_decode($res, true) : [];
 
         //兼容test.
-        if ($res['data']['status'] !== 1) {
+        if (!isset($res['data']['status']) || $res['data']['status'] !== 1) {
             $host = str_replace('test.', '', $host);
             $res = HttpService::request('http://authorize.crmeb.net/api/auth_cert_query', 'post', [
                 'domain_name' => $host,
@@ -71,7 +71,7 @@ class Common extends AuthController
         }
 
         //如果是主域名兼容www.
-        if ($res['data']['status'] !== 1) {
+        if (!isset($res['data']['status']) || $res['data']['status'] !== 1) {
             $host = str_replace('www.', '', $host);
             $res = HttpService::request('http://authorize.crmeb.net/api/auth_cert_query', 'post', [
                 'domain_name' => $host,
@@ -82,9 +82,9 @@ class Common extends AuthController
         }
 
         //升级状态
-        /** @var UpgradeServices $upgradeServices */
-        $upgradeServices = app()->make(UpgradeServices::class);
-        $upgradeStatus = $upgradeServices->getUpgradeStatus();
+//        /** @var UpgradeServices $upgradeServices */
+//        $upgradeServices = app()->make(UpgradeServices::class);
+//        $upgradeStatus = $upgradeServices->getUpgradeStatus();
 
         $status = $res['data']['status'] ?? -9;
         switch ((int)$status) {
@@ -402,6 +402,7 @@ class Common extends AuthController
                 'info' => ''
             ]);
         }
+        \crmeb\services\CacheService::clear();
         return app('json')->success(100000);
     }
 

+ 2 - 8
crmeb/app/adminapi/controller/v1/setting/SystemNotification.php

@@ -91,10 +91,7 @@ class SystemNotification extends AuthController
         if ($data['mark'] == 'verify_code') $data['type'] = 'is_sms';
         if (!$data['id']) return app('json')->fail(100100);
         if ($this->services->saveData($data)) {
-            CacheService::delete('NOTICE_SMS_' . $data['mark']);
-            CacheService::delete('wechat_' . $data['mark']);
-            CacheService::delete('routine_' . $data['mark']);
-            CacheService::delete('TEMP_IDS_LIST');
+            CacheService::clear();
             return app('json')->success(100001);
         } else {
             return app('json')->fail(100007);
@@ -117,10 +114,7 @@ class SystemNotification extends AuthController
         if ($type == '' || $status == '' || $id == 0) return app('json')->fail(100100);
         $this->services->update($id, [$type => $status]);
         $res = $this->services->getOneNotce(['id' => $id]);
-        CacheService::delete('NOTICE_SMS_' . $res->mark);
-        CacheService::delete('wechat_' . $res->mark);
-        CacheService::delete('routine_' . $res->mark);
-        CacheService::delete('TEMP_IDS_LIST');
+        CacheService::clear();
         return app('json')->success(100014);
     }
 }

+ 1 - 0
crmeb/app/api/controller/pc/PublicController.php

@@ -50,6 +50,7 @@ class PublicController
         $data['site_name'] = sys_config('site_name');
         $data['site_keywords'] = sys_config('site_keywords');
         $data['site_description'] = sys_config('site_description');
+        $data['network_security'] = sys_config('network_security');
         $logoUrl = sys_config('pc_logo');
         if (strstr($logoUrl, 'http') === false && $logoUrl) {
             $logoUrl = sys_config('site_url') . $logoUrl;

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

@@ -168,7 +168,7 @@ class StoreOrderController
         $userInfo = $request->user()->toArray();
         if ($checkOrder = $this->services->getOne(['order_id|unique' => $key, 'uid' => $userInfo['uid'], 'is_del' => 0]))
             return app('json')->status('extend_order', 410209, ['orderId' => $checkOrder['order_id'], 'key' => $key]);
-        [$addressId, $couponId, $payType, $useIntegral, $mark, $combinationId, $pinkId, $seckillId, $bargainId, $shipping_type, $real_name, $phone, $storeId, $news, $invoice_id, $quitUrl, $advanceId, $virtual_type, $customForm] = $request->postMore([
+        [$addressId, $couponId, $payType, $useIntegral, $mark, $combinationId, $pinkId, $seckillId, $bargainId, $shipping_type, $real_name, $phone, $storeId, $news, $invoice_id, $advanceId, $customForm] = $request->postMore([
             [['addressId', 'd'], 0],
             [['couponId', 'd'], 0],
             ['payType', ''],
@@ -184,9 +184,7 @@ class StoreOrderController
             [['store_id', 'd'], 0],
             ['new', 0],
             [['invoice_id', 'd'], 0],
-            ['quitUrl', ''],
             [['advanceId', 'd'], 0],
-            ['virtual_type', 0],
             ['custom_form', []],
         ], true);
         $payType = strtolower($payType);
@@ -249,6 +247,7 @@ class StoreOrderController
         if (!$uni) return app('json')->fail(100100);
         $orderInfo = $this->services->get(['order_id' => $uni]);
         $uid = $type == 1 ? (int)$request->uid() : $orderInfo->uid;
+        $orderInfo->is_channel = $this->getChennel[$request->getFromType()] ?? ($request->isApp() ? 0 : 1);
         $orderInfo->pay_uid = $uid;
         $orderInfo->save();
         $orderInfo = $orderInfo->toArray();
@@ -262,7 +261,7 @@ class StoreOrderController
         }
 
         //重新生成订单号去支付
-        $order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
+//        $order['order_id'] = mt_rand(100, 999) . '_' . $order['order_id'];
 
         //0元支付
         if (bcsub((string)$orderInfo['pay_price'], '0', 2) <= 0) {

+ 23 - 15
crmeb/app/dao/BaseDao.php

@@ -291,38 +291,43 @@ abstract class BaseDao
     }
 
     /**
-     * 获取搜索器和搜索条件key
-     * @param array $withSearch
+     * 获取搜索器和搜索条件key,以及不在搜索器的条件数组
+     * @param array $where
      * @return array[]
      * @throws \ReflectionException
+     * @author 吴汐
+     * @email 442384644@qq.com
+     * @date 2023/03/18
      */
-    private function getSearchData(array $withSearch)
+    private function getSearchData(array $where)
     {
         $with = [];
-        $whereKey = [];
+        $otherWhere = [];
         $responses = new \ReflectionClass($this->setModel());
-        foreach ($withSearch as $fieldName) {
-            $method = 'search' . Str::studly($fieldName) . 'Attr';
+        foreach ($where as $key => $value) {
+            $method = 'search' . Str::studly($key) . 'Attr';
             if ($responses->hasMethod($method)) {
-                $with[] = $fieldName;
+                $with[] = $key;
             } else {
-                $whereKey[] = $fieldName;
+                $otherWhere[] = $value;
             }
         }
-        return [$with, $whereKey];
+        return [$with, $otherWhere];
     }
 
     /**
      * 根据搜索器获取搜索内容
-     * @param array $withSearch
-     * @param array|null $data
+     * @param $where
      * @return BaseModel
      * @throws \ReflectionException
+     * @author 吴汐
+     * @email 442384644@qq.com
+     * @date 2023/03/18
      */
-    protected function withSearchSelect(array $withSearch, ?array $data = [])
+    protected function withSearchSelect($where)
     {
-        [$with] = $this->getSearchData($withSearch);
-        return $this->getModel()->withSearch($with, $data);
+        [$with, $otherWhere] = $this->getSearchData($where);
+        return $this->getModel()->withSearch($with, $where)->where($otherWhere);
     }
 
     /**
@@ -330,11 +335,14 @@ abstract class BaseDao
      * @param array $where
      * @return BaseModel
      * @throws \ReflectionException
+     * @author 吴汐
+     * @email 442384644@qq.com
+     * @date 2023/03/18
      */
     protected function search(array $where = [])
     {
         if ($where) {
-            return $this->withSearchSelect(array_keys($where), $where);
+            return $this->withSearchSelect($where);
         } else {
             return $this->getModel();
         }

+ 4 - 4
crmeb/app/listener/notice/NoticeListener.php

@@ -354,7 +354,7 @@ class NoticeListener implements ListenerInterface
                         $link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
                         $WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
                         //企业微信通知
-                        EnterpriseWechatJob::dispatch(['order_id' => $order['order_id']]);
+                        EnterpriseWechatJob::dispatch([['order_id' => $order['order_id']]]);
                         break;
                     //确认收货给客服
                     case 'send_admin_confirm_take_over':
@@ -371,7 +371,7 @@ class NoticeListener implements ListenerInterface
                         $link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
                         $WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
                         //企业微信通知
-                        EnterpriseWechatJob::dispatch(['storeTitle' => $storeTitle, 'order_id' => $order['order_id']]);
+                        EnterpriseWechatJob::dispatch([['storeTitle' => $storeTitle, 'order_id' => $order['order_id']]]);
                         break;
                     //申请退款给客服发消息
                     case 'send_order_apply_refund':
@@ -381,7 +381,7 @@ class NoticeListener implements ListenerInterface
                         //短信
                         $NoticeSms->sendAdminRefund($order);
                         //企业微信通知
-                        EnterpriseWechatJob::dispatch(['order_id' => $order['order_id']]);
+                        EnterpriseWechatJob::dispatch([['order_id' => $order['order_id']]]);
                         //公众号
                         $storeName = $orderInfoServices->getCarIdByProductTitle((int)$order['id']);
                         $title = '亲,您有个退款订单待处理!';
@@ -394,7 +394,7 @@ class NoticeListener implements ListenerInterface
                         //站内信
                         $SystemMsg->kefuSystemSend($data);
                         //企业微信通知
-                        EnterpriseWechatJob::dispatch($data);
+                        EnterpriseWechatJob::dispatch([$data]);
                         break;
                 }
 

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

@@ -391,7 +391,7 @@ class StoreOrderComputedServices extends BaseServices
                     foreach ($temp_num as $k => $v) {
                         if (isset($temp[$v['temp_id']]['appoint']) && $temp[$v['temp_id']]['appoint'] && isset($freeList[$v['temp_id']])) {
                             $free = $freeList[$v['temp_id']];
-                            $condition = $v['type'] == 1 ? $free['number'] <= $v['number'] : $free['number'] >= $v['number'];
+                            $condition = $free['number'] <= $v['number'];
                             if ($free['price'] <= $v['price'] && $condition) {
                                 unset($temp_num[$k]);
                             }

+ 4 - 6
crmeb/app/services/order/StoreOrderCreateServices.php

@@ -75,11 +75,11 @@ class StoreOrderCreateServices extends BaseServices
                 $id = $snowflake->setStartTimeStamp(strtotime('2022-01-01') * 1000)->id();
             }
             $replace = '';
-            $chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
-            for ($i = 0; $i < 3; $i++) {
+            $chars = '0123456789';
+            for ($i = 0; $i < 6; $i++) {
                 $replace .= $chars[mt_rand(0, strlen($chars) - 1)];
             }
-            $id = substr_replace($id, $replace, -3);
+            $id = substr_replace($id, $replace, -6);
         } else {
             $is_callable = function ($currentTime) {
                 $redis = Cache::store('redis');
@@ -281,10 +281,8 @@ class StoreOrderCreateServices extends BaseServices
         }
         /** @var StoreOrderCartInfoServices $cartServices */
         $cartServices = app()->make(StoreOrderCartInfoServices::class);
-        /** @var StoreSeckillServices $seckillServices */
-        $seckillServices = app()->make(StoreSeckillServices::class);
         $priceData['coupon_id'] = $couponId;
-        $order = $this->transaction(function () use ($cartIds, $orderInfo, $cartInfo, $key, $userInfo, $useIntegral, $priceData, $combinationId, $seckillId, $bargainId, $cartServices, $seckillServices, $uid, $addressId, $advanceId) {
+        $order = $this->transaction(function () use ($cartIds, $orderInfo, $cartInfo, $key, $userInfo, $useIntegral, $priceData, $combinationId, $seckillId, $bargainId, $cartServices, $uid, $addressId, $advanceId) {
             //创建订单
             $order = $this->dao->save($orderInfo);
             if (!$order) {

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

@@ -768,7 +768,7 @@ HTML;
         }
         /** @var StoreOrderCreateServices $createServices */
         $createServices = app()->make(StoreOrderCreateServices::class);
-        $data['order_id'] = $createServices->getNewOrderId();
+        $data['order_id'] = $createServices->getNewOrderId('cp');
         /** @var StoreOrderStatusServices $services */
         $services = app()->make(StoreOrderStatusServices::class);
         return $this->transaction(function () use ($id, $data, $services) {

+ 0 - 2
crmeb/app/services/product/sku/StoreProductAttrServices.php

@@ -90,8 +90,6 @@ class StoreProductAttrServices extends BaseServices
                         ];
                         if (!$productVirtual->count(['card_no' => $items['key'], 'card_pwd' => $items['value']])) {
                             $productVirtual->save($data);
-                        } else {
-                            throw new AdminException(400590, ['key' => $items['key'], 'value' => $items['value']]);
                         }
                     }
                 }

+ 2 - 2
crmeb/public/install/crmeb.sql

@@ -33531,8 +33531,8 @@ INSERT INTO `eb_system_config` (`id`, `menu_name`, `type`, `input_type`, `config
 (429, 'get_avatar', 'radio', 'input', 7, '0=>关闭\n1=>开启', 1, '', 0, 0, '\"0\"', '强制获取昵称头像', '是否在小程序用户授权之后,弹窗获取用户的昵称和头像', 0, 1),
 (430, 'share_qrcode', 'radio', 'input', 2, '0=>商城\n1=>公众号', 1, '', 0, 0, '\"0\"', '公众号推广码类型', '公众号生成的推广码类型:商城:扫码直接进入商城,公众号:扫码进入公众号后推送商城的链接', 0, 1),
 (431, 'member_brokerage', 'radio', 'input', 73, '1=>开启\n0=>关闭', 1, '', 0, 0, '\"0\"', '购买付费会员返佣', '购买付费会员是否按照设置的佣金比例进行返佣', 98, 1),
-(432, 'user_brokerage_type', 'radio', 'input', 73, '0=>按照商品价格返佣\n1=>按照实际支付价格返佣', 1, '', 0, 0, '\"0\"', '返佣类型', '选择返佣类型,按照商品价格返佣(按照商品售价计算返佣金额)以及按照实际支付价格返佣(按照商品的实际支付价格计算返佣 )', 97, 1);
-
+(432, 'user_brokerage_type', 'radio', 'input', 73, '0=>按照商品价格返佣\n1=>按照实际支付价格返佣', 1, '', 0, 0, '\"0\"', '返佣类型', '选择返佣类型,按照商品价格返佣(按照商品售价计算返佣金额)以及按照实际支付价格返佣(按照商品的实际支付价格计算返佣 )', 97, 1),
+(433, 'network_security', 'text', 'input', 26, '', 1, '', 100, 0, '\"\"', '网安备案', '公安部门登记的备案信息,显示在pc底部', 0, 1);
 -- --------------------------------------------------------
 
 --

+ 4 - 5
crmeb/route/route.php

@@ -12,18 +12,17 @@ Route::miss(function () {
     }
 
     switch (strtolower($appName)) {
-        case config('app.admin_prefix','admin'):
-            return view(app()->getRootPath() . 'public'  . DS . 'system.html');
+        case config('app.admin_prefix', 'admin'):
+        case 'kefu':
+            return view(app()->getRootPath() . 'public' . DS . 'system.html');
         case 'home':
             if (request()->isMobile()) {
                 return redirect(app()->route->buildUrl('/'));
             } else {
                 return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html');
             }
-        case 'kefu':
-            return view(app()->getRootPath() . 'public'  . DS . 'system.html');
         case 'pages':
-            return view(app()->getRootPath() . 'public' .DS . 'index.html');
+            return view(app()->getRootPath() . 'public' . DS . 'index.html');
         default:
             if (!request()->isMobile() && is_dir(app()->getRootPath() . 'public' . DS . 'home') && !request()->get('type')) {
                 return view(app()->getRootPath() . 'public' . DS . 'home' . DS . 'index.html');

+ 1 - 1
template/admin/src/components/couponList/index.vue

@@ -81,7 +81,7 @@ export default {
       isTemplate: false,
       loading: false,
       tableFrom: {
-        receive_type: 1,
+        receive_type: 3,
         page: 1,
         limit: 10,
       },

+ 4 - 0
template/admin/src/components/main/components/side-menu/side-menu.less

@@ -7,10 +7,14 @@
 .side-menu-wrapper {
   user-select: none;
   height: 100%;
+  ::-webkit-scrollbar{width:0;}
+  -ms-overflow-style: none;
   .menu-collapsed {
     height: 100%;
     background-color: @side-dark-theme;
     color: #fff !important;
+    overflow-y: scroll;
+    
     .ivu-dropdown {
       width: 100%;
       .ivu-dropdown-rel a {

+ 1 - 1
template/admin/src/components/sendCoupons/index.vue

@@ -97,7 +97,7 @@ export default {
         page: 1, // 当前页
         limit: 15,
         coupon_title: '',
-        receive_type: 1,
+        receive_type: 3,
       },
       total: 0, // 总条数
     };

+ 11 - 7
template/admin/src/pages/marketing/storeCouponIssue/create.vue

@@ -18,13 +18,17 @@
         <FormItem label="优惠券名称">
           <Input v-model="formData.coupon_title" :maxlength="18" placeholder="请输入优惠券名称"></Input>
         </FormItem>
+        <FormItem label="优惠券面值">
+          <InputNumber :min="1" :max="99999" v-model="formData.coupon_price"></InputNumber>
+        </FormItem>
         <FormItem label="发送方式">
           <RadioGroup v-model="formData.receive_type">
-            <Radio :label="1">普通券</Radio>
-            <Radio :label="2">新人券</Radio>
-            <!-- <Radio :label="3">赠送</Radio> -->
-            <Radio :label="4">会员券</Radio>
+            <Radio :label="1">手动领取</Radio>
+            <Radio :label="2">新用户自动发放</Radio>
+            <Radio :label="3">后台赠送</Radio>
+            <Radio :label="4">付费会员专享</Radio>
           </RadioGroup>
+          <div class="tip">手动领取:用户需要手动领取优惠券;新用户自动发放:新注册的用户自动发放;后台赠送:后台发放制定用户或者添加到商品里面用户购买该商品获得;付费会员专享:仅付费会员可以领取和使用</div>
         </FormItem>
         <FormItem label="优惠劵类型">
           <RadioGroup v-model="formData.type">
@@ -50,9 +54,6 @@
           </Select>
           <div class="info">选择商品的品类</div>
         </FormItem>
-        <FormItem label="优惠券面值">
-          <InputNumber :min="1" :max="99999" v-model="formData.coupon_price"></InputNumber>
-        </FormItem>
         <FormItem label="使用门槛">
           <RadioGroup v-model="isMinPrice">
             <Radio :label="0">无门槛</Radio>
@@ -462,4 +463,7 @@ export default {
   right: 0;
   transform: translate(50%, -50%);
 }
+.tip {
+  color: #888;
+}
 </style>

+ 7 - 4
template/admin/src/pages/setting/setSystem/index.vue

@@ -206,8 +206,10 @@ export default {
       })
         .then((res) => {
           this.$Message.success(res.msg);
-          localStorage.setItem('ADMIN_TITLE', formData.site_name);
-          window.document.title = `${formData.site_name} - 系统设置`;
+          if (formData.site_name) {
+            localStorage.setItem('ADMIN_TITLE', formData.site_name);
+            window.document.title = `${formData.site_name} - 系统设置`;
+          }
         })
         .catch((res) => {
           this.$Message.error(res.msg);
@@ -224,9 +226,10 @@ export default {
 
 .fromBox {
   min-height: calc(100vh - 200px);
-  margin-top: 0px !important ;
+  margin-top: 0px !important;
 }
-.article-manager /deep/ .ivu-form-item{
+
+.article-manager /deep/ .ivu-form-item {
   margin-bottom: 20px !important;
 }
 </style>

+ 1 - 4
template/admin/src/router/modules/frameOut.js

@@ -25,16 +25,13 @@ export default [
   },
   // 客服
   {
-    path: routePre + '/kefu',
+    path: '/kefu',
     name: `${pre}index`,
     meta: {
       auth: true,
       title: '客服管理',
       kefu: true,
     },
-    redirect: {
-      name: `setting_service`,
-    },
     component: () => import('@/pages/kefu/index'),
   },
   {

+ 0 - 11
template/admin/vue.config.js

@@ -2,8 +2,6 @@ const path = require('path');
 const Setting = require('./src/setting.env');
 // 引入打包分析文件
 const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
-// 引入Gzip压缩文件
-const CompressionPlugin = require('compression-webpack-plugin');
 // 引入js打包工具
 const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
 
@@ -43,15 +41,6 @@ module.exports = {
   configureWebpack: (config) => {
     const pluginsPro = [new BundleAnalyzerPlugin()];
 
-    pluginsPro.push(
-      new CompressionPlugin({
-        algorithm: 'gzip',
-        test: /\.js$|\.html$|\.css$/, // 匹配文件名
-        minRatio: 0.8, // 压缩率小于1才会压缩
-        threshold: 10240, // 对超过10k的数据压缩
-        deleteOriginalAssets: false, // 是否删除未压缩的源文件,谨慎设置,如果希望提供非gzip的资源,可不设置或者设置为false(比如删除打包后的gz后还可以加载到原始资源文件)
-      }),
-    );
     pluginsPro.push(
       // js文件压缩
       new UglifyJsPlugin({