126 lines
3.5 KiB
PHP
126 lines
3.5 KiB
PHP
<?php
|
|
|
|
|
|
namespace app\admin\logic\finance;
|
|
|
|
|
|
use app\common\basics\Logic;
|
|
use app\common\model\AccountLog;
|
|
use app\common\model\order\Order;
|
|
use app\common\enum\PayEnum;
|
|
use app\common\enum\OrderEnum;
|
|
use app\common\enum\OrderRefundEnum;
|
|
use app\common\enum\AfterSaleEnum;
|
|
use app\common\enum\WithdrawalEnum;
|
|
use app\common\enum\DistributionOrderGoodsEnum;
|
|
use app\common\enum\CardEnum;
|
|
use app\common\model\user\User;
|
|
use app\common\model\shop\Shop;
|
|
use app\common\model\shop\ShopWithdrawal;
|
|
use app\common\model\shop\ShopSettlement;
|
|
use app\common\model\Card;
|
|
|
|
|
|
class CardLogic extends Logic
|
|
{
|
|
/**
|
|
* @Notes: 卡密列表
|
|
*/
|
|
public static function lists($get, $is_export = false)
|
|
{
|
|
|
|
$where = [];
|
|
|
|
|
|
//卡号
|
|
if (isset($get['keyword']) && $get['keyword'] != '') {
|
|
$where[] = ['card_number', '=', $get['keyword']];
|
|
}
|
|
|
|
//提现状态
|
|
if (isset($get['status']) && $get['status'] != '') {
|
|
$where[] = ['status', '=', $get['status']];
|
|
}
|
|
|
|
// if (empty($get['start_time']) && empty($get['end_time'])) {
|
|
// $where[] = ['create_time', '>=', strtotime(date("Y-m-d", time()))];
|
|
// $where[] = ['create_time', '<=', strtotime(date("Y-m-d", time())) + 86399];
|
|
// }
|
|
|
|
// 创建时间
|
|
if (isset($get['start_time']) && $get['start_time'] && isset($get['end_time']) && $get['end_time']) {
|
|
$where[] = ['create_time', 'between', [strtotime($get['start_time']), strtotime($get['end_time'])]];
|
|
// }else{
|
|
//// $where[] = ['w.create_time', 'between', Time::today()];
|
|
}
|
|
|
|
|
|
//var_dump($where);
|
|
|
|
$lists = Card::where($where)
|
|
->field('card_number,id,money,create_time,status,update_time')
|
|
->page($get['page'], $get['limit'])
|
|
->order('id desc')
|
|
->select()->toArray();
|
|
//var_dump($lists);
|
|
$count = Card::where($where)
|
|
->field('card_number,id,money,status,create_time,update_time')
|
|
->order('id desc')
|
|
->count();
|
|
|
|
foreach ($lists as &$item) {
|
|
// if (empty($item['procurement'])) {
|
|
// // 用户不存在
|
|
// $procurement = [
|
|
// 'avatar' => '',
|
|
// 'sn' => '-',
|
|
// 'nickname' => '-',
|
|
// ];
|
|
// } else {
|
|
// $procurement = $item['procurement'];
|
|
// }
|
|
// $item['type_text'] = WithdrawEnum::getTypeDesc($item['type']);
|
|
$item['status_text'] = CardEnum::getStatusDesc($item['status']);
|
|
// $item['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
|
|
// $item['update_time'] = date('Y-m-d H:i:s', $list['update_time']);
|
|
}
|
|
|
|
return ['count' => $count, 'lists' => $lists];
|
|
}
|
|
|
|
public static function getcard($id){
|
|
|
|
$card = Card::where(['id' => $id])->findOrEmpty();
|
|
|
|
if($card->isEmpty()) {
|
|
return [];
|
|
}
|
|
|
|
|
|
return $card->toArray();
|
|
}
|
|
|
|
|
|
public static function edit($post)
|
|
{
|
|
try{
|
|
$data = [
|
|
'id' => $post['id'],
|
|
'card_number' => $post['card_number'],
|
|
'card_secret' => $post['card_secret'],
|
|
'money' => $post['money'],
|
|
'status' => $post['status'],
|
|
'update_time' => time()
|
|
];
|
|
Card::update($data);
|
|
return true;
|
|
}catch(\Exception $e) {
|
|
self::$error = $e->getMessage();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|