Procházet zdrojové kódy

拆分商城管理控制层代码

lyh před 3 roky
rodič
revize
9fbf16a5c7

+ 6 - 59
app/admin/controller/box/AppointList.php

@@ -3,16 +3,10 @@
 namespace app\admin\controller\box;
 
 
-use app\admin\model\SystemAdmin;
-use app\common\model\BoxModel;
+use app\admin\logic\BoxRecordLogic;
 use app\common\model\BoxRecordModel;
-use app\common\model\CouponAreaModel;
-use app\common\model\CouponPlanModel;
-use app\common\model\ShopCategory;
 use app\admin\traits\Curd;
 use app\common\controller\AdminController;
-use app\common\model\ThirddataLogModel;
-use app\common\model\ThirddataModel;
 use EasyAdmin\annotation\ControllerAnnotation;
 use EasyAdmin\annotation\NodeAnotation;
 use think\App;
@@ -28,7 +22,6 @@ class AppointList extends AdminController
 {
 
 
-
     public function __construct(App $app)
     {
         parent::__construct($app);
@@ -37,61 +30,23 @@ class AppointList extends AdminController
 
     use Curd;
 
-//    protected $allowModifyFields = [
-//        'can_buy',
-//        'status'
-//    ];
-
     /**
      * @NodeAnotation(title="预约记录")
      */
-    public function index ()
+    public function index()
     {
         if ($this->request->isAjax()) {
             if (input('selectFields')) {
                 return $this->selectList();
             }
             list($page, $limit, $where) = $this->buildTableParames();
-            $count = $this->model
-                ->where($where)
-                ->count();
-//            return 11;
-
-//            return json_decode('[{"price":10, "fee":1},{"price":50, "fee":0.5},{"price":100, "fee":0}]');
-            $list = $this->model
-//                ->alias('r')
-//                ->leftJoin('box b', 'u.id = o.user_id')
-                ->withJoin('user', 'LEFT')
-//                ->withJoin('box', 'LEFT')
-//                ->withAttr('buy_time', function ($val, $data){
-//                    if (!$val){return '还未配置时间';}
-//                    $curdata = json_decode($val);
-//                    $cu_data['day'] = sr_getcurtime($curdata->day, 'Y-m-d');
-//
-//                    $arr_time = $curdata->time;
-//                    for ($i = 0; $i < count($arr_time); $i++){
-//                        $val1 = $curdata->time[$i];
-//                        $key = 'time'.($i+1);
-//                        $cu_data[$key] = (sr_getcurtime($val1->start_time, 'H:i:s') . ' - ' . sr_getcurtime($val1->end_time, 'H:i:s'));
-//                    }
-//
-//                    return ($cu_data['day']. '日'. ($cu_data['time1']?('【'.$cu_data['time1'].'】'):'' ). '|'. (isset($cu_data['time2'])?('【'.$cu_data['time2'].'】'):''). '|' .(isset($cu_data['time3'])?('【'.$cu_data['time3'].'】'):''));
-//                })
-                ->withAttr('box_img', function($val, $data){
-                    return getWebUrl().'/'.$val;
-                })
-                ->where($where)
-                ->page($page, $limit)
-                ->order($this->sort)
-                ->select();
-
-
 
+            list($count, $list) = BoxRecordLogic::getList($page, $limit, $where, $this->sort);
             $data = [
-                'code' => 0,
-                'msg' => '',
+                'code'  => 0,
+                'msg'   => '',
                 'count' => $count,
-                'data' => $list,
+                'data'  => $list,
             ];
             return json($data);
         }
@@ -100,14 +55,6 @@ class AppointList extends AdminController
     }
 
 
-
-
-
-
-
-
-
-
 }
 
 

+ 4 - 46
app/admin/controller/box/Box.php

@@ -3,21 +3,13 @@
 namespace app\admin\controller\box;
 
 
-use app\admin\model\SystemAdmin;
+use app\admin\logic\BoxLogic;
 use app\common\model\BoxModel;
-use app\common\model\BoxRecordModel;
-use app\common\model\CouponAreaModel;
-use app\common\model\CouponPlanModel;
-use app\common\model\ShopCategory;
 use app\admin\traits\Curd;
 use app\common\controller\AdminController;
-use app\common\model\ThirddataLogModel;
-use app\common\model\ThirddataModel;
 use EasyAdmin\annotation\ControllerAnnotation;
 use EasyAdmin\annotation\NodeAnotation;
 use think\App;
-use think\facade\Db;
-use think\Model;
 
 /**
  * Class Admin
@@ -27,7 +19,7 @@ use think\Model;
 class Box extends AdminController
 {
 
-
+    use Curd;
 
     public function __construct(App $app)
     {
@@ -35,13 +27,6 @@ class Box extends AdminController
         $this->model = new BoxModel();
     }
 
-    use Curd;
-
-//    protected $allowModifyFields = [
-//        'can_buy',
-//        'status'
-//    ];
-
     /**
      * @NodeAnotation(title="福袋列表")
      */
@@ -52,35 +37,8 @@ class Box extends AdminController
                 return $this->selectList();
             }
             list($page, $limit, $where) = $this->buildTableParames();
