Browse Source

核销统一字段名

lizhen_gitee 1 year ago
parent
commit
dc78660487
1 changed files with 7 additions and 2 deletions
  1. 7 2
      application/api/controller/company/Coupon.php

+ 7 - 2
application/api/controller/company/Coupon.php

@@ -102,7 +102,7 @@ class Coupon extends Apic
                 'id'         => $id,
                 'remain'     => ['gt',0],
             ];
-            $check = Db::name('user_coupons')->field('id,coupon_name,coupon_info,endtime,getfrom')->where($map)->find();
+            $check = Db::name('user_coupons')->field('id,coupon_name as name,endtime,getfrom')->where($map)->find();
             if(!empty($check)){
                 $check['action'] = $action;
             }
@@ -113,11 +113,16 @@ class Coupon extends Apic
                 'ordertype'  => 3,
                 'status'     => 2, //2=已支付,待处理
             ];
-            $check = Db::name('order')->field('id,package_info,package_price')->where($map)->find();
+            $check = Db::name('order')->field('id,package_title as name,package_endtime as endtime,package_price as price')->where($map)->find();
             if(!empty($check)){
+                $check['getfrom'] = '购买';
                 $check['action'] = $action;
             }
         }
+        if(empty($check))
+        {
+            $this->error('错误的核销码');
+        }
 
         $this->success(1,$check);
     }