BaseController.php 930 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Http\Controllers\QuickApp;
  3. use App\Modules\User\Services\QappUserService;
  4. use Illuminate\Routing\Controller;
  5. class BaseController extends Controller
  6. {
  7. private $field = [];
  8. public function __get($name)
  9. {
  10. if (!isset($this->field[$name])) {
  11. QappUserService::setGolableUserStatic(10008);
  12. $qapp_user = QappUserService::getGolableUserStatic();
  13. if ($name == 'user_info') {
  14. $this->field[$name] = $qapp_user->user;
  15. }
  16. if ($name == 'uid') {
  17. $this->field[$name] = $qapp_user->uid;
  18. }
  19. if ($name == 'phone') {
  20. $this->field[$name] = $qapp_user->phone;
  21. }
  22. if ($name == 'distribution_channel_id') {
  23. $this->field[$name] = $qapp_user->user->distribution_channel_id;
  24. }
  25. }
  26. return $this->field[$name];
  27. }
  28. }