Browse Source

admin - 代理商品、代理优惠券

liugc 1 year ago
parent
commit
0790671ac3

+ 5 - 1
app/adminapi/controller/property/PropertyActivityController.php

@@ -109,5 +109,9 @@ class PropertyActivityController extends BaseAdminController
         return $this->success('',\app\adminapi\logic\property\PropertyHeadLogic::selectList(), 1, 1);
     }
 
-
+    public function getQRCode()
+    {
+        $params = (new PropertyActivityValidate())->post()->goCheck('detail');
+        return $this->success('',['qrcode'=>PropertyActivityLogic::getQRCode($params)], 1, 1);
+    }
 }

+ 2 - 2
app/adminapi/lists/coupon/CouponRulesLists.php

@@ -40,7 +40,7 @@ class CouponRulesLists extends BaseAdminDataLists implements ListsSearchInterfac
     public function setSearch(): array
     {
         return [
-            '=' => ['amount',  'amount_require',  'max_deductible_price', 'mold_type', 'server_category_name', 'coupon_type','voucher_status'],
+            '=' => ['amount',  'amount_require',  'max_deductible_price', 'mold_type', 'server_category_name', 'coupon_type','voucher_status','property_activity_id'],
             '%like%' => ['event_name','code'],
         ];
     }
@@ -100,7 +100,7 @@ class CouponRulesLists extends BaseAdminDataLists implements ListsSearchInterfac
             $query->field('id,name');
         }])->where($this->searchWhere)
             ->where($this->queryWhere())
-            ->field(['id','code', 'amount', 'coupon_type','amount_require', 'discount_ratio', 'event_name', 'expire_time', 'max_deductible_price', 'mold_type', 'server_category_name', 'voucher_status', 'voucher_count','remaining_count'])
+            ->field(['id','code', 'amount', 'coupon_type','amount_require', 'discount_ratio', 'event_name', 'expire_time', 'max_deductible_price', 'mold_type', 'server_category_name', 'voucher_status', 'voucher_count','remaining_count','property_activity_id'])
             ->limit($this->limitOffset, $this->limitLength)
             ->order(['id' => 'desc'])
             ->select()

+ 2 - 0
app/adminapi/logic/coupon/CouponRulesLogic.php

@@ -56,6 +56,7 @@ class CouponRulesLogic extends BaseLogic
                 'voucher_status' => $params['voucher_status'],
                 'voucher_count' => $params['voucher_count'],
                 'remaining_count' => $params['voucher_count'],
+                'property_activity_id' => $params['property_activity_id'],
             ]);
             if(!empty($params['goods_category_ids'])){
                 $categoryArr = [];
@@ -98,6 +99,7 @@ class CouponRulesLogic extends BaseLogic
                 'voucher_status' => $params['voucher_status'],
                 'voucher_count' => $params['voucher_count'],
                 'remaining_count' => $params['remaining_count'],
+                'property_activity_id' => $params['property_activity_id'],
             ]);
             CouponCategory::where('coupon_id',$params['id'])->delete();
             if(!empty($params['goods_category_ids'])){

+ 28 - 0
app/adminapi/logic/property/PropertyActivityLogic.php

@@ -17,7 +17,9 @@ namespace app\adminapi\logic\property;
 
 use app\common\model\property\PropertyActivity;
 use app\common\logic\BaseLogic;
+use app\common\service\wechat\WeChatMnpService;
 use think\facade\Db;
+use think\facade\Log;
 
 
 /**
@@ -109,4 +111,30 @@ class PropertyActivityLogic extends BaseLogic
     {
         return PropertyActivity::findOrEmpty($params['id'])->toArray();
     }
+
+    public static function getQRCode($params)
+    {
+        try {
+            /*$response = (new WeChatMnpService())->getUnlimitedQRCode(
+                '&property_head_id='.$params['id'],
+                env('miniprogram.property_activity_qrcode', ''),
+                env('miniprogram.mini_env_version', 'release'),
+                false
+            );
+            $qrcode = $response->getContent();
+            if(!is_dir('./uploads/wx_qrcode/'.date('Ymd'))){
+                mkdir('./uploads/wx_qrcode/'.date('Ymd'));
+            }
+            $file_name = 'uploads/wx_qrcode/'.date('Ymd').'/'.time().rand(1000,9999).'.png';
+            file_put_contents($file_name, $qrcode);*/
+
+            $file_name = 'https://fushencdn.kyjlkj.com/uploads/miniqrcode/27f140aae615bbe16c1e888c14c9ab10.png';
+            return $file_name;
+        } catch (\Throwable $e) {
+            Log::info('getQRCode:'.$e->getMessage());
+            return '';
+        }
+    }
+
+
 }