|
@@ -9,10 +9,12 @@
|
|
|
namespace app\admin\controller\finance;
|
|
|
|
|
|
use app\admin\controller\AuthController;
|
|
|
+use app\admin\model\order\StoreOrderCartInfo;
|
|
|
+use app\admin\model\wechat\WechatUser;
|
|
|
use think\facade\Route as Url;
|
|
|
use crmeb\services\JsonService;
|
|
|
use app\admin\model\user\UserExtract as UserExtractModel;
|
|
|
-use crmeb\services\{UtilService as Util, FormBuilder as Form};
|
|
|
+use crmeb\services\{PHPExcelService, UtilService as Util, FormBuilder as Form};
|
|
|
|
|
|
/**
|
|
|
* 用户提现管理
|
|
@@ -52,6 +54,82 @@ class UserExtract extends AuthController
|
|
|
return $this->fetch();
|
|
|
}
|
|
|
|
|
|
+ public function excel()
|
|
|
+ {
|
|
|
+ $data = Util::getMore([
|
|
|
+ ['status', ''],
|
|
|
+ ['nickname', ''],
|
|
|
+ ['extract_type', ''],
|
|
|
+ ['nireid', ''],
|
|
|
+ ['date', ''],
|
|
|
+ ], $this->request);
|
|
|
+ $where = [];
|
|
|
+ if ($data['status'] == 0) {
|
|
|
+ $where[] = ['a.status', '=', 0];
|
|
|
+ }elseif ($data['status'] == 1){
|
|
|
+ $where[] = ['a.status', '=', 1];
|
|
|
+ }elseif ($data['status'] < 0){
|
|
|
+ $where[] = ['a.status', '=', -1];
|
|
|
+ }
|
|
|
+ if ($data['nickname']) $where[] = ['a.nickname', '=', $data['nickname']];
|
|
|
+ if ($data['extract_type']) $where[] = ['a.extract_type', '=', $data['extract_type']];
|
|
|
+ if ($data['nireid']) $where[] = ['a.nireid', '=', $data['nireid']];
|
|
|
+ $model = UserExtractModel::where($where)->alias('a')
|
|
|
+ ->field('a.*,b.uid,b.nickname,b.phone')
|
|
|
+ ->leftJoin('user b', 'b.uid = a.uid');
|
|
|
+ if ($data['date']){
|
|
|
+ list($startTime, $endTime) = explode(' - ', $data['date']);
|
|
|
+ $model = $model->whereBetweenTime('a.add_time', $startTime, $endTime);
|
|
|
+ }
|
|
|
+ $list = $model->select();
|
|
|
+ if ($list) self::SaveExcel($list);
|
|
|
+ return JsonService::fail('没有数据');
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 保存并下载excel
|
|
|
+ * $list array
|
|
|
+ * return
|
|
|
+ */
|
|
|
+ public static function SaveExcel($list)
|
|
|
+ {
|
|
|
+ $export = [];
|
|
|
+ foreach ($list as $index => $item) {
|
|
|
+ if ($item['extract_type'] == 'weixin'){
|
|
|
+ $type = '微信';
|
|
|
+ $account = $item['wechat'];
|
|
|
+ }elseif ($item['extract_type'] == 'alipay'){
|
|
|
+ $type = '支付宝';
|
|
|
+ $account = $item['alipay_code'];
|
|
|
+ }elseif ($item['extract_type'] == 'bank'){
|
|
|
+ $type = '银行卡';
|
|
|
+ $account = $item['bank_code'];
|
|
|
+ }
|
|
|
+ if ($item['status'] == 0) $status = '审核中';
|
|
|
+ if ($item['status'] == 1) $status = '已提现';
|
|
|
+ if ($item['status'] < 0) $status = '未通过';
|
|
|
+
|
|
|
+
|
|
|
+ $export[] = [
|
|
|
+ $item['uid'],
|
|
|
+ $item['nickname'],
|
|
|
+ $item['phone'],
|
|
|
+ $item['extract_price'],
|
|
|
+ $type,
|
|
|
+ $account,
|
|
|
+ $item['bank_address'],
|
|
|
+ $status,
|
|
|
+ $item['fail_msg'],
|
|
|
+ date('Y-m-d H:i:s', $item['add_time'])
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ PHPExcelService::setExcelHeader(['UID', '用户昵称', '手机号', '提现金额', '提现方式','微信|支付宝|银行卡', '银行卡地址', '状态',
|
|
|
+ '未通过原因', '提现时间'])
|
|
|
+ ->setExcelTile('提现导出' . date('YmdHis', time()), '提现信息' . time(), ' 生成时间:' . date('Y-m-d H:i:s', time()))
|
|
|
+ ->setExcelContent($export)
|
|
|
+ ->ExcelSave();
|
|
|
+ }
|
|
|
+
|
|
|
public function edit($id)
|
|
|
{
|
|
|
if (!$id) return $this->failed('数据不存在');
|