Browse Source

Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix

* 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf:
  销量
  商品详情取消市场
  商品详情增加市场
  商户logo
  优惠券列表
  当面付支付
master
Mike 5 years ago
parent
commit
204dae2578
  1. 18
      app/Constants/v3/ErrorCode.php
  2. 2
      app/Controller/v3/OrderOfflineController.php
  3. 2
      app/Model/v3/Goods.php
  4. 2
      app/Model/v3/GoodsActivity.php
  5. 14
      app/Model/v3/Store.php
  6. 3
      app/Service/v3/Implementations/CouponRecService.php
  7. 2
      app/Service/v3/Implementations/OrderOfflineService.php
  8. 8
      app/Service/v3/Implementations/PaymentService.php

18
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 */
/************************************/

2
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]);
}
/**

2
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()

2
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()

14
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);

3
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;

2
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);
}
}

8
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;

Loading…
Cancel
Save