Browse Source

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

master
weigang 5 years ago
parent
commit
f8b10a0566
  1. 6
      app/Controller/v3/HomeController.php
  2. 2
      app/Controller/v3/LocationController.php
  3. 8
      app/Model/v3/StoreWithdrawal.php

6
app/Controller/v3/HomeController.php

@ -11,6 +11,7 @@ use App\Constants\v3\Tabs;
use App\Controller\BaseController;
use App\Model\v3\FinancialRecord;
use App\Model\v3\Market;
use App\Model\v3\Store;
use App\Request\v3\StoreIndexRequest;
use App\Request\v3\UserIndexRequest;
use App\Service\v3\Interfaces\ActivityServiceInterface;
@ -194,6 +195,7 @@ class HomeController extends BaseController
public function storeIndex(StoreIndexRequest $request)
{
$params = $request->validated();
$userId = Store::query()->where('id',$params['store_id'])->value('user_id');
//每日 每周 每月 开始结束时间
$dayStartTime = strtotime(date('Y-m-d'.' 00:00:00'));
$dayEndTime = strtotime(date('Y-m-d'.' 23:59:59'));
@ -212,7 +214,7 @@ class HomeController extends BaseController
];
$data['order_online']['total'] = 0;
$data['order_offline']['total'] = 0;
$revenueByOrder = $this->revenueListService->getRevenueByUser($params['user_id'],$type,$dayStartTime,$dayEndTime);
$revenueByOrder = $this->revenueListService->getRevenueByUser($userId,$type,$dayStartTime,$dayEndTime);
foreach ($revenueByOrder as $order){
if($order['money_type'] == FinancialRecord::MONEY_TYPE_STORE_OL_ORDER_COMP){
//线上订单
@ -223,7 +225,7 @@ class HomeController extends BaseController
}
}
//统计新增用户 无法筛选时间 所以和订单分开查询
$revenueByNewUsers = $this->revenueListService->getRevenueByUser($params['user_id'],[FinancialRecord::MONEY_TYPE_STORE_PLAT_NEW_USER]);
$revenueByNewUsers = $this->revenueListService->getRevenueByUser($userId,[FinancialRecord::MONEY_TYPE_STORE_PLAT_NEW_USER]);
$data['new_user'] = [
'day' => 0,
'week' => 0,

2
app/Controller/v3/LocationController.php

@ -29,7 +29,7 @@ class LocationController extends BaseController
{
$lng = $this->request->input('lng',0);
$lat = $this->request->input('lat',0);
return $this->success($this->locationService->getNearestMarket($lng,$lat));
return $this->success(['market' => $this->locationService->getNearestMarket($lng,$lat)]);
}
public function getMarketListByLocation()

8
app/Model/v3/StoreWithdrawal.php

@ -10,7 +10,8 @@ class StoreWithdrawal extends Model
protected $appends = [
'state_text',
'check_time_text'
'check_time_text',
'created_at_text'
];
public function getStateTextAttribute()
@ -26,4 +27,9 @@ class StoreWithdrawal extends Model
return date('Y-m-d H:i:s', $this->attributes['check_time']);
}
}
public function getCreatedAtTextAttribute()
{
return date('Y-m-d H:i:s', $this->attributes['created_at']);
}
}
Loading…
Cancel
Save