|
@@ -45,6 +45,20 @@ class UserController
|
|
|
public function userInfo(Request $request)
|
|
|
{
|
|
|
$info = $request->user()->toArray();
|
|
|
+
|
|
|
+ $info['statu'] = (int)sys_config('store_brokerage_statu');
|
|
|
+ if (!$info['is_promoter'] && $info['statu'] == 2) {
|
|
|
+ $price = StoreOrder::where(['paid' => 1, 'refund_status' => 0, 'uid' => $info['uid']])->sum('pay_price');
|
|
|
+ $status = is_brokerage_statu($price);
|
|
|
+ if ($status) {
|
|
|
+ User::where('uid', $info['uid'])->update(['is_promoter' => 1]);
|
|
|
+ $info['is_promoter'] = 1;
|
|
|
+ } else {
|
|
|
+ $storeBrokeragePrice = sys_config('store_brokerage_price', 0);
|
|
|
+ $info['promoter_price'] = bcsub($storeBrokeragePrice, $price, 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$broken_time = intval(sys_config('extract_time'));
|
|
|
$search_time = time() - 86400 * $broken_time;
|
|
|
//返佣 +
|
|
@@ -81,7 +95,7 @@ class UserController
|
|
|
if (!$uid && !$invite_code) return app('json')->success('ok', []);
|
|
|
$model = new User();
|
|
|
if ($uid) $model = $model->where('uid', $uid);
|
|
|
- if ($uid) $model = $model->where('invite_code', $invite_code);
|
|
|
+ if ($invite_code) $model = $model->where('invite_code', $invite_code);
|
|
|
$info = $model->field('uid,nickname,phone,email,avatar')->find();
|
|
|
return app('json')->success('ok', $info ? $info->toArray() : []);
|
|
|
}
|