Commit a51de744 by 杨树贤

fix bug

parent 8682c4ac
...@@ -7,6 +7,7 @@ use App\Models\UserExchange; ...@@ -7,6 +7,7 @@ use App\Models\UserExchange;
use Common\Model\RedisModel; use Common\Model\RedisModel;
use Hhxsv5\LaravelS\Swoole\Task\Task; use Hhxsv5\LaravelS\Swoole\Task\Task;
use DB; use DB;
use Illuminate\Support\Facades\Log;
class ExchangesTask extends Task class ExchangesTask extends Task
{ {
...@@ -25,12 +26,14 @@ class ExchangesTask extends Task ...@@ -25,12 +26,14 @@ class ExchangesTask extends Task
//验证这个订单是否充值,防止重复提现 //验证这个订单是否充值,防止重复提现
$Redis = new RedisModel(); $Redis = new RedisModel();
$Cache = $Redis->hsetnx('ic_user_exchanges' , $this->data['id'].'_'.$this->data['user_id'] , 1); $Cache = $Redis->hsetnx('ic_user_exchanges' , $this->data['id'].'_'.$this->data['user_id'] , 1);
Log::error('进来了');
Log::error($Cache);
if(!$Cache) if(!$Cache)
return true; return true;
try{ try{
DB::beginTransaction(); DB::beginTransaction();
Log::error('事务');
//先修改提现记录状态 //先修改提现记录状态
$UserExchangModel = new UserExchange(); $UserExchangModel = new UserExchange();
$Exchang = [ $Exchang = [
......
...@@ -80,11 +80,16 @@ class UserExchange extends Model ...@@ -80,11 +80,16 @@ class UserExchange extends Model
if ($data['status'] == 1) { if ($data['status'] == 1) {
$exchange['amount'] = $exchangedAmount; $exchange['amount'] = $exchangedAmount;
if ($exchangedAmount > 100) { if ($exchangedAmount > 100) {
Log::Error('出现大于200的兑换申请!'); Log::Error('出现大于100的兑换申请!');
return false; return false;
} }
$data['id'] = $id;
$task = new ExchangesTask($data, $exchange, $data['audit_id']); $task = new ExchangesTask($data, $exchange, $data['audit_id']);
$result = Task::deliver($task);
if (!$result) {
Log::error('后台审核任务失败');
}
} elseif ($data['status'] == -1) { } elseif ($data['status'] == -1) {
//如果是拒绝审核,那就是我直接操作数据库就完事了 //如果是拒绝审核,那就是我直接操作数据库就完事了
$result = DB::table('user_exchanges')->where('id', $id) $result = DB::table('user_exchanges')->where('id', $id)
......
2310 3994
\ No newline at end of file \ 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