BaseController.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Http\Controllers\QuickApp;
  3. use App\Modules\User\Models\User;
  4. use App\Modules\User\Services\QappUserService;
  5. use Illuminate\Routing\Controller;
  6. /**
  7. * @property User $user_info 用户基本信息
  8. * @property int $uid
  9. * @property string $phone 手机号
  10. * @property int $distribution_channel_id 渠道号ID
  11. * @property int $send_order_id 派单ID
  12. * @property int $app_pay_merchat_id 微信app支付通道ID
  13. * @property int $h5_pay_merchat_id 微信h5支付通道ID
  14. * @property int $ali_pay_merchat_id 支付宝支付通道ID
  15. */
  16. class BaseController extends Controller
  17. {
  18. private $field = [];
  19. public function __get($name)
  20. {
  21. if (!isset($this->field[$name])) {
  22. $qapp_user = QappUserService::getGolableUserStatic();
  23. if ($name == 'user_info') {
  24. $this->field[$name] = $qapp_user->user;
  25. }
  26. if ($name == 'uid') {
  27. $this->field[$name] = $qapp_user->uid;
  28. }
  29. if ($name == 'phone') {
  30. $this->field[$name] = $qapp_user->phone;
  31. }
  32. if ($name == 'distribution_channel_id') {
  33. $this->field[$name] = $qapp_user->user->distribution_channel_id;
  34. }
  35. if ($name == 'send_order_id') {
  36. $this->field[$name] = $qapp_user->send_order_id;
  37. }
  38. if ($name == 'app_pay_merchat_id') {
  39. $this->field[$name] = $qapp_user->app_pay_merchat_id;
  40. }
  41. if ($name == 'h5_pay_merchat_id') {
  42. $this->field[$name] = $qapp_user->h5_pay_merchat_id;
  43. }
  44. if ($name == 'ali_pay_merchat_id') {
  45. $this->field[$name] = $qapp_user->ali_pay_merchat_id;
  46. }
  47. }
  48. return $this->field[$name];
  49. }
  50. }