From 161c16e562e55d58b455bb06f5fcc6b4fffc1411 Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 16 Sep 2020 15:56:19 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=BD=93=E9=9D=A2=E4=BB=98=E6=94=AF?= =?UTF-8?q?=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Constants/v3/ErrorCode.php | 18 +++++++++++++++++- app/Controller/v3/OrderOfflineController.php | 2 +- .../v3/Implementations/OrderOfflineService.php | 2 +- .../v3/Implementations/PaymentService.php | 8 ++++---- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/Constants/v3/ErrorCode.php b/app/Constants/v3/ErrorCode.php index 362d532..df607c8 100644 --- a/app/Constants/v3/ErrorCode.php +++ b/app/Constants/v3/ErrorCode.php @@ -89,12 +89,18 @@ class ErrorCode extends AbstractConstants */ const ORDER_NOT_ENOUGH_INITIAL_DELIVERY = 611; + /** + * 下单失败 + * @Message("付款失败") + */ + const ORDER_OFFLINE_FAIL = 612; + /************************************/ /* 支付相关 651-700 */ /************************************/ /** - * @Message("提现支付失败") + * @Message("支付失败") */ const PAYMENT_FAIL = 651; @@ -118,6 +124,16 @@ class ErrorCode extends AbstractConstants */ const PAYMENT_AMOUNT_LIMIT = 655; + /** + * @Message("提现失败") + */ + const WITHDRAW_PAYMENT_FAIL = 656; + + /** + * @Message("退款失败") + */ + const REFUND_PAYMENT_FAIL = 657; + /************************************/ /* 用户相关 701-750 */ /************************************/ diff --git a/app/Controller/v3/OrderOfflineController.php b/app/Controller/v3/OrderOfflineController.php index c53fb05..e929c3b 100644 --- a/app/Controller/v3/OrderOfflineController.php +++ b/app/Controller/v3/OrderOfflineController.php @@ -47,7 +47,7 @@ class OrderOfflineController extends BaseController $params = $validator->validated(); $store = $this->storeService->detail($params['store_id']); - return $this->success(['store' => $store]); + return $this->success(['store' => $store, 'digit_length' => 8]); } /** diff --git a/app/Service/v3/Implementations/OrderOfflineService.php b/app/Service/v3/Implementations/OrderOfflineService.php index 9e41a25..33883b8 100644 --- a/app/Service/v3/Implementations/OrderOfflineService.php +++ b/app/Service/v3/Implementations/OrderOfflineService.php @@ -99,7 +99,7 @@ class OrderOfflineService implements OrderOfflineServiceInterface } catch (\Exception $e) { Db::rollBack(); $this->log->event(LogLabel::ORDER_OFFLINE_LOG, ['exception_msg' => $e->getMessage()]); - throw new ErrorCodeException(ErrorCode::ORDER_ONLINE_FAIL); + throw new ErrorCodeException(ErrorCode::ORDER_OFFLINE_FAIL); } } diff --git a/app/Service/v3/Implementations/PaymentService.php b/app/Service/v3/Implementations/PaymentService.php index acae5bb..65e6235 100644 --- a/app/Service/v3/Implementations/PaymentService.php +++ b/app/Service/v3/Implementations/PaymentService.php @@ -139,11 +139,11 @@ class PaymentService implements PaymentServiceInterface if ($result['return_code'] == 'SUCCESS' && isset($result['result_code']) && $result['result_code'] == "SUCCESS") { return true; } else { - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL,$result['err_code_des']); + throw new ErrorCodeException(ErrorCode::REFUND_PAYMENT_FAIL,$result['err_code_des']); } } catch (\Exception $e) { $this->log->event(LogLabel::ORDER_PAYMENT_LOG, ['payment_do_exception_msg' => $e->getMessage()]); - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL, '[退款失败]'.$e->getMessage()); + throw new ErrorCodeException(ErrorCode::REFUND_PAYMENT_FAIL, '[退款失败]'.$e->getMessage()); } } @@ -182,7 +182,7 @@ class PaymentService implements PaymentServiceInterface 'result' => json_encode($result), 'desc' => $desc ]); - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL); + throw new ErrorCodeException(ErrorCode::WITHDRAW_PAYMENT_FAIL); } if ($result['result_code'] != 'SUCCESS') { @@ -218,7 +218,7 @@ class PaymentService implements PaymentServiceInterface throw new ErrorCodeException(ErrorCode::PAYMENT_AMOUNT_LIMIT); } - throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL); + throw new ErrorCodeException(ErrorCode::WITHDRAW_PAYMENT_FAIL); } return true; From 29a46d8ae9ed801c89ca062c68cc0a539a526cbd Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Wed, 16 Sep 2020 15:57:33 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/CouponRecService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Service/v3/Implementations/CouponRecService.php b/app/Service/v3/Implementations/CouponRecService.php index a23f09b..fe48062 100644 --- a/app/Service/v3/Implementations/CouponRecService.php +++ b/app/Service/v3/Implementations/CouponRecService.php @@ -114,7 +114,8 @@ class CouponRecService implements CouponRecServiceInterface case 'unused': $builder = $builder->where([ ['lanzu_coupon.usable_end_time' ,'>', time()], - ['lanzu_coupon_receive.number_remain' ,'>', 0] + ['lanzu_coupon_receive.number_remain' ,'>', 0], + ['lanzu_coupon.status','=',1] ]) ->whereIn('lanzu_coupon_receive.status',[0,1]); break; From ea2cf36816fdd18c2b41aac056c7775eef7fff29 Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 16 Sep 2020 16:13:30 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=95=86=E6=88=B7logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/v3/Store.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Model/v3/Store.php b/app/Model/v3/Store.php index 93d5dad..830c019 100644 --- a/app/Model/v3/Store.php +++ b/app/Model/v3/Store.php @@ -3,13 +3,16 @@ declare (strict_types=1); namespace App\Model\v3; +use App\Constants\v3\OssThumbnail; use App\Constants\v3\SsdbKeys; use App\Model\Model; +use App\Service\v3\Interfaces\AttachmentServiceInterface; use App\TaskWorker\SSDBTask; use Hyperf\Database\Model\Builder; use Hyperf\Database\Model\SoftDeletes; use Hyperf\Utils\ApplicationContext; use App\Constants\v3\Store as StoreConstants; +use Hyperf\Di\Annotation\Inject; /** */ @@ -40,6 +43,12 @@ class Store extends Model 'month_sales' ]; + /** + * @Inject + * @var AttachmentServiceInterface + */ + protected $attachmentService; + protected function boot(): void { parent::boot(); @@ -63,6 +72,11 @@ class Store extends Model return (integer)$ssdb->exec('get', SsdbKeys::STORE_MONTH_SALES.date('Ym').'_'.$this->id); } + public function getLogoAttribute($value) + { + return $this->attachmentService->switchImgToAliOss($value, OssThumbnail::THUMBNAIL_300_Q80); + } + public function goods() { return $this->hasMany(Goods::class, 'store_id', 'id')->limit(5); From a81510d29a46a814c22607c0db3e274b819695e4 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Wed, 16 Sep 2020 16:16:09 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B8=82=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/GoodsService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Service/v3/Implementations/GoodsService.php b/app/Service/v3/Implementations/GoodsService.php index bf240f3..56ff073 100644 --- a/app/Service/v3/Implementations/GoodsService.php +++ b/app/Service/v3/Implementations/GoodsService.php @@ -67,7 +67,9 @@ class GoodsService implements GoodsServiceInterface public function detail($goodsId) { - $res = Goods::query()->with('store')->where('id',$goodsId)->first(); + $res = Goods::query()->with(['store' => function($query){ + $query->with('market'); + }])->where('id',$goodsId)->first(); return $res; } } \ No newline at end of file From 08fe7199480bff514d01396e5fff69f6ce95c4d3 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Wed, 16 Sep 2020 16:18:17 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=B8=82=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/GoodsService.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/Service/v3/Implementations/GoodsService.php b/app/Service/v3/Implementations/GoodsService.php index 56ff073..bf240f3 100644 --- a/app/Service/v3/Implementations/GoodsService.php +++ b/app/Service/v3/Implementations/GoodsService.php @@ -67,9 +67,7 @@ class GoodsService implements GoodsServiceInterface public function detail($goodsId) { - $res = Goods::query()->with(['store' => function($query){ - $query->with('market'); - }])->where('id',$goodsId)->first(); + $res = Goods::query()->with('store')->where('id',$goodsId)->first(); return $res; } } \ No newline at end of file From 551bc685567598db2ee4c284fa75aa86afdb7f2c Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 16 Sep 2020 16:22:15 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E9=94=80=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/v3/Goods.php | 2 +- app/Model/v3/GoodsActivity.php | 2 +- app/Model/v3/Store.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Model/v3/Goods.php b/app/Model/v3/Goods.php index d7feb67..bf0417f 100644 --- a/app/Model/v3/Goods.php +++ b/app/Model/v3/Goods.php @@ -96,7 +96,7 @@ class Goods extends Model public function getMonthSalesAttribute() { $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); - return (integer)$ssdb->exec('get', SsdbKeys::GOODS_MONTH_SALES.date('Ym').'_'.$this->id); + return (integer)$ssdb->exec('get', SsdbKeys::GOODS_MONTH_SALES.date('Ym').'_1_'.$this->id); } public function getCartNumAttribute() diff --git a/app/Model/v3/GoodsActivity.php b/app/Model/v3/GoodsActivity.php index 1243de2..70b6e0b 100644 --- a/app/Model/v3/GoodsActivity.php +++ b/app/Model/v3/GoodsActivity.php @@ -64,7 +64,7 @@ class GoodsActivity extends Model public function getMonthSalesAttribute() { $ssdb = ApplicationContext::getContainer()->get(SSDBTask::class); - return (integer)$ssdb->exec('get', SsdbKeys::GOODS_MONTH_SALES.date('Ym').'_'.$this->id); + return (integer)$ssdb->exec('get', SsdbKeys::GOODS_MONTH_SALES.date('Ym').'_2_'.$this->id); } public function getCartNumAttribute() diff --git a/app/Model/v3/Store.php b/app/Model/v3/Store.php index 830c019..a4e3df4 100644 --- a/app/Model/v3/Store.php +++ b/app/Model/v3/Store.php @@ -72,10 +72,10 @@ class Store extends Model return (integer)$ssdb->exec('get', SsdbKeys::STORE_MONTH_SALES.date('Ym').'_'.$this->id); } - public function getLogoAttribute($value) - { - return $this->attachmentService->switchImgToAliOss($value, OssThumbnail::THUMBNAIL_300_Q80); - } + // public function getLogoAttribute($value) + // { + // return $this->attachmentService->switchImgToAliOss($value, OssThumbnail::THUMBNAIL_300_Q80); + // } public function goods() {