Index.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: qisse
  5. * Date: 2017/6/27
  6. * Time: 20:02
  7. */
  8. namespace app\mobile_v_2_1\logic;
  9. use app\core\model\Banner;
  10. use app\core\model\Subject;
  11. use app\core\service\Stat;
  12. use think\Cache;
  13. use think\Config;
  14. use tool\Common;
  15. class Index extends Base
  16. {
  17. public function getIndexInfo()
  18. {
  19. $buttonBigList = $this->skin['index_button'];
  20. foreach ($buttonBigList as $k=>$item) {
  21. if($item['link']) {
  22. if(strpos($item['link'], 'http') === false) {
  23. $buttonBigList[$k]['link'] = $this->h5RootUrl().'/'.$item['link'].'?######';
  24. }
  25. }
  26. if(isset($item['share']['link']) && strpos($item['share']['link'], '@uuid@') !== false) {
  27. if($this->user) {
  28. $buttonBigList[$k]['share']['link'] = str_replace('@uuid@', $this->user['uuid'], $buttonBigList[$k]['share']['link']);
  29. }
  30. else {
  31. $buttonBigList[$k]['share']['link'] = str_replace('@uuid@', '', $buttonBigList[$k]['share']['link']);
  32. }
  33. }
  34. }
  35. //banner
  36. $map = [];
  37. $map['clientType'] = 1;
  38. if($this->data['osType'] == 3) {
  39. $map['clientType'] = 2;
  40. }
  41. $map['status'] = Banner::STATUS_ONLINE;
  42. $bannerList = Banner::where($map)->order('bannerID desc')->select();
  43. if($bannerList) {
  44. $bannerList->visible(['thumb','link','title']);
  45. }
  46. //subjectHot
  47. $map = [];
  48. $map['isShow'] = 1;
  49. if($this->data['osType'] != 3) {
  50. $map['isIndexPc'] = 1;
  51. }
  52. else {
  53. $map['isIndexApp'] = 1;
  54. }
  55. $map['subjectTypeID'] = 1;
  56. $map['status'] = ['in', [Subject::STATUS_ONLINE, Subject::STATUS_FULL]];
  57. $subjectHot = Subject::with('subjectType,interestType,interestTimeType,subjectStat')->where($map)->order('addTime desc')->find();
  58. if($subjectHot) {
  59. $subjectHot->append(['statusText','investDay', 'repayTime','reachTime','unit','interestBeginTime'])->hidden(['subjectTypeID','beginTime','endTime','multiplePrice','interestTypeID','interestTimeTypeID','isIndexApp','isIndexPc','operation','updateTime',
  60. 'subjectStat'=>[
  61. 'subjectID','subjectStatID'
  62. ]
  63. ])->toArray();
  64. $subjectHot['contentUrl1'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=1' . '&######';
  65. $subjectHot['contentUrl2'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=2' . '&######';
  66. $subjectHot['contentUrl3'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=3' . '&######';
  67. $subjectHot['subjectType']['icon'] = isset($this->skin['subjectType_icon'][$subjectHot['subjectType']['subjectTypeID']]) ? $this->skin['subjectType_icon'][$subjectHot['subjectType']['subjectTypeID']] : '';
  68. }
  69. //$subjectRecommendList
  70. $map = [];
  71. $map['isShow'] = 1;
  72. if($this->data['osType'] != 3) {
  73. $map['isIndexApp'] = 1;
  74. }
  75. else {
  76. $map['isIndexPc'] = 1;
  77. }
  78. $map['subjectTypeID'] = ['neq', 1];
  79. $map['status'] = Subject::STATUS_ONLINE;
  80. if($subjectHot) {
  81. $map['subjectID'] = ['neq', $subjectHot['subjectID']];
  82. }
  83. $subjectRecommendList = Subject::with('subjectType,interestType,interestTimeType,subjectStat')->where($map)->limit(0,3)->order('addTime desc')->select();
  84. if(!$subjectRecommendList->isEmpty()) {
  85. $subjectRecommendList->append(['statusText','investDay', 'repayTime','reachTime','unit','interestBeginTime'])->hidden(['subjectTypeID','beginTime','endTime','multiplePrice','interestTypeID','interestTimeTypeID','isIndexApp','isIndexPc','operation','updateTime',
  86. 'subjectStat'=>[
  87. 'subjectID','subjectStatID'
  88. ]
  89. ])->toArray();
  90. foreach ($subjectRecommendList as $k=>$item) {
  91. $subjectRecommendList[$k]['contentUrl1'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=1' . '&######';
  92. $subjectRecommendList[$k]['contentUrl2'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=2' . '&######';
  93. $subjectRecommendList[$k]['contentUrl3'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=3' . '&######';
  94. $subjectRecommendList[$k]['subjectType']['icon'] = isset($this->skin['subjectType_icon'][$subjectRecommendList[$k]['subjectType']['subjectTypeID']]) ? $this->skin['subjectType_icon'][$subjectRecommendList[$k]['subjectType']['subjectTypeID']] : '';
  95. };
  96. }
  97. $stat = Cache::get('stat_laojiaqian');
  98. $tradeTotal = isset($stat['stat_totalAll']) ? $stat['stat_totalAll'] : "11231231.00";
  99. $userMakeTotal = isset($stat['stat_usermakeTotal']) ? $stat['stat_usermakeTotal'] : "54123.21";
  100. $safeDayTotal = (int)((THINK_START_TIME - Common::datetotime('2017-11-11')) / 86400);
  101. $userTotal = isset($stat['stat_userTotal']) ? $stat['stat_userTotal'] : "23665";
  102. return Common::rm(1, '操作成功', [
  103. 'notice1'=>'',
  104. 'notice2'=>'',
  105. 'noticeList'=>Stat::getStatUserAction(),
  106. 'noticeListConfig'=>[
  107. 'cycle'=>1000
  108. ],
  109. 'buttonBigList'=>$buttonBigList ? $buttonBigList : [],
  110. 'bannerList'=>$bannerList ? $bannerList : [],
  111. 'subjectHot'=>$subjectHot ? $subjectHot : new \stdClass(),
  112. 'subjectRecommendList'=>$subjectRecommendList ? $subjectRecommendList : [],
  113. /*'bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/04/aghypFQ6t0.png',*/
  114. /*'bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/16/OFlkpTWxoI.png',*/
  115. 'bottomIcon'=>'',
  116. 'stat'=>[
  117. "tradeTotal"=>$tradeTotal,
  118. "userMakeTotal"=>$userMakeTotal,
  119. "safeDayTotal"=>$safeDayTotal,
  120. "userTotal"=>$userTotal
  121. ]
  122. ]);
  123. /*return Common::rm(1, '操作成功', [
  124. 'notice1'=>'累计交易额<font color="red">6,449,502</font>元',
  125. 'notice2'=>'已安全运营<font color="red">78</font>天',
  126. 'buttonBigList'=>$buttonBigList ? $buttonBigList : [],
  127. 'bannerList'=>$bannerList ? $bannerList : [],
  128. 'subjectHot'=>$subjectHot ? $subjectHot : new \stdClass(),
  129. 'subjectRecommendList'=>$subjectRecommendList ? $subjectRecommendList : [],
  130. //'bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/04/aghypFQ6t0.png',
  131. 'bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/16/OFlkpTWxoI.png',
  132. 'stat'=>[
  133. "tradeTotal"=>"1231231.20",
  134. "userMakeTotal"=>"123321.12",
  135. "safeDayTotal"=>"1313",
  136. "userTotal"=>"23665"
  137. ]
  138. ]);*/
  139. }
  140. }