|
|
@@ -8,6 +8,7 @@ use app\middleware\AuthMiddleware;
|
|
|
use app\model\saas\SaasLivePlan;
|
|
|
use app\model\saas\SaasLivePlanGoods;
|
|
|
use app\model\saas\SaasLivePlanStar;
|
|
|
+use app\service\saas\GoodsService;
|
|
|
use app\service\saas\PlanService;
|
|
|
use DI\Attribute\Inject;
|
|
|
use LinFly\Annotation\Attributes\Route\Controller;
|
|
|
@@ -26,6 +27,9 @@ class Plan extends Base
|
|
|
#[Inject]
|
|
|
protected PlanService $service;
|
|
|
|
|
|
+ #[Inject]
|
|
|
+ protected GoodsService $goodsService;
|
|
|
+
|
|
|
#[Inject]
|
|
|
protected SaasLivePlan $model;
|
|
|
|
|
|
@@ -128,9 +132,16 @@ class Plan extends Base
|
|
|
"id.require" => trans("empty.require"),
|
|
|
],$request->method());
|
|
|
if (!is_array($param)) return error($param);
|
|
|
- $plan = $this->model->where("id",$param['id'])->with(['goods' => function ($query) {
|
|
|
- $query->with(['goods' => function($subQue){
|
|
|
- $subQue->field("goods_id,product_name,image_list,product_id,price,line_price,limit_use_rule,use_num_per_consume,status");
|
|
|
+ $productType = $this->goodsService->productType();
|
|
|
+ $plan = $this->model->where("id",$param['id'])->with(['goods' => function ($query) use($productType){
|
|
|
+ $query->with(['goods' => function($subQue) use($productType){
|
|
|
+ $subQue->field("goods_id,product_name,image_list,product_id,price,line_price,limit_use_rule,use_num_per_consume,status,product_type")->append(['types'])->withAttr(['types' => function($query,$resp) use($productType){
|
|
|
+ $productTypeArr = [];
|
|
|
+ foreach ($productType as $val) {
|
|
|
+ $productTypeArr[$val['key']] = $val['name'];
|
|
|
+ }
|
|
|
+ return $productTypeArr[$resp['product_type']]??'';
|
|
|
+ }]);
|
|
|
}]);
|
|
|
},'star' => function ($query) {
|
|
|
$query->with(['star' => function($subQue){
|