UserBusiness.php 864 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace app\business;
  3. use Illuminate\Support\Arr;
  4. use support\Db;
  5. use support\Redis;
  6. class UserBusiness
  7. {
  8. /** 查询用户信息
  9. * @param $param
  10. * @return void
  11. */
  12. static public function userData($param)
  13. {
  14. try {
  15. $data=Db::table('wa_users')->where(function ($query)use ($param){
  16. if(Arr::get($param,'id')){
  17. $query->where('id',$param['id']);
  18. }
  19. if(Arr::get($param,'mobile')){
  20. $query->where('mobile',$param['mobile']);
  21. }
  22. })->first();
  23. if(empty($data)){
  24. throw new \Exception('账号不存在');
  25. }
  26. }catch (\Throwable $exception){
  27. throw new \Exception($exception->getMessage());
  28. }
  29. return collect($data)->toArray();
  30. }
  31. }