Browse Source

暂时关闭登录验证码,新增测试接口

Kirin 1 year ago
parent
commit
2955907745
1 changed files with 310 additions and 305 deletions
  1. 310 305
      app/services/user/UserServices.php

+ 310 - 305
app/services/user/UserServices.php

@@ -60,41 +60,41 @@ use think\facade\Route as Url;
  */
 class UserServices extends BaseServices
 {
-	/**
- 	* 性别
-	* @var array
-	*/
-	public $sex = [
-		'男' => 1,
-		'女' => 2,
-		'保密' => 0,
-		0 => 1,//男
-		1 => 2,//女
-		2 => 0,//保密
-	];
-
-	/**
-	 * 逆转数据
-	 * @var int[]
-	 */
-	public $rSex = [
-		0 => 2,
-		1 => 0,
-		2 => 1,
-	];
-
-	/**
- 	* 用户默认补充信息
-	* @var array
-	*/
-	public $defaultExtendInfo = [
-		['info' => '姓名', 'tip' => '请填写真实姓名', 'format' => 'text', 'label' => '文本', 'param' => 'real_name', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 1],
-		['info' => '性别', 'tip' => '请选择性别', 'format' => 'radio', 'label' => '单选项', 'param' => 'sex', 'single' => '', 'singlearr' => ['男', '女', '保密'], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 2],
-		['info' => '生日', 'tip' => '请选择出生日期', 'format' => 'date', 'label' => '日期', 'param' => 'birthday', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 3],
-		['info' => '身份证', 'tip' => '请填写身份证', 'format' => 'id', 'label' => '身份证', 'param' => 'card_id', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 4],
-		['info' => '地址', 'tip' => '请填写地址', 'format' => 'address', 'label' => '地址', 'param' => 'address', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 5],
-		['info' => '备注', 'tip' => '请填写补充备注内容', 'format' => 'text', 'label' => '文本', 'param' => 'mark', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 6],
-	];
+    /**
+     * 性别
+     * @var array
+     */
+    public $sex = [
+        '男' => 1,
+        '女' => 2,
+        '保密' => 0,
+        0 => 1,//男
+        1 => 2,//女
+        2 => 0,//保密
+    ];
+
+    /**
+     * 逆转数据
+     * @var int[]
+     */
+    public $rSex = [
+        0 => 2,
+        1 => 0,
+        2 => 1,
+    ];
+
+    /**
+     * 用户默认补充信息
+     * @var array
+     */
+    public $defaultExtendInfo = [
+        ['info' => '姓名', 'tip' => '请填写真实姓名', 'format' => 'text', 'label' => '文本', 'param' => 'real_name', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 1],
+        ['info' => '性别', 'tip' => '请选择性别', 'format' => 'radio', 'label' => '单选项', 'param' => 'sex', 'single' => '', 'singlearr' => ['男', '女', '保密'], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 2],
+        ['info' => '生日', 'tip' => '请选择出生日期', 'format' => 'date', 'label' => '日期', 'param' => 'birthday', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 3],
+        ['info' => '身份证', 'tip' => '请填写身份证', 'format' => 'id', 'label' => '身份证', 'param' => 'card_id', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 4],
+        ['info' => '地址', 'tip' => '请填写地址', 'format' => 'address', 'label' => '地址', 'param' => 'address', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 5],
+        ['info' => '备注', 'tip' => '请填写补充备注内容', 'format' => 'text', 'label' => '文本', 'param' => 'mark', 'single' => '', 'singlearr' => [], 'required' => 0, 'use' => 0, 'user_show' => 0, 'sort' => 6],
+    ];
 
     /**
      * UserServices constructor.
@@ -135,7 +135,7 @@ class UserServices extends BaseServices
      */
     public function getUserCacheInfo(int $uid, int $expire = 60)
     {
-		return $this->dao->cacheTag()->remember('user_info_' . $uid, function () use ($uid) {
+        return $this->dao->cacheTag()->remember('user_info_' . $uid, function () use ($uid) {
             return $this->dao->get($uid);
         }, $expire);
     }
@@ -392,16 +392,16 @@ class UserServices extends BaseServices
         return $this->dao->batchUpdate($uids, ['group_id' => $group_id], 'uid');
     }
 
-	/**
-	 * 获取用户标签
-	 * @param array $uids
-	 * @param int $type
-	 * @param int $relation_id
-	 * @return array
-	 * @throws \think\db\exception\DataNotFoundException
-	 * @throws \think\db\exception\DbException
-	 * @throws \think\db\exception\ModelNotFoundException
-	 */
+    /**
+     * 获取用户标签
+     * @param array $uids
+     * @param int $type
+     * @param int $relation_id
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
     public function getUserLablel(array $uids, int $type = 0, int $relation_id = 0)
     {
         /** @var UserLabelRelationServices $services */
@@ -467,8 +467,8 @@ class UserServices extends BaseServices
             $userExtract = app()->make(UserExtractServices::class)->getUsersSumList($uids);
             $levelName = app()->make(SystemUserLevelServices::class)->getUsersLevel(array_unique(array_column($list, 'level')));
             $userLevel = app()->make(UserLevelServices::class)->getUsersLevelInfo($uids);
-			$spreadUids = array_unique(array_column($list, 'spread_uid'));
-			$spread_names = $this->dao->getColumn([['uid', 'in', $spreadUids]], 'nickname', 'uid');
+            $spreadUids = array_unique(array_column($list, 'spread_uid'));
+            $spread_names = $this->dao->getColumn([['uid', 'in', $spreadUids]], 'nickname', 'uid');
             /** @var WorkClientServices $workClientService */
             $workClientService = app()->make(WorkClientServices::class);
             $clientData = $workClientService->getList(['uid' => $uids], ['id', 'uid', 'name', 'external_userid', 'corp_id', 'unionid'], false);
@@ -691,12 +691,12 @@ class UserServices extends BaseServices
                         $form = Form::date($field, $item['info'], $userExtendInfo[$item['info']]['value'] ?? '');
                         break;
                     case 'radio'://'单选项'
-						$options = [];
-						if (isset($item['singlearr']) && $item['singlearr']) {
-							foreach ($item['singlearr'] as $key => $value) {
-								$options[] = ['value' => $key, 'label' => $value];
-							}
-						}
+                        $options = [];
+                        if (isset($item['singlearr']) && $item['singlearr']) {
+                            foreach ($item['singlearr'] as $key => $value) {
+                                $options[] = ['value' => $key, 'label' => $value];
+                            }
+                        }
                         $form = Form::radio($field, $item['info'], (int)($userExtendInfo[$item['info']]['value'] ?? 0))->options($options);
                         break;
                     case 'text'://'文本'
@@ -731,77 +731,77 @@ class UserServices extends BaseServices
     {
         $extendInfo = SystemConfigService::get('user_extend_info', []);
         if ($inputExtendInfo && $extendInfo) {
-			if ($is_all) {//移动端全数据 处理
-				$inputExtendInfo = array_combine(array_column($inputExtendInfo, 'info'), $inputExtendInfo);
-			} else {//后台key=>value类型数据
-				$inputExtendInfo = $inputExtendInfo[0] ?? $inputExtendInfo;
-			}
+            if ($is_all) {//移动端全数据 处理
+                $inputExtendInfo = array_combine(array_column($inputExtendInfo, 'info'), $inputExtendInfo);
+            } else {//后台key=>value类型数据
+                $inputExtendInfo = $inputExtendInfo[0] ?? $inputExtendInfo;
+            }
             foreach ($extendInfo as &$item) {
-				$value = $is_all ? ($inputExtendInfo[$item['info'] ?? '']['value'] ?? '') : ($inputExtendInfo[$item['param'] ?? $item['info'] ?? ''] ?? '');
-				if ($value) {
-					//验证手机号
+                $value = $is_all ? ($inputExtendInfo[$item['info'] ?? '']['value'] ?? '') : ($inputExtendInfo[$item['param'] ?? $item['info'] ?? ''] ?? '');
+                if ($value) {
+                    //验证手机号
                     if ($item['format'] == 'phone') {
-                        if (!check_phone($value)) throw new AdminException( '请填写正确的手机号');
+                        if (!check_phone($value)) throw new AdminException('请填写正确的手机号');
                     }
                     //验证邮箱
                     if ($item['format'] == 'mail') {
-                        if (!check_mail($value)) throw new AdminException( '请填写正确的邮箱');
+                        if (!check_mail($value)) throw new AdminException('请填写正确的邮箱');
                     }
                     //验证身份证号
                     if ($item['format'] == 'id') {
-						try {
-							if (!check_card($value)) throw new AdminException( '请填写正确的身份证号码');
-						} catch (\Throwable $e) {
+                        try {
+                            if (!check_card($value)) throw new AdminException('请填写正确的身份证号码');
+                        } catch (\Throwable $e) {
 //							throw new AdminException( '请填写正确的身份证号码');
-						}
+                        }
                     }
-				}
+                }
                 $item['value'] = $value;
             }
         }
         return $extendInfo;
     }
 
-	/**
- 	* 保存用户补充信息
-	* @param int $uid
-	* @param array $extend_info 补充信息
- 	* @param array $update 原本需要修改字段
- 	* @param bool $is_all
-	* @return bool
-	*/
-	public function saveExtendForm(int $uid, array $extend_info, array $update = [], bool $is_all = false)
-	{
-		$userInfo = $this->getUserInfo($uid);
-		if (!$userInfo) {
-			throw new ValidateException('用户不存在');
-		}
-		$extend_info = $this->handelExtendInfo($extend_info, $is_all) ?: [];
-		if ($extend_info) {
-			$default = $this->defaultExtendInfo;
-			$params = array_column($default, 'param');
-			$sex = $this->sex;
-			$update['extend_info'] = $extend_info;
-			foreach ($extend_info as $info) {
-				if (isset($info['param']) && in_array($info['param'], $params) && isset($info['value'])) {
-					if ($info['param'] == 'sex') {
-						$update['sex'] = $sex[$info['value']] ?? 0;
-					} elseif ($info['param'] == 'birthday') {
-						$update['birthday'] = strtotime($info['value']);
-					} elseif($info['param'] == 'address') {
-						$update['addres'] = $info['value'];
-					} else {
-						$update[$info['param']] = $info['value'];
-					}
-				}
-			}
-		}
-		if ($update) {
-			$this->dao->update($uid, $update);
-			$this->dao->cacheTag()->clear();
-		}
-		return true;
-	}
+    /**
+     * 保存用户补充信息
+     * @param int $uid
+     * @param array $extend_info 补充信息
+     * @param array $update 原本需要修改字段
+     * @param bool $is_all
+     * @return bool
+     */
+    public function saveExtendForm(int $uid, array $extend_info, array $update = [], bool $is_all = false)
+    {
+        $userInfo = $this->getUserInfo($uid);
+        if (!$userInfo) {
+            throw new ValidateException('用户不存在');
+        }
+        $extend_info = $this->handelExtendInfo($extend_info, $is_all) ?: [];
+        if ($extend_info) {
+            $default = $this->defaultExtendInfo;
+            $params = array_column($default, 'param');
+            $sex = $this->sex;
+            $update['extend_info'] = $extend_info;
+            foreach ($extend_info as $info) {
+                if (isset($info['param']) && in_array($info['param'], $params) && isset($info['value'])) {
+                    if ($info['param'] == 'sex') {
+                        $update['sex'] = $sex[$info['value']] ?? 0;
+                    } elseif ($info['param'] == 'birthday') {
+                        $update['birthday'] = strtotime($info['value']);
+                    } elseif ($info['param'] == 'address') {
+                        $update['addres'] = $info['value'];
+                    } else {
+                        $update[$info['param']] = $info['value'];
+                    }
+                }
+            }
+        }
+        if ($update) {
+            $this->dao->update($uid, $update);
+            $this->dao->cacheTag()->clear();
+        }
+        return true;
+    }
 
     /**
      * 修改提交处理
@@ -818,7 +818,7 @@ class UserServices extends BaseServices
         $res2 = false;
         $edit = [];
         if ($data['money_status'] && $data['money']) {//余额增加或者减少
-			$data['money'] = sprintf("%.2f", $data['money']);
+            $data['money'] = sprintf("%.2f", $data['money']);
             /** @var UserMoneyServices $userMoneyServices */
             $userMoneyServices = app()->make(UserMoneyServices::class);
             if ($data['money_status'] == 1) {//增加
@@ -840,15 +840,15 @@ class UserServices extends BaseServices
             $integral_data = ['link_id' => $data['adminId'] ?? 0, 'number' => $data['integration'], 'balance' => $user['integral']];
             /** @var UserBillServices $userBill */
             $userBill = app()->make(UserBillServices::class);
-			$balance = $user['integral'];
-			if ($data['integration_status'] == 1) {//增加
-				$balance = bcadd((string)$user['integral'], (string)$data['integration'], 0);
-				$res2 = $userBill->income('system_add_integral', $id, (int)$data['integration'], (int)$balance, $data['adminId'] ?? 0);
-			} else if ($data['integration_status'] == 2) {//减少
-				$balance = bcsub((string)$user['integral'], (string)$data['integration'], 0);
-				$res2 = $userBill->income('system_sub_integral', $id, (int)$data['integration'], (int)$balance, $data['adminId'] ?? 0);
-			}
-			$edit['integral'] = $balance;
+            $balance = $user['integral'];
+            if ($data['integration_status'] == 1) {//增加
+                $balance = bcadd((string)$user['integral'], (string)$data['integration'], 0);
+                $res2 = $userBill->income('system_add_integral', $id, (int)$data['integration'], (int)$balance, $data['adminId'] ?? 0);
+            } else if ($data['integration_status'] == 2) {//减少
+                $balance = bcsub((string)$user['integral'], (string)$data['integration'], 0);
+                $res2 = $userBill->income('system_sub_integral', $id, (int)$data['integration'], (int)$balance, $data['adminId'] ?? 0);
+            }
+            $edit['integral'] = $balance;
         } else {
             $res2 = true;
         }
@@ -910,10 +910,10 @@ class UserServices extends BaseServices
         }
         if ($edit) $res3 = $this->dao->update($id, $edit);
         else $res3 = true;
-        if ($res1 && $res2 && $res3){
-			$this->dao->cacheTag()->clear();
-			return true;
-		} else throw new AdminException('修改失败');
+        if ($res1 && $res2 && $res3) {
+            $this->dao->cacheTag()->clear();
+            return true;
+        } else throw new AdminException('修改失败');
     }
 
     /**
@@ -1038,33 +1038,33 @@ class UserServices extends BaseServices
         return create_form('设置用户标签', $field, Url::buildUrl('/user/save_set_label'), 'PUT');
     }
 
-	/**
-	 * 保存用户标签
-	 * @param $uids
-	 * @param $label_id
-	 * @return bool
-	 */
+    /**
+     * 保存用户标签
+     * @param $uids
+     * @param $label_id
+     * @return bool
+     */
     public function saveSetLabel($uids, $label_id)
     {
-		/** @var UserLabelRelationServices $services */
-		$services = app()->make(UserLabelRelationServices::class);
-		if ($label_id) {
-			/** @var UserLabelServices $userlabel */
-			$userlabel = app()->make(UserLabelServices::class);
-			if (count($label_id) != $userlabel->getCount([['id', 'in', $label_id]])) {
-				throw new AdminException('用户标签不存在或被删除');
-			}
-			if (!$services->setUserLable($uids, $label_id)) {
-				throw new AdminException('设置标签失败');
-			}
-		} else {//没传入标签 默认清空
-			if (!is_array($uids)) {
-				$uids = [$uids];
-			}
-			foreach ($uids as $uid) {
-				$services->unUserLabel((int)$uid);
-			}
-		}
+        /** @var UserLabelRelationServices $services */
+        $services = app()->make(UserLabelRelationServices::class);
+        if ($label_id) {
+            /** @var UserLabelServices $userlabel */
+            $userlabel = app()->make(UserLabelServices::class);
+            if (count($label_id) != $userlabel->getCount([['id', 'in', $label_id]])) {
+                throw new AdminException('用户标签不存在或被删除');
+            }
+            if (!$services->setUserLable($uids, $label_id)) {
+                throw new AdminException('设置标签失败');
+            }
+        } else {//没传入标签 默认清空
+            if (!is_array($uids)) {
+                $uids = [$uids];
+            }
+            foreach ($uids as $uid) {
+                $services->unUserLabel((int)$uid);
+            }
+        }
 
         return true;
     }
@@ -1157,87 +1157,87 @@ class UserServices extends BaseServices
      * */
     public function giveLevelTime($id)
     {
-		$userInfo = $this->getUserCacheInfo($id);
-		if (!$userInfo) {
-			throw new AdminException('用户不存在');
-		}
-		$overdue_time = '';
-		if ($userInfo['is_ever_level'] == 1) {
-			$overdue_time = '永久';
-		} else {
-			if ($userInfo['is_money_level'] > 0 && $userInfo['overdue_time'] > 0) {
-				$overdue_time = date('Y-m-d H:i:s', $userInfo['overdue_time']);
-			} else {
-				$overdue_time = '已过期/暂未开通';
-			}
-		}
-		$field[] = Form::input('overdue_time', '会员到期时间', $overdue_time)->disabled(true);
-		$field[] = Form::radio('days_status', '修改付费会员', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
-		$field[] = Form::number('days', '调整时长(天)')->min(0)->max(999999)->precision(0)->placeholder('请输入');
-		return create_form('赠送付费会员时长', $field, Url::buildUrl('/user/save_give_level_time/' . $id), 'PUT');
+        $userInfo = $this->getUserCacheInfo($id);
+        if (!$userInfo) {
+            throw new AdminException('用户不存在');
+        }
+        $overdue_time = '';
+        if ($userInfo['is_ever_level'] == 1) {
+            $overdue_time = '永久';
+        } else {
+            if ($userInfo['is_money_level'] > 0 && $userInfo['overdue_time'] > 0) {
+                $overdue_time = date('Y-m-d H:i:s', $userInfo['overdue_time']);
+            } else {
+                $overdue_time = '已过期/暂未开通';
+            }
+        }
+        $field[] = Form::input('overdue_time', '会员到期时间', $overdue_time)->disabled(true);
+        $field[] = Form::radio('days_status', '修改付费会员', 1)->options([['value' => 1, 'label' => '增加'], ['value' => 2, 'label' => '减少']]);
+        $field[] = Form::number('days', '调整时长(天)')->min(0)->max(999999)->precision(0)->placeholder('请输入');
+        return create_form('赠送付费会员时长', $field, Url::buildUrl('/user/save_give_level_time/' . $id), 'PUT');
     }
 
-	/**
-	 * 执行赠送付费会员时长
-	 * @param int $id
-	 * @param int $days
-	 * @param int $days_status 1:增加 2:减少
-	 * @return bool
-	 * @throws \Exception
-	 */
-	public function saveGiveLevelTime(int $id, int $days, int $days_status = 1)
-	{
-		$userInfo = $this->getUserInfo($id);
-		if (!$userInfo) {
-			throw new AdminException('用户不存在');
-		}
-		if ($days <= 0) throw new AdminException('赠送天数不能小于1天');
-		if ($userInfo['is_ever_level'] == 1) {
-			throw new AdminException('永久会员无需操作');
-		}
-		$update = [];
-		$days_time = bcmul((string)$days, '86400');
-		if ($userInfo['is_money_level'] == 0) {
-			$update['is_money_level'] = 3;
-			$time = time();
-		} else {
-			$time = $userInfo['overdue_time'];
-		}
-		if ($days_status == 1) {//增加
-			$time = (int)bcadd((string)$time, (string)$days_time);
-		} else {//减少
-			if ($time <= $days_time) {
-				$time = 0;
-			} else {
-				$time = (int)bcsub((string)$time, (string)$days_time);
-			}
-		}
-		$update['overdue_time'] = $time;
-		if ($time < time()) {//已经过期
-			$update['is_money_level'] = 0;
-		}
-		$this->dao->update($id, $update);
-		$userInfo->save();
-		/** @var StoreOrderCreateServices $storeOrderCreateService */
-		$storeOrderCreateService = app()->make(StoreOrderCreateServices::class);
-		$orderInfo = [
-			'uid' => $id,
-			'order_id' => $storeOrderCreateService->getNewOrderId(),
-			'type' => 4,
-			'member_type' => 0,
-			'pay_type' => 'admin',
-			'paid' => 1,
-			'pay_time' => time(),
-			'is_free' => 1,
-			'overdue_time' => $time,
-			'vip_day' => $days_status == 1 ? $days : bcsub('0', $days),
-			'add_time' => time()
-		];
-		/** @var OtherOrderServices $otherOrder */
-		$otherOrder = app()->make(OtherOrderServices::class);
-		$otherOrder->save($orderInfo);
-		return true;
-	}
+    /**
+     * 执行赠送付费会员时长
+     * @param int $id
+     * @param int $days
+     * @param int $days_status 1:增加 2:减少
+     * @return bool
+     * @throws \Exception
+     */
+    public function saveGiveLevelTime(int $id, int $days, int $days_status = 1)
+    {
+        $userInfo = $this->getUserInfo($id);
+        if (!$userInfo) {
+            throw new AdminException('用户不存在');
+        }
+        if ($days <= 0) throw new AdminException('赠送天数不能小于1天');
+        if ($userInfo['is_ever_level'] == 1) {
+            throw new AdminException('永久会员无需操作');
+        }
+        $update = [];
+        $days_time = bcmul((string)$days, '86400');
+        if ($userInfo['is_money_level'] == 0) {
+            $update['is_money_level'] = 3;
+            $time = time();
+        } else {
+            $time = $userInfo['overdue_time'];
+        }
+        if ($days_status == 1) {//增加
+            $time = (int)bcadd((string)$time, (string)$days_time);
+        } else {//减少
+            if ($time <= $days_time) {
+                $time = 0;
+            } else {
+                $time = (int)bcsub((string)$time, (string)$days_time);
+            }
+        }
+        $update['overdue_time'] = $time;
+        if ($time < time()) {//已经过期
+            $update['is_money_level'] = 0;
+        }
+        $this->dao->update($id, $update);
+        $userInfo->save();
+        /** @var StoreOrderCreateServices $storeOrderCreateService */
+        $storeOrderCreateService = app()->make(StoreOrderCreateServices::class);
+        $orderInfo = [
+            'uid' => $id,
+            'order_id' => $storeOrderCreateService->getNewOrderId(),
+            'type' => 4,
+            'member_type' => 0,
+            'pay_type' => 'admin',
+            'paid' => 1,
+            'pay_time' => time(),
+            'is_free' => 1,
+            'overdue_time' => $time,
+            'vip_day' => $days_status == 1 ? $days : bcsub('0', $days),
+            'add_time' => time()
+        ];
+        /** @var OtherOrderServices $otherOrder */
+        $otherOrder = app()->make(OtherOrderServices::class);
+        $otherOrder->save($orderInfo);
+        return true;
+    }
 
     /**
      * 清除会员等级
@@ -1558,7 +1558,7 @@ class UserServices extends BaseServices
         if (!$user['bar_code']) {
             $bar_code = $this->getBarCode();
             $this->dao->update($uid, ['bar_code' => $bar_code], 'uid');
-			$user['bar_code'] = $bar_code;
+            $user['bar_code'] = $bar_code;
         }
         //获取配置参数
         $configData = SystemConfigService::more([
@@ -1665,27 +1665,32 @@ class UserServices extends BaseServices
                 if (isset($item['use']) && $item['use'] && isset($item['user_show']) && $item['user_show']) $user['register_extend_info'][] = $item;
             }
         }
-		if (isset($user['extend_info']) && $user['extend_info']) {
-			$default = $this->defaultExtendInfo;
-			$params = array_column($default, 'param');
-			$sex = $this->rSex;
-			foreach ($user['extend_info'] as &$info) {
-				if (isset($info['param']) && in_array($info['param'], $params)) {
-					if ($info['param'] == 'sex') {
-						$info['value'] = $sex[$user['sex']] ?? 0;
-					} elseif ($info['param'] == 'birthday') {
-						$info['value'] = ($user['birthday'] ?? '') ? date('Y-m-d', $user['birthday']) : '';
-					} elseif($info['param'] == 'address') {
-						$info['value'] = $user['addres'] ?? '';
-					} else {
-						$info['value'] = $user[$info['param']] ?? '';
-					}
-				}
-			}
-		}
-
-		$user['is_default_avatar'] = $user['avatar'] == sys_config('h5_avatar') ? 1 : 0;
-        return $user;
+        if (isset($user['extend_info']) && $user['extend_info']) {
+            $default = $this->defaultExtendInfo;
+            $params = array_column($default, 'param');
+            $sex = $this->rSex;
+            foreach ($user['extend_info'] as &$info) {
+                if (isset($info['param']) && in_array($info['param'], $params)) {
+                    if ($info['param'] == 'sex') {
+                        $info['value'] = $sex[$user['sex']] ?? 0;
+                    } elseif ($info['param'] == 'birthday') {
+                        $info['value'] = ($user['birthday'] ?? '') ? date('Y-m-d', $user['birthday']) : '';
+                    } elseif ($info['param'] == 'address') {
+                        $info['value'] = $user['addres'] ?? '';
+                    } else {
+                        $info['value'] = $user[$info['param']] ?? '';
+                    }
+                }
+            }
+        }
+        /** @var UserAwardIntegralServices $award_integral_service */
+        $award_integral_service = app()->make(UserAwardIntegralServices::class);
+        $award_lack = $award_integral_service->getLake();
+        $integral_price = $award_integral_service->getPrice();
+        $static_integral = $award_integral_service->getIntegralSum(['status' => 1, 'type' => 0, 'uid' => $user['uid']]);
+        $action_integral = $award_integral_service->getIntegralSum(['status' => 1, 'type' => 1, 'uid' => $user['uid']]);
+        $user['is_default_avatar'] = $user['avatar'] == sys_config('h5_avatar') ? 1 : 0;
+        return array_merge($user, compact('award_lack', 'integral_price', 'static_integral', 'action_integral'));
     }
 
     /**
@@ -1785,7 +1790,7 @@ class UserServices extends BaseServices
             $serviceFriend->saveFriend($uid, $spreadUid);
         }
         $data = [];
-		//永久绑定
+        //永久绑定
         $store_brokergae_binding_status = sys_config('store_brokerage_binding_status', 1);
         $spread_uid = isset($user['code']) && $user['code'] && $user['code'] != $userInfo->uid ? $user['code'] : ($userInfo['spread_uid'] ?? 0);
         if ($userInfo->spread_uid && $store_brokergae_binding_status == 1) {
@@ -1807,14 +1812,14 @@ class UserServices extends BaseServices
                 }
             }
         }
-		if ($data && !$this->dao->update($userInfo['uid'], $data, 'uid')) {
+        if ($data && !$this->dao->update($userInfo['uid'], $data, 'uid')) {
             throw new ValidateException('修改信息失败');
         }
         if (isset($data['spread_uid']) && $data['spread_uid']) {
-			/** @var UserBillServices $userBill */
-			$userBill = app()->make(UserBillServices::class);
-			//邀请新用户增加经验
-			$userBill->inviteUserIncExp((int)$spreadUid);
+            /** @var UserBillServices $userBill */
+            $userBill = app()->make(UserBillServices::class);
+            //邀请新用户增加经验
+            $userBill->inviteUserIncExp((int)$spreadUid);
         }
         return true;
     }
@@ -1830,10 +1835,10 @@ class UserServices extends BaseServices
         if (!$userInfo) {
             throw new ValidateException('数据不存在');
         }
-		if (isset($data['ip']) && $data['ip']) {
-			$addressArr = $this->addressHandle($this->convertIp($data['ip']));
-			$data['province'] = $addressArr['province'] ?? '';
-		}
+        if (isset($data['ip']) && $data['ip']) {
+            $addressArr = $this->addressHandle($this->convertIp($data['ip']));
+            $data['province'] = $addressArr['province'] ?? '';
+        }
         $data['channel_type'] = $userInfo['user_type'];
         $data['add_time'] = time();
         /** @var UserVisitServices $userVisit */
@@ -1887,13 +1892,13 @@ class UserServices extends BaseServices
         /** @var UserStoreOrderServices $userStoreOrder */
         $userStoreOrder = app()->make(UserStoreOrderServices::class);
         $list = [];
-		$where = ['pid' => 0, 'type' => 0, 'paid' => 1, 'refund_status' => [0, 3], 'is_del' => 0, 'is_system_del' => 0];
+        $where = ['pid' => 0, 'type' => 0, 'paid' => 1, 'refund_status' => [0, 3], 'is_del' => 0, 'is_system_del' => 0];
         if ($grade == 0) {
             if ($spread_one_ids) $list = $userStoreOrder->getUserSpreadCountList($spread_one_ids, $orderBy, $keyword, $time);
-			$where = $where + ['spread_uid' => $uid];
+            $where = $where + ['spread_uid' => $uid];
         } else {
             if ($spread_two_ids) $list = $userStoreOrder->getUserSpreadCountList($spread_two_ids, $orderBy, $keyword, $time);
-			$where = $where + ['spread_two_uid' => $uid];
+            $where = $where + ['spread_two_uid' => $uid];
         }
         foreach ($list as &$item) {
             if (isset($item['spread_time']) && $item['spread_time']) {
@@ -1905,11 +1910,11 @@ class UserServices extends BaseServices
         $data['count'] = 0;
         $data['price'] = 0;
         if ($list) {
-			$uids = array_column($list, 'uid');
-			$data['count'] = count($uids);
+            $uids = array_column($list, 'uid');
+            $data['count'] = count($uids);
             /** @var StoreOrderServices $storeOrder */
             $storeOrder = app()->make(StoreOrderServices::class);
-			$data['price'] = $storeOrder->sum($where, $grade == 0 ? 'one_brokerage' : 'two_brokerage');
+            $data['price'] = $storeOrder->sum($where, $grade == 0 ? 'one_brokerage' : 'two_brokerage');
         }
         return $data;
     }
@@ -1947,9 +1952,9 @@ class UserServices extends BaseServices
      */
     public function checkUserPromoter(int $uid, $user = [], float $sumPrice = 0.00)
     {
-		if (!$uid) {
-			return false;
-		}
+        if (!$uid) {
+            return false;
+        }
         if (!$user) {
             $user = $this->getUserInfo($uid);
         }
@@ -2150,43 +2155,43 @@ class UserServices extends BaseServices
         return $this->dao->getUserInfoList($where, $field);
     }
 
-	/**
-	 * 保存用户上级推广人
-	 * @param int $uid
-	 * @param int $spread_uid
-	 * @return bool
-	 */
-	public function saveUserSpreadUid(int $uid, int $spread_uid)
-	{
-		if (!$uid || !$spread_uid) {
-			return false;
-		}
-		if ($uid == $spread_uid) {
-			throw new ValidateException('上级推广人不能为自己');
-		}
-		$userInfo = $this->getUserInfo($uid);
-		if (!$userInfo) {
-			throw new ValidateException('用户不存在');
-		}
-		//上级已经是这个uid
-		if ($userInfo['spread_uid'] == $spread_uid) {
-			return true;
-		}
-		$spreadInfo = $this->getUserInfo($spread_uid);
-		if (!$spreadInfo) {
-			throw new ValidateException('上级用户不存在');
-		}
-		if ($spreadInfo['spread_uid'] == $uid) {
-			throw new ValidateException('上级推广人不能为自己下级');
-		}
-		$data = ['spread_uid' => $spread_uid, 'spread_time' => time()];
-		$this->dao->update($uid, $data);
-		//记录推广绑定关系
-		UserSpreadJob::dispatch([$uid, $spread_uid]);
-		//记录好友关系
-		UserFriendsJob::dispatch([$uid, $spread_uid]);
-		return true;
-	}
+    /**
+     * 保存用户上级推广人
+     * @param int $uid
+     * @param int $spread_uid
+     * @return bool
+     */
+    public function saveUserSpreadUid(int $uid, int $spread_uid)
+    {
+        if (!$uid || !$spread_uid) {
+            return false;
+        }
+        if ($uid == $spread_uid) {
+            throw new ValidateException('上级推广人不能为自己');
+        }
+        $userInfo = $this->getUserInfo($uid);
+        if (!$userInfo) {
+            throw new ValidateException('用户不存在');
+        }
+        //上级已经是这个uid
+        if ($userInfo['spread_uid'] == $spread_uid) {
+            return true;
+        }
+        $spreadInfo = $this->getUserInfo($spread_uid);
+        if (!$spreadInfo) {
+            throw new ValidateException('上级用户不存在');
+        }
+        if ($spreadInfo['spread_uid'] == $uid) {
+            throw new ValidateException('上级推广人不能为自己下级');
+        }
+        $data = ['spread_uid' => $spread_uid, 'spread_time' => time()];
+        $this->dao->update($uid, $data);
+        //记录推广绑定关系
+        UserSpreadJob::dispatch([$uid, $spread_uid]);
+        //记录好友关系
+        UserFriendsJob::dispatch([$uid, $spread_uid]);
+        return true;
+    }
 
     /**
      * 增加推广用户佣金