Browse Source

修改 system_attachment 表的 attr_id 为 id,不标准

joe 3 years ago
parent
commit
1b7bd37452

+ 5 - 0
CHANGELOG

@@ -10,6 +10,7 @@ INSERT INTO eb_dict_coin (symbol,name,icon,price,min_withdrawal,mine_per_sec,sta
 	 ('PIG','PIGTOKEN','http://twongpic.shotshock.shop/logos/icon-pigg.png',0.00000120,10000.00000000,0.00000000,0),
 	 ('RMB','RMB','http://twongpic.shotshock.shop/logos/rmb.png',1.00000000,1.00000000,0.00000000,0);
 
+
 2022-07-29:
 
 -- 注意一下表名前缀需要根据实际情况更改 
@@ -74,3 +75,7 @@ VALUES('leader_robot_earn_min', 'text', 'number', 25, '', NULL, NULL, 100, NULL,
 INSERT INTO eb_system_config
 (menu_name, `type`, input_type, config_tab_id, `parameter`, upload_type, required, width, high, value, info, `desc`, sort, status)
 VALUES('leader_robot_earn_max', 'text', 'number', 25, '', NULL, NULL, 100, NULL, '"50"', '机器人最多返利(元)', '机器人定时下订单并获得返利,最少返利和最多返利定义了机器人单次返利范围', 0, 1);
+
+2022-08-18
+
+ALTER TABLE twong.eb_system_attachment CHANGE att_id id int(10) auto_increment NOT NULL;

+ 5 - 5
app/admin/controller/widget/Images.php

@@ -142,11 +142,11 @@ class Images extends AuthController
     }
 
     /**删除图片和数据记录
-     * @param $att_id
+     * @param $id
      */
-    public function deleteimganddata($att_id)
+    public function deleteimganddata($id)
     {
-        $attinfo = SystemAttachmentModel::get($att_id);
+        $attinfo = SystemAttachmentModel::get($id);
         if ($attinfo) {
             if ($attinfo['image_type'] > 0 && $attinfo['image_type'] < 5) {
                 try {
@@ -169,7 +169,7 @@ class Images extends AuthController
                 }
             }
 
-            SystemAttachmentModel::where('att_id', $att_id)->delete();
+            SystemAttachmentModel::where('id', $id)->delete();
         }
     }
 
@@ -215,7 +215,7 @@ class Images extends AuthController
         ]);
         if ($data['imgaes'] == '') return Json::fail('请选择图片');
         if (!$data['pid']) return Json::fail('请选择分类');
-        $res = SystemAttachmentModel::where('att_id', 'in', $data['imgaes'])->update(['pid' => $data['pid']]);
+        $res = SystemAttachmentModel::where('id', 'in', $data['imgaes'])->update(['pid' => $data['pid']]);
         if ($res)
             Json::successful('移动成功');
         else

+ 5 - 5
app/admin/model/system/SystemAttachment.php

@@ -19,7 +19,7 @@ class SystemAttachment extends BaseModel
      * 数据表主键
      * @var string
      */
