Commit 83ce91a8 by 杨树贤

用户红包兑换账单的详情改成统计而不是直接取数据库

parent e5c586ed
......@@ -38,10 +38,10 @@ class IntegralBillsController extends Controller
{
$this->data['title'] = '红包详细';
//获取该用户的红包信息
//获取该用户的红包统计信息
$userIntegralService = new UserIntegralService();
$userIntegral = $userIntegralService->getUserIntegral($request->user_id);
$this->data['user_integral'] = array_get($userIntegral,'data');
$statistics = $userIntegralService->getUserIntegralStatistics($request->user_id);
$this->data['statistics'] = $statistics;
$integralService = new IntegralService();
//获取红包列表做tab项
......
......@@ -35,7 +35,6 @@ class BaseService
public function apiDelete($requestPath)
{
$response = $this->client->request('DELETE', $requestPath);
$data = json_decode($response->getBody()->getContents(), true);
if ($data['errcode'] !== 0) {
......@@ -58,6 +57,16 @@ class BaseService
return $data;
}
public function apiRequest($requestPath, $data = [])
{
$response = $this->client->request('POST', $requestPath,
['form_params' => $data]
);
$data = json_decode($response->getBody()->getContents(), true);
return $data;
}
public function apiPatch($requestPath, $data = [])
{
$response = $this->client->request('PATCH', $requestPath,
......@@ -67,6 +76,7 @@ class BaseService
if ($data['errcode'] !== 0) {
Log::Error($requestPath . '---' . $data['errcode'] . $data['errmsg']);
}
dd($data);
return $data;
}
......
......@@ -8,6 +8,7 @@ use App\Model\RedisModel;
class UserIntegralService extends BaseService
{
//获取单个用户的红包信息
public function getUserIntegral($userId)
{
$path = '/user_integrals/info?id=' . $userId;
......@@ -15,6 +16,15 @@ class UserIntegralService extends BaseService
return $this->apiPost($path);
}
//获取单个用户的红包统计信息
public function getUserIntegralStatistics($userId)
{
$path = 'user_integrals/statistics?user_id=' . $userId;
return $this->apiRequest($path);
}
//获取用户的红包列表信息
public function getUserIntegralList($params)
{
$path = '/user_integrals/list?' . http_build_query($params);
......@@ -22,6 +32,11 @@ class UserIntegralService extends BaseService
return $this->apiPost($path);
}
public function updateUserIntegral($path, $data)
{
return $this->apiPost($path, $data);
}
public function getUsersFromRedis($userIds = [])
{
$redis = new RedisModel();
......
......@@ -62,8 +62,7 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
{type: 'checkbox'}
, {field: 'id', title: '序号'}
, {field: 'mobile', title: '注册手机号'}
, {field: 'integral', title: '账户红包'}
, {field: 'exchanged_integral', title: '累计兑换'}
, {field: 'integral', title: '账户剩余红包'}
, {field: 'certification_status', title: '认证状态'}
, {field: 'status', title: '兑换状态', templet: '#status'}
, {field: 'experience', title: '操作', templet: '#operate', fixed: 'right'}
......
......@@ -8,7 +8,7 @@
用户已得红包
</div>
<div class="layui-card-body layuiadmin-card-list">
<p class="layuiadmin-big-font">{{$user_integral['integral']}}</p>
<p class="layuiadmin-big-font">{{$statistics['total_amount']}}</p>
</div>
</div>
</div>
......@@ -19,7 +19,7 @@
已提现红包
</div>
<div class="layui-card-body layuiadmin-card-list">
<p class="layuiadmin-big-font">{{$user_integral['exchanged_integral']}}</p>
<p class="layuiadmin-big-font">{{$statistics['exchanged_amount']}}</p>
</div>
</div>
</div>
......@@ -30,7 +30,7 @@
账户剩余红包
</div>
<div class="layui-card-body layuiadmin-card-list">
<p class="layuiadmin-big-font">{{$user_integral['integral']-$user_integral['exchanged_integral']}}</p>
<p class="layuiadmin-big-font">{{$statistics['integral']}}</p>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment