|
|
@@ -9,6 +9,7 @@ use app\admin\model\vote\VoteJoin;
|
|
|
use app\admin\model\vote\VoteOrder;
|
|
|
use app\Request;
|
|
|
use crmeb\repositories\OrderRepository;
|
|
|
+use crmeb\services\CacheService;
|
|
|
use crmeb\services\UtilService;
|
|
|
|
|
|
class VoteController
|
|
|
@@ -99,8 +100,12 @@ class VoteController
|
|
|
public function vote($id, Request $request)
|
|
|
{
|
|
|
if (!$id) return app('json')->fail('参数错误!');
|
|
|
-
|
|
|
$uid = $request->uid();
|
|
|
+ if (CacheService::get('last_time_' . $uid, 0) >= time() - 3) {
|
|
|
+ return app('json')->fail('请勿连续投票!');
|
|
|
+ }
|
|
|
+ CacheService::set('last_time_' . $uid, time(), 60);
|
|
|
+
|
|
|
if (!VoteJoin::valid()->find($id)) return app('json')->fail('参数错误!');
|
|
|
list($num, $payType, $from) = UtilService::postMore([
|
|
|
'num', 'payType', ['from', 'weixin']
|