From fe3575cf53d03c807c2d08ac7f790eb085c80452 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Tue, 28 Nov 2023 18:15:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E6=96=87=E5=88=9B?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=20-=20=E5=9F=BA=E6=9C=AC=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=20=20-=20=E4=BB=BB=E5=8A=A1=E8=A7=86=E9=A2=91=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=EF=BC=9A=E5=8F=AF=E4=BB=A5=E4=BD=BF=E7=94=A8=E6=96=87?= =?UTF-8?q?=E5=88=9B=E8=B1=86=E5=85=91=E6=8D=A2=E7=9A=84=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/GoodsController.php | 32 +++++++++++ .../src/models/GoodsCulturalSpace.php | 50 ++++++++++++++++ .../cultural-space/views/index/set.blade.php | 57 ++++++++++++++++++- 3 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 plugins/cultural-space/src/api/GoodsController.php diff --git a/plugins/cultural-space/src/api/GoodsController.php b/plugins/cultural-space/src/api/GoodsController.php new file mode 100644 index 00000000..b65051c3 --- /dev/null +++ b/plugins/cultural-space/src/api/GoodsController.php @@ -0,0 +1,32 @@ +successJson('success',$result); + } + + + + + + + + + + + +} \ No newline at end of file diff --git a/plugins/cultural-space/src/models/GoodsCulturalSpace.php b/plugins/cultural-space/src/models/GoodsCulturalSpace.php index d0104b70..10b00a8a 100644 --- a/plugins/cultural-space/src/models/GoodsCulturalSpace.php +++ b/plugins/cultural-space/src/models/GoodsCulturalSpace.php @@ -2,6 +2,7 @@ namespace Yunshop\CulturalSpace\models; +use app\common\facades\Setting; use app\common\models\BaseModel; use app\frontend\models\Goods; @@ -48,4 +49,53 @@ class GoodsCulturalSpace extends BaseModel{ return $this->belongsTo(Goods::class, 'goods_id', 'id'); } + + /** + * Common: 获取可以使用文创豆兑换的商品 + * Author: wu-hui + * Time: 2023/11/28 17:44 + * @return array + */ + public static function getExchangeGoodsList(){ + $result = self::uniacid() + ->select(['id','goods_id','legumes_exchange_price']) + ->with(['belongsToGoods'=>function($query){ + $query->select(['id','title','thumb']); + }]) + ->where('is_open',1) + ->where('is_legumes_exchange',1) + ->orderBy('id','DESC') + ->paginate(10) + ->toArray(); + $data = [ + 'current_page' => (int)$result['current_page'], + 'data' => (array)$result['data'], + 'last_page' => (int)$result['last_page'], + ]; + // 计算需要使用的文创豆 + $currentFee = (float)CulturalFund::uniacid()->value('current_fee');// 当前费率 + $holdExchangeLegumes = 0;// 当前用户持有的用以兑换商品的文创豆 + $data['data'] = array_map(function($item) use ($currentFee,$holdExchangeLegumes){ + // 使用的文创豆 + $useLegumes = ceil($item['legumes_exchange_price'] * $currentFee); + return [ + 'id' => $item['id'], + 'goods_id' => $item['goods_id'], + 'legumes_exchange_price' => $item['legumes_exchange_price'], + 'goods_title' => $item['belongs_to_goods']['title'], + 'goods_thumb' => $item['belongs_to_goods']['thumb'], + 'use_legumes' => $useLegumes, + 'is_allow_exchange' => (int)$holdExchangeLegumes >= $useLegumes, + ]; + },$data['data']); + + return $data; + } + + + + + + + } diff --git a/plugins/cultural-space/views/index/set.blade.php b/plugins/cultural-space/views/index/set.blade.php index 060e5882..9300c940 100644 --- a/plugins/cultural-space/views/index/set.blade.php +++ b/plugins/cultural-space/views/index/set.blade.php @@ -3,6 +3,8 @@ @section('content') + +
-
+
基本设置
@@ -29,6 +32,20 @@ + + + +
+
+
+ + +
+
点击重新上传视频
+
+
+
+
@@ -139,7 +156,19 @@
+ + +
+ @include('public.admin.uploadMultimediaImg')