public function actionUpload() { $filter = $this->getFilterCondition(); if (isset($filter['adv_channel_id'])) { $advertiseChannel = AdvertiseChannel::model()->findByPk($filter['adv_channel_id']); $advertise = $advertiseChannel->advertise; } else { if (isset($filter['adv_id'])) { $advertise = Advertise::model()->findByPk($filter['adv_id']); } } //$historyList = $adv_data->getDayDataForIn('',$startTime, $endTime, false); $this->render('upload', array('filters' => $this->getFilterCondition(), 'advertise' => $advertise, 'adv_channel_id' => $filter['adv_channel_id'])); }
public function actionMerge() { $ids = array('100040', '100039', '100022', '100046'); $adv_data = AdvData::model(); $advertice_channel = AdvertiseChannel::model(); $channel = Channel::model(); foreach ($ids as $channel_id) { if ($channel_id != 100046) { $adv_data->updateRelatedChannelId(array('channel_id' => 100043), $channel_id); $advertice_channel->updateRelatedChannelId(array('channel_id' => 100043), $channel_id); } else { $adv_data->updateRelatedChannelId(array('channel_id' => 100123), $channel_id); $advertice_channel->updateRelatedChannelId(array('channel_id' => 100123), $channel_id); } $channel->deleteOneRow($channel_id); } }
/** * * 导入360的渠道-包 分配关系 */ public function action360() { $adv_name = ''; while ($row = trim(fgets(STDIN))) { $data = array_filter(preg_split('/\\s+/', $row), 'strlen'); if (count($data) == 4) { $adv_name = $data[0]; $adv_id = $this->getAdvId($adv_name); if (!$adv_id) { echo "adv missing {$adv_name}\n"; var_dump($data); } array_shift($data); } $tag = $data[0]; if (!preg_match('/^\\d+$/', $tag)) { var_dump($tag); var_dump($data); continue; } $tag = 'sjzs_' . $tag; $price = $data[1]; $channel_id = $this->getChannelId($data[2]); if (!$channel_id) { echo "channel id missing {$data[2]}\n"; } $criteria = new CDbCriteria(); $criteria->compare('tag', $tag); $criteria->compare('channel_id', $channel_id); if (!($model = AdvertiseChannel::model()->find($criteria))) { $m = new AdvertiseChannel(); $m->adv_id = $adv_id; $m->channel_id = $channel_id; $m->tag = $tag; $m->price = $price; echo $m->save(), ':', $row, "\n"; } } }
public function getTableName() { $filters = $this->getFilterCondition(); $conditions = array(); if (isset($filters['cp_id'])) { $model = CP::model()->findByPk($filters['cp_id']); if ($model) { $conditions[] = "CP:{$model->name}"; } } if (isset($filters['adv_id'])) { $model = Advertise::model()->findByPk($filters['adv_id']); if ($model) { $conditions[] = "业务:{$model->name}"; } } if (isset($filters['channel_id'])) { $model = Channel::model()->findByPk($filters['channel_id']); if ($model) { $conditions[] = "渠道:{$model->name}"; } } /*2014-11-17包名*/ if (isset($filters['adv_channel_id'])) { $model = AdvertiseChannel::model()->findByPk($filters['adv_channel_id']); if ($model) { $conditions[] = "包名:{$model->tag}"; } } /*end*/ if (isset($filters['begin_date']) && isset($filters['end_date'])) { $conditions[] = "从{$filters['begin_date']}到{$filters['end_date']}"; } if (isset($filters['date'])) { $conditions[] = "日期:{$filters['date']}"; } if (count($conditions)) { return $this->getTableBaseName() . '-(' . join('-', $conditions) . ')'; } else { return $this->getTableBaseName() . '-全部'; } }