Commit 187e0248 by 杨树贤

恢复好友助力提现

parent 60020b50
......@@ -4,6 +4,7 @@
namespace App\Models;
use App\Http\Controllers\ExchangesTask;
use App\Http\Filters\QueryFilter;
use App\Tasks\IntegralBillTask;
use App\Tasks\SendNoticeTask;
......@@ -76,14 +77,32 @@ class Assist extends Model
if ($result === false) {
return false;
}
// //去判断是不是有两个好友助力了
// $assistCount = DB::table('user_exchanges')->where('id', $exchangeId)
// ->value('assist_count');
// //如果$assistCount=2,就代表是有两个好友助力,应该去判断是否自动提现
// //todo:但是由于目前微信的红包自动转账还没有申请下来,所以目前先不做处理
// if ($assistCount == 2) {
// //todo:还有一个问题就是提现成功后,要清除对应ic_welfare_assists里面的exchange_id的数据
// }
//去判断是不是有两个好友助力了
$assistCount = DB::table('user_exchanges')->where('id', $exchangeId)
->value('assist_count');
//如果$assistCount=2,就代表是有两个好友助力,应该去判断是否自动提现
if ($assistCount == 2) {
//获取userExchange
$userExchange = DB::table('user_exchanges')->where('id', $data['exchange_id'])->first();
$userExchange = (array)$userExchange;
if ($userExchange['amount'] < 20 && $userExchange['type'] == 2) {
$ic_exchange_settings['amount'] = $userExchange['amount'];
$Task = new ExchangesTask($userExchange, $ic_exchange_settings);
$Task->delay(5);
$result = Task::deliver($Task);
if (!$result) {
ErrorLog(ErrorCode(1, 9), '提现任务推送失败,提现ID:' . $userExchange['id']);
return false;
}
Log::info('进行提现任务投递成功');
return true;
} else {
//如果是大于20块的,需要审核,这步就什么都不做
return true;
}
}
} else {
return false;
}
......@@ -124,7 +143,7 @@ class Assist extends Model
public function sendNotice($userId)
{
$redis = new RedisModel();
$user = $redis->hget('ic_user',$userId);
$user = $redis->hget('ic_user', $userId);
if ($user) {
//发送通知
$task = new SendNoticeTask('IC_Code_Exchange', $user, $userId);
......
21975
\ No newline at end of file
23271
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment