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

文章推荐列表修复,用户筛选优化,用户导出优化,diy使用商品分类优化,文件校验优化,用户等级限制title长度,app登录优化,增加日志

吴昊天 2 лет назад
Родитель
Сommit
feffc9b750

+ 6 - 1
crmeb/app/api/controller/v1/publics/ArticleController.php

@@ -34,8 +34,13 @@ class ArticleController
      */
     public function lst($cid)
     {
+        if ($cid == 0) {
+            $where = ['is_hot' => 1];
+        } else {
+            $where = ['cid' => $cid];
+        }
         [$page, $limit] = $this->services->getPageValue();
-        $list = $this->services->cidByArticleList(['cid' => $cid], $page, $limit, "id,title,image_input,visit,from_unixtime(add_time,'%Y-%m-%d %H:%i') as add_time,synopsis,url");
+        $list = $this->services->cidByArticleList($where, $page, $limit, "id,title,image_input,visit,from_unixtime(add_time,'%Y-%m-%d %H:%i') as add_time,synopsis,url");
         return app('json')->success($list);
     }
 

+ 14 - 0
crmeb/app/common.php

@@ -24,6 +24,20 @@ use app\services\system\lang\LangCountryServices;
 use think\facade\Config;
 use think\facade\Log;
 
+if (!function_exists('crmebLog')) {
+    /**
+     * CRMEB Log 日志
+     * @param $msg
+     * @author 吴汐
+     * @email 442384644@qq.com
+     * @date 2023/03/03
+     */
+    function crmebLog($msg)
+    {
+        Log::write($msg, 'crmeb');
+    }
+}
+
 if (!function_exists('getWorkerManUrl')) {
 
     /**

+ 4 - 0
crmeb/app/dao/user/UserWechatUserDao.php

@@ -240,6 +240,10 @@ class UserWechatUserDao extends BaseDao
         if (isset($where['time'])) {
             $model->withSearch(['time'], ['time' => $where['time'], 'timeKey' => 'u.add_time']);
         }
+
+        if (isset($where['is_del'])) {
+            $model->where($userAlias . 'is_del', $where['is_del']);
+        }
         return $field ? $model->field($field) : $model;
     }
 

+ 14 - 0
crmeb/app/model/wechat/WechatUser.php

@@ -127,4 +127,18 @@ class WechatUser extends BaseModel
         return $query->where('user_type', $value);
     }
 
+    /**
+     * is_del 搜索器
+     * @param $query
+     * @param $value
+     * @return void
+     * @author 吴汐
+     * @email 442384644@qq.com
+     * @date 2023/03/03
+     */
+    public function searchIsDelAttr($query, $value)
+    {
+        if($value !== '') return $query->where('is_del', $value);
+    }
+
 }

+ 3 - 2
crmeb/app/services/other/export/ExportServices.php

@@ -33,7 +33,7 @@ class ExportServices extends BaseServices
         /** @var UserServices $userServices */
         $userServices = app()->make(UserServices::class);
         $data = $userServices->index($where)['list'];
