增加:惠民积分信息移动端相关接口
This commit is contained in:
parent
8e9f3e164f
commit
44366db5f6
|
|
@ -44,6 +44,9 @@ class ExchangeQuotaRecordDao extends BaseDao{
|
|||
->when(isset($params['order_product_id']) && $params['order_product_id'] !== '',function($query) use ($params){
|
||||
$query->where('order_product_id', (int)$params['order_product_id']);
|
||||
})
|
||||
->when(isset($params['mer_id']) && $params['mer_id'] !== '',function($query) use ($params){
|
||||
$query->where('mer_id', (int)$params['mer_id']);
|
||||
})
|
||||
->with([
|
||||
'user' => function($query){
|
||||
$query->field('uid,nickname,avatar')->bind(['nickname','avatar']);
|
||||
|
|
|
|||
|
|
@ -185,7 +185,32 @@ class ExchangeQuotaRepository extends BaseRepository{
|
|||
|
||||
return $holdInfo;
|
||||
}
|
||||
/**
|
||||
* Common: 获取全部惠民积分(不区分商户)
|
||||
* Author: wu-hui
|
||||
* Time: 2024/07/03 14:51
|
||||
* @param int $uid
|
||||
* @return mixed
|
||||
*/
|
||||
public function getIntegralAll(int $uid){
|
||||
$info = $this->searchModel(['uid' => $uid,'quota_type' => 5])
|
||||
->field([
|
||||
'uid',
|
||||
'SUM(total_quota) as total_quota',
|
||||
'SUM(use_quota) as use_quota',
|
||||
'SUM(surplus_quota) as surplus_quota',
|
||||
'SUM(freeze_quota) as freeze_quota',
|
||||
'quota_type'
|
||||
])
|
||||
->findOrEmpty()
|
||||
->toArray();
|
||||
if($info){
|
||||
// 计算可用额度
|
||||
$info['available_quota'] = (float)sprintf("%.2f", $info['surplus_quota'] - $info['freeze_quota']);
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Common: 设置获取
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ class Auth extends BaseController
|
|||
$data['oil_available'] = $oilQuotaInfo['surplus_quota'] ?? '0.00';
|
||||
$data['oil_available_quota'] = $oilQuotaInfo['available_quota'] ?? '0.00';
|
||||
|
||||
$quotaIntegralInfo = app()->make(ExchangeQuotaRepository::class)->getInfo((int)$user->uid, (int)5);
|
||||
$quotaIntegralInfo = app()->make(ExchangeQuotaRepository::class)->getIntegralAll((int)$user->uid);
|
||||
$data['quota_integral'] = $quotaIntegralInfo['surplus_quota'] ?? '0.00';// 剩余额度
|
||||
$data['quota_integral_available'] = $quotaIntegralInfo['available_quota'] ?? '0.00';// 可用额度
|
||||
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ class Exchange extends BaseController{
|
|||
* @return mixed
|
||||
*/
|
||||
public function recordQuota(){
|
||||
$params = $this->request->params(['quota_type']);
|
||||
$params = $this->request->params(['quota_type', ['mer_id', 0]]);
|
||||
$params['uid'] =$this->request->uid();
|
||||
|
||||
$statistics = app()->make(ExchangeQuotaRepository::class)
|
||||
|
|
@ -446,7 +446,7 @@ class Exchange extends BaseController{
|
|||
*/
|
||||
public function recordQuotaList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['quota_type']);
|
||||
$params = $this->request->params(['quota_type',['mer_id', 0]]);
|
||||
$params['uid'] = $this->request->uid();
|
||||
$data = app()->make(ExchangeQuotaRecordRepository::class)->getList((array)$params,(int)$page,(int)$limit);
|
||||
|
||||
|
|
@ -514,6 +514,33 @@ class Exchange extends BaseController{
|
|||
|
||||
return app('json')->success($bindShop);
|
||||
}
|
||||
/**
|
||||
* Common: 惠民积分 - 统计
|
||||
* Author: wu-hui
|
||||
* Time: 2024/07/03 15:18
|
||||
* @return mixed
|
||||
*/
|
||||
public function quotaIntegralStatistics(){
|
||||
$uid = $this->request->uid();
|
||||
$info = app()->make(ExchangeQuotaRepository::class)->getIntegralAll((int)$uid);
|
||||
|
||||
return app('json')->success($info);
|
||||
}
|
||||
/**
|
||||
* Common: 惠民积分 - 各商户持有信息列表
|
||||
* Author: wu-hui
|
||||
* Time: 2024/07/03 15:40
|
||||
* @return mixed
|
||||
*/
|
||||
public function quotaIntegralHoldList(){
|
||||
[$page, $limit] = $this->getPage();
|
||||
$params = $this->request->params(['quota_type']);
|
||||
$params['uid'] = $this->request->uid();
|
||||
$data = app()->make(ExchangeQuotaRepository::class)->getList((array)$params,(int)$page,(int)$limit);
|
||||
|
||||
return app('json')->success($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -385,6 +385,9 @@ Route::group('api/', function () {
|
|||
Route::get('quota_transfer', 'Exchange/quotaTransfer');
|
||||
// 获取 商户绑定的酒道馆信息
|
||||
Route::get('mer_bind_shop/:merId', 'Exchange/merBindShop');
|
||||
// 惠民积分
|
||||
Route::get('quota_integral_statistics', 'Exchange/quotaIntegralStatistics');
|
||||
Route::get('quota_integral_hold_list', 'Exchange/quotaIntegralHoldList');
|
||||
|
||||
|
||||
})->prefix('api.user.');
|
||||
|
|
|
|||
Loading…
Reference in New Issue