添加商户邀请记录

This commit is contained in:
luofei 2024-02-05 10:08:57 +08:00
parent a74c1308b6
commit e856c4c32a
2 changed files with 36 additions and 0 deletions

View File

@ -2,9 +2,11 @@
namespace app\controller\api\server;
use app\common\model\system\merchant\FinancialRecord;
use app\controller\api\Common;
use crmeb\basic\BaseController;
use think\App;
use think\db\Query;
class Store extends BaseController
{
@ -28,4 +30,37 @@ class Store extends BaseController
return app('json')->success(['url' => $data]);
}
/**
* 邀请记录
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function record()
{
[$page, $limit] = $this->getPage();
$query = FinancialRecord::field('order_sn,number')
->where('mer_id', $this->merId)
->where('financial_type', 'commission_to_promoter')
->with(['orderInfo' => function (Query $query) {
$query->field('pay_price,real_name,uid,order_sn')->with(['user' => function (Query $query) {
$query->field('nickname,uid');
}]);
}]);
$count = $query->count();
$result = $query->page($page, $limit)->select()->toArray();
$list = [];
foreach ($result as $item) {
$list[] = [
'nickname' => $item['orderInfo']['user']['nickname'],
'uid' => $item['orderInfo']['uid'],
'order_amount' => $item['orderInfo']['pay_price'],
'commission' => $item['number'],
];
}
return app('json')->success(['count' => $count, 'list' => $list]);
}
}

View File

@ -300,6 +300,7 @@ Route::group('api/', function () {
//客服商品管理
Route::group('server/:merId', function () {
Route::get('qrcode', 'Store/qrcode');
Route::get('record', 'Store/record');
//商品
Route::post('product/create', 'StoreProduct/create');
Route::post('product/update/:id', 'StoreProduct/update');