|
|
@@ -49,6 +49,7 @@ class Ledger extends Api
|
|
|
];
|
|
|
$this->success('', $res);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 资产变动明细
|
|
|
* @return void
|
|
|
@@ -86,10 +87,10 @@ class Ledger extends Api
|
|
|
break;
|
|
|
}
|
|
|
$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);
|
|
|
+ ->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);
|
|
|
$res['statusList'] = LedgerWalletModel::getStatusList();
|
|
|
$this->success('',$res);
|
|
|
}
|
|
|
@@ -118,51 +119,6 @@ class Ledger extends Api
|
|
|
$this->success('',$res);
|
|
|
}
|
|
|
|
|
|
- public function actionGet()
|
|
|
- {
|
|
|
- $asset = $this->request->post('type'); // 资产类型
|
|
|
- $resp = [];
|
|
|
- switch ($asset) {
|
|
|
- case 1:
|
|
|
- $resp = [
|
|
|
- $this->getActionValueText(Action::All),
|
|
|
- $this->getActionValueText(Action::PowerRentalPower),
|
|
|
- $this->getActionValueText(Action::PowerDirectAward),
|
|
|
- $this->getActionValueText(Action::PowerTeamAward),
|
|
|
- $this->getActionValueText(Action::PowerEqualAward),
|
|
|
- $this->getActionValueText(Action::PowerBonusAward),
|
|
|
- $this->getActionValueText(Action::PowerCommunityBonusAward),
|
|
|
- ];
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- $resp = [
|
|
|
- $this->getActionValueText(Action::All),
|
|
|
- $this->getActionValueText(Action::UsdtRentalPower),
|
|
|
- $this->getActionValueText(Action::UsdtGenerateProfit),
|
|
|
- $this->getActionValueText(Action::UsdtWeightDividend),
|
|
|
- $this->getActionValueText(Action::UsdtWithdrawCash),
|
|
|
- $this->getActionValueText(Action::UsdtWithdrawReturn),
|
|
|
- $this->getActionValueText(Action::UsdtRegBonus),
|
|
|
- $this->getActionValueText(Action::UsdtCmmunityBonus),
|
|
|
- ];
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- $resp = [
|
|
|
- $this->getActionValueText(Action::All),
|
|
|
- $this->getActionValueText(Action::TokenAllocateEtc),
|
|
|
- ];
|
|
|
- break;
|
|
|
- default:
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
- break;
|
|
|
- }
|
|
|
- $this->success('', $resp);
|
|
|
- }
|
|
|
-
|
|
|
- private function getActionValueText(int $action): array
|
|
|
- {
|
|
|
- return ['value' => $action, 'text' => Action::getText($action)];
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 茶宝赠送明细
|
|
|
@@ -170,7 +126,6 @@ class Ledger extends Api
|
|
|
*/
|
|
|
public function chabao()
|
|
|
{
|
|
|
-
|
|
|
$this->success('', ['value' => getConfig('chabao_giveaway'), 'text' => getConfig('chabao_giveaway_txt')]);
|
|
|
}
|
|
|
|
|
|
@@ -219,9 +174,7 @@ class Ledger extends Api
|
|
|
public function tokenList()
|
|
|
{
|
|
|
$type = $this->request->post('query.action'); // 账变类型
|
|
|
- $where = [
|
|
|
- 'user_id' => $this->auth->getTokenUserID(),
|
|
|
- ];
|
|
|
+ $where = ['user_id' => $this->auth->getTokenUserID()];
|
|
|
if ($type != Action::All) {
|
|
|
$where['action'] = $type;
|
|
|
}
|
|
|
@@ -239,7 +192,6 @@ class Ledger extends Api
|
|
|
{
|
|
|
//post 获取过来的数据格式为:{"code":"1","data":{"orderNo":"1768","tx_hash":"xx4545"}}
|
|
|
$parems = $this->request->post();
|
|
|
-
|
|
|
Log::write('提现自动打款回调参数:','info');
|
|
|
Log::info(json_encode($parems));
|
|
|
|
|
|
@@ -250,9 +202,7 @@ class Ledger extends Api
|
|
|
if($parems['code'] != 1){
|
|
|
$this->error("本次提现失败");
|
|
|
}
|
|
|
-
|
|
|
$rs_data = $parems['data'];
|
|
|
-
|
|
|
$info = (new OfflineWithdrawRecordModel())
|
|
|
->where('id', $rs_data['orderNo'])
|
|
|
->find();
|
|
|
@@ -277,60 +227,7 @@ class Ledger extends Api
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- /**
|
|
|
- * 提现自动打款回调
|
|
|
- * 接口回调信息格式:
|
|
|
- * companyWithdrawId=126&sign=8e3c6aee53e3ea4ff974c1d80f4e8beb&status=1&txId=0x39ce05a0698ff2b7459ca707703fd48937dd958422d98ebade6b4f5188b70995
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function withdrawCallback()
|
|
|
- {
|
|
|
-// $body1 = file_get_contents("php://input");
|
|
|
-// Log::write('提现自动打款回调1:' . $body1, 'info');
|
|
|
-//
|
|
|
-// $body = $this->request->post();
|
|
|
- $body = file_get_contents("php://input");
|
|
|
- //$body = 'companyWithdrawId=126&sign=8e3c6aee53e3ea4ff974c1d80f4e8beb&status=1&txId=0x39ce05a0698ff2b7459ca707703fd48937dd958422d98ebade6b4f5188b70995';
|
|
|
- Log::write('提现自动打款回调:' . $body, 'info');
|
|
|
-
|
|
|
- if(empty($body)){
|
|
|
- return;
|
|
|
- }
|
|
|
- $parems = explode('&', $body);
|
|
|
-
|
|
|
- $req_arr = [];
|
|
|
- foreach ($parems as $item){
|
|
|
- $temp = explode('=', $item);
|
|
|
- $req_arr[$temp[0]] = $temp[1];
|
|
|
- }
|
|
|
- Log::write('提现自动打款回调参数:','info');
|
|
|
- Log::info(json_encode($req_arr));
|
|
|
-
|
|
|
- $info = (new OfflineWithdrawRecordModel())
|
|
|
- ->where('id', $req_arr['companyWithdrawId'])
|
|
|
- ->find();
|
|
|
- if(empty($info)){
|
|
|
- $this->error("当前提现信息不存在");
|
|
|
- }
|
|
|
- if($info['status'] == OfflineWithdrawRecordModel::StatusSuccessAuto){
|
|
|
- $this->success("更新成功");
|
|
|
- }
|
|
|
- if($info['status'] == OfflineWithdrawRecordModel::StatusConfirm){
|
|
|
- $is_update = (new OfflineWithdrawRecordModel())
|
|
|
- ->where('id', $req_arr['companyWithdrawId'])
|
|
|
- ->update([
|
|
|
- 'tx_hash' => $req_arr['txId'],
|
|
|
- 'status' => OfflineWithdrawRecordModel::StatusSuccessAuto,
|
|
|
- 'update_time' => time(),
|
|
|
- ]);
|
|
|
- if($is_update){
|
|
|
- $this->success("更新成功");
|
|
|
- }else{
|
|
|
- $this->error("更新失败");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
// 获取充值地址
|
|
|
public function getAddress()
|
|
|
{
|