本文整理汇总了PHP中Admin\Builder\AdminConfigBuilder::keyTime方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminConfigBuilder::keyTime方法的具体用法?PHP AdminConfigBuilder::keyTime怎么用?PHP AdminConfigBuilder::keyTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Admin\Builder\AdminConfigBuilder
的用法示例。
在下文中一共展示了AdminConfigBuilder::keyTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAdv
public function editAdv()
{
$advModel = D('Common/Adv');
$aId = I('id', 0, 'intval');
if ($aId != 0) {
$adv = $advModel->find($aId);
$aPosId = $adv['pos_id'];
} else {
$aPosId = I('get.pos_id', 0, 'intval');
}
$advPosModel = D('Common/AdvPos');
$pos = $advPosModel->find($aPosId);
if (IS_POST) {
$adv['title'] = I('title', '', 'text');
$adv['pos_id'] = $aPosId;
$adv['url'] = I('url', '', 'text');
$adv['sort'] = I('sort', 1, 'intval');
$adv['status'] = I('status', 1, 'intval');
$adv['create_time'] = I('create_time', '', 'intval');
$adv['start_time'] = I('start_time', '', 'intval');
$adv['end_time'] = I('end_time', '', 'intval');
$adv['target'] = I('target', '', 'text');
S('adv_list_' . $pos['name'] . $pos['path'], null);
if ($pos['type'] == 2) {
//todo 多图
$aTitles = I('title', '', 'text');
$aUrl = I('url', '', 'text');
$aSort = I('sort', '', 'intval');
$aStartTime = I('start_time', '', 'intval');
$aEndTime = I('end_time', '', 'intval');
$aTarget = I('target', '', 'text');
$added = 0;
$advModel->where(array('pos_id' => $aPosId))->delete();
foreach (I('pic', 0, 'intval') as $key => $v) {
$data['pic'] = $v;
$data['target'] = $aTarget[$key];
$adv_temp['title'] = $aTitles[$key];
$adv_temp['pos_id'] = $adv['pos_id'];
$adv_temp['url'] = $aUrl[$key];
$adv_temp['sort'] = $aSort[$key];
$adv_temp['status'] = 1;
$adv_temp['create_time'] = time();
$adv_temp['start_time'] = $aStartTime[$key];
$adv_temp['end_time'] = $aEndTime[$key];
$adv_temp['target'] = $aTarget[$key];
$adv_temp['data'] = json_encode($data);
$result = $advModel->add($adv_temp);
if ($result !== false) {
$added++;
}
//todo添加
}
$this->success('成功改动' . $added . '个广告。');
} else {
switch ($pos['type']) {
case 1:
//todo 单图
$data['pic'] = I('pic', 0, 'intval');
$data['target'] = I('target', 0, 'text');
break;
case 3:
$data['text'] = I('text', '', 'text');
$data['text_color'] = I('text_color', '', 'text');
$data['text_font_size'] = I('text_font_size', '', 'text');
$data['target'] = I('target', 0, 'text');
//todo 文字
break;
case 4:
//todo 代码
$data['code'] = I('code', '', '');
break;
}
$adv['data'] = json_encode($data);
if ($aId == 0) {
$result = $advModel->add($adv);
} else {
$adv['id'] = $aId;
$result = $advModel->save($adv);
}
if ($result === false) {
$this->error('保存失败。');
} else {
$this->success('保存成功。');
}
}
} else {
//快速添加广告位逻辑
//todo 快速添加
$builder = new AdminConfigBuilder();
$adv['pos'] = $pos['title'] . '——' . $pos['name'] . '——' . $pos['path'];
$adv['pos_id'] = $aPosId;
$builder->keyReadOnly('pos', '所属广告位');
$builder->keyReadOnly('pos_id', '广告位ID');
$builder->keyId()->keyTitle('title', '广告说明');
$builder->title($pos['title'] . '设置——' . $advPosModel->switchType($pos['type']));
$builder->keyTime('start_time', '开始生效时间', '不设置则立即生效')->keyTime('end_time', '失效时间', '不设置则一直有效')->keyText('sort', '排序')->keyCreateTime()->keyStatus();
$builder->buttonSubmit();
$data = json_decode($adv['data'], true);
if (!empty($data)) {
$adv = array_merge($adv, $data);
//.........这里部分代码省略.........