Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MOfficeCampaignDetail::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'office_id' => $this->office_id, 'pic_category' => $this->pic_category, 'created_time' => $this->created_time]);
     $query->andFilterWhere(['like', 'pic_url', $this->pic_url]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function actionOutlets()
 {
     $outlets = \app\models\ClientOutlet::find()->all();
     foreach ($outlets as $outlet) {
         $office = \app\models\MOffice::find()->where(['title' => $outlet->title])->one();
         if (!empty($office)) {
             echo "found {$outlet->title}" . PHP_EOL;
             $details = \app\models\MOfficeCampaignDetail::findAll(['office_id' => $office->office_id]);
             $pics = [];
             foreach ($details as $detail) {
                 $pic_urls = explode(',', $detail->pic_url);
                 foreach ($pic_urls as $pic_url) {
                     $from = $detail->getPicFileByMedia($pic_url);
                     $media = str_replace('.jpg', '', $pic_url);
                     $to = $outlet->getPicPathname($media);
                     copy($from, $to);
                     $pics[] = $media;
                 }
             }
             $outlet->pics = implode(",", $pics);
             $outlet->original_office_id = $office->office_id;
             $outlet->latitude = $office->lat;
             $outlet->longitude = $office->lon;
             $outlet->save(false);
         }
     }
 }
Ejemplo n.º 3
0
    }
    $myscore = \app\models\MOfficeCampaignScore::getScoreByScorerAndPicCategory($office->office_id, $staff->staff_id, $category->id);
    if ($myscore !== false) {
        continue;
    }
    $min_score = 0;
    if (!$office->is_selfOperated) {
        $max_score = 20;
    } else {
        if ($category->sort_order == 6) {
            $max_score = 10;
        } else {
            $max_score = 18;
        }
    }
    $detail = MOfficeCampaignDetail::getDetailByOfficeAndPicCategory($office->office_id, $category->id);
    if (!empty($detail)) {
        $url = $detail->getImageUrl();
    } else {
        $url = '../web/images/comm-icon/upload-pic-64x64.png';
    }
    ?>

                <?php 
    if (!empty($detail)) {
        ?>
                    <div style='background-color:white;' class="slide campaign-slide" detail_id = <?php 
        echo $detail->id;
        ?>
>
                        <div>
Ejemplo n.º 4
0
    <?php 
$scores = \app\models\MOfficeCampaignScore::getScoreByPicCategory($model_office->office_id, $model_ocpc->id);
$supervisor = $model_office->supervisor;
?>
    <!-- Wrap all non-bar HTML in the .content div (this is actually what scrolls) -->
    <div class="content">

      <p>
        <?php 
echo $model_ocpc->name;
?>
      </p>
       

      <?php 
$model_office_campaign_detail = MOfficeCampaignDetail::findOne(['pic_category' => $model_ocpc->id, 'office_id' => $model_office->office_id]);
if (!empty($model_office_campaign_detail)) {
    $urls = $model_office_campaign_detail->getImageUrls();
} else {
    //$url = 'http://placehold.it/200x200';
    $urls = ['../web/images/comm-icon/upload-pic-700x700.gif'];
}
?>

      <!--
      <img width=100% class="media-object pull-left" src="<//?= $url ?>">
      -->

        <div class="slider" id="mySlider">
        <div class="slide-group">
            <?php 
Ejemplo n.º 5
0
 public function getCampaignDetail()
 {
     return $this->hasOne(MOfficeCampaignDetail::className(), ['id' => 'office_campaign_id']);
 }
Ejemplo n.º 6
0
 public function actionHandlecsmdzltj()
 {
     $this->layout = false;
     $gh_id = U::getSessionParam('gh_id');
     $openid = U::getSessionParam('openid');
     Yii::$app->wx->setGhId($gh_id);
     $office_id = empty($_GET['office_id']) ? 0 : $_GET['office_id'];
     $cat = empty($_GET['cat']) ? 1 : $_GET['cat'];
     $media_id = empty($_GET['serverId']) ? 0 : json_decode($_GET['serverId'], true);
     if (empty($media_id)) {
         //U::W([$_GET]);
         return json_encode(['code' => 1]);
     }
     $model_office_campaign_detail = MOfficeCampaignDetail::findOne(['pic_category' => $cat, 'office_id' => $office_id]);
     if (!empty($model_office_campaign_detail)) {
         U::W("model_office_campaign_detail Not NULL , update ...");
         $model_office_campaign_detail->delete();
     }
     $model = new MOfficeCampaignDetail();
     //$model->gh_id = $gh_id;
     //$model->openid = $openid;
     $model->office_id = $office_id;
     $model->pic_category = $cat;
     //$model->media_id = $media_id;
     //$model->pic_url = "{$media_id}.jpg";
     $media_url = array();
     foreach ($media_id as $media) {
         $filename = $media . ".jpg";
         $log_file_path = $model->getPicFileByMedia($filename);
         Yii::$app->wx->setGhId('gh_03a74ac96138');
         //Yii::$app->wx->WxMediaDownload($model->media_id, $log_file_path);
         Yii::$app->wx->WxMediaDownload($media, $log_file_path);
         U::compress_image_file($log_file_path);
         $media_url[] = $filename;
     }
     $model->pic_url = implode(",", $media_url);
     $model->save(false);
     return json_encode(['code' => 0]);
 }
Ejemplo n.º 7
0
    <div class="content">
      <p class="content-padded">
      门店选择
      </p>

        <ul class="table-view">
        <li class="table-view-cell table-view-divider"><?php 
echo "{$staff->name} {$staff->mobile}";
?>
</li>
        <?php 
foreach ($models_office as $model_office) {
    if ($model_office->is_selfOperated && !$staff->isSelfOperatedOfficeDirector()) {
        continue;
    }
    $detail_status = \app\models\MOfficeCampaignDetail::getDetailReadyStatus($model_office->office_id);
    ?>

            <li class="table-view-cell media">
            <a data-ignore="push" class="navigate-right" href="<?php 
    echo Url::to(['csmdzltj2', 'gh_id' => $gh_id, 'openid' => $openid, 'office_id' => $model_office->office_id, 'staff_id' => $staff->staff_id], true);
    ?>
">

            <?php 
    if ($detail_status == \app\models\MOfficeCampaignDetail::DETAIL_COMPLETE) {
        ?>
              <span class="badge badge-positive">已提交</span>
            <?php 
    } elseif ($detail_status == \app\models\MOfficeCampaignDetail::DETAIL_IMCOMPLETE) {
        ?>
Ejemplo n.º 8
0
            if ($staff->isOfficeCampaignScorer()) {
                $myscore = \app\models\MOfficeCampaignScore::getScoreByScorer($model_office->office_id, $staff->staff_id);
                if ($myscore === false) {
                    ?>
                    <span class="icon icon-info" style="color:red"></span>
                    <?php 
                }
            }
            ?>
                <span class="badge badge-positive"><?php 
            echo number_format($score, 2);
            ?>
分</span>
              <?php 
        } else {
            if (\app\models\MOfficeCampaignDetail::getDetailReadyStatus($model_office->office_id) != \app\models\MOfficeCampaignDetail::DETAIL_COMPLETE) {
                ?>
                <span class="badge badge-negative"><?php 
                echo "未提交资料";
                ?>
</span>
              <?php 
            } else {
                ?>
                <span class="badge badge-negative"><?php 
                echo "未评分";
                ?>
</span>    
              <?php 
            }
        }
 /**
  * Finds the MOfficeCampaignDetail model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return MOfficeCampaignDetail the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MOfficeCampaignDetail::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }