BaseController.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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(env('QUICKAPP_TEST_UID',162261523));
  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. if ($name == 'send_order_id') {
  26. $this->field[$name] = $qapp_user->send_order_id;
  27. }
  28. }
  29. return $this->field[$name];
  30. }
  31. }