正在显示
1 个修改的文件
包含
12 行增加
和
3 行删除
@@ -121,6 +121,17 @@ class User extends Api | @@ -121,6 +121,17 @@ class User extends Api | ||
121 | { | 121 | { |
122 | $user = $this->auth->getUser(); | 122 | $user = $this->auth->getUser(); |
123 | $house = House::get($user['house_id']); | 123 | $house = House::get($user['house_id']); |
124 | + $plus = UserMoneyLog::where('user_id',$this->auth->id) | ||
125 | + ->where('money','>',0) | ||
126 | + ->select(); | ||
127 | + $total_money = 0; | ||
128 | + foreach ($plus as $v) { | ||
129 | + if($v['before'] > $v['after']) { | ||
130 | + $total_money -= $v['money']; | ||
131 | + } else { | ||
132 | + $total_money += $v['money']; | ||
133 | + } | ||
134 | + } | ||
124 | $data = [ | 135 | $data = [ |
125 | // 当前小区信息 | 136 | // 当前小区信息 |
126 | 'house' => !empty($house) ? $house->visible(['id','name'])->toArray() : [], | 137 | 'house' => !empty($house) ? $house->visible(['id','name'])->toArray() : [], |
@@ -130,9 +141,7 @@ class User extends Api | @@ -130,9 +141,7 @@ class User extends Api | ||
130 | ->whereTime('createtime', 'today') | 141 | ->whereTime('createtime', 'today') |
131 | ->sum('money'), | 142 | ->sum('money'), |
132 | // 总收益 | 143 | // 总收益 |
133 | - 'total_money' => UserMoneyLog::where('user_id',$this->auth->id) | ||
134 | - ->where('money','>',0) | ||
135 | - ->sum('money'), | 144 | + 'total_money' => $total_money, |
136 | // 未读消息数量 | 145 | // 未读消息数量 |
137 | 'message_num' => \app\api\model\Message::where('user_id',$user['id']) | 146 | 'message_num' => \app\api\model\Message::where('user_id',$user['id']) |
138 | ->where('is_read_user',2) | 147 | ->where('is_read_user',2) |
-
请 注册 或 登录 后发表评论