|
|
@@ -94,6 +94,7 @@ class Exchange extends Api
|
|
|
if($check_user >= $welfare_config['limit_num']) $this->error('每人限制兑换' .$welfare_config['limit_num'].'套,您已达上限');
|
|
|
}
|
|
|
$token = 0;
|
|
|
+ $bonus = 0; //推广u或茶宝数量
|
|
|
$order_no = date('YmdHis') . rand(1000, 9999);
|
|
|
$inster_data = [
|
|
|
'order_no' => $order_no,
|
|
|
@@ -165,6 +166,7 @@ class Exchange extends Api
|
|
|
foreach ($result_usdt['data'] as $value) {
|
|
|
if ($value['amount'] == $welfare_config->usdt_num) {
|
|
|
$usdt_list[] = $value;
|
|
|
+ $bonus += $value['amount'];
|
|
|
}
|
|
|
}
|
|
|
if (empty($usdt_list)) {
|
|
|
@@ -191,7 +193,8 @@ class Exchange extends Api
|
|
|
}
|
|
|
|
|
|
if($type_id == 1){
|
|
|
- $inster_data['amount_chabao'] =$token= $welfare_config->chabao_num;
|
|
|
+ $inster_data['amount_chabao'] =$token= $bonus= $welfare_config->chabao_num;
|
|
|
+
|
|
|
}
|
|
|
try {
|
|
|
Db::startTrans();
|
|
|
@@ -208,6 +211,10 @@ class Exchange extends Api
|
|
|
if($token > 0){
|
|
|
$ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$token, LedgerTokenChangeModel::RwaExchangeRecord, 0);
|
|
|
}
|
|
|
+ //推广奖励
|
|
|
+ if($bonus > 0 && !empty($welfare_config->is_promotion) && $welfare_config->promotion_product > 0){
|
|
|
+ ProductWelfareRede::sendPromotionReward($this->auth->id, explode(',', $welfare_config->product_id), $welfare_config->promotion_product, $bonus, $welfare_config->promotion_one,$welfare_config->promotion_two, $welfare_config->promotion_thre);
|
|
|
+ }
|
|
|
//发放产品奖励
|
|
|
$rs =WelfareLoginc::setUserWelfareProduct($this->auth->id, $welfare_config['product_id'], ProductOrder::RwaExchange);
|
|
|
Log::info($rs, '发放产品奖励状态');
|