wugg 9 months ago
parent
commit
fc9f235479
2 changed files with 16 additions and 6 deletions
  1. 15 5
      app/txx/controller/Activity.php
  2. 1 1
      app/txx/model/ActGood.php

+ 15 - 5
app/txx/controller/Activity.php

@@ -114,20 +114,30 @@ class Activity extends Base{
         if($param['roundId']!==""){
             $where[]=["roundId","=",$param['roundId']];
         }
-        $list= $this->model->with(["act","platformYz"=>["platform","good"],"promocode"])->where($where)->order("id desc")->paginate(["list_rows"=>$param['size'],"page"=>$param['page']]);
-        $list->each(function($item,$key){
+        $list= $this->model->with(["act","platformYz"=>["platform","good"=>["unit","brand","category"]],"promocode"])
+        ->where($where)->order("id desc")
+        ->paginate(["list_rows"=>$param['size'],"page"=>$param['page']]);
+        $list->visible(['id',"actCode","yz_good_code","stock_num","status","addtime","updatetime","act_name",
+        "company_name","contactor","mobile","startTime","endTime","act_status","final_price","good_name","unit_name","cat_name",
+        "brand_name","fetch_url","roundId","status_cn","act_status_cn"]);
+        $list->each(function (&$item){
             $item['status_cn']=ActGood::$statusCn[$item['status']]??"";
-            $item['act_status_cn']=\app\txx\model\Act::$statusCn[$item['act_status']]??"";
-            return $item;
+            $item['act_status_cn']=\app\txx\model\Act::$statusCn[$item['act_status']];
+            if($item['act_status']!==4){
+                $item['fetch_url']=null;
+            }
         });
         $this->success("获取成功",["list"=>$list->items(),"count"=>$list->total()]);
     }
     public function info(){
         $param=$this->request->param(["id"=>""],"post","trim");
-        $info= $this->model->with(["act","platformYz"=>["platform","good"],"promocode"])->findOrEmpty($param['id']);
+        $info= $this->model->with(["act","platformYz"=>["platform","good"=>['unit','brand','category']],"promocode"])->findOrEmpty($param['id']);
         if($info->isEmpty()){
             $this->error("信息有误");
         }
+         $info->visible(['id','actCode','yz_good_code','stock_num','status','addtime','updatetime','act_name',
+        'company_name','contactor','mobile','startTime','endTime','act_status','final_price','good_name','unit_name','cat_name',
+        'brand_name','fetch_url','roundId','status_cn','act_status_cn']);
         $info['status_cn']=ActGood::$statusCn[$info['status']]??"";
         $info['act_status_cn']=\app\txx\model\Act::$statusCn[$info['act_status']];
         $this->success("获取成功",$info);

+ 1 - 1
app/txx/model/ActGood.php

@@ -26,6 +26,6 @@ class ActGood extends Model
     }
 
     public function platformYz(){
-        return $this->belongsTo(PlatformYouzan::class,'yz_good_code','skuCode')->bind(['plat_code','spuCode','sale_price','final_price','platform_name','good_name']);
+        return $this->belongsTo(PlatformYouzan::class,'yz_good_code','skuCode')->bind(['plat_code','spuCode','sale_price','final_price','platform_name','good_name',"unit_name","brand_name","cat_name","cat_search"]);
     }
 }