-        $header = ['用户ID', '昵称', '真实姓名', '性别', '电话', '用户等级', '用户分组', '用户标签', '用户类型', '用户余额', '最后登录时间', '注册时间'];
+        $header = ['用户ID', '昵称', '真实姓名', '性别', '电话', '用户等级', '用户分组', '用户标签', '用户类型', '用户余额', '最后登录时间', '注册时间', '是否注销'];
         $filename = '用户列表_' . date('YmdHis', time());
         $export = $fileKey = [];
         if (!empty($data)) {
@@ -51,7 +51,8 @@ class ExportServices extends BaseServices
                     'user_type' => $item['user_type'],
                     'now_money' => $item['now_money'],
                     'last_time' => date('Y-m-d H:i:s', $item['last_time']),
-                    'add_time' => date('Y-m-d H:i:s', $item['add_time'])
+                    'add_time' => date('Y-m-d H:i:s', $item['add_time']),
+                    'is_del' => $item['is_del'] ? '已注销' : '正常'
                 ];
                 $export[] = $one_data;
                 if ($i == 0) {

+ 1 - 1
crmeb/app/services/product/product/StoreCategoryServices.php

@@ -96,7 +96,7 @@ class StoreCategoryServices extends BaseServices
         $where = [];
         if ($show !== '') $where['is_show'] = $show;
         if (!$type) $where['pid'] = 0;
-        $data = get_tree_children($this->dao->getTierList($where, ['id', 'cate_name as title', 'pid']), 'children', 'id');
+        $data = get_tree_children($this->dao->getTierList($where, ['id', 'id as value', 'cate_name as label', 'cate_name as title', 'pid']), 'children', 'id');
         foreach ($data as &$item) {
             if (!isset($item['children'])) {
                 $item['disabled'] = true;

+ 1 - 1
crmeb/app/services/system/log/SystemFileServices.php

@@ -167,7 +167,7 @@ class SystemFileServices extends BaseServices
                 $update_time = stat($vo);
                 $cthash = md5_file($vo);
                 $cha[] = [
-                    'filename' => $vo,
+                    'filename' => str_replace($rootPath, '', $vo),
                     'cthash' => $cthash,
                     'atime' => date('Y-m-d H:i:s', $update_time['atime']),
                     'mtime' => date('Y-m-d H:i:s', $update_time['mtime']),

+ 1 - 1
crmeb/app/services/user/UserLevelServices.php

@@ -217,7 +217,7 @@ class UserLevelServices extends BaseServices
         } else {
             $msg = '添加用户等级';
         }
-        $field[] = Form::input('name', '等级名称', isset($vipInfo) ? $vipInfo->name : '')->col(24)->required();
+        $field[] = Form::input('name', '等级名称', isset($vipInfo) ? $vipInfo->name : '')->maxlength(10)->col(24)->required();
         $field[] = Form::number('grade', '等级', isset($vipInfo) ? $vipInfo->grade : 0)->min(0)->precision(0)->col(8)->required();
         $field[] = Form::number('discount', '享受折扣', isset($vipInfo) ? $vipInfo->discount : 100)->min(0)->max(100)->col(8)->placeholder('输入折扣数100,代表原价,90代表9折')->required();
         $field[] = Form::number('exp_num', '解锁需经验值达到', isset($vipInfo) ? $vipInfo->exp_num : 0)->min(0)->precision(0)->col(8)->required();

+ 2 - 2
crmeb/app/services/wechat/WechatServices.php

@@ -378,8 +378,8 @@ class WechatServices extends BaseServices
             if ($userInfo['unionid'] && $storeUserMobile) {
                 /** @var UserServices $userServices */
                 $userServices = app()->make(UserServices::class);
-                $uid = $this->dao->value(['unionid' => $userInfo['unionid']], 'uid');
-                $res = $userServices->value(['uid' => $uid], 'phone');
+                $uid = $this->dao->value(['unionid' => $userInfo['unionid'], 'is_del' => 0], 'uid');
+                $res = $userServices->value(['uid' => $uid, 'is_del' => 0], 'phone');
                 if (!$uid && !$res) {
                     return false;
                 }

+ 2 - 2
crmeb/config/log.php

@@ -17,7 +17,7 @@ return [
     // 默认日志记录通道
     'default'      => Env::get('log.channel', 'file'),
     // 日志记录级别
-    'level'        => ['error', 'warning', 'fail', 'success', 'info', 'notice', 'crontab'],
+    'level'        => ['error', 'warning', 'fail', 'success', 'info', 'notice', 'crontab', 'crmeb'],
     // 日志类型记录的通道 ['error'=>'email',...]
     'type_channel' => [],
     //是否开启业务成功日志
@@ -36,7 +36,7 @@ return [
             // 单文件日志写入
             'single'      => false,
             // 独立日志级别
-            'apart_level' => ['error', 'fail', 'success', 'crontab'],
+            'apart_level' => ['error', 'fail', 'success', 'crontab', 'crmeb'],
             // 最大日志文件数量
             'max_files'   => 60,
             'time_format' => 'Y-m-d H:i:s',

+ 2 - 1
template/uni-app/pages/extension/news_list/index.vue

@@ -124,7 +124,8 @@
 		 * 生命周期函数--监听页面显示
 		 */
 		onShow: function() {
-			this.getArticleHot();
+			// this.getArticleHot();
+			this.getCidArticle(0);
 			this.getArticleBanner();
 			this.getArticleCate();
 			this.status = false;