调整红包余额查询
This commit is contained in:
parent
06d34cd24a
commit
6aaf02c5a0
@ -183,11 +183,13 @@ class StoreActivityUserDao extends BaseDao
|
|||||||
->whereIn('type', $type)
|
->whereIn('type', $type)
|
||||||
->where('status', StoreConsumptionUser::STATUS_UNUSED)
|
->where('status', StoreConsumptionUser::STATUS_UNUSED)
|
||||||
->sum('balance');
|
->sum('balance');
|
||||||
$query = UserBill::where('uid', $userId)
|
$query = UserBill::with('storeConsumptionUser')
|
||||||
|
->field('link_id,create_time')
|
||||||
|
->where('uid', $userId)
|
||||||
->where('category', 'red_pack')
|
->where('category', 'red_pack')
|
||||||
->where('type', "red_pack_{$type}");
|
->where('type', "red_pack_{$type}");
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$record = $query->page($page)->limit($limit)->select();
|
$record = $query->page($page)->limit($limit)->select()->toArray();
|
||||||
return ['total_amount' => $totalAmount, 'count' => $count, 'record' => $record];
|
return ['total_amount' => $totalAmount, 'count' => $count, 'record' => $record];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ namespace app\common\model\user;
|
|||||||
|
|
||||||
|
|
||||||
use app\common\model\BaseModel;
|
use app\common\model\BaseModel;
|
||||||
|
use app\common\model\store\consumption\StoreConsumptionUser;
|
||||||
|
|
||||||
class UserBill extends BaseModel
|
class UserBill extends BaseModel
|
||||||
{
|
{
|
||||||
@ -44,4 +45,9 @@ class UserBill extends BaseModel
|
|||||||
return $this->hasOne(User::class, 'uid', 'uid');
|
return $this->hasOne(User::class, 'uid', 'uid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function storeConsumptionUser()
|
||||||
|
{
|
||||||
|
return $this->hasOne(StoreConsumptionUser::class, 'coupon_user_id', 'link_id')->bind(['order_amount', 'coupon_price']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user