Browse Source

用户地址和优惠券

master
weigang 5 years ago
parent
commit
c62ce29dcd
  1. 1
      app/Controller/v3/HomeController.php
  2. 4
      app/Controller/v3/NotifyController.php
  3. 5
      app/Model/v3/Coupon.php
  4. 2
      app/Service/v3/Implementations/BadgeService.php
  5. 2
      app/Service/v3/Implementations/CouponRecService.php
  6. 1
      app/Service/v3/Implementations/OrderOnlineService.php
  7. 1
      app/Service/v3/Implementations/StoreLoginService.php
  8. 2
      app/Service/v3/Implementations/UserAddressService.php

1
app/Controller/v3/HomeController.php

@ -216,7 +216,6 @@ class HomeController extends BaseController
$data['order_offline']['total'] = 0; $data['order_offline']['total'] = 0;
$revenueByOrder = $this->revenueListService->getRevenueByUser($userId,$type,$dayStartTime,$dayEndTime); $revenueByOrder = $this->revenueListService->getRevenueByUser($userId,$type,$dayStartTime,$dayEndTime);
foreach ($revenueByOrder as $order){ foreach ($revenueByOrder as $order){
var_dump($order['money']);
if($order['money_type'] == FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP){ if($order['money_type'] == FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP){
//线上订单 //线上订单
$data['order_online']['total'] = bcadd($data['order_online']['total'],$order['money'],2); $data['order_online']['total'] = bcadd($data['order_online']['total'],$order['money'],2);

4
app/Controller/v3/NotifyController.php

@ -134,7 +134,7 @@ class NotifyController extends BaseController
|| $message['result_code'] != 'SUCCESS' || $message['result_code'] != 'SUCCESS'
) { ) {
$this->log->event( $this->log->event(
LogLabel::ORDER_OFFLINE_PAY_NOTIFY_LOG,
LogLabel::ORDER_ONLINE_PAY_NOTIFY_LOG,
$message $message
); );
Db::rollBack(); Db::rollBack();
@ -149,7 +149,7 @@ class NotifyController extends BaseController
// 订单不存在 // 订单不存在
if (empty($orderMain)) { if (empty($orderMain)) {
$this->log->event( $this->log->event(
LogLabel::ORDER_OFFLINE_PAY_NOTIFY_LOG,
LogLabel::ORDER_ONLINE_PAY_NOTIFY_LOG,
['global_order_id_fail' => $message['out_trade_no']] ['global_order_id_fail' => $message['out_trade_no']]
); );
Db::rollBack(); Db::rollBack();

5
app/Model/v3/Coupon.php

@ -16,6 +16,10 @@ class Coupon extends Model
'discounts_text' 'discounts_text'
]; ];
protected $casts = [
'activity_available' => 'array'
];
public function getFullAmountTextAttribute() public function getFullAmountTextAttribute()
{ {
return '满'.$this->attributes['full_amount'].'可用'; return '满'.$this->attributes['full_amount'].'可用';
@ -29,4 +33,5 @@ class Coupon extends Model
return floatval($this->attributes['discounts']).""; return floatval($this->attributes['discounts'])."";
} }
} }
} }

2
app/Service/v3/Implementations/BadgeService.php

@ -155,7 +155,7 @@ class BadgeService implements BadgeServiceInterface
* @inheritDoc * @inheritDoc
*/ */
public function clearStoreOrder($storeId, $badge = 'all') public function clearStoreOrder($storeId, $badge = 'all')
{var_dump('badge_'.$badge.'_store_'.$storeId);
{
$redis = ApplicationContext::getContainer()->get(Redis::class); $redis = ApplicationContext::getContainer()->get(Redis::class);
if ($badge == 'all') { if ($badge == 'all') {
$redis->del('badge_paid_store_'.$storeId); # 移除商户待付款 $redis->del('badge_paid_store_'.$storeId); # 移除商户待付款

2
app/Service/v3/Implementations/CouponRecService.php

@ -268,7 +268,7 @@ class CouponRecService implements CouponRecServiceInterface
} }
// 活动商品可用,校验对应的优惠券可使用活动类型 // 活动商品可用,校验对应的优惠券可使用活动类型
$intersects = array_intersect($goodsActivityTypes, $item['activity_available']); # 所有活动商品的活动类型和优惠券的可用活动类型求交集
$intersects = array_intersect($goodsActivityTypes, (array)$item['activity_available']); # 所有活动商品的活动类型和优惠券的可用活动类型求交集
$canUseByTypes = array_diff($goodsActivityTypes, $intersects); # 所有活动商品的活动类型和上述交集求差集,如果为空则是可以用的,否则说明前者中有后者不能用的活动类型 $canUseByTypes = array_diff($goodsActivityTypes, $intersects); # 所有活动商品的活动类型和上述交集求差集,如果为空则是可以用的,否则说明前者中有后者不能用的活动类型
if (!empty($canUseByTypes)) { if (!empty($canUseByTypes)) {
$item['not_available_reason'] = '活动不可用'; $item['not_available_reason'] = '活动不可用';

1
app/Service/v3/Implementations/OrderOnlineService.php

@ -126,6 +126,7 @@ class OrderOnlineService implements OrderOnlineServiceInterface
$userAddr = $userAddrAndDPrice['address']['address']; $userAddr = $userAddrAndDPrice['address']['address'];
$deliveryAmount = $userAddrAndDPrice['distribution_price']; $deliveryAmount = $userAddrAndDPrice['distribution_price'];
$deliveryDistance = $userAddrAndDPrice['delivery_distance']; $deliveryDistance = $userAddrAndDPrice['delivery_distance'];
// 优惠券数据,当前订单可用个优惠券 // 优惠券数据,当前订单可用个优惠券
$couponRecs = $this->couponRecService->allForOnlineOrderAvailable($userId, $marketId); $couponRecs = $this->couponRecService->allForOnlineOrderAvailable($userId, $marketId);
$canRealUseCoupons = $couponRecs['available']; $canRealUseCoupons = $couponRecs['available'];

1
app/Service/v3/Implementations/StoreLoginService.php

@ -13,7 +13,6 @@ class StoreLoginService implements StoreLoginServiceInterface
{ {
$storeUsersModel = StoreUsers::query()->where('username',$account)->first(); $storeUsersModel = StoreUsers::query()->where('username',$account)->first();
$password = $this->stringHash($password,$storeUsersModel->salt); $password = $this->stringHash($password,$storeUsersModel->salt);
var_dump($storeUsersModel,$password);
if($storeUsersModel->password === $password){ if($storeUsersModel->password === $password){
return $storeUsersModel; return $storeUsersModel;
}else{ }else{

2
app/Service/v3/Implementations/UserAddressService.php

@ -85,7 +85,7 @@ class UserAddressService implements UserAddressServiceInterface
{ {
$address = $this->get($userAddressId); $address = $this->get($userAddressId);
$market = Market::query()->select('lng','lat')->find($marketId); $market = Market::query()->select('lng','lat')->find($marketId);
$distance = $this->locationService->getDistanceByTencent($address->lng,$address->lat,$market->lng,$market->lat);
$distance = $this->locationService->getDistanceByTencent($address['address']->lng,$address['address']->lat,$market->lng,$market->lat);
$distributionPrice = $this->distributionPriceService->do($distance); $distributionPrice = $this->distributionPriceService->do($distance);
$res['address'] = $address; $res['address'] = $address;
$res['delivery_distance'] = $distance; $res['delivery_distance'] = $distance;

Loading…
Cancel
Save