截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

User.php 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  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\model\AccountLog;
  22. use app\common\server\JsonServer;
  23. use app\admin\logic\finance\WithdrawLogic;
  24. use app\common\model\order\Order as OrderModel;
  25. use app\common\model\Client_;
  26. use app\common\enum\PayEnum;
  27. /**
  28. * 财务-会员相关
  29. * Class User
  30. * @package app\admin\controller\finance
  31. */
  32. class User extends AdminBase
  33. {
  34. /**
  35. * @notes 会员佣金提现列表
  36. * @return \think\response\Json|\think\response\View
  37. * @throws \think\db\exception\DataNotFoundException
  38. * @throws \think\db\exception\DbException
  39. * @throws \think\db\exception\ModelNotFoundException
  40. * @author suny
  41. * @date 2021/7/13 7:01 下午
  42. */
  43. public function withdrawal()
  44. {
  45. if ($this->request->isAjax()) {
  46. $get = $this->request->get();
  47. $data = WithdrawLogic::lists($get);
  48. return JsonServer::success('', $data, 1);
  49. }
  50. $today = [
  51. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time()))),
  52. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time())) + 86399)
  53. ];
  54. $yesterday = [
  55. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day")))),
  56. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day"))) + 86399)
  57. ];
  58. $days_ago7 = [
  59. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-7 day")))),
  60. date('Y-m-d 23:59:59', time())
  61. ];
  62. $days_ago30 = [
  63. date('Y-m-d 00:00:00', strtotime("-30 day")),
  64. date('Y-m-d 23:59:59', time())
  65. ];
  66. $summary = WithdrawLogic::summary();
  67. return view('', [
  68. 'today' => $today,
  69. 'yesterday' => $yesterday,
  70. 'days_ago7' => $days_ago7,
  71. 'days_ago30' => $days_ago30,
  72. 'summary' => $summary
  73. ]);
  74. }
  75. /**
  76. * @notes 会员佣金明细列表
  77. * @return \think\response\Json|\think\response\View
  78. * @throws \think\db\exception\DataNotFoundException
  79. * @throws \think\db\exception\DbException
  80. * @throws \think\db\exception\ModelNotFoundException
  81. * @author suny
  82. * @date 2021/7/13 7:01 下午
  83. */
  84. public function commission()
  85. {
  86. if ($this->request->isAjax()) {
  87. $get = $this->request->get();
  88. $data = WithdrawLogic::commission($get);
  89. return JsonServer::success('', $data, 1);
  90. }
  91. $today = [
  92. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time()))),
  93. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time())) + 86399)
  94. ];
  95. $yesterday = [
  96. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day")))),
  97. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day"))) + 86399)
  98. ];
  99. $days_ago7 = [
  100. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-7 day")))),
  101. date('Y-m-d 23:59:59', time())
  102. ];
  103. $days_ago30 = [
  104. date('Y-m-d 00:00:00', strtotime("-30 day")),
  105. date('Y-m-d 23:59:59', time())
  106. ];
  107. return view('', [
  108. 'today' => $today,
  109. 'yesterday' => $yesterday,
  110. 'days_ago7' => $days_ago7,
  111. 'days_ago30' => $days_ago30,
  112. 'source_type' => AccountLog::getEarningsChange()
  113. ]);
  114. }
  115. /**
  116. * @notes 充值明细列表
  117. * @return \think\response\Json|\think\response\View
  118. * @author suny
  119. * @date 2021/7/13 7:01 下午
  120. */
  121. public function recharge()
  122. {
  123. if ($this->request->isAjax()) {
  124. $get = $this->request->get();
  125. $data = WithdrawLogic::recharge($get);
  126. return JsonServer::success('', $data, 1);
  127. }
  128. // 订单状态
  129. $order_status = OrderModel::getOrderStatus(true);
  130. // 订单类型
  131. $order_type = OrderModel::getOrderType(true);
  132. // 订单来源
  133. $order_source = Client_::getClient(true);
  134. unset($order_source[2]);
  135. // 支付方式
  136. $pay_way = PayEnum::getPayWay(true);
  137. unset($pay_way[3], $pay_way[4]);
  138. // 配送方式
  139. $today = [
  140. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time()))),
  141. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time())) + 86399)
  142. ];
  143. $yesterday = [
  144. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day")))),
  145. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day"))) + 86399)
  146. ];
  147. $days_ago7 = [
  148. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-7 day")))),
  149. date('Y-m-d 23:59:59', time())
  150. ];
  151. $days_ago30 = [
  152. date('Y-m-d 00:00:00', strtotime("-30 day")),
  153. date('Y-m-d 23:59:59', time())
  154. ];
  155. return view('', [
  156. 'order_status' => $order_status,
  157. 'order_type' => $order_type,
  158. 'order_source' => $order_source,
  159. 'pay_way' => $pay_way,
  160. 'today' => $today,
  161. 'yesterday' => $yesterday,
  162. 'days_ago7' => $days_ago7,
  163. 'days_ago30' => $days_ago30,
  164. ]);
  165. }
  166. /**
  167. * @notes 账户明细列表
  168. * @return \think\response\Json|\think\response\View
  169. * @throws \think\db\exception\DataNotFoundException
  170. * @throws \think\db\exception\DbException
  171. * @throws \think\db\exception\ModelNotFoundException
  172. * @author suny
  173. * @date 2021/7/13 7:02 下午
  174. */
  175. public function account()
  176. {
  177. if ($this->request->isAjax()) {
  178. $get = $this->request->get();
  179. $data = WithdrawLogic::account($get);
  180. return JsonServer::success('', $data, 1);
  181. }
  182. $today = [
  183. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time()))),
  184. date('Y-m-d H:i:s', strtotime(date("Y-m-d", time())) + 86399)
  185. ];
  186. $yesterday = [
  187. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day")))),
  188. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-1 day"))) + 86399)
  189. ];
  190. $days_ago7 = [
  191. date('Y-m-d H:i:s', strtotime(date("Y-m-d", strtotime("-7 day")))),
  192. date('Y-m-d 23:59:59', time())
  193. ];
  194. $days_ago30 = [
  195. date('Y-m-d 00:00:00', strtotime("-30 day")),
  196. date('Y-m-d 23:59:59', time())
  197. ];
  198. return view('', [
  199. 'today' => $today,
  200. 'yesterday' => $yesterday,
  201. 'days_ago7' => $days_ago7,
  202. 'days_ago30' => $days_ago30,
  203. ]);
  204. }
  205. /**
  206. * @notes 会员佣金提现详情
  207. * @return \think\response\View
  208. * @author suny
  209. * @date 2021/7/13 7:02 下午
  210. */
  211. public function withdraw_detail()
  212. {
  213. $id = $this->request->get('id', '', 'intval');
  214. $detail = WithdrawLogic::detail($id);
  215. return view('detail', [
  216. 'detail' => $detail
  217. ]);
  218. }
  219. /**
  220. * @notes 显示提现审核界面
  221. * @return \think\response\View
  222. * @author suny
  223. * @date 2021/7/13 7:02 下午
  224. */
  225. public function withdraw_review()
  226. {
  227. $id = $this->request->get('id', '', 'intval');
  228. return view('review', [
  229. 'id' => $id
  230. ]);
  231. }
  232. /**
  233. * @notes 审核通过
  234. * @return \think\response\Json
  235. * @throws \think\db\exception\DataNotFoundException
  236. * @throws \think\db\exception\DbException
  237. * @throws \think\db\exception\ModelNotFoundException
  238. * @throws \think\exception\DbException
  239. * @author suny
  240. * @date 2021/7/13 7:02 下午
  241. */
  242. public function confirm()
  243. {
  244. if ($this->request->isAjax()) {
  245. $post = $this->request->post();
  246. $result = WithdrawLogic::confirm($post);
  247. if ($result['code']) {
  248. return JsonServer::success($result['msg']);
  249. } else {
  250. return JsonServer::error($result['msg']);
  251. }
  252. }
  253. }
  254. /**
  255. * @notes 审核拒绝
  256. * @return \think\response\Json
  257. * @throws \think\exception\PDOException
  258. * @author suny
  259. * @date 2021/7/13 7:02 下午
  260. */
  261. public function refuse()
  262. {
  263. if ($this->request->isAjax()) {
  264. $post = $this->request->post();
  265. WithdrawLogic::refuse($post);
  266. return JsonServer::success('已拒绝提现');
  267. }
  268. }
  269. /**
  270. * @notes 显示提现转账界面
  271. * @return \think\response\View
  272. * @author suny
  273. * @date 2021/7/13 7:02 下午
  274. */
  275. public function transfer()
  276. {
  277. $id = $this->request->get('id', '', 'intval');
  278. return view('', [
  279. 'id' => $id
  280. ]);
  281. }
  282. /**
  283. * @notes 转账失败
  284. * @return \think\response\Json
  285. * @throws \think\db\exception\DataNotFoundException
  286. * @throws \think\db\exception\DbException
  287. * @throws \think\db\exception\ModelNotFoundException
  288. * @throws \think\exception\DbException
  289. * @author suny
  290. * @date 2021/7/13 7:02 下午
  291. */
  292. public function transferFail()
  293. {
  294. $post = $this->request->post();
  295. $result = WithdrawLogic::transferFail($post);
  296. if ($result['code']) {
  297. return JsonServer::success($result['msg']);
  298. } else {
  299. return JsonServer::error($result['msg']);
  300. }
  301. }
  302. /**
  303. * @notes 转账成功
  304. * @return \think\response\Json
  305. * @author suny
  306. * @date 2021/7/13 7:02 下午
  307. */
  308. public function transferSuccess()
  309. {
  310. $post = $this->request->post();
  311. $result = WithdrawLogic::transferSuccess($post);
  312. if ($result['code']) {
  313. return JsonServer::success($result['msg']);
  314. } else {
  315. return JsonServer::error($result['msg']);
  316. }
  317. }
  318. /**
  319. * @notes 提现结果查询
  320. * @return \think\response\Json
  321. * @author suny
  322. * @date 2021/7/13 7:02 下午
  323. */
  324. public function search()
  325. {
  326. $id = $this->request->post('id', '', 'intval');
  327. $result = WithdrawLogic::search($id);
  328. if ($result['code']) {
  329. return JsonServer::success($result['msg']);
  330. } else {
  331. return JsonServer::error($result['msg']);
  332. }
  333. }
  334. /**
  335. * @notes 提现失败
  336. * @return \think\response\Json
  337. * @throws \think\db\exception\DataNotFoundException
  338. * @throws \think\db\exception\DbException
  339. * @throws \think\db\exception\ModelNotFoundException
  340. * @throws \think\exception\DbException
  341. * @author suny
  342. * @date 2021/7/13 7:03 下午
  343. */
  344. public function withdrawFailed()
  345. {
  346. $id = $this->request->post('id', '', 'intval');
  347. WithdrawLogic::withdrawFailed($id);
  348. return JsonServer::success('提现失败已回退佣金');
  349. }
  350. /**
  351. * @notes 导出充值明细Excel
  352. * @return \think\response\Json
  353. * @throws \think\db\exception\DataNotFoundException
  354. * @throws \think\db\exception\DbException
  355. * @throws \think\db\exception\ModelNotFoundException
  356. * @author 段誉
  357. * @date 2022/4/24 10:20
  358. */
  359. public function rechargeExport()
  360. {
  361. $params = $this->request->get();
  362. $result = WithdrawLogic::recharge($params, true);
  363. if(false === $result) {
  364. return JsonServer::error(WithdrawLogic::getError() ?: '导出失败');
  365. }
  366. return JsonServer::success('', $result);
  367. }
  368. /**
  369. * @notes 导出账户明细Excel
  370. * @return \think\response\Json
  371. * @throws \think\db\exception\DataNotFoundException
  372. * @throws \think\db\exception\DbException
  373. * @throws \think\db\exception\ModelNotFoundException
  374. * @author 段誉
  375. * @date 2022/4/24 10:20
  376. */
  377. public function accountExport()
  378. {
  379. $params = $this->request->get();
  380. $result = WithdrawLogic::account($params, true);
  381. if(false === $result) {
  382. return JsonServer::error(WithdrawLogic::getError() ?: '导出失败');
  383. }
  384. return JsonServer::success('', $result);
  385. }
  386. /**
  387. * @notes 导出佣金明细Excel
  388. * @return \think\response\Json
  389. * @throws \think\db\exception\DataNotFoundException
  390. * @throws \think\db\exception\DbException
  391. * @throws \think\db\exception\ModelNotFoundException
  392. * @author 段誉
  393. * @date 2022/4/24 10:20
  394. */
  395. public function commissionExport()
  396. {
  397. $params = $this->request->get();
  398. $result = WithdrawLogic::commission($params, true);
  399. if(false === $result) {
  400. return JsonServer::error(WithdrawLogic::getError() ?: '导出失败');
  401. }
  402. return JsonServer::success('', $result);
  403. }
  404. /**
  405. * @notes 导出佣金提现Excel
  406. * @return \think\response\Json
  407. * @throws \think\db\exception\DataNotFoundException
  408. * @throws \think\db\exception\DbException
  409. * @throws \think\db\exception\ModelNotFoundException
  410. * @author 段誉
  411. * @date 2022/4/24 10:20
  412. */
  413. public function withdrawalExport()
  414. {
  415. $params = $this->request->get();
  416. $result = WithdrawLogic::lists($params, true);
  417. if(false === $result) {
  418. return JsonServer::error(WithdrawLogic::getError() ?: '导出失败');
  419. }
  420. return JsonServer::success('', $result);
  421. }
  422. }