2025-04-09 19:07:58 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace app\api\controller\school\newworker;
|
|
|
|
|
|
|
|
use app\common\controller\Api;
|
|
|
|
use app\common\model\school\activity\Activity;
|
|
|
|
use app\common\model\school\classes\Teacher;
|
|
|
|
use app\common\model\school\classes\Verification;
|
|
|
|
|
|
|
|
class Base extends Api
|
|
|
|
{
|
|
|
|
|
|
|
|
protected $activity_ids = [];
|
|
|
|
protected $vaild_activity_ids = [];
|
|
|
|
|
|
|
|
|
2025-04-12 18:01:47 +08:00
|
|
|
protected function transactionCheck()
|
|
|
|
{
|
|
|
|
// 得到活动交易关闭时间段列表
|
|
|
|
$activity_close_times = config("site.activity_close_time") ?: [];
|
|
|
|
foreach ($activity_close_times as $key => $value) {
|
|
|
|
// 解析时间区间
|
|
|
|
$time_arr = explode("-", $value);
|
|
|
|
$start_time = trim($time_arr[0]);
|
|
|
|
$end_time = trim($time_arr[1]);
|
|
|
|
|
|
|
|
// 当前时间
|
|
|
|
$current_time = date("H:i");
|
|
|
|
|
|
|
|
// 跨天时间段的处理
|
|
|
|
if ($start_time > $end_time) {
|
|
|
|
// 如果当前时间大于等于开始时间 或者 小于等于结束时间,则认为在范围内
|
|
|
|
if ($current_time >= $start_time || $current_time <= $end_time) {
|
|
|
|
$this->error("活动交易已关闭进入结算周期,期间您无法交易!");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// 普通时间段的处理
|
|
|
|
if ($current_time >= $start_time && $current_time <= $end_time) {
|
|
|
|
$this->error("活动交易已关闭进入结算周期,期间您无法交易!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-09 19:07:58 +08:00
|
|
|
/**
|
|
|
|
* 初始化操作
|
|
|
|
* @access protected
|
|
|
|
*/
|
|
|
|
protected function _initialize()
|
|
|
|
{
|
|
|
|
parent::_initialize();
|
|
|
|
// 判断员工权限
|
|
|
|
$this->check_worker_auth();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function check_worker_auth(){
|
|
|
|
//判断登录用户是否是员工
|
|
|
|
$user_id = 0;
|
|
|
|
$user = $this->auth->getUser();//登录用户
|
|
|
|
if($user)$user_id = $user['id'];
|
|
|
|
if(!$user_id)$this->error("请登录后再访问该接口!",['errcode'=>30002], 401);
|
|
|
|
|
|
|
|
$this->activity_ids = (new Activity())->getActivityAuthIds($user_id);
|
|
|
|
$this->vaild_activity_ids = (new Activity())->getActivityAuthIds($user_id,true);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|