-            $count = $this->model
-                ->where($where)
-                ->count();
-//            return 11;
-
-//            return json_decode('[{"price":10, "fee":1},{"price":50, "fee":0.5},{"price":100, "fee":0}]');
-            $list = $this->model
-                ->withoutField('password')
-//                ->withAttr('buy_time', function ($val, $data){
-//                    if (!$val){return '还未配置时间';}
-//                    $curdata = json_decode($val);
-//                    $cu_data['day'] = sr_getcurtime($curdata->day, 'Y-m-d');
-//
-//                    $arr_time = $curdata->time;
-//                    for ($i = 0; $i < count($arr_time); $i++){
-//                        $val1 = $curdata->time[$i];
-//                        $key = 'time'.($i+1);
-//                        $cu_data[$key] = (sr_getcurtime($val1->start_time, 'H:i:s') . ' - ' . sr_getcurtime($val1->end_time, 'H:i:s'));
-//                    }
-//
-//                    return ($cu_data['day']. '日'. ($cu_data['time1']?('【'.$cu_data['time1'].'】'):'' ). '|'. (isset($cu_data['time2'])?('【'.$cu_data['time2'].'】'):''). '|' .(isset($cu_data['time3'])?('【'.$cu_data['time3'].'】'):''));
-//                })
-                    ->withAttr('box_img', function($val, $data){
-                        return getWebUrl().'/'.$val;
-                })
-                ->where($where)
-                ->page($page, $limit)
-                ->order($this->sort)
-                ->select();
+
+            list($count, $list) = BoxLogic::getList($page, $limit, $where, $this->sort);
             $data = [
                 'code' => 0,
                 'msg' => '',

+ 2 - 2
app/admin/controller/box/HandleBoxAction.php

@@ -18,14 +18,14 @@ use think\facade\Db;
  */
 class HandleBoxAction extends AdminController
 {
+    use Curd;
+
     public function __construct(App $app)
     {
         parent::__construct($app);
         $this->model = new BoxMidHandleModel();
     }
 
-    use Curd;
-
     /**
      * @NodeAnotation(title="系统自动前置开奖结果")
      */

+ 1 - 0
app/admin/controller/coupon/Couponarea.php

@@ -18,6 +18,7 @@ use think\facade\Db;
 use think\Model;
 
 /**
+ * (业务已取消)
  * Class Admin
  * @package app\admin\controller\system
  * @ControllerAnnotation(title="消费券分类管理")

+ 2 - 1
app/admin/controller/coupon/Couponplan.php

@@ -18,7 +18,8 @@ use think\App;
 use think\facade\Db;
 use think\Model;
 
-/**
+/**(业务已取消)
+ * (业务已取消)
  * Class Admin
  * @package app\admin\controller\system
  * @ControllerAnnotation(title="消费券计划管理")

+ 1 - 0
app/admin/controller/coupon/Couponplanbuylog.php

@@ -20,6 +20,7 @@ use think\facade\Db;
 use think\Model;
 
 /**
+ * (业务已取消)
  * Class Admin
  * @package app\admin\controller\system
  * @ControllerAnnotation(title="消费券购买列表")

+ 1 - 0
app/admin/controller/informational/CouponData.php

@@ -14,6 +14,7 @@ use think\facade\Db;
 use think\Model;
 
 /**
+ * (业务已取消)
  * Class Admin
  * @package app\admin\controller\system
  * @ControllerAnnotation(title="商品分类管理")

+ 1 - 0
app/admin/controller/informational/Xzlog.php

@@ -16,6 +16,7 @@ use think\facade\Db;
 use think\Model;
 
 /**
+ * (业务已取消)
  * Class Admin
  * @package app\admin\controller\system
  * @ControllerAnnotation(title="星钻转赠记录")

+ 19 - 18
app/admin/controller/mall/Goods.php

@@ -4,9 +4,13 @@
 namespace app\admin\controller\mall;
 
 use app\admin\logic\ShopGoodsLogic;
+use app\admin\logic\ShopGoodsSpecLogic;
+use app\admin\logic\ShopGoodsSpecTypeLogic;
 use app\admin\logic\ShopGoodsTypeLogic;
 use app\admin\logic\ShopHotKeywordsLogic;
 use app\admin\logic\ShopSupplierLogic;
+use app\admin\model\dao\ShopGoodsSpecRelation;
+use app\admin\model\dao\ShopGoodsSpecType;
 use app\common\model\ShopGoods as ShopGoods;
 use app\common\model\ShopGoodsSpec;
 use app\admin\traits\Curd;
@@ -64,7 +68,7 @@ class Goods extends AdminController
 
     public function goodsBase($id)
     {
-        list($data, $hot_keywords, $shop_goods_type, $shop_supplier,$specAttrId) = ShopGoodsLogic::getGoodsBase($id);
+        list($data, $hot_keywords, $shop_goods_type, $shop_supplier, $specAttrId) = ShopGoodsLogic::getGoodsBase($id);
 
         $this->assign('shop_goods_type', $shop_goods_type);
         $this->assign('box_type', system_box_typesetting());
@@ -87,11 +91,12 @@ class Goods extends AdminController
     public function getGoodsSpecData($goodsId, $attriId)
     {
         if ($this->request->isAjax()) {
-            $specRelation = Db::name('shop_goods_spec_relation')->where(['goods_id' => $goodsId])->select()->toArray();
-            $specAttrId   = Db::name('shop_goods_spec_type')->where(['id' => $specRelation[0]['spec_id']])->value('pid');
-            $specType     = Db::name('shop_goods_spec_type')->select()->toArray();
-            $specType     = app()->make(Tree::class)->DeepTree($specType, 'child');
-            $specTypeArr  = [];
+            $specRelation = ShopGoodsSpecRelation::getArrListByGoodsId($goodsId);
+            $specAttrId   = ShopGoodsSpecType::getPidById($specRelation[0]['spec_id']);
+            $specType     = ShopGoodsSpecTypeLogic::getCacheList();
+
+            $specType    = app()->make(Tree::class)->DeepTree($specType, 'child');
+            $specTypeArr = [];
             foreach ($specType as $k => $v) {
                 if ($v['id'] == $specAttrId) {
                     if (isset($v['child']))
@@ -118,7 +123,7 @@ class Goods extends AdminController
             }
 
             $goodsSkuArr = [];
-            $goodsSku    = Db::name('shop_goods_spec')->where(['goods_id' => $goodsId])->select()->toArray();
+            $goodsSku    = ShopGoodsSpecLogic::getGoodsSpecByGoodId($goodsId);
             foreach ($goodsSku as $sk => $sv) {
                 $goodsSkuArr['skus[' . $sv['spec_ids'] . '][picture]']      = $sv['picture'];
                 $goodsSkuArr['skus[' . $sv['spec_ids'] . '][price]']        = $sv['price'];
@@ -148,9 +153,9 @@ class Goods extends AdminController
             Db::startTrans();
             try {
                 if (!isset($goods['is_exist_many_spec'])) {
-                    $flag = ShopGoods::singleSpecGoods($goods);
+                    ShopGoods::singleSpecGoods($goods);
                 } else {
-                    $flag = ShopGoods::manySpecGoods($goods);
+                    ShopGoods::manySpecGoods($goods);
                 }
                 Db::commit();
 
@@ -160,11 +165,9 @@ class Goods extends AdminController
             }
 
             $this->success('成功');
-//            return $flag ? json(['code' => 1, 'msg' => '发布成功']) :
-//                json(['code' => 0, 'msg' => '发布失败']);
         }
-        $hot_keywords  = Db::name('shop_hot_keywords')->select()->toArray();
-        $shop_supplier = Db::name('shop_supplier')->select()->toArray();
+        $hot_keywords  = ShopHotKeywordsLogic::getCacheList();
+        $shop_supplier = ShopSupplierLogic::getCacheList();
         $this->assign('hot_keywords', $hot_keywords);
         $this->assign('shop_supplier', $shop_supplier);
         return $this->fetch();
@@ -204,9 +207,9 @@ class Goods extends AdminController
             Db::startTrans();
             try {
                 if (!isset($goods['is_exist_many_spec'])) {
-                    $flag = ShopGoods::singleSpecGoods($goods);
+                    ShopGoods::singleSpecGoods($goods);
                 } else {
-                    $flag = ShopGoods::manySpecGoods($goods);
+                    ShopGoods::manySpecGoods($goods);
                 }
                 Db::commit();
             } catch (\Exception $e) {
@@ -215,8 +218,6 @@ class Goods extends AdminController
             }
 
             $this->success('保存成功');
-//            return $flag ? json(['code' => 1, 'msg' => '保存成功']) :
-//                json(['code' => 0, 'msg' => '保存失败']);
         }
         $this->goodsBase($id);
         return $this->fetch();
@@ -227,7 +228,7 @@ class Goods extends AdminController
      */
     public function stock($id)
     {
-        $sku = Db::name('shop_goods_spec')->where(['goods_id' => $id])->select()->toArray();
+        $sku = ShopGoodsSpecLogic::getGoodsSpecByGoodId($id);
         $this->assign('sku', $sku);
 
         if ($this->request->isAjax()) {

+ 6 - 10
app/admin/controller/mall/GoodsSpecType.php

@@ -2,6 +2,7 @@
 
 namespace app\admin\controller\mall;
 
+use app\admin\logic\ShopGoodsSpecTypeLogic;
 use app\common\command\Tree;
 use app\common\controller\AdminController;
 use EasyAdmin\annotation\ControllerAnnotation;
@@ -36,15 +37,9 @@ class GoodsSpecType extends AdminController
             }
             list($page, $limit, $where) = $this->buildTableParames();
             $where['pid'] = 0;
-            $count = $this->model
-                ->where($where)
-                ->count();
-            $list = $this->model
-                ->withoutField('password')
-                ->where($where)
-                ->page($page, $limit)
-                ->order($this->sort)
-                ->select();
+
+            list($count, $list) = ShopGoodsSpecTypeLogic::getList($page, $limit, $where, $this->sort);
+
             $data = [
                 'code' => 0,
                 'msg' => '',
@@ -64,7 +59,8 @@ class GoodsSpecType extends AdminController
     public function getSpec ()
     {
         if ($this->request->isAjax()) {
-            $data = $this->model->where(['pid' => 0])->where('id', '<>', 1)->select();
+            $data = ShopGoodsSpecTypeLogic::getTopList();
+
             $data = [
                 'code' => 1,
                 'msg' => '',

+ 23 - 0
app/admin/controller/user/User.php

@@ -308,6 +308,29 @@ class User extends AdminController
     }
 
     /**
+     * 回收卡设置
+     * @return mixed
+     */
+    public function recyclecountset()
+    {
+        if ($this->request->isPost()) {
+
+            $post = $this->request->post();
+
+            $result = UserLogic::recycleCountSet($post);
+            if ($result !== true) {
+                $this->error($result);
+            }
+            $this->success('成功');
+        }
+
+        $user = UserDao::getUserOrEmptyById($this->request['id']);
+        $this->assign('info', $user);
+
+        return $this->fetch();
+    }
+
+    /**
      * 末尾奖励(功能已注释)
      * @return mixed
      */

+ 37 - 0
app/admin/logic/BoxLogic.php

@@ -0,0 +1,37 @@
+<?php
+
+
+namespace app\admin\logic;
+
+
+use app\admin\model\dao\MoneyLog;
+use app\admin\model\dao\ScoreLog;
+use app\admin\model\dao\ShopOrder;
+use app\admin\model\dao\User;
+use app\common\model\BoxModel;
+use app\common\model\UserMoneyModel;
+use think\facade\Cache;
+use think\facade\Db;
+
+class BoxLogic
+{
+
+    public static function getList($page, $limit, $where, $sort)
+    {
+
+        $count = (new BoxModel())
+            ->where($where)
+            ->count();
+
+        $list = (new BoxModel())
+            ->withoutField('password')
+            ->withAttr('box_img', function ($val, $data) {
+                return getWebUrl() . '/' . $val;
+            })
+            ->where($where)
+            ->page($page, $limit)
+            ->order($sort)
+            ->select();
+        return [$count, $list];
+    }
+}

+ 40 - 0
app/admin/logic/BoxMidHandleLogic.php

@@ -0,0 +1,40 @@
+<?php
+
+
+namespace app\admin\logic;
+
+
+use app\admin\model\dao\MoneyLog;
+use app\admin\model\dao\ScoreLog;
+use app\admin\model\dao\ShopOrder;
+use app\admin\model\dao\User;
+use app\common\model\BoxMidHandleModel;
+use app\common\model\UserMoneyModel;
+use think\facade\Cache;
+use think\facade\Db;
+
+class BoxMidHandleLogic
+{
+
+    public static function getList($page, $limit)
+    {
+
+        $count = (new BoxMidHandleModel())
+            ->alias('r')
+            ->leftJoin('user u', 'u.id = r.uid')
+            ->field('r.*,u.mobile,u.total_null_box,u.total_free,u.total_income')
+            ->order('r.box_type desc')
+            ->page($page, $limit)
+            ->count();
+
+        $list = (new BoxMidHandleModel())
+            ->alias('r')
+            ->leftJoin('user u', 'u.id = r.uid')
+            ->field('r.*,u.mobile,u.total_null_box,u.total_free,u.total_income,u.total_appoint_count,u.box10,u.box20,u.box30,u.box40')
+            ->order('r.box_type desc')
+            ->page($page, $limit)
+            ->select()->toArray();
+
+        return [$count, $list];
+    }
+}

+ 38 - 0
app/admin/logic/BoxRecordLogic.php

@@ -0,0 +1,38 @@
+<?php
+
+
+namespace app\admin\logic;
+
+
+use app\admin\model\dao\MoneyLog;
+use app\admin\model\dao\ScoreLog;
+use app\admin\model\dao\ShopOrder;
+use app\admin\model\dao\User;
+use app\common\model\BoxRecordModel;
+use app\common\model\UserMoneyModel;
+use think\facade\Cache;
+use think\facade\Db;
+
+class BoxRecordLogic
+{
+
+    public static function getList( $page,  $limit,  $where, array $sort)
+    {
+
+        $count = (new BoxRecordModel())
+            ->where($where)
+            ->count();
+
+        $list = (new BoxRecordModel())
+            ->withJoin('user', 'LEFT')
+            ->withAttr('box_img', function ($val, $data) {
+                return getWebUrl() . '/' . $val;
+            })
+            ->where($where)
+            ->page($page, $limit)
+            ->order($sort)
+            ->select();
+        return [$count, $list];
+
+    }
+}

+ 25 - 0
app/admin/logic/ShopGoodsSpecLogic.php

@@ -0,0 +1,25 @@
+<?php
+
+
+namespace app\admin\logic;
+
+
+use app\admin\model\dao\MoneyLog;
+use app\admin\model\dao\ScoreLog;
+use app\admin\model\dao\ShopGoods;
+use app\admin\model\dao\ShopGoodsSpec;
+use app\admin\model\dao\ShopOrder;
+use app\admin\model\dao\User;
+use app\common\model\BoxModel;
+use app\common\model\UserMoneyModel;
+use think\facade\Cache;
+use think\facade\Db;
+
+class ShopGoodsSpecLogic
+{
+
+    public static function getGoodsSpecByGoodId($goodsId)
+    {
+        return ShopGoodsSpec::getGoodsSpecByGoodId($goodsId);
+    }
+}

+ 57 - 0
app/admin/logic/ShopGoodsSpecTypeLogic.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace app\admin\logic;
+
+use app\admin\model\dao\ShopGoodsSpecType;
+
+;
+
+use think\facade\Cache;
+use app\common\model\ShopGoodsSpecType as ShopGoodsSpecTypeModel;
+
+/**
+ *
+ * Class ShopGoodsLogic
+ * @package app\admin\logic
+ */
+class ShopGoodsSpecTypeLogic
+{
+    private static $CACHE_LIST_KEY = "cache:shop_goods_spec_type:list";
+
+    public static function getCacheList()
+    {
+        $key = self::$CACHE_LIST_KEY;
+        if (Cache::has($key)) {
+            return Cache::get($key);
+        }
+        $name = ShopGoodsSpecType::getArrList();
+        Cache::set($key, $name, 10 * 60);
+        return $name;
+    }
+
+    public static function delCache()
+    {
+        $key = self::$CACHE_LIST_KEY;
+        Cache::delete($key);
+    }
+
+    public static function getList($page, $limit, $where, $sort)
+    {
+        $count = (new ShopGoodsSpecTypeModel())
+            ->where($where)
+            ->count();
+        $list  = (new ShopGoodsSpecTypeModel())
+            ->withoutField('password')
+            ->where($where)
+            ->page($page, $limit)
+            ->order($sort)
+            ->select();
+
+        return [$count, $list];
+    }
+
+    public static function getTopList()
+    {
+        return ShopGoodsSpecType::getTopList();
+    }
+}

+ 21 - 0
app/admin/logic/UserLogic.php

@@ -110,6 +110,27 @@ class UserLogic
             ->toArray();
     }
 
+    public static function recycleCountSet($post)
+    {
+        $user = User::getUserById($post['id']);
+        if (empty($user)) return '用户不存在';
+
+        if (empty($post['recycle_count']) || $post['recycle_count'] < 0 || $post['recycle_count'] > 500) {
+            return '回收卡数量格式有误';
+        }
+
+        try {
+            $updateData = ['recycle_count' => $post['recycle_count']];
+            $result     = User::update($user['id'], $updateData);
+            if (!$result) return "更新临时卡数量失败";
+
+        } catch (\Exception $e) {
+            return '失败' . $e->getMessage();
+        }
+
+        return true;
+    }
+
     public function getList($page, $limit, $where, $sort, $userMap)
     {
         $where[] = ['status', '<>', 3];

+ 11 - 0
app/admin/model/dao/BaseDao.php

@@ -5,6 +5,7 @@ namespace app\admin\model\dao;
 
 
 use app\admin\traits\Curd;
+use think\facade\Db;
 
 class BaseDao
 {
@@ -15,4 +16,14 @@ class BaseDao
 
     protected static $table;
 
+
+    public static function getList()
+    {
+        return Db::table(self::$table)->select()->toArray();
+    }
+
+    public static function getById($uid)
+    {
+        return Db::table(self::$table)->where(['id' => $uid])->find();
+    }
 }

+ 17 - 0
app/admin/model/dao/Box.php

@@ -0,0 +1,17 @@
+<?php
+
+
+namespace app\admin\model\dao;
+
+
+use app\common\model\UserModel;
+use think\facade\Db;
+
+class Box extends BaseDao
+{
+    public static $table = "db_box";
+
+    public function __construct()
+    {
+    }
+}

+ 17 - 0
app/admin/model/dao/BoxMidHandle.php

@@ -0,0 +1,17 @@
+<?php
+
+
+namespace app\admin\model\dao;
+
+
+use app\common\model\UserModel;
+use think\facade\Db;
+
+class BoxMidHandle extends BaseDao
+{
+    public static $table = "db_box_mid_handle";
+
+    public function __construct()
+    {
+    }
+}

+ 17 - 0
app/admin/model/dao/BoxRecord.php

@@ -0,0 +1,17 @@
+<?php
+
+
+namespace app\admin\model\dao;
+
+
+use app\common\model\UserModel;
+use think\facade\Db;
+
+class BoxRecord extends BaseDao
+{
+    public static $table = "db_box_record";
+
+    public function __construct()
+    {
+    }
+}

+ 12 - 0
app/admin/model/dao/ShopGoodsSpecType.php

@@ -20,5 +20,17 @@ class ShopGoodsSpecType extends BaseDao
         return Db::table(self::$table)->where(['id' => $spec_id])->value('pid');
     }
 
+    public static function getArrList()
+    {
+
+        $specType = Db::name('shop_goods_spec_type')->select()->toArray();
+        return $specType;
+    }
+
+    public static function getTopList()
+    {
+        return $data = Db::table(self::$table)->where(['pid' => 0])->where('id', '<>', 1)->select();
+    }
+
 
 }

+ 76 - 0
app/admin/view/user/user/recyclecountset.html

@@ -0,0 +1,76 @@
+<style>
+    .layui-iconpicker-body.layui-iconpicker-body-page .hide {
+        display: none;
+    }
+</style>
+<link rel="stylesheet" href="__STATIC__/plugs/lay-module/autocomplete/autocomplete.css?v={$version}" media="all">
+<div class="layuimini-container">
+    <form id="app-form" class="layui-form layuimini-form">
+        <div class="layui-form-item  layui-row layui-col-xs12">
+            <label class="layui-form-label required">回收卡数量</label>
+            <div class="layui-input-block">
+                <input type="text" name="recycle_count" id="recycle_count" class="layui-input" lay-verify="required"
+                       lay-reqtext="请输入回收卡数量"
+                       placeholder="请输入回收卡数量" value="{$info.recycle_count}">
+
+            </div>
+        </div>
+
+        <input type="hidden" name="id" value="{$Request.param.id}">
+        <div class="hr-line"></div>
+        <div class="layui-form-item text-center">
+            <button type="button" data-id="{$Request.param.id}" class="layui-btn layui-btn-normal layui-btn-sm"
+                    lay-filter="recyclecountset" lay-submit
+                    data-refresh="true">确认
+            </button>
+            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
+        </div>
+    </form>
+</div>
+
+
+<script>
+    layui.use('form', function () {
+        var form = layui.form;
+        form.render();
+    })
+</script>
+
+<script>
+
+    layui.use(['jquery', 'layer'], function () {
+        var $ = layui.$ //重点处
+            , layer = layui.layer
+            , form = layui.form;
+
+        form.on('submit(recyclecountset)', function (data) {
+            layer.load(1);
+            layer.confirm('确定要修改回收卡数量吗?', {
+                btn: ['确定', '取消'] //按钮
+            }, function () {
+                layer.load(1);
+
+                $.post("{:url('user.user/recyclecountset')}", data.field, function (result) {
+                    console.log(result)
+                    if (result.code == 1) {
+                        layer.closeAll();
+                        layer.alert(result.msg, {
+                            yes: function () {
+                                window.location.reload();
+                            }, cancel: function () {
+                                window.location.reload();
+                            }
+                        });
+                    } else {
+                        layer.alert(result.msg, function (index) {
+                            window.location.reload();
+                            layer.close(index);
+                        });
+                    }
+                });
+            });
+        });
+    });
+
+</script>
+

+ 16 - 1
app/common/model/ShopGoodsSpecType.php

@@ -2,7 +2,10 @@
 
 namespace app\common\model;
 
+use app\admin\logic\ShopGoodsSpecTypeLogic;
+use app\admin\logic\ShopGoodsTypeLogic;
 use app\common\model\TimeModel;
+use think\Model;
 
 class ShopGoodsSpecType extends TimeModel
 {
@@ -11,7 +14,19 @@ class ShopGoodsSpecType extends TimeModel
 
     protected $deleteTime = false;
 
-    
+    public static function onAfterUpdate($model){
+        ShopGoodsSpecTypeLogic::delCache();
+    }
+
+    public static function onAfterInsert(Model $model): void
+    {
+        ShopGoodsSpecTypeLogic::delCache();
+    }
+
+    public static function onAfterDelete(Model $model): void
+    {
+        ShopGoodsSpecTypeLogic::delCache();
+    }
     
 
 }

+ 3 - 0
public/static/admin/js/user/user.js

@@ -118,6 +118,9 @@ define(["jquery", "easy-admin"], function ($, ea) {
                             if (ea.checkAuth('levelset', init.table_elem)) {
                                 button += '<button class="layui-btn layui-btn-xs layui-btn-normal" data-open="user.user/levelset?id=' + d.id + '" data-title="等级设置">等级设置</button>';
                             }
+                            if (ea.checkAuth('recyclecountset', init.table_elem)) {
+                                button += '<button class="layui-btn layui-btn-xs layui-btn-normal" data-open="user.user/recyclecountset?id=' + d.id + '" data-title="回收卡设置">回收卡设置</button>';
+                            }
 
                             if (ea.checkAuth('phoneset', init.table_elem)) {
                                 button += '<button class="layui-btn layui-btn-xs layui-btn-normal" data-open="user.user/phoneset?id=' + d.id + '" data-title="修改手机号码">修改手机号码</button>';