-    protected $pk = 'att_id';
+    protected $pk = 'id';
 
     /**
      * 模型名称
@@ -65,7 +65,7 @@ class SystemAttachment extends BaseModel
         $model = new self;
         $where['pid'] = $id;
         $where['module_type'] = 1;
-        $model->where($where)->order('att_id desc');
+        $model->where($where)->order('id desc');
         return $model->page($model, $where, '', 24);
     }
 
@@ -83,7 +83,7 @@ class SystemAttachment extends BaseModel
             $model = $model->where('pid', '<>', 20);
         }
         $model = $model->page((int)$where['page'], (int)$where['limit']);
-        $model = $model->order('att_id desc,time desc');
+        $model = $model->order('id desc,time desc');
         $list = $model->select();
         $list = count($list) ? $list->toArray() : [];
         $site_url = sys_config('site_url');
@@ -107,7 +107,7 @@ class SystemAttachment extends BaseModel
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public static function getInfo($value, $field = 'att_id')
+    public static function getInfo($value, $field = 'id')
     {
         $where[$field] = $value;
         // $count = self::where($where)->count();
@@ -125,7 +125,7 @@ class SystemAttachment extends BaseModel
      */
     public static function emptyYesterdayAttachment()
     {
-        $list = self::whereTime('time', 'yesterday')->where('module_type', 2)->field('name,att_dir,att_id,image_type')->select();
+        $list = self::whereTime('time', 'yesterday')->where('module_type', 2)->field('name,att_dir,id,image_type')->select();
         try {
             $uploadType = (int)sys_config('upload_type', 1);
             $upload = new Upload($uploadType, [

+ 3 - 3
app/admin/model/system/SystemAttachmentCategory.php

@@ -150,16 +150,16 @@ class SystemAttachmentCategory extends BaseModel
 
     /**
      * 获取单条信息
-     * @param $att_id
+     * @param $id
      * @return mixed
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public static function getinfo($att_id)
+    public static function getinfo($id)
     {
         $model = new self;
-        $where['att_id'] = $att_id;
+        $where['id'] = $id;
         return $model->where($where)->select()->toArray()[0];
     }
 }

+ 3 - 3
app/admin/model/system/SystemAttachmentType.php

@@ -36,15 +36,15 @@ class SystemAttachmentType extends BaseModel
     public static function getAll($id){
         $model = new self;
         $where['pid'] = $id;
-        $model->where($where)->order('att_id desc');
+        $model->where($where)->order('id desc');
         return $model->page($model,$where,'',30);
     }
     /**
      * 获取单条信息
      * */
-    public static function getinfo($att_id){
+    public static function getinfo($id){
         $model = new self;
-        $where['att_id'] = $att_id;
+        $where['id'] = $id;
         return $model->where($where)->select()->toArray()[0];
     }
 

+ 2 - 2
app/admin/view/widget/images.php

@@ -282,11 +282,11 @@
                 var val = small == 1 ? item['satt_dir'] : item['att_dir'];
                 if(item.isSelect === true) {
                     this.selectImages[this.selectImages.length] = val;
-                    this.selectImagesIDS[this.selectImages.length] = item['att_id'];
+                    this.selectImagesIDS[this.selectImages.length] = item['id'];
                     item.sort = this.selectImages.length;
                 }else{
                     this.selectImages.splice(this.selectImages.indexOf(val),1);
-                    this.selectImagesIDS.splice(this.selectImages.indexOf(item['att_id']),1);
+                    this.selectImagesIDS.splice(this.selectImages.indexOf(item['id']),1);
                     for (var i=0;i<this.imageList.length;i++){
                         if(this.imageList[i].sort > item.sort) {
                             this.imageList[i].sort = (this.imageList[i].sort-1)>=0? this.imageList[i].sort-1 : 0;

+ 2 - 2
app/admin/view/widget/video/vedio.php

@@ -282,11 +282,11 @@
                 var val = small == 1 ? item['satt_dir'] : item['att_dir'];
                 if(item.isSelect === true) {
                     this.selectImages[this.selectImages.length] = val;
-                    this.selectImagesIDS[this.selectImages.length] = item['att_id'];
+                    this.selectImagesIDS[this.selectImages.length] = item['id'];
                     item.sort = this.selectImages.length;
                 }else{
                     this.selectImages.splice(this.selectImages.indexOf(val),1);
-                    this.selectImagesIDS.splice(this.selectImages.indexOf(item['att_id']),1);
+                    this.selectImagesIDS.splice(this.selectImages.indexOf(item['id']),1);
                     for (var i=0;i<this.imageList.length;i++){
                         if(this.imageList[i].sort > item.sort) {
                             this.imageList[i].sort = (this.imageList[i].sort-1)>=0? this.imageList[i].sort-1 : 0;

+ 3 - 3
public/install/crmeb.sql

@@ -6381,7 +6381,7 @@ INSERT INTO `eb_system_admin` (`id`, `account`, `pwd`, `real_name`, `roles`, `la
 --
 
 CREATE TABLE IF NOT EXISTS `eb_system_attachment` (
-  `att_id`  int(10) NOT NULL AUTO_INCREMENT,
+  `id`  int(10) NOT NULL AUTO_INCREMENT,
   `name` varchar(100) NOT NULL DEFAULT '' COMMENT '附件名称',
   `att_dir` varchar(200) NOT NULL DEFAULT '' COMMENT '附件路径',
   `satt_dir` varchar(200) DEFAULT NULL DEFAULT NULL COMMENT '压缩图片路径',
@@ -6391,7 +6391,7 @@ CREATE TABLE IF NOT EXISTS `eb_system_attachment` (
   `time` int(11) NOT NULL DEFAULT 0 COMMENT '上传时间',
   `image_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '图片上传类型 1本地 2七牛云 3OSS 4COS ',
   `module_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '图片上传模块类型 1 后台上传 2 用户生成',
-  PRIMARY KEY (`att_id`) USING BTREE,
+  PRIMARY KEY (`id`) USING BTREE,
   UNIQUE KEY `att_dir` (`att_dir`) USING BTREE
 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='附件管理表' AUTO_INCREMENT=1204 ;
 
@@ -6422,7 +6422,7 @@ CREATE TABLE IF NOT EXISTS `eb_system_store` (
 -- 转存表中的数据 `eb_system_attachment`
 --
 
-INSERT INTO `eb_system_attachment` (`att_id`, `name`, `att_dir`, `satt_dir`, `att_size`, `att_type`, `pid`, `time`, `image_type`, `module_type`) VALUES
+INSERT INTO `eb_system_attachment` (`id`, `name`, `att_dir`, `satt_dir`, `att_size`, `att_type`, `pid`, `time`, `image_type`, `module_type`) VALUES
 (336, '69eb5f09f947ff53244a57d5c021b817.jpg', 'http://kaifa.crmeb.net/uploads/attach/2019/07/30/69eb5f09f947ff53244a57d5c021b817.jpg', 'http://kaifa.crmeb.net/uploads/attach/2019/07/30/69eb5f09f947ff53244a57d5c021b817.jpg', '377824', 'image/jpeg', 9, 1564471315, 1, 1),
 (337, '69eb5f09f947ff53244a57d5c021b817.jpg', 'http://kaifa.crmeb.net/uploads/attach/2019/07/30/69eb5f09f947ff53244a57d5c021b817.jpg', 'http://kaifa.crmeb.net/uploads/attach/2019/07/30/69eb5f09f947ff53244a57d5c021b817.jpg', '377824', 'image/jpeg', 9, 1564471315, 1, 1),
 (338, 'ce0a2ed478552ca0bfc7092f337c8d10.jpg', 'http://kaifa.crmeb.net/uploads/attach/2019/07/30/ce0a2ed478552ca0bfc7092f337c8d10.jpg', 'http://kaifa.crmeb.net/uploads/attach/2019/07/30/ce0a2ed478552ca0bfc7092f337c8d10.jpg', '196474', 'image/jpeg', 9, 1564471315, 1, 1),