|
|
@@ -18,7 +18,6 @@ use think\Db;
|
|
|
use fast\Asset;
|
|
|
use think\Loader ;
|
|
|
use think\Exception;
|
|
|
-
|
|
|
/**
|
|
|
* 首页接口
|
|
|
*/
|
|
|
@@ -78,8 +77,53 @@ class Ledger extends Api
|
|
|
*/
|
|
|
public function coinList()
|
|
|
{
|
|
|
+
|
|
|
$type_id = $this->request->post('query.action'); // 账变类型
|
|
|
$coin_type = $this->request->post('query.coin_type'); // 資金类型
|
|
|
+
|
|
|
+ $where = ['user_id' => $this->auth->id];
|
|
|
+ if ($type_id > 0) $where['action'] = $type_id;
|
|
|
+ switch ($coin_type){
|
|
|
+ case 'token':
|
|
|
+ $paginator = Loader::model('LedgerTokenChangeModel');
|
|
|
+ $res['data']= $paginator->alias('a')
|
|
|
+ ->join('user u', 'a.from_id = u.id and a.action > 9 and a.action < 12', 'LEFT')
|
|
|
+ ->field('a.*, u.address')
|
|
|
+ ->where($where)
|
|
|
+ ->order('a.id DESC')->paginate($this->pageSize);
|
|
|
+ break;
|
|
|
+ case 'frozen':
|
|
|
+ $paginator = (new LedgerFrozenChangeModel());
|
|
|
+ $res['data'] = $paginator->alias('a')
|
|
|
+ ->join('user u', 'a.from_id = u.id and a.action > 2', 'LEFT')
|
|
|
+ ->field('a.*, u.address')
|
|
|
+ ->where($where)
|
|
|
+ ->order('id DESC')->paginate($this->pageSize);
|
|
|
+ break;
|
|
|
+ case 'teac':
|
|
|
+ $paginator = Loader::model('LedgerTeacChangeModel');
|
|
|
+ $res['data'] = $paginator->where($where)->order('id DESC')->paginate($this->pageSize);
|
|
|
+ break;
|
|
|
+ case 'teac_angel':
|
|
|
+ $paginator = (new LedgerTeacAngelChangeModel());
|
|
|
+ $res['data'] = $paginator->where($where)->order('id DESC')->paginate($this->pageSize);
|
|
|
+ break;
|
|
|
+ case 'teac_ecology':
|
|
|
+ $paginator = (new LedgerTeacEcolyChangeModel());
|
|
|
+ $res['data'] = $paginator->where($where)->order('id DESC')->paginate($this->pageSize);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $res['statusList'] = $paginator::getStatusList();
|
|
|
+ $this->success('',$res);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getCoinList($type_id,$coin_type)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
$where = ['user_id' => $this->auth->id];
|
|
|
if ($type_id > 0) $where['action'] = $type_id;
|
|
|
switch ($coin_type){
|
|
|
@@ -277,7 +321,8 @@ class Ledger extends Api
|
|
|
// 更新USDT和账变
|
|
|
$ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TEAC_ANGEL, -$amount, LedgerTeacAngelChangeModel::GiftPay, $user['id']);
|
|
|
|
|
|
- $ledgerWalletModel->changeWalletAccount($user['id'], Asset::TEAC_ANGEL, $real, LedgerTeacChangeModel::GiftReceipt, $this->auth->id);
|
|
|
+ $re=$ledgerWalletModel->changeWalletAccount($user['id'], Asset::TEAC_ANGEL, $real, LedgerTeacAngelChangeModel::GiftReceipt, $this->auth->id);
|
|
|
+
|
|
|
// 提交事务
|
|
|
Db::commit();
|
|
|
} catch (Exception $e) {
|
|
|
@@ -285,7 +330,7 @@ class Ledger extends Api
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage(), null, $e->getCode());
|
|
|
}
|
|
|
- $this->getGiftDesc();
|
|
|
+ $this->success('ok');
|
|
|
}
|
|
|
|
|
|
|