My.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\common\model\BrokerIncome as BrokerIncomeModel;
  4. use app\mobile\MobileBaseController;
  5. use think\App;
  6. use think\facade\View;
  7. class My extends MobileBaseController
  8. {
  9. private $_broker = null;
  10. public function __construct(App $app)
  11. {
  12. parent::__construct($app);
  13. $this->_broker = get_broker();
  14. View::assign('broker', $this->_broker);
  15. }
  16. /**
  17. * 个人中心
  18. */
  19. public function index()
  20. {
  21. return view('my/index');
  22. }
  23. /**
  24. * 收益明细
  25. */
  26. public function income()
  27. {
  28. $data = [];
  29. //上月收益
  30. $month_time = date('Ym', strtotime('-1 month'));
  31. $month_income = BrokerIncomeModel::where(['monthtime' => $month_time, 'brokerid' => $this->_broker['id']])->sum('value');
  32. $data['month_income'] = $month_income;
  33. return view('my/income', $data);
  34. }
  35. /**
  36. * 收益明细列表
  37. */
  38. public function listIncome()
  39. {
  40. $map = $this->dealEqualInput(['cate_id']);
  41. $map[] = ['brokerid', '=', $this->_broker['id']];
  42. $list = BrokerIncomeModel::where($map)
  43. ->order(['id' => 'desc'])
  44. ->limit(input('limit', 10))
  45. ->page(input('page', 1))
  46. ->append(['status_text'])
  47. ->select();
  48. ajax_success($list);
  49. }
  50. /**
  51. * 推广码
  52. */
  53. public function qrcode()
  54. {
  55. error_reporting(E_ERROR);
  56. $url = request()->domain(true) . '/mobile/candidate/info?broker_id=' . $this->_broker['id'];
  57. header('Content-Type: image/png');
  58. ob_clean();
  59. $errorCorrectionLevel = "L"; // 纠错级别:L、M、Q、H
  60. $matrixPointSize = "4"; //生成图片大小 :1到10
  61. \phpqrcode\QRcode::png($url, false, $errorCorrectionLevel, $matrixPointSize);
  62. exit();
  63. }
  64. }