Dividend.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeshop开源商城系统
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | gitee下载:https://gitee.com/likeshop_gitee
  7. // | github下载:https://github.com/likeshop-github
  8. // | 访问官网:https://www.likeshop.cn
  9. // | 访问社区:https://home.likeshop.cn
  10. // | 访问手册:http://doc.likeshop.cn
  11. // | 微信公众号:likeshop技术社区
  12. // | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
  13. // | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
  14. // | 禁止对系统程序代码以任何目的,任何形式的再发布
  15. // | likeshop团队版权所有并拥有最终解释权
  16. // +----------------------------------------------------------------------
  17. // | author: likeshop.cn.team
  18. // +----------------------------------------------------------------------
  19. namespace app\admin\controller\finance;
  20. use app\common\basics\AdminBase;
  21. use app\common\server\ConfigServer;
  22. use app\common\server\JsonServer;
  23. use app\admin\logic\finance\WithdrawLogic;
  24. use app\admin\logic\finance\DividendCashLogic;
  25. /**
  26. * 财务-分红池相关
  27. * Class User
  28. * @package app\admin\controller\finance
  29. */
  30. class Dividend extends AdminBase
  31. {
  32. /**
  33. * @notes 分红池资金明细列表
  34. * @return \think\response\Json|\think\response\View
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. * @author suny
  39. * @date 2021/7/13 7:02 下午
  40. */
  41. public function dividend_cash()
  42. {
  43. if ($this->request->isAjax()) {
  44. $get = $this->request->get();
  45. $data = DividendCashLogic::cash($get);
  46. return JsonServer::success('', $data, 1);
  47. }
  48. $today = [
  49. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time()))),
  50. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time())) + 86399)
  51. ];
  52. $yesterday = [
  53. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day")))),
  54. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day"))) + 86399)
  55. ];
  56. $days_ago7 = [
  57. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-7 day")))),
  58. date('Y-m-d 23:59:59', time())
  59. ];
  60. $days_ago30 = [
  61. date('Y-m-d 00:00:00', strtotime("-30 day")),
  62. date('Y-m-d 23:59:59', time())
  63. ];
  64. $dividend_cash = ConfigServer::get('platform_setting', 'dividend_cash', 0);
  65. return view('', [
  66. 'today' => $today,
  67. 'yesterday' => $yesterday,
  68. 'days_ago7' => $days_ago7,
  69. 'days_ago30' => $days_ago30,
  70. 'dividend_cash'=>$dividend_cash,
  71. ]);
  72. }
  73. /**
  74. * @notes 分红排队列表
  75. * @return \think\response\Json|\think\response\View
  76. * @throws \think\db\exception\DataNotFoundException
  77. * @throws \think\db\exception\DbException
  78. * @throws \think\db\exception\ModelNotFoundException
  79. * @author suny
  80. * @date 2021/7/13 7:02 下午
  81. */
  82. public function dividend_order()
  83. {
  84. if ($this->request->isAjax()) {
  85. $get = $this->request->get();
  86. $data = DividendCashLogic::order($get);
  87. return JsonServer::success('', $data, 1);
  88. }
  89. $today = [
  90. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time()))),
  91. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time())) + 86399)
  92. ];
  93. $yesterday = [
  94. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day")))),
  95. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day"))) + 86399)
  96. ];
  97. $days_ago7 = [
  98. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-7 day")))),
  99. date('Y-m-d 23:59:59', time())
  100. ];
  101. $days_ago30 = [
  102. date('Y-m-d 00:00:00', strtotime("-30 day")),
  103. date('Y-m-d 23:59:59', time())
  104. ];
  105. return view('', [
  106. 'today' => $today,
  107. 'yesterday' => $yesterday,
  108. 'days_ago7' => $days_ago7,
  109. 'days_ago30' => $days_ago30,
  110. ]);
  111. }
  112. /**
  113. * @notes 排队订单详情
  114. * @return \think\response\View
  115. * @author suny
  116. * @date 2021/7/13 7:02 下午
  117. */
  118. public function detail()
  119. {
  120. $id = $this->request->get('id', '', 'intval');
  121. if ($this->request->isAjax()) {
  122. $get = $this->request->get();
  123. $data = DividendCashLogic::detail($get);
  124. return JsonServer::success('', $data, 1);
  125. }
  126. $today = [
  127. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time()))),
  128. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time())) + 86399)
  129. ];
  130. $yesterday = [
  131. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day")))),
  132. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day"))) + 86399)
  133. ];
  134. $days_ago7 = [
  135. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-7 day")))),
  136. date('Y-m-d 23:59:59', time())
  137. ];
  138. $days_ago30 = [
  139. date('Y-m-d 00:00:00', strtotime("-30 day")),
  140. date('Y-m-d 23:59:59', time())
  141. ];
  142. return view('detail', [
  143. 'id' => $id,
  144. 'today' => $today,
  145. 'yesterday' => $yesterday,
  146. 'days_ago7' => $days_ago7,
  147. 'days_ago30' => $days_ago30,
  148. ]);
  149. }
  150. /**
  151. * @notes 导出账户明细Excel
  152. * @return \think\response\Json
  153. * @throws \think\db\exception\DataNotFoundException
  154. * @throws \think\db\exception\DbException
  155. * @throws \think\db\exception\ModelNotFoundException
  156. * @author 段誉
  157. * @date 2022/4/24 10:20
  158. */
  159. public function cashExport()
  160. {
  161. $params = $this->request->get();
  162. $result = DividendCashLogic::cash($params, true);
  163. if(false === $result) {
  164. return JsonServer::error(DividendCashLogic::getError() ?: '导出失败');
  165. }
  166. return JsonServer::success('', $result);
  167. }
  168. /**
  169. * @notes 导出佣金提现Excel
  170. * @return \think\response\Json
  171. * @throws \think\db\exception\DataNotFoundException
  172. * @throws \think\db\exception\DbException
  173. * @throws \think\db\exception\ModelNotFoundException
  174. * @author 段誉
  175. * @date 2022/4/24 10:20
  176. */
  177. public function orderExport()
  178. {
  179. $params = $this->request->get();
  180. $result = DividendCashLogic::order($params, true);
  181. if(false === $result) {
  182. return JsonServer::error(DividendCashLogic::getError() ?: '导出失败');
  183. }
  184. return JsonServer::success('', $result);
  185. }
  186. /**
  187. * @notes 导出佣金提现Excel
  188. * @return \think\response\Json
  189. * @throws \think\db\exception\DataNotFoundException
  190. * @throws \think\db\exception\DbException
  191. * @throws \think\db\exception\ModelNotFoundException
  192. * @author 段誉
  193. * @date 2022/4/24 10:20
  194. */
  195. public function detailExport()
  196. {
  197. $params = $this->request->get();
  198. $result = DividendCashLogic::detail($params, true);
  199. if(false === $result) {
  200. return JsonServer::error(DividendCashLogic::getError() ?: '导出失败');
  201. }
  202. return JsonServer::success('', $result);
  203. }
  204. }