|
| xqd
@@ -13,7 +13,10 @@ class UserController extends Controller
|
|
|
{
|
|
|
public function get()
|
|
|
{
|
|
|
- return out();
|
|
|
+ $user = auth('api')->user();
|
|
|
+
|
|
|
+ $user = User::with(['parent'])->where('id',$user['id'])->first()->toArray();
|
|
|
+ return out($user);
|
|
|
}
|
|
|
|
|
|
|
|
| xqd
@@ -22,14 +25,17 @@ class UserController extends Controller
|
|
|
{
|
|
|
$user = auth('api')->user();
|
|
|
|
|
|
- $record = UserVip::where('user_id',$user['id'])->first()->toArray();
|
|
|
+ $record = UserVip::where('user_id',$user['id'])
|
|
|
+ ->where('status',1)
|
|
|
+ ->first()
|
|
|
+ ->toArray();
|
|
|
if(empty($record)){
|
|
|
return out();
|
|
|
}
|
|
|
|
|
|
return out([
|
|
|
'order_fee' => $record['order_fee'],
|
|
|
- 'buy_time' => $record['created_at'],
|
|
|
+ 'buy_time' => $record['pay_at'],
|
|
|
]);
|
|
|
}
|
|
|
|
|
| xqd
@@ -38,7 +44,7 @@ class UserController extends Controller
|
|
|
{
|
|
|
$user = auth('api')->user();
|
|
|
|
|
|
- $user = User::where('user_id',$user['id'])->first()->toArray();
|
|
|
+ $user = User::where('id',$user['id'])->first()->toArray();
|
|
|
|
|
|
return out([
|
|
|
'overage' => $user['overage'],
|
|
| xqd
@@ -102,7 +108,7 @@ class UserController extends Controller
|
|
|
if($order->status == 0){
|
|
|
$data = $jssdk->bridgeConfig($order->prepay_id,false);
|
|
|
}else{
|
|
|
- throw new \Exception('您已经是会员了');
|
|
|
+ return out([],10013,'您已经是会员了!');
|
|
|
}
|
|
|
|
|
|
\DB::commit();
|
|
| xqd
@@ -113,4 +119,25 @@ class UserController extends Controller
|
|
|
|
|
|
return out($data);
|
|
|
}
|
|
|
+
|
|
|
+ // 查询购买订单
|
|
|
+ public function query()
|
|
|
+ {
|
|
|
+ $user = auth('api')->user();
|
|
|
+ $order = UserVip::where('user_id', $user['id'])->first()->toArray();
|
|
|
+ return out($order);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function shares()
|
|
|
+ {
|
|
|
+ $user = auth('api')->user();
|
|
|
+ $builder = User::where('parent_id', $user['id'])->orderBy('become_child_at','desc');
|
|
|
+ $data = $builder->paginate($req['per_page'] ?? 15);
|
|
|
+ $total_num = $builder->sum('id');
|
|
|
+ $custom = collect([
|
|
|
+ 'total_num' => $total_num,
|
|
|
+ ]);
|
|
|
+ $data = $custom->merge($data);
|
|
|
+ return out($data);
|
|
|
+ }
|
|
|
}
|