<?php
|
|
namespace app\api\controller\branch;
|
|
use app\api\controller\Controller;
|
use app\api\model\branch\ActivityUser as ActivityUserModel; // 报名会员
|
use app\common\service\qrcode\ExtractService;
|
use xin\helper\Func;
|
|
/**
|
* 活动报名控制器
|
*/
|
class ActivityUser extends Controller
|
{
|
/**
|
* 活动报名列表
|
*/
|
public function lists()
|
{
|
$user = $this->getUser();
|
$model = new ActivityUserModel;
|
$list = $model->getList($user['user_id'], $this->postData());
|
return $this->renderSuccess('', compact('list'));
|
}
|
|
/**
|
*报名详情
|
*/
|
public function detail($order_id)
|
{
|
$detail = ActivityUserModel::detail($order_id, ['activity.image']);
|
return $this->renderSuccess('', compact('detail'));
|
}
|
|
/**
|
* 获取核销二维码(废弃)
|
*/
|
public function qrcode($order_id, $source)
|
{
|
$user = $this->getUser();
|
$Qrcode = new ExtractService(
|
$this->app_id,
|
$user,
|
$order_id,
|
$source,
|
'activityUser-' . $order_id,
|
'activityUser'
|
);
|
return $this->renderSuccess('',[
|
'qrcode' => $Qrcode->getImage(),
|
]);
|
}
|
|
// 签到
|
public function verify($activity_id)
|
{
|
$model = new ActivityUserModel;
|
$user = $this->getUser();
|
if ($model->onVerify($user, $activity_id)) {
|
return $this->renderSuccess('签到成功');
|
}
|
return $this->renderError($model->getError() ?:'签到失败');
|
}
|
}
|