Index.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: qisse
  5. * Date: 2017/6/27
  6. * Time: 20:02
  7. */
  8. namespace app\mobile\logic;
  9. use app\core\model\Banner;
  10. use app\core\model\Subject;
  11. use think\Cache;
  12. use think\Config;
  13. use tool\Common;
  14. class Index extends Base
  15. {
  16. public function getIndexInfo()
  17. {
  18. //index 素材
  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. }
  27. //banner
  28. $map = [];
  29. $map['clientType'] = 1;
  30. if($this->data['osType'] == 3) {
  31. $map['clientType'] = 2;
  32. }
  33. $map['status'] = Banner::STATUS_ONLINE;
  34. $bannerList = Banner::where($map)->order('bannerID desc')->select();
  35. if($bannerList) {
  36. $bannerList->visible(['thumb','link','title']);
  37. }
  38. //subjectHot
  39. $map = [];
  40. $map['isShow'] = 1;
  41. if($this->data['osType'] != 3) {
  42. $map['isIndexPc'] = 1;
  43. }
  44. else {
  45. $map['isIndexApp'] = 1;
  46. }
  47. $map['subjectTypeID'] = 1;
  48. $map['status'] = ['in', [Subject::STATUS_ONLINE, Subject::STATUS_FULL]];
  49. $subjectHot = Subject::with('subjectType,interestType,interestTimeType,subjectStat')->where($map)->order('addTime desc')->find();
  50. if($subjectHot) {
  51. $subjectHot->append(['statusText','investDay', 'repayTime','reachTime','unit','interestBeginTime'])->hidden(['subjectTypeID','beginTime','endTime','multiplePrice','interestTypeID','interestTimeTypeID','isIndexApp','isIndexPc','operation','updateTime',
  52. 'subjectStat'=>[
  53. 'subjectID','subjectStatID'
  54. ]
  55. ])->toArray();
  56. $subjectHot['contentUrl1'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=1' . '&######';
  57. $subjectHot['contentUrl2'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=2' . '&######';
  58. $subjectHot['contentUrl3'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=3' . '&######';
  59. $subjectHot['subjectType']['icon'] = isset($this->skin['subjectType_icon'][$subjectHot['subjectType']['subjectTypeID']]) ? $this->skin['subjectType_icon'][$subjectHot['subjectType']['subjectTypeID']] : '';
  60. }
  61. //$subjectRecommendList
  62. $map = [];
  63. $map['isShow'] = 1;
  64. if($this->data['osType'] != 3) {
  65. $map['isIndexApp'] = 1;
  66. }
  67. else {
  68. $map['isIndexPc'] = 1;
  69. }
  70. $map['subjectTypeID'] = ['neq', 1];
  71. $map['status'] = Subject::STATUS_ONLINE;
  72. if($subjectHot) {
  73. $map['subjectID'] = ['neq', $subjectHot['subjectID']];
  74. }
  75. $subjectRecommendList = Subject::with('subjectType,interestType,interestTimeType,subjectStat')->where($map)->limit(0,3)->order('addTime desc')->select();
  76. if(!$subjectRecommendList->isEmpty()) {
  77. $subjectRecommendList->append(['statusText','investDay', 'repayTime','reachTime','unit','interestBeginTime'])->hidden(['subjectTypeID','beginTime','endTime','multiplePrice','interestTypeID','interestTimeTypeID','isIndexApp','isIndexPc','operation','updateTime',
  78. 'subjectStat'=>[
  79. 'subjectID','subjectStatID'
  80. ]
  81. ])->toArray();
  82. foreach ($subjectRecommendList as $k=>$item) {
  83. $subjectRecommendList[$k]['contentUrl1'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=1' . '&######';
  84. $subjectRecommendList[$k]['contentUrl2'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=2' . '&######';
  85. $subjectRecommendList[$k]['contentUrl3'] = $this->h5RootUrl().'/mobile/h5/subjectContent?tab=3' . '&######';
  86. $subjectRecommendList[$k]['subjectType']['icon'] = isset($this->skin['subjectType_icon'][$subjectRecommendList[$k]['subjectType']['subjectTypeID']]) ? $this->skin['subjectType_icon'][$subjectRecommendList[$k]['subjectType']['subjectTypeID']] : '';
  87. };
  88. }
  89. //db('cang')->sum('score');
  90. return Common::rm(1, '操作成功', [
  91. 'notice1'=>'累计交易额<font color="red">'.'0'.'</font>元',
  92. 'notice2'=>'已安全运营<font color="red">'.'0'.'</font>天',
  93. 'buttonBigList'=>$buttonBigList ? $buttonBigList : [],
  94. 'bannerList'=>$bannerList ? $bannerList : [],
  95. 'subjectHot'=>$subjectHot ? $subjectHot : new \stdClass(),
  96. 'subjectRecommendList'=>$subjectRecommendList ? $subjectRecommendList : [],
  97. /*'bottomIcon'=>'http://slb.dahengdian.com/jiaqiancaifu/2018/01/04/aghypFQ6t0.png',*/
  98. 'bottomIcon'=>$this->skin['index_bottomIcon'],
  99. 'stat'=>[
  100. "tradeTotal"=>0,
  101. "userMakeTotal"=>0,
  102. "safeDayTotal"=>0,
  103. "userTotal"=>0
  104. ]
  105. ]);
  106. /*return Common::rm(1, '操作成功', [
  107. 'notice1'=>'累计交易额<font color="red">6,449,502</font>元',
  108. 'notice2'=>'已安全运营<font color="red">78</font>天',
  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. 'stat'=>[
  116. "tradeTotal"=>"1231231.20",
  117. "userMakeTotal"=>"123321.12",
  118. "safeDayTotal"=>"1313",
  119. "userTotal"=>"23665"
  120. ]
  121. ]);*/
  122. }
  123. }