wugg 7 maanden geleden
bovenliggende
commit
0b28d1f7b5
3 gewijzigde bestanden met toevoegingen van 13 en 5 verwijderingen
  1. 2 3
      app/txx/controller/Act.php
  2. 3 2
      app/txx/controller/Activity.php
  3. 8 0
      app/txx/model/YzActivityPromoCode.php

+ 2 - 3
app/txx/controller/Act.php

@@ -3,14 +3,13 @@ declare (strict_types = 1);
 
 namespace app\txx\controller;
 
-use app\txx\model\ActGood;use think\facade\Validate;
+use app\txx\model\ActGood;
+use think\facade\Validate;
 use app\txx\model\Act as Actm;
 use think\App;
 
 class Act extends Base
 {
-	protected $uid=0;
-	protected $uname='';
 	protected $model;
 	protected static $ActStatusCn=["无状态",'活动未开始','活动进行中',"活动已结束"];
     public function __construct(App $app) {

+ 3 - 2
app/txx/controller/Activity.php

@@ -7,7 +7,7 @@ namespace app\txx\controller;
 use app\api\model\GoodSpec;
 use app\txx\model\ActGood;
 use app\txx\model\PlatformYouzan;
-use think\App;
+use app\txx\model\YzActivityPromoCode;use think\App;
 use think\facade\Validate;
 class Activity extends Base{
     private $platform_id=[37,79];
@@ -131,13 +131,14 @@ class Activity extends Base{
         ->paginate(["list_rows"=>$param['size'],"page"=>$param['page']]);
         $list->visible(['id',"actCode","yz_good_code","stock_num","awards_type","status","addtime","updatetime","act_name",
         "company_name","contactor","mobile","startTime","endTime","act_status","sale_price","good_name","unit_name","cat_name",
-        "brand_name","fetch_url","roundId","status_cn","ActStatus_cn"]);
+        "brand_name","fetch_url","roundId","status_cn","ActStatus_cn","awards_order_num"]);
         $list->each(function (&$item){
             $item['status_cn']=ActGood::$statusCn[$item['status']]??"";
             $item['ActStatus_cn']=\app\txx\model\Act::$statusCn[$item['act_status']];
             if($item['act_status']!==4){
                 $item['fetch_url']=null;
             }
+            $item['awards_order_num']=YzActivityPromoCode::GetOrderNumById($item['id']);
         });
         $this->success("获取成功",["list"=>$list->items(),"count"=>$list->total()]);
     }

+ 8 - 0
app/txx/model/YzActivityPromoCode.php

@@ -12,4 +12,12 @@ class YzActivityPromoCode  extends  Model{
     protected $autoWriteTimestamp = false;
     protected $createTime='createTime';
     protected $updateTime='updateTime';
+
+    public function GetOrderNumById($id){
+      $coupid= $this->where(["act_good_id"=>$id])->value("group_id",0);
+      if ($coupid>0){
+          return $this->name("order_promotion")->where(["coupon_id"=>$coupid])->count();
+      }
+      return 0;
+    }
 }