添加:会员类型增加赠送酒卡额度
This commit is contained in:
parent
5b0d7b0ca2
commit
80d54c0680
|
|
@ -375,6 +375,7 @@ class GroupDataRepository extends BaseRepository
|
|||
Elm::number('cost_price', '原价')->required(),
|
||||
Elm::number('price', '优惠价')->required(),
|
||||
Elm::number('sort', '排序'),
|
||||
Elm::number('quota', '赠送酒卡额度')->required(),
|
||||
Elm::switches('status', '是否显示')->activeValue(1)->inactiveValue(0)->inactiveText('关')->activeText('开'),
|
||||
];
|
||||
$form->setRule($rules);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use app\common\repositories\store\order\StoreOrderRepository;
|
|||
use app\common\repositories\store\order\StoreRefundOrderRepository;
|
||||
use app\common\repositories\system\notice\SystemNoticeConfigRepository;
|
||||
use app\common\repositories\user\ExchangePickupPointRepository;
|
||||
use app\common\repositories\user\ExchangeQuotaRepository;
|
||||
use app\common\repositories\user\UserRepository;
|
||||
use app\common\repositories\user\UserSignRepository;
|
||||
use app\common\repositories\wechat\RoutineQrcodeRepository;
|
||||
|
|
@ -161,6 +162,17 @@ class Auth extends BaseController
|
|||
}
|
||||
// 用户是否为兑换站点管理员
|
||||
$data['is_exchange_saff'] = app()->make(ExchangePickupPointRepository::class)->userIsStaff($user->uid);
|
||||
// 用户持有可用酒卡额度及积分
|
||||
$info = app()->make(ExchangeQuotaRepository::class)
|
||||
->getSearch([])
|
||||
->field([
|
||||
'uid',
|
||||
// 可用额度=剩余额度-冻结额度
|
||||
'(surplus_quota - freeze_quota) as available'
|
||||
])
|
||||
->where('uid',$user->uid)
|
||||
->findOrEmpty();
|
||||
$data['available'] = (float)$info->available;
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@ use app\common\model\user\ExchangePickupRecord;
|
|||
use app\common\model\user\ExchangeQuota;
|
||||
use app\common\model\user\ExchangeQuotaRecord;
|
||||
use app\common\model\user\User;
|
||||
use app\common\repositories\user\ExchangeIntegralRecordRepository;
|
||||
use app\common\repositories\user\ExchangePickupPointRepository;
|
||||
use app\common\repositories\user\ExchangePickupRecordRepository;
|
||||
use app\common\repositories\user\ExchangeQuotaRecordRepository;
|
||||
use app\common\repositories\user\ExchangeQuotaRepository;
|
||||
use app\common\repositories\user\UserRepository;
|
||||
use crmeb\basic\BaseController;
|
||||
|
|
@ -274,4 +276,63 @@ class Exchange extends BaseController{
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Common: 额度记录 - 统计
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/17 17:00
|
||||
* @return mixed
|
||||
*/
|
||||
public function recordQuota(){
|
||||
$uid = $this->request->uid();
|
||||
$statistics = app()->make(ExchangeQuotaRepository::class)
|
||||
->getSearch([])
|
||||
->field([
|
||||
'*',
|
||||
// 可用额度=剩余额度-冻结额度
|
||||
'(surplus_quota - freeze_quota) as available'
|
||||
])
|
||||
->where('uid',$uid)
|
||||
->findOrEmpty()
|
||||
->toArray();
|
||||
|
||||
$statisticsList = [
|
||||
['title' => '总额度','value' => $statistics['total_quota']],
|
||||
['title' => '已使用额度','value' => $statistics['use_quota']],
|
||||
['title' => '剩余额度','value' => $statistics['surplus_quota']],
|
||||
['title' => '冻结额度','value' => $statistics['freeze_quota']],
|
||||
['title' => '可用额度','value' => $statistics['available']],
|
||||
];
|
||||
|
||||
return app('json')->success($statisticsList);
|
||||
}
|
||||
/**
|
||||
* Common: 额度记录 - 记录列表
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/17 17:01
|
||||
* @return mixed
|
||||
*/
|
||||
public function recordQuotaList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['uid']);
|
||||
$params['uid'] = $this->request->uid();
|
||||
$data = app()->make(ExchangeQuotaRecordRepository::class)->getList((array)$params,(int)$page,(int)$limit);
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
/**
|
||||
* Common: 积分记录 - 记录列表
|
||||
* Author: wu-hui
|
||||
* Time: 2024/01/17 17:02
|
||||
* @return mixed
|
||||
*/
|
||||
public function recordIntegralList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['uid']);
|
||||
$params['uid'] = $this->request->uid();
|
||||
$data = app()->make(ExchangeIntegralRecordRepository::class)->getList((array)$params,(int)$page,(int)$limit);
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,6 +358,12 @@ Route::group('api/', function () {
|
|||
Route::get('site_exchange_record', 'Exchange/siteExchangeRecord');
|
||||
Route::get('site_qr_code', 'Exchange/siteQrCode');
|
||||
Route::get('user_qr_code', 'Exchange/userQrCode');
|
||||
// 变更记录
|
||||
Route::get('record_quota', 'Exchange/recordQuota');
|
||||
Route::get('record_quota_list', 'Exchange/recordQuotaList');
|
||||
Route::get('record_integral_list', 'Exchange/recordIntegralList');
|
||||
|
||||
|
||||
})->prefix('api.user.');
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue