|
|
@@ -29,19 +29,19 @@ class ActivityUser extends Controller
|
|
|
'id' => ['required', 'integer', 'min:1'],
|
|
|
]);
|
|
|
$id = request()->input('id');
|
|
|
- $activityUser = ActivityUserService::findOne(['id' => $id, 'status' => 0]);
|
|
|
- if (!$activityUser) throw new Exception("活动已完成或活动不存在", HttpStatus::CUSTOM_ERROR);
|
|
|
- $activityUser->status = 1;
|
|
|
- $activityUser->finish_time = time();
|
|
|
- $activityUser->save();
|
|
|
$params['action'] = request()->action;
|
|
|
- $memberId = $activityUser->member_id;
|
|
|
$amount = request()->input('amount');
|
|
|
$remark = request()->input('remark');
|
|
|
$changeType = request()->input('change_type');
|
|
|
- $key = 'api_request_' . md5($memberId . json_encode($params));
|
|
|
+ $key = 'api_request_' . md5(json_encode($params));
|
|
|
if (Cache::has($key)) throw new Exception("请求太频繁,请稍后再试。", HttpStatus::CUSTOM_ERROR);
|
|
|
Cache::put($key, true, 3);
|
|
|
+ $activityUser = ActivityUserService::findOne(['id' => $id, 'status' => 0]);
|
|
|
+ if (!$activityUser) throw new Exception("活动已完成或活动不存在", HttpStatus::CUSTOM_ERROR);
|
|
|
+ $memberId = $activityUser->member_id;
|
|
|
+ $activityUser->status = 1;
|
|
|
+ $activityUser->finish_time = time();
|
|
|
+ $activityUser->save();
|
|
|
$wallet = WalletModel::where('member_id', $memberId)->first();
|
|
|
if (!$wallet) throw new Exception('用户不存在', HttpStatus::CUSTOM_ERROR);
|
|
|
$availableBalance = bcadd($wallet->available_balance, $amount, 10);
|