Selaa lähdekoodia

增加师傅商城

林海涛 1 vuosi sitten
vanhempi
commit
890c2e0a6f

+ 112 - 0
app/adminapi/controller/shops/ShopCategoryController.php

@@ -0,0 +1,112 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+
+namespace app\adminapi\controller\shops;
+
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\shops\ShopCategoryLists;
+use app\adminapi\logic\shops\ShopCategoryLogic;
+use app\adminapi\validate\shops\ShopCategoryValidate;
+
+
+/**
+ * ShopCategory控制器
+ * Class ShopCategoryController
+ * @package app\adminapi\controller\shops
+ */
+class ShopCategoryController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function lists()
+    {
+        return $this->dataLists(new ShopCategoryLists());
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function add()
+    {
+        $params = (new ShopCategoryValidate())->post()->goCheck('add');
+        $result = ShopCategoryLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(ShopCategoryLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function edit()
+    {
+        $params = (new ShopCategoryValidate())->post()->goCheck('edit');
+        $result = ShopCategoryLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(ShopCategoryLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function delete()
+    {
+        $params = (new ShopCategoryValidate())->post()->goCheck('delete');
+        ShopCategoryLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function detail()
+    {
+        $params = (new ShopCategoryValidate())->goCheck('detail');
+        $result = ShopCategoryLogic::detail($params);
+        return $this->data($result);
+    }
+
+    public function treeData()
+    {
+        $result = GoodsCategoryLogic::getTreeData();
+        return $this->data($result);
+    }
+}

+ 108 - 0
app/adminapi/controller/shops/ShopGoodsController.php

@@ -0,0 +1,108 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+
+namespace app\adminapi\controller\shops;
+
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\shops\ShopGoodsLists;
+use app\adminapi\logic\shops\ShopGoodsLogic;
+use app\adminapi\validate\shops\ShopGoodsValidate;
+
+
+/**
+ * ShopGoods控制器
+ * Class ShopGoodsController
+ * @package app\adminapi\controller\shops
+ */
+class ShopGoodsController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function lists()
+    {
+        return $this->dataLists(new ShopGoodsLists());
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function add()
+    {
+        $params = (new ShopGoodsValidate())->post()->goCheck('add');
+        $result = ShopGoodsLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(ShopGoodsLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function edit()
+    {
+        $params = (new ShopGoodsValidate())->post()->goCheck('edit');
+        $result = ShopGoodsLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(ShopGoodsLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function delete()
+    {
+        $params = (new ShopGoodsValidate())->post()->goCheck('delete');
+        ShopGoodsLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function detail()
+    {
+        $params = (new ShopGoodsValidate())->goCheck('detail');
+        $result = ShopGoodsLogic::detail($params);
+        return $this->data($result);
+    }
+
+
+}

+ 108 - 0
app/adminapi/controller/shops/ShopOrdersController.php

@@ -0,0 +1,108 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+
+namespace app\adminapi\controller\shops;
+
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\shops\ShopOrdersLists;
+use app\adminapi\logic\shops\ShopOrdersLogic;
+use app\adminapi\validate\shops\ShopOrdersValidate;
+
+
+/**
+ * ShopOrders控制器
+ * Class ShopOrdersController
+ * @package app\adminapi\controller\shops
+ */
+class ShopOrdersController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function lists()
+    {
+        return $this->dataLists(new ShopOrdersLists());
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function add()
+    {
+        $params = (new ShopOrdersValidate())->post()->goCheck('add');
+        $result = ShopOrdersLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(ShopOrdersLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function edit()
+    {
+        $params = (new ShopOrdersValidate())->post()->goCheck('edit');
+        $result = ShopOrdersLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(ShopOrdersLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function delete()
+    {
+        $params = (new ShopOrdersValidate())->post()->goCheck('delete');
+        ShopOrdersLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function detail()
+    {
+        $params = (new ShopOrdersValidate())->goCheck('detail');
+        $result = ShopOrdersLogic::detail($params);
+        return $this->data($result);
+    }
+
+
+}

+ 79 - 0
app/adminapi/lists/shops/ShopCategoryLists.php

@@ -0,0 +1,79 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\shops;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\shops\ShopCategory;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * ShopCategory列表
+ * Class ShopCategoryLists
+ * @package app\adminapi\listsshops
+ */
+class ShopCategoryLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['name', 'status'],
+
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function lists(): array
+    {
+        $lists = ShopCategory::where($this->searchWhere)
+            ->field(['id', 'pid', 'picture', 'name', 'status', 'weigh'])
+            ->order(['weigh' => 'desc'])
+            ->select()
+            ->toArray();
+
+        return linear_to_tree($lists, 'children', 'id', 'pid');
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function count(): int
+    {
+        return ShopCategory::where($this->searchWhere)->count();
+    }
+
+}

+ 77 - 0
app/adminapi/lists/shops/ShopGoodsLists.php

@@ -0,0 +1,77 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\shops;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\shops\ShopGoods;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * ShopGoods列表
+ * Class ShopGoodsLists
+ * @package app\adminapi\listsshops
+ */
+class ShopGoodsLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['delivery_type', 'shop_goods_type', 'goods_category_id', 'goods_name', 'company_name', 'goods_status', 'is_recommend'],

+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function lists(): array
+    {
+        return ShopGoods::where($this->searchWhere)
+            ->field(['id', 'delivery_type', 'shop_goods_type', 'goods_category_ids', 'goods_category_id', 'goods_name', 'company_name', 'good_unit', 'goods_image', 'goods_banners', 'description', 'goods_status', 'is_recommend', 'recommend_weight'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function count(): int
+    {
+        return ShopGoods::where($this->searchWhere)->count();
+    }
+
+}

+ 78 - 0
app/adminapi/lists/shops/ShopOrdersLists.php

@@ -0,0 +1,78 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\shops;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\shops\ShopOrders;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * ShopOrders列表
+ * Class ShopOrdersLists
+ * @package app\adminapi\listsshops
+ */
+class ShopOrdersLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['shop_order_type', 'worker_id', 'real_name', 'mobile', 'pay_time', 'pay_status', 'pay_sn', 'paw_way', 'order_terminal', 'transaction_id', 'refund_status'],
+            '%like%' => ['sn', 'refund_transaction_id'],

+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function lists(): array
+    {
+        return ShopOrders::where($this->searchWhere)
+            ->field(['id', 'shop_order_type', 'worker_id', 'sn', 'real_name', 'mobile', 'address', 'pay_time', 'pay_status', 'pay_sn', 'paw_way', 'order_terminal', 'amount_total', 'amount', 'transaction_id', 'refund_status', 'refund_transaction_id'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function count(): int
+    {
+        return ShopOrders::where($this->searchWhere)->count();
+    }
+
+}

+ 129 - 0
app/adminapi/logic/shops/ShopCategoryLogic.php

@@ -0,0 +1,129 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\logic\shops;
+
+
+use app\common\model\shops\ShopCategory;
+use app\common\logic\BaseLogic;
+use think\facade\Db;
+
+
+/**
+ * ShopCategory逻辑
+ * Class ShopCategoryLogic
+ * @package app\adminapi\logic\shops
+ */
+class ShopCategoryLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ShopCategory::create([
+                'pid' => $params['pid'],
+                'picture' => $params['picture'],
+                'name' => $params['name'],
+                'status' => $params['status'],
+                'weigh' => $params['weigh'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 编辑
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ShopCategory::where('id', $params['id'])->update([
+                'pid' => $params['pid'],
+                'picture' => $params['picture'],
+                'name' => $params['name'],
+                'status' => $params['status'],
+                'weigh' => $params['weigh'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public static function delete(array $params): bool
+    {
+        return ShopCategory::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public static function detail($params): array
+    {
+        return ShopCategory::findOrEmpty($params['id'])->toArray();
+    }
+
+    public static function getTreeData():array
+    {
+        $data = ShopCategory::field('id,pid,name')
+            ->where('status', 1)
+            ->order(['weigh' => 'desc', 'id' => 'desc'])
+            ->select()
+            ->toArray();
+        foreach($data as $k => $v){
+            $v['label'] = $v['name'];
+            $v['value'] = $v['id'];
+            $data[$k] = $v;
+        }
+        return linear_to_tree($data, 'children');
+    }
+}

+ 130 - 0
app/adminapi/logic/shops/ShopGoodsLogic.php

@@ -0,0 +1,130 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\logic\shops;
+
+
+use app\common\model\shops\ShopGoods;
+use app\common\logic\BaseLogic;
+use think\facade\Db;
+
+
+/**
+ * ShopGoods逻辑
+ * Class ShopGoodsLogic
+ * @package app\adminapi\logic\shops
+ */
+class ShopGoodsLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ShopGoods::create([
+                'delivery_type' => $params['delivery_type'],
+                'shop_goods_type' => $params['shop_goods_type'],
+                'goods_category_ids' => $params['goods_category_ids'],
+                'goods_category_id' => $params['goods_category_id'],
+                'goods_name' => $params['goods_name'],
+                'company_name' => $params['company_name'],
+                'good_unit' => $params['good_unit'],
+                'goods_image' => $params['goods_image'],
+                'goods_banners' => $params['goods_banners'],
+                'description' => $params['description'],
+                'goods_status' => $params['goods_status'],
+                'is_recommend' => $params['is_recommend'],
+                'recommend_weight' => $params['recommend_weight'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 编辑
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ShopGoods::where('id', $params['id'])->update([
+                'delivery_type' => $params['delivery_type'],
+                'shop_goods_type' => $params['shop_goods_type'],
+                'goods_category_ids' => $params['goods_category_ids'],
+                'goods_category_id' => $params['goods_category_id'],
+                'goods_name' => $params['goods_name'],
+                'company_name' => $params['company_name'],
+                'good_unit' => $params['good_unit'],
+                'goods_image' => $params['goods_image'],
+                'goods_banners' => $params['goods_banners'],
+                'description' => $params['description'],
+                'goods_status' => $params['goods_status'],
+                'is_recommend' => $params['is_recommend'],
+                'recommend_weight' => $params['recommend_weight'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public static function delete(array $params): bool
+    {
+        return ShopGoods::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public static function detail($params): array
+    {
+        return ShopGoods::findOrEmpty($params['id'])->toArray();
+    }
+}

+ 136 - 0
app/adminapi/logic/shops/ShopOrdersLogic.php

@@ -0,0 +1,136 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\logic\shops;
+
+
+use app\common\model\shops\ShopOrders;
+use app\common\logic\BaseLogic;
+use think\facade\Db;
+
+
+/**
+ * ShopOrders逻辑
+ * Class ShopOrdersLogic
+ * @package app\adminapi\logic\shops
+ */
+class ShopOrdersLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ShopOrders::create([
+                'shop_order_type' => $params['shop_order_type'],
+                'worker_id' => $params['worker_id'],
+                'sn' => $params['sn'],
+                'real_name' => $params['real_name'],
+                'mobile' => $params['mobile'],
+                'address' => $params['address'],
+                'pay_time' => strtotime($params['pay_time']),
+                'pay_status' => $params['pay_status'],
+                'pay_sn' => $params['pay_sn'],
+                'paw_way' => $params['paw_way'],
+                'order_terminal' => $params['order_terminal'],
+                'amount_total' => $params['amount_total'],
+                'amount' => $params['amount'],
+                'transaction_id' => $params['transaction_id'],
+                'refund_status' => $params['refund_status'],
+                'refund_transaction_id' => $params['refund_transaction_id'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 编辑
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ShopOrders::where('id', $params['id'])->update([
+                'shop_order_type' => $params['shop_order_type'],
+                'worker_id' => $params['worker_id'],
+                'sn' => $params['sn'],
+                'real_name' => $params['real_name'],
+                'mobile' => $params['mobile'],
+                'address' => $params['address'],
+                'pay_time' => strtotime($params['pay_time']),
+                'pay_status' => $params['pay_status'],
+                'pay_sn' => $params['pay_sn'],
+                'paw_way' => $params['paw_way'],
+                'order_terminal' => $params['order_terminal'],
+                'amount_total' => $params['amount_total'],
+                'amount' => $params['amount'],
+                'transaction_id' => $params['transaction_id'],
+                'refund_status' => $params['refund_status'],
+                'refund_transaction_id' => $params['refund_transaction_id'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public static function delete(array $params): bool
+    {
+        return ShopOrders::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public static function detail($params): array
+    {
+        return ShopOrders::findOrEmpty($params['id'])->toArray();
+    }
+}

+ 100 - 0
app/adminapi/validate/shops/ShopCategoryValidate.php

@@ -0,0 +1,100 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\validate\shops;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * ShopCategory验证器
+ * Class ShopCategoryValidate
+ * @package app\adminapi\validate\shops
+ */
+class ShopCategoryValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'name' => 'require',
+        'status' => 'require',
+        'weigh' => 'require',

+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'name' => '名称',
+        'status' => '状态',
+        'weigh' => '权重',

+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return ShopCategoryValidate
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['name','status','weigh']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return ShopCategoryValidate
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','name','status','weigh']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return ShopCategoryValidate
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return ShopCategoryValidate
+     * @author likeadmin
+     * @date 2024/08/04 10:42
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 108 - 0
app/adminapi/validate/shops/ShopGoodsValidate.php

@@ -0,0 +1,108 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\validate\shops;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * ShopGoods验证器
+ * Class ShopGoodsValidate
+ * @package app\adminapi\validate\shops
+ */
+class ShopGoodsValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'delivery_type' => 'require',
+        'shop_goods_type' => 'require',
+        'goods_category_ids' => 'require',
+        'goods_category_id' => 'require',
+        'goods_name' => 'require',
+        'goods_image' => 'require',
+        'goods_status' => 'require',

+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'delivery_type' => '配送类型',
+        'shop_goods_type' => '商品类别',
+        'goods_category_ids' => '服务类目',
+        'goods_category_id' => '服务产品',
+        'goods_name' => '商品名称',
+        'goods_image' => '商品图片',
+        'goods_status' => '商品状态',

+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return ShopGoodsValidate
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['delivery_type','shop_goods_type','goods_category_ids','goods_category_id','goods_name','goods_image','goods_status']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return ShopGoodsValidate
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','delivery_type','shop_goods_type','goods_category_ids','goods_category_id','goods_name','goods_image','goods_status']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return ShopGoodsValidate
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return ShopGoodsValidate
+     * @author likeadmin
+     * @date 2024/08/04 11:07
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 110 - 0
app/adminapi/validate/shops/ShopOrdersValidate.php

@@ -0,0 +1,110 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\validate\shops;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * ShopOrders验证器
+ * Class ShopOrdersValidate
+ * @package app\adminapi\validate\shops
+ */
+class ShopOrdersValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'shop_order_type' => 'require',
+        'worker_id' => 'require',
+        'sn' => 'require',
+        'real_name' => 'require',
+        'mobile' => 'require',
+        'address' => 'require',
+        'pay_status' => 'require',
+        'amount' => 'require',

+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'shop_order_type' => '订单类型',
+        'worker_id' => '师傅ID',
+        'sn' => '订单编号',
+        'real_name' => '姓名',
+        'mobile' => '手机号',
+        'address' => '地址',
+        'pay_status' => '支付方式',
+        'amount' => '实际结算金额',

+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return ShopOrdersValidate
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['shop_order_type','worker_id','sn','real_name','mobile','address','pay_status','amount']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return ShopOrdersValidate
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','shop_order_type','worker_id','sn','real_name','mobile','address','pay_status','amount']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return ShopOrdersValidate
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return ShopOrdersValidate
+     * @author likeadmin
+     * @date 2024/08/04 13:49
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 34 - 0
app/common/model/shops/ShopCategory.php

@@ -0,0 +1,34 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\shops;
+
+
+use app\common\model\BaseModel;
+
+
+
+/**
+ * ShopCategory模型
+ * Class ShopCategory
+ * @package app\common\model\shops
+ */
+class ShopCategory extends BaseModel
+{
+    
+    protected $name = 'shop_category';
+    
+
+    
+}

+ 34 - 0
app/common/model/shops/ShopGoods.php

@@ -0,0 +1,34 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\shops;
+
+
+use app\common\model\BaseModel;
+
+
+
+/**
+ * ShopGoods模型
+ * Class ShopGoods
+ * @package app\common\model\shops
+ */
+class ShopGoods extends BaseModel
+{
+    
+    protected $name = 'shop_goods';
+    
+
+    
+}

+ 34 - 0
app/common/model/shops/ShopOrders.php

@@ -0,0 +1,34 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\shops;
+
+
+use app\common\model\BaseModel;
+
+
+
+/**
+ * ShopOrders模型
+ * Class ShopOrders
+ * @package app\common\model\shops
+ */
+class ShopOrders extends BaseModel
+{
+    
+    protected $name = 'shop_orders';
+    
+
+    
+}