My.php 2.5 KB

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