63 lines
1.9 KiB
PHP
Executable File
63 lines
1.9 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers\Api\Seller;
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class AgentController extends BaseController
|
|
{
|
|
/**
|
|
* @api {GET} /api/seller/agent/shop_flow 代理-店铺流水
|
|
* @apiVersion 0.1.0
|
|
* @apiGroup 店主
|
|
*
|
|
* @apiParam {String} [date_start] 开始时间,默认当天
|
|
* @apiParam {String} [date_end] 结束时间,默认当天
|
|
*
|
|
* @apiSuccessExample {json} 返回结果
|
|
* {
|
|
* "code": 200,
|
|
* "message": "",
|
|
* "data": [
|
|
* {
|
|
* "agent_seller_id": 1000,
|
|
* "real_name": "测试",
|
|
* "name": "第二家",
|
|
* "shop_sn": "S100002",
|
|
* "shop_id": 2001,
|
|
* "c": "512.0000"
|
|
* }
|
|
* ]
|
|
* }
|
|
*
|
|
*/
|
|
public function shopFlow(Request $request)
|
|
{
|
|
$dateStart = $request->input('date_start');
|
|
$dateEnd = $request->input('date_end');
|
|
$size = $request->input('size');
|
|
if (!$dateStart) {
|
|
$dateStart = date('Y-m-d');
|
|
}
|
|
if (!$dateStart) {
|
|
$dateStart = date('Y-m-d');
|
|
}
|
|
if (!$dateEnd) {
|
|
$dateEnd = date('Y-m-d');
|
|
}
|
|
$dateStart = date('Ymd', strtotime($dateStart));
|
|
$dateEnd = date('Ymd', strtotime($dateEnd));
|
|
|
|
$sellerId = $this->sellerId();
|
|
|
|
|
|
$sql = "SELECT b.agent_seller_id,c.real_name,b.name,b.shop_sn,a.shop_id,b.name,sum(money) as c FROM `order` as a left join shop as b on a.shop_id=b.id LEFT JOIN seller as c on b.agent_seller_id=c.id where a.lottery_state in (1,2,3,7) and a.created_date>='{$dateStart}' and a.created_date<='{$dateEnd}' and b.agent_seller_id={$sellerId} group by a.shop_id order by c desc;";
|
|
$data = DB::select($sql);
|
|
|
|
return $this->jsonSuccess($data);
|
|
}
|
|
|
|
}
|