本文整理汇总了PHP中yii\helpers\ArrayHelper::isIn方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayHelper::isIn方法的具体用法?PHP ArrayHelper::isIn怎么用?PHP ArrayHelper::isIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\ArrayHelper
的用法示例。
在下文中一共展示了ArrayHelper::isIn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHotlinkTo
public function getHotlinkTo(Model $model, $action = null, $options = [])
{
if (!ArrayHelper::isIn($this->className(), ArrayHelper::getColumn($model->behaviors(), 'class'))) {
throw new InvalidRouteException('The "LinkableBehavior" is not attached to the specified model');
}
return $this->getHotlink(strtr('{route}/{action}', ['{route}' => $model->route, '{action}' => $action ?? $model->defaultAction]), $model->linkableParams, $options);
}
示例2: __construct
public function __construct($config = array())
{
self::$plugins = array_diff(scandir(__DIR__ . '/plugins/'), array('..', '.'));
$provider = ArrayHelper::getValue($config, 'config.provider');
if (isset($provider)) {
if (ArrayHelper::isIn($provider . '.php', self::$plugins)) {
require __DIR__ . '/plugins/' . $provider . '.php';
$format = ArrayHelper::getValue($config, 'config.return_formats');
if (isset($format)) {
if (ArrayHelper::isIn($format, ArrayHelper::getValue($plugin, 'accepted_formats'))) {
self::$return_formats = $format;
} else {
self::$return_formats = ArrayHelper::getValue($plugin, 'default_accepted_format');
}
}
self::$provider = $plugin;
self::$api_key = ArrayHelper::getValue($config, 'config.api_key', NULL);
} else {
throw new HttpException(404, 'The requested Item could not be found.');
}
} else {
require __DIR__ . '/plugins/geoplugin.php';
self::$provider = $plugin;
self::$return_formats = $plugin['default_accepted_format'];
}
return parent::__construct($config);
}
示例3: validateValue
/**
* @inheritdoc
*/
protected function validateValue($value)
{
$in = false;
if ($this->allowArray && ($value instanceof \Traversable || is_array($value)) && ArrayHelper::isSubset($value, $this->range, $this->strict)) {
$in = true;
}
if (!$in && ArrayHelper::isIn($value, $this->range, $this->strict)) {
$in = true;
}
return $this->not !== $in ? null : [$this->message, []];
}
示例4: getLanguagesList
/**
* Return not default languages
* @return array
* */
public function getLanguagesList()
{
$languages = $this->languages;
if (ArrayHelper::getValue($languages, $this->defaultLanguage)) {
unset($languages[$this->defaultLanguage]);
} else {
if ($key = ArrayHelper::isIn($this->defaultLanguage, $languages)) {
unset($languages[$key]);
}
}
return $languages;
}
示例5: onSucRow
public function onSucRow($event)
{
$row = $event->row;
if (ArrayHelper::isIn($row['status'], ['공개', '유찰'])) {
$bidkey = BidKey::findOne(['whereis' => '05', 'notinum' => $row['notinum'] . '-' . $row['subno']]);
if ($bidkey !== null) {
if ($row['status'] === '유찰' && $bidkey->bidproc === 'F') {
return;
}
if ($row['status'] === '공개' && $bidkey->bidproc === 'S') {
return;
}
$this->gman_client->doBackground('ebidlh_suc_work', Json::encode($row));
}
}
}
示例6: renderSelectOptions
/**
* Renders the option tags that can be used by [[dropDownList()]] and [[listBox()]].
* @param string|array|null $selection the selected value(s). String for single or array for multiple selection(s).
* @param array $items the option data items. The array keys are option values, and the array values
* are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too).
* For each sub-array, an option group will be generated whose label is the key associated with the sub-array.
* If you have a list of data models, you may convert them into the format described above using
* [[\yii\helpers\ArrayHelper::map()]].
*
* Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in
* the labels will also be HTML-encoded.
* @param array $tagOptions the $options parameter that is passed to the [[dropDownList()]] or [[listBox()]] call.
* This method will take out these elements, if any: "prompt", "options" and "groups". See more details
* in [[dropDownList()]] for the explanation of these elements.
*
* @return string the generated list options
*/
public static function renderSelectOptions($selection, $items, &$tagOptions = [])
{
$lines = [];
$encodeSpaces = ArrayHelper::remove($tagOptions, 'encodeSpaces', false);
$encode = ArrayHelper::remove($tagOptions, 'encode', true);
if (isset($tagOptions['prompt'])) {
$prompt = $encode ? static::encode($tagOptions['prompt']) : $tagOptions['prompt'];
if ($encodeSpaces) {
$prompt = str_replace(' ', ' ', $prompt);
}
$lines[] = static::tag('option', $prompt, ['value' => '']);
}
$options = isset($tagOptions['options']) ? $tagOptions['options'] : [];
$groups = isset($tagOptions['groups']) ? $tagOptions['groups'] : [];
unset($tagOptions['prompt'], $tagOptions['options'], $tagOptions['groups']);
$options['encodeSpaces'] = ArrayHelper::getValue($options, 'encodeSpaces', $encodeSpaces);
$options['encode'] = ArrayHelper::getValue($options, 'encode', $encode);
foreach ($items as $key => $value) {
if (is_array($value)) {
$groupAttrs = isset($groups[$key]) ? $groups[$key] : [];
if (!isset($groupAttrs['label'])) {
$groupAttrs['label'] = $key;
}
$attrs = ['options' => $options, 'groups' => $groups, 'encodeSpaces' => $encodeSpaces, 'encode' => $encode];
$content = static::renderSelectOptions($selection, $value, $attrs);
$lines[] = static::tag('optgroup', "\n" . $content . "\n", $groupAttrs);
} else {
$attrs = isset($options[$key]) ? $options[$key] : [];
$attrs['value'] = (string) $key;
if (!array_key_exists('selected', $attrs)) {
$attrs['selected'] = $selection !== null && (!ArrayHelper::isTraversable($selection) && !strcmp($key, $selection) || ArrayHelper::isTraversable($selection) && ArrayHelper::isIn($key, $selection));
}
$text = $encode ? static::encode($value) : $value;
if ($encodeSpaces) {
$text = str_replace(' ', ' ', $text);
}
$lines[] = static::tag('option', $text, $attrs);
}
}
return implode("\n", $lines);
}
示例7: i2conv_run
public function i2conv_run($job)
{
$workload = $job->workload();
$workload = Json::decode($workload);
try {
$this->module->i2db->close();
$this->module->infodb->close();
$bidKey = BidKey::findOne($workload['bidid']);
if ($bidKey === null) {
return;
}
$bidvalue = $bidKey->bidValue;
if ($bidvalue === null) {
return;
}
if (!ArrayHelper::isIn($bidKey->state, ['Y', 'N', 'D'])) {
return;
}
if ($bidKey->bidproc === 'J') {
return;
}
if (empty($bidKey->location)) {
return;
}
switch ($bidKey->bidtype) {
case 'con':
echo Console::renderColoredString('%y[공사]%n');
break;
case 'ser':
echo Console::renderColoredString('%g[용역]%n');
break;
case 'pur':
echo Console::renderColoredString('%b[구매]%n');
break;
default:
return;
}
echo $bidKey->constnm;
echo '[' . $bidKey->notinum . ']';
echo '(' . $bidKey->state . ',' . $bidKey->bidproc . ')';
//------------------------------------------------------
// v3_bid_key
//------------------------------------------------------
$v3bidkey = V3BidKey::findNew($bidKey->bidid);
$this->stdout($v3bidkey->isNewRecord ? "[NEW]\n" : "\n", Console::FG_RED);
$v3bidkey->attributes = ['whereis' => $bidKey->whereis, 'bidtype' => $bidKey->bidtype, 'con' => strpos($bidKey->bidview, 'con') === false ? 'N' : 'Y', 'ser' => strpos($bidKey->bidview, 'ser') === false ? 'N' : 'Y', 'pur' => strpos($bidKey->bidview, 'pur') === false ? 'N' : 'Y', 'notinum' => $bidKey->notinum, 'orgcode' => $bidKey->orgcode_i, 'constnm' => $bidKey->constnm, 'org' => $bidKey->org_i, 'bidproc' => $bidKey->bidproc, 'contract' => $bidKey->contract, 'bidcls' => $bidKey->bidcls, 'succls' => $bidKey->succls, 'conlevel' => $bidKey->toV3BidKey_conlevel(), 'ulevel' => $bidKey->opt, 'concode' => $bidKey->toV3BidKey_concode(), 'sercode' => $bidKey->toV3BidKey_sercode(), 'purcode' => $bidKey->toV3BidKey_purcode(), 'location' => $bidKey->location ? $bidKey->location : 0, 'convention' => $bidKey->convention == '3' ? '2' : $bidKey->convention, 'presum' => $bidKey->presum ? $bidKey->presum : 0, 'basic' => $bidKey->basic ? $bidKey->basic : 0, 'pct' => $bidKey->pct ? $bidKey->pct : '', 'registdate' => strtotime($bidKey->registdt) > 0 ? date('Y-m-d', strtotime($bidKey->registdt)) : '', 'explaindate' => strtotime($bidKey->explaindt) > 0 ? date('Y-m-d', strtotime($bidKey->explaindt)) : '', 'agreedate' => strtotime($bidKey->agreedt) > 0 ? date('Y-m-d', strtotime($bidKey->agreedt)) : '', 'opendate' => strtotime($bidKey->opendt) > 0 ? date('Y-m-d', strtotime($bidKey->opendt)) : '', 'closedate' => strtotime($bidKey->closedt) > 0 ? date('Y-m-d', strtotime($bidKey->closedt)) : '', 'constdate' => strtotime($bidKey->constdt) > 0 ? date('Y-m-d', strtotime($bidKey->constdt)) : '', 'writedate' => strtotime($bidKey->writedt) > 0 ? date('Y-m-d', strtotime($bidKey->writedt)) : '', 'reswdate' => strtotime($bidKey->resdt) > 0 ? date('Y-m-d', strtotime($bidKey->resdt)) : '', 'state' => $bidKey->state, 'in_id' => 91];
//------------------------------------------------------
// v3_bid_value
//------------------------------------------------------
$v3BidValue = V3BidValue::findNew($v3bidkey->bidid);
$v3BidValue->attributes = ['scrcls' => $bidvalue->scrcls, 'scrid' => $bidvalue->scrid, 'constno' => $bidvalue->constno, 'refno' => $bidvalue->refno, 'realorg' => $bidvalue->realorg, 'yegatype' => $bidvalue->yegatype, 'yegarng' => str_replace('|', '/', $bidvalue->yegarng), 'prevamt' => $bidvalue->prevamt, 'parbasic' => $bidvalue->parbasic, 'lvcnt' => $bidvalue->lvcnt, 'charger' => str_replace('|', '/', $bidvalue->charger), 'multispare' => str_replace('|', '/', str_replace(',', '', $bidvalue->multispare)), 'contper' => $bidvalue->contper, 'noticedt' => strtotime($bidKey->noticedt) > 0 ? strtotime($bidKey->noticedt) : 0, 'registdt' => strtotime($bidKey->registdt) > 0 ? strtotime($bidKey->registdt) : 0, 'explaindt' => strtotime($bidKey->explaindt) > 0 ? strtotime($bidKey->explaindt) : 0, 'agreedt' => strtotime($bidKey->agreedt) > 0 ? strtotime($bidKey->agreedt) : 0, 'opendt' => strtotime($bidKey->opendt) > 0 ? strtotime($bidKey->opendt) : 0, 'closedt' => strtotime($bidKey->closedt) > 0 ? strtotime($bidKey->closedt) : 0, 'constdt' => strtotime($bidKey->constdt) > 0 ? strtotime($bidKey->constdt) : 0, 'writedt' => strtotime($bidKey->writedt) > 0 ? strtotime($bidKey->writedt) : 0, 'editdt' => strtotime($bidKey->editdt) > 0 ? strtotime($bidKey->editdt) : 0];
//공동도급지역코드 (사용하나??)
$arr = explode('|', $bidvalue->contloc);
foreach ($arr as $val) {
if (empty($val)) {
continue;
}
$m = BidLocal::findOne(['bidid' => $v3bidkey->bidid, 'name' => iconv('utf-8', 'euckr', $val)]);
if ($m !== null) {
$v3BidValue->contloc = $m->code;
break;
//v3_bid_key.contloc char(4) 때문 1개 지역만 처리...
}
}
//------------------------------------------------------
// v3_bid_itemcode
//------------------------------------------------------
V3BidItemcode::deleteAll(['bidid' => $v3bidkey->bidid]);
$bidItemcodes = $bidKey->toV3BidItemcodes_attributes();
foreach ($bidItemcodes as $row) {
$v3BidItemcode = V3BidItemcode::findNew($v3bidkey->bidid, $row['bidtype'], $row['code']);
$v3BidItemcode->name = $row['name'];
$v3BidItemcode->save();
}
//------------------------------------------------------
// v3_bid_local
//------------------------------------------------------
V3BidLocal::deleteAll(['bidid' => $v3bidkey->bidid]);
$bidlocals = $bidKey->bidLocals;
foreach ($bidlocals as $bidlocal) {
$v3BidLocal = new V3BidLocal(['bidid' => $v3bidkey->bidid, 'code' => $bidLocal->code, 'name' => $bidLocal->name]);
$v3BidLocal->save();
}
//------------------------------------------------------
// v3_bid_subcode
//------------------------------------------------------
V3BidSubcode::deleteAll(['bidid' => $v3bidkey->bidid]);
$subcodes = $bidKey->bidSubcodes;
foreach ($subcodes as $subcode) {
$v3BidSubcode = new V3BidSubcode(['bidid' => $v3bidkey->bidid, 'g2b_code' => $subcode->g2b_code, 'g2b_code_nm' => $subcode->g2b_code_nm, 'i2_code' => $subcode->i2_code, 'itemcode' => $subcode->itemcode, 'pri_cont' => $subcode->pri_cont, 'share' => $subcode->share]);
$v3BidSubcode->save();
}
//-------------------------------------------------------
// v3_bid_content
//-------------------------------------------------------
$bidcontent = $bidKey->bidContent;
if ($bidcontent !== null) {
$v3content = V3BidContent::findNew($v3bidkey->bidid);
$v3content->attributes = ['content_bid' => $bidcontent->bid_html, 'important_suc' => $bidcontent->nbidcomment, 'content_suc' => $bidcontent->nbid_html, 'upfile_bid' => $bidcontent->bid_file, 'upfile_suc' => $bidcontent->nbid_file, 'important_bid' => !empty($bidcontent->bidcomment_mod) ? $bidcontent->bidcomment_mod . '\\n<hr/>\\n' . $bidcontent->bidcomment : $bidcontent->bidcomment];
$v3content->save();
//.........这里部分代码省略.........
示例8: run
public function run($workload, $className)
{
try {
$notinum_ex = $workload['bidno'];
if (isset($workload['bidproc']) and ArrayHelper::isIn($workload['bidproc'], ['유찰', '재공고'])) {
$query = BidKey::find()->where(['whereis' => '08', 'notinum' => $data['notinum']]);
if ($notinum_ex == 1) {
$query->andWhere("notinum_ex='' or notinum_ex='1'");
} else {
$query->andWhere(['notinum_ex' => $notinum_ex]);
}
$bidkey = $query->orderBy('bidid desc')->limit(1)->one();
if ($bidkey !== null and $bidkey->bidproc !== 'F') {
$this->gman_client->doBackground('i2_auto_suc_test', Json::encode(['bidid' => $bidkey->bidid, 'bidproc' => 'F']));
$this->stdout2(" >>> {$bidkey->bidid} ({$bidkey->bidproc}) %y유찰%n\n");
}
return;
}
$worker = new $className(['notino' => $workload['notino'], 'bidno' => $workload['bidno'], 'bidseq' => $workload['bidseq'], 'state' => $workload['state']]);
$worker->on('total_page', function ($event) {
Console::startProgress(0, $event->sender->succom_total_page);
});
$worker->on('page', function ($event) {
if ($event->sender->succom_total_page == $event->sender->succom_page) {
Console::updateProgress($event->sender->succom_page, $event->sender->succom_total_page);
Console::endProgress();
} else {
Console::updateProgress($event->sender->succom_page, $event->sender->succom_total_page);
}
});
$data = $worker->run();
$query = BidKey::find()->where(['whereis' => '08', 'notinum' => $data['notinum']]);
if ($notinum_ex == 1) {
$query->andWhere("notinum_ex='' or notinum_ex='1'");
} else {
$query->andWhere(['notinum_ex' => $notinum_ex]);
}
$bidkey = $query->orderBy('bidid desc')->limit(1)->one();
if ($bidkey === null) {
return;
}
$bidvalue = $bidkey->bidValue;
$data['multispare'] = $bidvalue->multispare;
if (is_array($data['selms'])) {
$selms = [];
$multispares = explode('|', $data['multispare']);
foreach ($multispares as $i => $v) {
if (ArrayHelper::isIn($v, $data['selms'])) {
$selms[] = $i + 1;
}
}
$data['selms'] = join('|', $selms);
}
$data['bidid'] = $bidkey->bidid;
$data['bidproc'] = 'S';
$this->gman_client->doBackground('i2_auto_suc_test', Json::encode($data));
$this->stdout2(" >>> {$bidkey->bidid} ({$bidkey->bidproc}) 예가:{$data['yega']} 참여수:{$data['innum']} %g개찰%n\n");
} catch (\Exception $e) {
$this->stdout("{$e}\n", Console::FG_RED);
\Yii::error($e, 'ebidex');
}
}
示例9: work
public function work($job)
{
\Yii::info('[' . __METHOD__ . '] $workload' . PHP_EOL . VarDumper::dumpAsString($job->workload()), 'kwater');
$workload = Json::decode($job->workload());
$http = new \kwater\Http();
$data = [];
try {
if (empty($workload['notinum'])) {
throw new \Exception('notinum is empty');
}
if (empty($workload['bidtype'])) {
throw new \Exception('bidtype is empty');
}
$data['org_i'] = '한국수자원공사';
if ($workload['realorg']) {
$data['org_i'] .= ' ' . str_replace('관리처', '지역본부', $workload['realorg']);
}
$data['notinum'] = $workload['notinum'];
switch ($workload['bidtype']) {
case '공사':
$data['bidtype'] = 'con';
$data['bidview'] = 'con';
break;
case '용역':
$data['bidtype'] = 'ser';
$data['bidview'] = 'ser';
break;
default:
$data['bidtype'] = 'pur';
$data['bidview'] = 'pur';
}
$html = $http->request('GET', static::URL, ['query' => ['BidNo' => $workload['notinum']]]);
$thml = strip_tags($html, '<tr><td><a>');
$html = preg_replace('/<tr[^>]*>/', '<tr>', $html);
$html = preg_replace('/<td[^>]*>/', '<td>', $html);
$html = str_replace(' ', '', $html);
$data['attchd_lnk'] = $this->attchd_lnk($html);
$html = strip_tags($html, '<tr><td>');
//echo $html,PHP_EOL;
$data['constnm'] = $this->constnm($html);
$contract = $this->contract($html);
if ($contract == '소액전자') {
$data['contract'] = '40';
}
$succls = $this->succls($html);
switch ($succls) {
case '적격심사':
$data['succls'] = '01';
break;
case '최저가':
$data['succls'] = '02';
break;
default:
$data['succls'] = '00';
}
$data['registdt'] = $this->registdt($html);
$data['multispare'] = $this->multispare($html);
$data['constdt'] = $this->constdt($html);
//$data['bidcomment']=$this->bidcomment($thml);
$data['charger'] = $this->charger($html);
$data = ArrayHelper::merge($data, $this->closedt($html));
$convention = $this->convention($html);
$data['convention'] = '0';
if (ArrayHelper::isIn($convention['convention1'], ['가능', '공동'])) {
$data['convention'] = '2';
}
if (ArrayHelper::isIn($convention['convention2'], ['가능', '공동'])) {
$data['convention'] = '2';
}
$data['orign_lnk'] = 'http://ebid.kwater.or.kr/fz?bidno=' . $workload['notinum'];
$data['noticedt'] = $this->noticedt($html);
$data['basic'] = $this->basic($html);
$data['pqdt'] = $this->pqdt($html);
//현장설명회
if ($data['pqdt']) {
$data['bidcomment'] = 'PQ심사신청서 신청기한 : ' . $data['pqdt'] . '<hr>';
$data['succls'] = '05';
}
$event = new \kwater\WatchEvent();
$event->row = $data;
$this->trigger(\kwater\WatchEvent::EVENT_ROW, $event);
} catch (\Exception $e) {
echo Console::renderColoredString("%r{$e}%n"), PHP_EOL;
\Yii::error($e, 'kwater');
}
$this->module->db->close();
echo sprintf("[%s] Peak memory usage: %sMb\n", date('Y-m-d H:i:s'), memory_get_peak_usage(true) / 1024 / 1024);
sleep(1);
}
示例10: _action_params
protected function _action_params()
{
$action_params = Yii::$app->request->queryParams;
if ($this->_view() && isset($this->actions[$this->_view()])) {
$action_param = $this->actions[$this->_view()];
foreach ($action_params as $key => $value) {
if (is_null($value) || $value == '' || !ArrayHelper::isIn($key, $action_param)) {
unset($action_params[$key]);
}
}
}
$action_params = Json::encode($action_params);
return $action_params;
}
示例11: actionSuc
public function actionSuc()
{
$con = new SucWatcherCon();
$ser = new SucWatcherSer();
$pur = new SucWatcherPur();
while (true) {
$start = date('Ymd', strtotime('-1 month'));
$end = date('Ymd');
try {
$con->watch($start, $end, function ($row) {
$this->stdout2("도로> %y[공사낙찰]%n {$row['notinum']} {$row['constnm']} ({$row['local']},{$row['multi']},{$row['bidproc']})");
$bidkey = $this->findBidKey($row);
if ($bidkey === null) {
$this->stdout2(" %rERROR%n\n");
return;
}
$this->stdout2(" [{$bidkey->bidproc}]");
if (ArrayHelper::isIn($row['bidproc'], ['유찰', '재공고']) and $bidkey->bidproc == 'F') {
$this->stdout("\n");
return;
} else {
if ($bidkey->bidproc == 'S') {
$this->stdout("\n");
return;
}
}
$this->stdout2(" %yNEW%n\n");
sleep(1);
$this->gman_client->doNormal('ebidex_work_suc_con', Json::encode($row));
});
$ser->watch($start, $end, function ($row) {
$this->stdout2("도로> %g[용역낙찰]%n {$row['notinum']} {$row['constnm']} ({$row['local']},{$row['multi']},{$row['bidproc']})");
$bidkey = $this->findBidKey($row);
if ($bidkey === null) {
$this->stdout2(" %rERROR%n\n");
return;
}
$this->stdout2(" [{$bidkey->bidproc}]");
if (ArrayHelper::isIn($row['bidproc'], ['유찰', '재공고']) and $bidkey->bidproc == 'F') {
$this->stdout("\n");
return;
} else {
if ($bidkey->bidproc == 'S') {
$this->stdout("\n");
return;
}
}
$this->stdout2(" %yNEW%n\n");
sleep(1);
$this->gman_client->doNormal('ebidex_work_suc_ser', Json::encode($row));
});
$pur->watch($start, $end, function ($row) {
$this->stdout2("도로> %b[구매낙찰]%n {$row['notinum']} {$row['constnm']} ({$row['local']},{$row['multi']},{$row['bidproc']})");
$bidkey = $this->findBidKey($row);
if ($bidkey === null) {
$this->stdout2(" %rERROR%n\n");
return;
}
$this->stdout2(" [{$bidkey->bidproc}]");
if (ArrayHelper::isIn($row['bidproc'], ['유찰', '재공고']) and $bidkey->bidproc == 'F') {
$this->stdout("\n");
return;
} else {
if ($bidkey->bidproc == 'S') {
$this->stdout("\n");
return;
}
}
$this->stdout2(" %yNEW%n\n");
$this->gman_client->doNormal('ebidex_work_suc_pur', Json::encode($row));
sleep(1);
});
} catch (\Exception $e) {
$this->stdout("{$e}\n", Console::FG_RED);
\Yii::error($e, 'ebidex');
}
$this->stdout(sprintf("[%s] Peak memory usage: %s MB\n", date('Y-m-d H:i:s'), memory_get_peak_usage(true) / 1024 / 1024), Console::FG_GREY);
sleep(mt_rand(5, 10));
}
}
示例12: actionAction
public function actionAction()
{
if (User::hasRole('admin')) {
//\Yii::trace('### ### ### Тест лога');
//Проверяем был ли выбрана комманда
$ids = Yii::$app->request->post('ActionForm');
//\Yii::trace(Yii::$app->request->post('ActionForm'));
//Проверяем, выбран ли пустой id, если да, то как будто только открыли
if ($ids and ArrayHelper::isIn('', $ids)) {
$ids = null;
}
//Для проверки отправки запроса получаем значение
$page = Yii::$app->request->post('adr');
if ($ids) {
//Если выбран ID
$model = $this->findModel($ids);
return $this->render('action', ['model' => $model, 'ghide' => 1, 'gadr' => '10.24.2.188', 'guser' => '', 'gpass' => '', 'gid' => $model->id, 'gcommand' => $model->actionstring, 'gparams' => $model->params, 'pagein' => '', 'pageout' => '']);
} elseif ($page) {
//Если отправлен запрос
$ids = Yii::$app->request->post('id');
$model = $this->findModel($ids);
$vagon = new Vagon();
$pagein = 'http://' . Yii::$app->request->post('adr') . '/crq?req=' . Yii::$app->request->post('string') . '&' . Yii::$app->request->post('params');
$user = Yii::$app->request->post('user');
$pass = Yii::$app->request->post('pass');
return $this->render('action', ['model' => $model, 'ghide' => 2, 'gadr' => Yii::$app->request->post('adr'), 'guser' => $user, 'gpass' => $pass, 'gid' => $model->id, 'gcommand' => Yii::$app->request->post('string'), 'gparams' => Yii::$app->request->post('params'), 'pagein' => $pagein, 'pageout' => $vagon->getCurlOut($pagein, $user, $pass)]);
} else {
//Если форму только открыли
return $this->render('action', ['model' => new ActionForm(), 'ghide' => 0, 'gadr' => '', 'guser' => '', 'gpass' => '', 'gid' => '', 'gcommand' => '', 'gparams' => '', 'pagein' => '', 'pageout' => '']);
}
} else {
throw new NotFoundHttpException('Страница не найдена.');
}
}
示例13: c
$objectProperty = $model_object_property->theObjectProperty;
$property = $model_object_property->property;
if (!ArrayHelper::isIn($objectProperty->id, $parentData)) {
if ($property->formTypePresentation($service->object_ownership) != null) {
echo $this->render('objectProperty/' . $property->formTypePresentation($service->object_ownership) . '.php', ['form' => $form, 'index' => $index, 'model_object_property' => $model_object_property, 'objectProperty' => $objectProperty, 'property' => $property, 'service' => $service]);
echo Html::activeHiddenInput($model_object_property, 'checkUserObject', ['id' => 'checkUserObject_model_spec' . $property->id]);
//echo Html::activeHiddenInput($model_object_property, '['.$index.']spec_id', ['value'=>$objectProperty->id]);
}
}
}
echo '<h5 class="col-sm-offset-3 gray-color"><hr>' . c($parent->tName) . '</h5>';
echo '<p class="col-sm-offset-3 hint margin-bottom-20">Opišite i detalje ' . $parent->tNameGen . ', kao celine.</p>';
foreach ($model_object_properties as $index => $model_object_property) {
$objectProperty = $model_object_property->theObjectProperty;
$property = $model_object_property->property;
if (ArrayHelper::isIn($objectProperty->id, $parentData)) {
if ($property->formTypePresentation($service->object_ownership) != null) {
echo $this->render('objectProperty/' . $property->formTypePresentation($service->object_ownership) . '.php', ['form' => $form, 'index' => $index, 'model_object_property' => $model_object_property, 'objectProperty' => $objectProperty, 'property' => $property, 'service' => $service]);
echo Html::activeHiddenInput($model_object_property, 'checkUserObject', ['id' => 'checkUserObject_model_spec' . $property->id]);
//echo Html::activeHiddenInput($model_object_property, '['.$index.']spec_id', ['value'=>$objectProperty->id]);
}
}
}
} else {
// ako objekat nije part
foreach ($model_object_properties as $index => $model_object_property) {
$objectProperty = $model_object_property->theObjectProperty;
$property = $model_object_property->property;
if ($property->formTypePresentation($service->object_ownership) != null) {
echo $this->render('objectProperty/' . $property->formTypePresentation($service->object_ownership) . '.php', ['form' => $form, 'index' => $index, 'model_object_property' => $model_object_property, 'objectProperty' => $objectProperty, 'property' => $property, 'service' => $service]);
echo Html::activeHiddenInput($model_object_property, 'checkUserObject', ['id' => 'checkUserObject_model_spec' . $property->id]);
示例14: onRow
public function onRow($event)
{
$row = $event->row;
$out[] = "[KWATER] [{$row['bidtype']}] %g{$row['notinum']}%n {$row['constnm']} ({$row['contract']},{$row['status']})";
$bidkey = BidKey::find()->where(['whereis' => \kwater\Module::WHEREIS, 'notinum' => $row['notinum']])->orderBy('bidid desc')->limit(1)->one();
if ($bidkey === null) {
if (!ArrayHelper::isIn($row['status'], ['입찰완료', '적격신청', '결과발표']) and !ArrayHelper::isIn($row['contract'], ['지명경쟁', '수의계약(시담)'])) {
$out[] = "%rNEW%n";
$this->gman_client->doBackground('kwater_work_bid', Json::encode($row));
$sleep = 1;
}
} else {
$out[] = "({$bidkey->bidproc})";
if ($bidkey->bidproc === 'B' and $bidkey->state === 'Y') {
$bidcheck = BidModifyCheck::findOne($bidkey->bidid);
if ($bidcheck === null) {
$out[] = "%yCHECK%n";
$this->gman_client->doBackground('kwater_work_bid', Json::encode($row));
} else {
$diff = time() - $bidcheck->check_at;
if ($diff >= 60 * 60 * 1) {
$out[] = "%yCHECK%n";
$this->gman_client->doBackground('kwater_work_bid', Json::encode($row));
$bidcheck->check_at = time();
$bidcheck->save();
$sleep = 1;
}
}
}
}
$this->stdout(Console::renderColoredString(join(' ', $out)) . PHP_EOL);
if (isset($sleep)) {
sleep(3);
}
}
示例15: foreach
foreach ($model_specs as $index => $model_spec) {
$specification = $model_spec->specification;
$property = $model_spec->property;
if (!ArrayHelper::isIn($specification->id, $parentData)) {
if ($property->formTypePresentation($service->service_object) != null) {
echo $this->render('specification/' . $property->formTypePresentation($service->service_object) . '.php', ['form' => $form, 'index' => $index, 'model_spec' => $model_spec, 'specification' => $specification, 'property' => $property, 'service' => $service, 'input' => Yii::$app->request->get('PresentationSpecs')]);
echo Html::activeHiddenInput($model_spec, '[' . $index . ']spec_id', ['value' => $specification->id]);
}
}
}
echo '<h5 class="col-sm-offset-3 gray-color"><hr>' . c($parent->tName) . '</h5>';
echo '<p class="col-sm-offset-3 hint margin-bottom-20">Opišite i detalje ' . $parent->tNameGen . ', kao celine.</p>';
foreach ($model_specs as $index => $model_spec) {
$specification = $model_spec->specification;
$property = $model_spec->property;
if (ArrayHelper::isIn($specification->id, $parentData)) {
if ($property->formTypePresentation($service->service_object) != null) {
echo $this->render('specification/' . $property->formTypePresentation($service->service_object) . '.php', ['form' => $form, 'index' => $index, 'model_spec' => $model_spec, 'specification' => $specification, 'property' => $property, 'service' => $service, 'input' => Yii::$app->request->get('PresentationSpecs')]);
echo Html::activeHiddenInput($model_spec, '[' . $index . ']spec_id', ['value' => $specification->id]);
}
}
}
} else {
// ako objekat nije part
foreach ($model_specs as $index => $model_spec) {
$specification = $model_spec->specification;
$property = $model_spec->property;
if ($property->formTypePresentation($service->service_object) != null) {
echo $this->render('specification/' . $property->formTypePresentation($service->service_object) . '.php', ['form' => $form, 'index' => $index, 'model_spec' => $model_spec, 'specification' => $specification, 'property' => $property, 'service' => $service, 'input' => Yii::$app->request->get('PresentationSpecs')]);
echo Html::activeHiddenInput($model_spec, '[' . $index . ']spec_id', ['value' => $specification->id]);
}