wugg 4 months ago
parent
commit
7e104bf465
2 changed files with 1 additions and 44 deletions
  1. 1 15
      app/youzan/controller/Voucher.php
  2. 0 29
      app/youzan/listener/Voucher.php

+ 1 - 15
app/youzan/controller/Voucher.php

@@ -66,21 +66,7 @@ class Voucher extends Base{
         $params['operator_id']=0;
         $params['app_name']='youzanyun';
         $data = Youzan::getData('promocode_delete',$params);
-        if($data['code']!='200') return error($data['message']);
+         if(!isset($data['code'])|| $data['code']!='200') return error($data['message']??$data['gw_err_resp']['err_msg']);
         return success($data['message']);
     }
-
-    public function refesh(){
-        $params = $this->request->param([
-                       'activity_type_group' => 2,
-                                       'time_line_status' => 0,
-                                       'page_num' => 1,
-                                       'page_size' => 20
-                	]);
-        $bool = Cache::get("voucher_list_params");
-        if($bool) return error('一小时内只能刷新一次');
-        Cache::set('voucher_list_params',$params,3600);
-        event('voucher',$params);
-        return success('稍后刷新页面');
-    }
 }

+ 0 - 29
app/youzan/listener/Voucher.php

@@ -1,29 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace app\youzan\listener;
-
-use app\common\facade\Youzan;use app\youzan\model\Promocode;
-class Voucher
-{
-    /**
-     * 事件监听处理
-     *
-     * @return mixed
-     */
-    public function handle($event)
-    {
-        if(!empty($event)){
-              $data = Youzan::getData('coupon_search',$event,'1.0.1');
-            if ($data['code'] != '200') throw new \Exception($data['message']);
-              if (!empty($data['data']))array_map(function ($item){
-                $temp=array_merge($item['activity'],$item['activity_budget']);
-                $temp['time_line_status']= $item['time_line_status'];
-                $temp['activity_display_type']= $item['activity_display_type'];
-                $promocode = Promocode::where('id', $item['activity']['id'])->findOrEmpty();
-                if($promocode->isEmpty())  Promocode::create($temp);
-                else $promocode->save($temp);
-            }, $data['data']);
-        }
-    }
-}