feat: 扫码签到功能

This commit is contained in:
2026-03-19 17:41:23 +08:00
parent e2c8ae752d
commit 1156b2f4e2
9 changed files with 457 additions and 349 deletions

View File

@@ -1,6 +1,6 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
@@ -53,6 +53,7 @@ return [
'Verification_method 1' => '自助签到(范围1000米)',
'Verification_method 2' => '管理员核销',
'Applet_activity_qrcode_path' => '活动小程序码',
'Checked_in_qrcode' => '签到二维码',
'Points_status' => '设置是否获得积分',
'Points_status 1' => '是',
'Points_status 2' => '否',

View File

@@ -1,6 +1,6 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
@@ -20,6 +20,9 @@ return [
'State 3' => '退款中',
'State 4' => '已退款',
'State 5' => '已驳回',
'check_in_status' => '签到状态',
'checked_in' => '已签到',
'unchecked_in' => '未签到',
'Is_sign_in' => '核销状态',
'Is_sign_in 1' => '已核销',
'Is_sign_in 2' => '未核销',

View File

@@ -1,6 +1,6 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力商协会发展
// | 麦沃德科技赋能开发者,助力商协会发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 www.wdsxh.cn All rights reserved.
// +----------------------------------------------------------------------
@@ -42,7 +42,8 @@ class Activity extends Model
'state_text',
'is_verifying_text',
'status_text',
'applet_activity_qrcode_path'
'applet_activity_qrcode_path',
'checked_in_qrcode'
];
@@ -186,6 +187,7 @@ class Activity extends Model
$response = $app->app_code->getUnlimit($ids, [
'page' => $path,
'check_path' => false,
'env_version' => 'develop',
]);
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
@@ -202,6 +204,48 @@ class Activity extends Model
return $value;
}
public function getCheckedInQrcodeAttr($value, $data)
{
$row = $data;
$row['createtime'] = self::where('id',$row['id'])->value('createtime');
$save_path = '/uploads/wdsxh/check_in_qrcode/'.$row['id'].'/'.$row['createtime'].'.png';
if (is_file(ROOT_PATH."public".$save_path)) {
$value = $save_path;
} else {
if(isset($row['id'])) {
$configObj = (new \app\admin\model\wdsxh\Config())->where('id',1)->find();
if (!empty($configObj['applet_appid']) && !empty($configObj['applet_secret'])) {
$path = 'pagesActivity/index/details';
$config = [
'app_id' => $configObj['applet_appid'],
'secret' => $configObj['applet_secret'],
'response_type' => 'array',
'log' => [
'level' => 'debug',
],
];
$app = Factory::miniProgram($config);
$scene = http_build_query(['id' => $row['id'], 'op' => 'checked_in']);
$response = $app->app_code->getUnlimit($scene, [
'page' => $path,
'check_path' => false,
'env_version' => 'develop',
]);
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
$response->saveAs('uploads/wdsxh/check_in_qrcode/'.$row['id'], $row['createtime'].'.png');
$value = $save_path;
}
}
}
}
if (!empty($value)) {
$value = request()->domain().$value;
}
return $value;
}
public function getPointsStatusList()
{
return ['2' => __('Points_status 2'), '1' => __('Points_status 1')];
@@ -216,6 +260,4 @@ class Activity extends Model
{
return ['1' => __('启用单独证书'), '2' => __('使用统一证书')];
}
}

View File

@@ -9,11 +9,6 @@
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('wdsxh/activity/activity_apply/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('wdsxh/activity/activity_apply/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('wdsxh/activity/activity_apply/edit')}"