From 744f7d92ed40f438c9cac08b7d514767e174df8d Mon Sep 17 00:00:00 2001 From: xucong <850806214@qq.com> Date: Fri, 16 May 2025 15:31:11 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8F=90=E4=BA=A4=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E4=B8=9C=E8=A5=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/GoodsLogic.php | 8 +-- app/api/model/Goods.php | 2 +- .../model/distribution/DistributionGoods.php | 11 ++++ app/common/model/goods/Goods.php | 51 +++++++++++++++++++ 4 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 app/common/model/distribution/DistributionGoods.php create mode 100644 app/common/model/goods/Goods.php diff --git a/app/api/logic/GoodsLogic.php b/app/api/logic/GoodsLogic.php index d7d0f7e..dd2b41c 100644 --- a/app/api/logic/GoodsLogic.php +++ b/app/api/logic/GoodsLogic.php @@ -18,9 +18,9 @@ // +---------------------------------------------------------------------- namespace app\api\logic; use app\api\model\Goods; -use app\common\model\Distribution; -use app\common\model\DistributionGoods; -use app\common\model\DistributionLevel; +use app\common\model\distribution\Distribution; +use app\common\model\distribution\DistributionGoods; +use app\common\model\distribution\DistributionLevel; use app\common\model\Footprint; use app\common\model\goods\GoodsBrand; use app\common\model\TeamActivity; @@ -367,7 +367,7 @@ class GoodsLogic{ public static function getDistribution($goodsId, $userId) { $earnings = 0; - $goods = \app\common\model\Goods::findOrEmpty($goodsId)->toArray(); + $goods = \app\common\model\goods\Goods::findOrEmpty($goodsId)->toArray(); $distributionGoods = DistributionGoods::where('goods_id', $goodsId)->select()->toArray(); if(!empty($distributionGoods) && $distributionGoods[0]['is_distribution'] && $distributionGoods[0]['rule'] == 2) { foreach($distributionGoods as $item) { diff --git a/app/api/model/Goods.php b/app/api/model/Goods.php index b6aacec..b5aef01 100644 --- a/app/api/model/Goods.php +++ b/app/api/model/Goods.php @@ -130,7 +130,7 @@ class Goods extends Model{ public function getCommentAttr($value,$data){ $comment = []; - $goods_comment = Db::name('goods_comment')->alias('g') + $goods_comment = Db::name('goods_comment')->alias('Goods.phpg') ->leftjoin('user u','g.user_id = u.id') ->where(['goods_id'=>$data['id'],'g.del'=>0,'g.status'=>1]) ->order('g.id desc') diff --git a/app/common/model/distribution/DistributionGoods.php b/app/common/model/distribution/DistributionGoods.php new file mode 100644 index 0000000..0591b0d --- /dev/null +++ b/app/common/model/distribution/DistributionGoods.php @@ -0,0 +1,11 @@ + '上架', + self::STATUS_STORAGE => '下架', + self::STATUS_RECYCLE => '回收站', + ]; + if ($state === true) { + return $data; + } + return $data[$state] ?? ''; + } + +} \ No newline at end of file