Browse Source

Merge branch 'phoenix' of ssh://120.24.33.109:11022/hyzjshwo/lanzu_api_hyperf into phoenix

master
weigang 6 years ago
parent
commit
7a7327014c
  1. 3
      app/Controller/v3/OrderListController.php
  2. 2
      app/Controller/v3/OrderOnlineController.php
  3. 14
      app/Model/v3/UserCollection.php
  4. 7
      app/Service/v3/Implementations/CollectStoreService.php
  5. 1
      app/Service/v3/Implementations/CouponRecService.php
  6. 3
      app/Service/v3/Implementations/LocationService.php
  7. 35
      app/Service/v3/Implementations/OrderListService.php
  8. 2
      app/Service/v3/Interfaces/OrderListServiceInterface.php

3
app/Controller/v3/OrderListController.php

@ -48,12 +48,11 @@ class OrderListController extends BaseController
public function offlineForStore()
{
$storeId = $this->request->input('store_id','');
$tab = $this->request->input('tab','all');
$page = $this->request->input('page',1);
$pagesize = $this->request->input('pagesize',10);
$startTime = $this->request->input('start_time','');
$endTime = $this->request->input('end_time','');
$list = $this->orderListService->offlineByStore($storeId, $tab, $page, $pagesize,$startTime,$endTime);
$list = $this->orderListService->offlineByStore($storeId,$page, $pagesize,$startTime,$endTime);
return $this->success($list);
}

2
app/Controller/v3/OrderOnlineController.php

@ -93,7 +93,7 @@ class OrderOnlineController extends BaseController
])
->select('id')
->first();
// $res['location'] = $this->userAddressService->getAddressAndDistributionRrice($address->id,$marketId);
$res['location'] = $this->userAddressService->getAddressAndDistributionRrice($address->id,$marketId);
//返回预约送达时间 数组
$res['appointment_time'] = $this->appointmentTimeService->do();
//

14
app/Model/v3/UserCollection.php

@ -0,0 +1,14 @@
<?php
declare (strict_types=1);
namespace App\Model\v3;
use App\Model\Model;
use Hyperf\Database\Model\SoftDeletes;
class UserCollection extends Model
{
use SoftDeletes;
protected $table = 'lanzu_user_collection';
}

7
app/Service/v3/Implementations/CollectStoreService.php

@ -3,6 +3,7 @@
namespace App\Service\v3\Implementations;
use App\Model\v3\Market;
use App\Model\v3\Store;
use App\Model\v3\UserCollection;
use App\Service\v3\Interfaces\CollectStoreServiceInterface;
use App\Constants\v3\SsdbKeys;
use App\TaskWorker\SSDBTask;
@ -57,10 +58,10 @@ class CollectStoreService implements CollectStoreServiceInterface
public function getListByUser($userId)
{
$marketIds = Db::table('lanzu_user_collection')->where('user_id',$userId)->pluck('market_id')->toArray();
$storeIds = Db::table('lanzu_user_collection')->where('user_id',$userId)->pluck('store_id')->toArray();
$marketIds = UserCollection::query()->where('user_id',$userId)->pluck('market_id')->toArray();
$storeIds = UserCollection::query()->where('user_id',$userId)->pluck('store_id')->toArray();
$res = Market::query()->with(['stores' => function($query) use ($storeIds) {
$query->whereIn('lanzu_store.id',$storeIds);
$query->whereIn('id',$storeIds);
}])
->whereIn('id',$marketIds)
->get();

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

@ -134,6 +134,7 @@ class CouponRecService implements CouponRecServiceInterface
'lanzu_coupon.full_amount',
'lanzu_coupon.discount_type',
'lanzu_coupon.introduce',
'lanzu_coupon.tags',
'lanzu_coupon.usable_start_time',
'lanzu_coupon.usable_end_time',
'lanzu_coupon_receive.number',

3
app/Service/v3/Implementations/LocationService.php

@ -94,7 +94,8 @@ class LocationService implements LocationServiceInterface
$resultArr = json_decode($result,true);
if($resultArr['status'] > 0)
{
throw new ErrorCodeException(ErrorCode::LOCATION_ERROR,$resultArr['message']);
return 1000;
//throw new ErrorCodeException(ErrorCode::LOCATION_ERROR,$resultArr['message']);
}
$distance = $resultArr['result']['routes'][0]['distance'];
return $distance;

35
app/Service/v3/Implementations/OrderListService.php

@ -76,7 +76,9 @@ class OrderListService implements OrderListServiceInterface
'lanzu_order_main.name',
'lanzu_order_main.delivery_time_note',
'lanzu_order_main.shipping_type',
'lanzu_order_main.global_order_id'
'lanzu_order_main.global_order_id',
'lanzu_order_main.lat',
'lanzu_order_main.lng'
)
->with('orderGoods')
->where('lanzu_order.store_id', $storeId)
@ -92,14 +94,14 @@ class OrderListService implements OrderListServiceInterface
switch ($tab) {
case 'all':
break;
case 'completed':
$builder->whereIn('lanzu_order_main.state', OrderState::FINISH);
case 'paid':
$builder->where('lanzu_order_main.state', OrderState::PAID);
break;
case 'unpaid':
$builder->where(['lanzu_order_main.state' => OrderState::UNPAID]);
case 'delivery':
$builder->where(['lanzu_order_main.state' => OrderState::DELIVERY]);
break;
case 'receiving':
$builder->whereIn('lanzu_order_main.state', OrderState::RECEIVING);
case 'finish':
$builder->whereIn('lanzu_order_main.state', OrderState::FINISH);
break;
case 'refund':
$builder->whereIn('lanzu_order_main.state', OrderState::REFUND);
@ -137,30 +139,13 @@ class OrderListService implements OrderListServiceInterface
return $res;
}
public function offlineByStore($storeId, $tab, $page=1, $pagesize=10 ,$start_time = '',$end_time = '')
public function offlineByStore($storeId, $page=1, $pagesize=10 ,$start_time = '',$end_time = '')
{
$builder = Order::join('lanzu_order_main','lanzu_order.order_main_id','lanzu_order_main.id')
->where('store_id', $storeId)
->where('lanzu_order_main.type',4)
->with('user');
switch ($tab) {
case 'all':
break;
case 'completed':
$builder->whereIn('lanzu_order_main.state', OrderState::FINISH);
break;
case 'unpaid':
$builder->where(['lanzu_order_main.state' => OrderState::UNPAID]);
break;
case 'receiving':
$builder->whereIn('lanzu_order_main.state', OrderState::RECEIVING);
break;
case 'refund':
$builder->whereIn('lanzu_order_main.state', OrderState::REFUND);
break;
}
if(!empty($start_time) && !empty($end_time)){
$builder->whereBetween('lanzu_order_main.created_at',[strtotime($start_time.' 23:59:59'),strtotime($end_time.' 23:59:59')]);
}

2
app/Service/v3/Interfaces/OrderListServiceInterface.php

@ -9,6 +9,6 @@ interface OrderListServiceInterface
public function undo();
public function onlineByUser($userId, $tab, $page=1, $pagesize=10);
public function onlineByStore($storeId, $tab, $page, $pagesize);
public function offlineByStore($storeId, $tab, $page, $pagesize,$startTime = '',$endTime = '');
public function offlineByStore($storeId, $page, $pagesize,$startTime = '',$endTime = '');
public function offlineByUser($userId, $page=1, $pagesize=10);
}
Loading…
Cancel
Save