From 6fbd1168cd165a420aa6aef3c3c47b9714af6279 Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Tue, 8 Feb 2022 10:03:36 +0800 Subject: [PATCH] setter --- app/controller/api/Coupon.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/controller/api/Coupon.php b/app/controller/api/Coupon.php index 1674b7d..ba87594 100644 --- a/app/controller/api/Coupon.php +++ b/app/controller/api/Coupon.php @@ -199,6 +199,8 @@ class Coupon extends Base $whereMap = []; $fields = [ 'id', + 'coupon_id', + 'business_code', 'is_verificated as isVerificated', 'money', 'name as couponName', @@ -215,7 +217,16 @@ class Coupon extends Base $sortOrder = ['sort_weight' => 'desc', 'end_time' => 'asc']; $res = CouponRepository::getInstance()->findList($whereMap, $fields, $page, $size,function ($q){ - return $q->with(["couponMain","scoreModel"]); + return $q->with( + [ + "couponMain" => function ($q) { + $q->field("id,name,image_url"); + }, + "scoreModel", + "business" => function ($q) { + $q->field("id,code,business_name"); + } + ]); }, $sortOrder); $res['list'] ->each(function ($item){ @@ -530,17 +541,17 @@ class Coupon extends Base 'amount' => $amount, //单位为分,不小于100 'desc' => '验证优惠券签到', ]; - //不发起支付 - //$result = $payment->transfer->toBalance($toBalanceData); + //发起支付 + $result = $payment->transfer->toBalance($toBalanceData); //var_dump($result); //付款成功才提交!!!!!伪装成功 - if(true||isset($result['payment_no']) ){ + if(isset($result['payment_no']) ){ Db::commit(); return $this->json(0,"优惠券签到使用成功,您获得{$consumerMoney}元红包,已存入您的零钱",["redPacket"=>$consumerMoney]); } - //Log::info("企业发起付款失败:" . json_encode($result,JSON_UNESCAPED_UNICODE)); + Log::info("企业发起付款失败:" . json_encode($result,JSON_UNESCAPED_UNICODE)); } //默认回滚