list.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <?php
  2. use common\services\xhUserService;
  3. use common\services\xhTrainUserCourseService;
  4. use yii\widgets\LinkPager;
  5. ?>
  6. <div class="page-title">
  7. <div class="title-env">
  8. <h1 class="title">作品管理</h1>
  9. </div>
  10. <div class="breadcrumb-env">
  11. <ol class="breadcrumb bc-1">
  12. <li>
  13. <a href="/"><i class="fa-home"></i>Home</a>
  14. </li>
  15. <li>
  16. <a href="javascript:void(0)">花艺培训</a>
  17. </li>
  18. <li class="active">
  19. <strong>作品管理</strong>
  20. </li>
  21. </ol>
  22. </div>
  23. </div>
  24. <div class="panel panel-default">
  25. <div class="panel-body">
  26. <div id="example-2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  27. <div class="row">
  28. <div class="col-xs-6" style="width:90%;">
  29. <div class="dataTables_length">
  30. <a href="javascript:void(0)" name="weekList" class="btn btn-secondary btn-single" style="margin-right:15px;">本周榜</a>
  31. <a href="javascript:void(0)" name="monthList" class="btn btn-secondary btn-single" style="margin-right:15px;">本月榜</a>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="table-responsive">
  36. <table class="table table-bordered table-striped table-hover" >
  37. <thead>
  38. <tr class="active">
  39. <th class="no-sorting"><input type="checkbox"></th>
  40. <th>ID</th>
  41. <th>姓名</th>
  42. <th>课名</th>
  43. <th>作品</th>
  44. <th>喜欢数</th>
  45. <th>时间</th>
  46. <th>操作</th>
  47. </tr>
  48. </thead>
  49. <tbody class="middle-align">
  50. <?php if(!empty($models)){ ?>
  51. <?php foreach($models as $key => $val){
  52. $userId = $val['userId'];
  53. $user = xhUserService::getById($userId);
  54. ?>
  55. <tr>
  56. <td><input type="checkbox"></td>
  57. <td><?= $key+1 ?></td>
  58. <td><a href="/course/detail?id=<?= $val['studentId'] ?>"><?= $user['userName'] ?></a></td>
  59. <td><?= $val['courseName'] ?></td>
  60. <td>
  61. <?php
  62. $largeImg = $val['worksImg'];
  63. $imgList = xhTrainUserCourseService::getWorksImgList($largeImg);
  64. echo '<img src="'.Yii::$app->params['imgUrl'].$imgList['small'].'" width="25" />';
  65. ?>
  66. </td>
  67. <td>
  68. <?php
  69. $praiseNum = Yii::$app->redis->executeCommand('ZCOUNT', ["userCourse".$val['id']."PraiseUser", 0, time()]);
  70. echo $praiseNum;
  71. ?>
  72. </td>
  73. <td><?php if(!empty($val['attendTime'])){ echo date("Y-m-d H:i:s",$val['attendTime']); } ?></td>
  74. <td>
  75. </td>
  76. </tr>
  77. <?php } } ?>
  78. </tbody>
  79. </table>
  80. </div>
  81. <div class="row">
  82. <div>
  83. <!--
  84. <div style="display:inline-block;margin-left:15px;">
  85. <label><select name="example-1_length"
  86. aria-controls="example-1" class="form-control">
  87. <option value="0">批量操作</option>
  88. <option value="1">批量下架</option>
  89. <option value="2">批量删除</option>
  90. </select>
  91. </label>
  92. <input class="btn btn-secondary btn-single" type="submit" name="" value="确认" />
  93. </div>
  94. -->
  95. <div class="dataTables_paginate paging_simple_numbers" style="float:right;padding-top:0px;margin-right:15px;">
  96. <?= LinkPager::widget(['pagination' => $pages]); ?>
  97. </div>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <!-- footer -->
  104. <?php
  105. use backend\widgets\FooterWidget;
  106. ?>
  107. <?= FooterWidget::widget()?>
  108. <!-- footer -->
  109. <!-- modal 周榜 -->
  110. <div class="modal fade" id="weekModal" >
  111. <div class="modal-dialog" style="height:450px;">
  112. <div class="modal-content">
  113. <div class="modal-header">
  114. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  115. <h4 class="modal-title">本周集赞排行榜</h4>
  116. </div>
  117. <div class="modal-body">
  118. <div class="table-responsive">
  119. <table class="table table-bordered table-striped table-hover" >
  120. <thead>
  121. <tr class="active">
  122. <th>名次</th>
  123. <th>头像</th>
  124. <th>姓名</th>
  125. <th>点赞数</th>
  126. </tr>
  127. </thead>
  128. <tbody class="middle-align">
  129. <?php if(!empty($weekRank)){ ?>
  130. <?php foreach($weekRank as $key => $val){ ?>
  131. <tr>
  132. <td><?= $key + 1 ?></td>
  133. <td><img width="20" src="<?= Yii::$app->params['imgUrl'].$val['userInfo']['avatar'] ?>" /></td>
  134. <td><a href="#"><?= $val['userInfo']['userName'] ?></a></td>
  135. <td><?= $val['praiseNum'] ?></td>
  136. </tr>
  137. <?php } } ?>
  138. </tbody>
  139. </table>
  140. </div>
  141. </div>
  142. <div class="modal-footer">
  143. <button type="button" class="btn btn-white" data-dismiss="modal">确认</button>
  144. </div>
  145. </div>
  146. </div>
  147. </div>
  148. <script>
  149. $(function(){
  150. //充值操作
  151. jQuery("a[name=weekList]").click(function(){
  152. var url = $(this).attr('data-url');
  153. var userName = $(this).attr('data-userName');
  154. $("#rechargeModal .modal-body span").text(userName);
  155. $("#rechargeModal .modal-body input[name=userName]").val(userName);
  156. $("#rechargeModal .modal-body input[name=requestUrl]").val(url);
  157. $("#rechargeModal .modal-body input[name=rechargeAmount]").val('');
  158. jQuery('#weekModal').modal('show');
  159. });
  160. });
  161. </script>
  162. <!-- modal 月榜 -->
  163. <div class="modal fade" id="monthModal" >
  164. <div class="modal-dialog" style="height:450px;">
  165. <div class="modal-content">
  166. <div class="modal-header">
  167. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  168. <h4 class="modal-title">本月集赞排行榜</h4>
  169. </div>
  170. <div class="modal-body">
  171. <div class="table-responsive">
  172. <table class="table table-bordered table-striped table-hover" >
  173. <thead>
  174. <tr class="active">
  175. <th>名次</th>
  176. <th>头像</th>
  177. <th>姓名</th>
  178. <th>点赞数</th>
  179. </tr>
  180. </thead>
  181. <tbody class="middle-align">
  182. <?php if(!empty($monthRank)){ ?>
  183. <?php foreach($monthRank as $key => $val){ ?>
  184. <tr>
  185. <td><?= $key + 1 ?></td>
  186. <td><img width="20" src="<?= Yii::$app->params['imgUrl'].$val['userInfo']['avatar'] ?>" /></td>
  187. <td><a href="#"><?= $val['userInfo']['userName'] ?></a></td>
  188. <td><?= $val['praiseNum'] ?></td>
  189. </tr>
  190. <?php } } ?>
  191. </tbody>
  192. </table>
  193. </div>
  194. </div>
  195. <div class="modal-footer">
  196. <button type="button" class="btn btn-white" data-dismiss="modal">确认</button>
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. <script>
  202. $(function(){
  203. //充值操作
  204. jQuery("a[name=monthList]").click(function(){
  205. var url = $(this).attr('data-url');
  206. var userName = $(this).attr('data-userName');
  207. $("#rechargeModal .modal-body span").text(userName);
  208. $("#rechargeModal .modal-body input[name=userName]").val(userName);
  209. $("#rechargeModal .modal-body input[name=requestUrl]").val(url);
  210. $("#rechargeModal .modal-body input[name=rechargeAmount]").val('');
  211. jQuery('#monthModal').modal('show');
  212. });
  213. });
  214. </script>