where('status', 1) ->find(); } public static function all_point() { return self::where('status', 1) ->column('uid'); } public static function day_release() { $list = self::where('status', 1) ->where('last_release_day', '<>', date('Y-m-d')) ->select(); $res = true; BaseModel::beginTrans(); foreach ($list as $v) { if ($v['release_time_now'] < $v['release_time_all']) { $day_release = bcdiv(bcmul($v['release_ratio'], $v['buy_num'], 8), $v['release_time_all']); $res = $res && UserMoney::incomeMoney($v['uid'], $v['release_money_type'], $day_release, 'release', '节点释放', '节点释放' . ' 第' . ($v['release_time_now'] + 1) . '期'); $res = $res && self::where('id', $v['id']) ->inc('release_time_now', 1) ->update(); $res = $res && self::where('id', $v['id']) ->update(['last_release_day' => date('Y-m-d')]); } } BaseModel::checkTrans($res); return $res; } public static function checkPass() { $list = self::where('status', 0)->select(); $res = true; // BaseModel::beginTrans(); foreach ($list as $v) { $recommend = User::where('spread_uid', $v['uid'])->where('vote_num', '>=', sys_config('vaild_user', 0))->count(); $group = User::getAllLowUid($v['uid'], false, false, true); $plan = PointPlan::get($v['plan_id']); if ($recommend >= $plan['recommend_num'] && $group >= $plan['group_num']) { $res = $res && self::where('id', $v['id'])->update(['status' => 1, 'pass_time' => time()]); } } // BaseModel::checkTrans($res); return $res; } public static function checkFail() { $list = self::where('status', 0)->where('exam_time', '<=', time())->select(); $res = true; BaseModel::beginTrans(); foreach ($list as $v) { $res = $res && self::where('id', $v['id'])->update(['status' => 2]); } BaseModel::checkTrans($res); return $res; } /** * @param $where * @return array */ public static function getList($where) { $model = new self(); if (isset($where['id']) && $where['id'] != '') { $model->where('plan_id', $where['id']); } $count = $model->count(); $data = $model->page((int)$where['page'], (int)$where['limit'])->select()->each(function ($item) { $item['_status'] = ($item['status'] == 1) ? "考核成功" : (($item['status'] == 2) ? "考核失败" : "考核中"); $item['user'] = User::getUserInfo($item['uid']); $item['_add_time'] = date('Y-m-d H:i:s', $item['add_time']); $item['_pass_time'] = $item['pass_time'] ? date('Y-m-d H:i:s', $item['pass_time']) : '--'; $item['_check_end_time'] = date('Y-m-d H:i:s', $item['check_end_time']); }); return compact('count', 'data'); } }