thinkphp 加cache锁

admin6个月前Thinkphp84
$lockKey = 'user_lock_requirement' . $this->user_id;
$isLocked = Cache::get($lockKey); if ($isLocked) {
    $this->error('请勿重复点击');
}
$expire = 3;
$setLockSuccess = Cache::set($lockKey, 1, $expire);
Cache::rm($lockKey);

相关文章

微信卡卷html 领取的签名

/* * 创建签名 */public function sign(){    $cardId = 'p7YU46qidv5_baigH0Ds4ObP7MDg'; &...

fastadmin上传图片并压缩并加水印

public function image() { // $url = 'uploads/20241026/8f32aebb8be904c5c01ea80de534880...

支付宝生成支付二维码

public function alipay($pay_order_no = '20241114123331000000195475', $uid = 1, $url = '') {...

文章中图片路径替换

if ($list['post_content']) { $list['post_content'] = html_entity_decode($list['post_content']);...

微信公众号h5登录

public function getCode(){    $order_id = '95896766';    $config = confi...

查找重复的数据

$data = Db::name('about_product_list')->field('id,title,count(id) as num')->gr...