|
|
@@ -98,7 +98,7 @@ class Ledger extends Api
|
|
|
$paginator = Loader::model('LedgerTeacChangeModel');
|
|
|
$res['data'] = $paginator->where($where)->order('id DESC')->paginate($this->pageSize);
|
|
|
break;
|
|
|
- case 'usdt':
|
|
|
+ case 'teac_angel':
|
|
|
$paginator = (new LedgerUsdtChangeModel());
|
|
|
break;
|
|
|
case 'smh':
|
|
|
@@ -113,14 +113,15 @@ class Ledger extends Api
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Teac资产转账
|
|
|
+ * 标记茶宝资产转账
|
|
|
* @return void
|
|
|
*/
|
|
|
public function frozenTransfer(UserModel $userModel, LedgerWalletModel $ledgerWalletModel)
|
|
|
{
|
|
|
$amount = $this->request->post('amount'); // 茶宝
|
|
|
- $address = $this->request->post('address'); // 地址
|
|
|
- if(empty($amount) || empty($address)){
|
|
|
+ $type = $this->request->post('type/d', 0); // type: 0地址 1uid
|
|
|
+ $account= $this->request->post('account/s', ''); // 账号
|
|
|
+ if(empty($amount) || empty($account)){
|
|
|
$this->error(__('Parameter error'));
|
|
|
}
|
|
|
$real = bcsub($amount, bcmul(getConfig('frozen_transfer'), $amount, 2), 2) ; // 手续费
|
|
|
@@ -128,7 +129,7 @@ class Ledger extends Api
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
|
|
|
- $user = $userModel->getByAddress($address);
|
|
|
+ $user = (empty($type))? $userModel->getByAddress($account): $userModel->getById($account);
|
|
|
if(empty($user)) throw new Exception(__("赠送用户不存在"));
|
|
|
if($user['id'] == $this->auth->id) throw new Exception(__("赠送用户不能是自己"));
|
|
|
|
|
|
@@ -169,8 +170,9 @@ class Ledger extends Api
|
|
|
public function chabaoGift(UserModel $userModel, LedgerWalletModel $ledgerWalletModel)
|
|
|
{
|
|
|
$amount = $this->request->post('amount'); // 茶宝
|
|
|
- $address = $this->request->post('address'); // 地址
|
|
|
- if(empty($amount) || empty($address)){
|
|
|
+ $type = $this->request->post('type/d', 0); // type: 0地址 1uid
|
|
|
+ $account= $this->request->post('account/s', ''); // 账号
|
|
|
+ if(empty($amount) || empty($account)){
|
|
|
$this->error(__('Parameter error'));
|
|
|
}
|
|
|
$real = bcsub($amount, bcmul(getConfig('chabao_giveaway'), $amount, 2), 2) ; // 手续费
|
|
|
@@ -179,7 +181,7 @@ class Ledger extends Api
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
|
|
|
- $user = $userModel->getByAddress($address);
|
|
|
+ $user = (empty($type))? $userModel->getByAddress($account): $userModel->getById($account);
|
|
|
if(empty($user)) throw new Exception(__("赠送用户不存在"));
|
|
|
if($user['id'] == $this->auth->id) throw new Exception(__("赠送用户不能是自己"));
|
|
|
$chabao = $ledgerWalletModel::getWalletChaBao($this->auth->id);
|