public function search($params) { $query = MItem::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $this->addCondition($query, 'cid'); $this->addCondition($query, 'title', true); return $dataProvider; }
<?php use yii\helpers\Html; use yii\helpers\Url; use app\models\U; use app\models\MOffice; use app\models\MItem; $item = \app\models\MItem::findOne(['gh_id' => $gh_id, 'cid' => $cid]); //U::W($item); ?> <style type="text/CSS"> .tabSumm { color:#00C; } .keyword { color: red; background-color: yellow; } .highlight { color: red; background-color: yellow; } .productPkgHint { color: #aaaaaa; font-size: 10pt;
public function actionItemdelete($id) { $model = MItem::findOne($id); $model->delete(); return $this->redirect(['itemlist']); }
/** * Finds the MItem model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return MItem the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MItem::find($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<a data-ajax=false href="http://m.10010.com/mobilegoodsdetail/711408014789.html?src=wolm&channel=cps&cid=8a94a89148bf746b0148bfe4ee5600ef&adid=8a94a891487978800148826b0d5a005a"> 华为荣耀6 </a> </li> <!-- <li> <a data-ajax=false href=""> 小米红米1S </a> </li> --> <?php //$models = MItem::findAll(['kind'=>MItem::ITEM_KIND_MOBILE]); $models = MItem::find()->where(['kind' => MItem::ITEM_KIND_MOBILE])->orderBy(['price' => SORT_DESC])->all(); ?> <?php foreach ($models as $model) { ?> <li><a data-ajax=false href="<?php echo Url::to(['mobile', 'cid' => $model->cid, 'gh_id' => $gh_id, 'openid' => $openid]); ?> "> <?php echo $model->title; ?> </a></li> <?php } ?>
public function actionLlb() { $this->layout = 'wapy'; $gh_id = U::getSessionParam('gh_id'); $openid = U::getSessionParam('openid'); Yii::$app->wx->setGhId($gh_id); $kind = $_GET['kind']; $user = MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]); if (empty($user->openidBindMobiles)) { Yii::$app->getSession()->set('RETURN_URL', Url::to()); return $this->redirect(['addbindmobile', 'gh_id' => $gh_id, 'openid' => $openid]); } $cats = $this->getLLBCatsByMobiles($user->getBindMobileNumbers()); if (empty($cats)) { return $this->render('lyhzxyhhint', ['gh_id' => $gh_id, 'openid' => $openid]); } //$models = MItem::find()->where(['kind'=>$kind, 'cid'=>$cats])->orderBy(['price'=>SORT_ASC])->all(); $models = MItem::find()->where(['kind' => $kind])->orderBy(['price' => SORT_ASC])->all(); U::W("\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$"); U::W($models); U::W($cats); return $this->render('llb', ['gh_id' => $gh_id, 'openid' => $openid, 'user' => $user, 'models' => $models, 'kind' => $kind]); }
</h1> <?php //echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('增加套餐', ['itemcreate'], ['class' => 'btn btn-primary']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table-responsive'], 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['attribute' => 'cid', 'value' => function ($model, $key, $index, $column) { return MItem::getItemCatName($model->cid); }, 'filter' => MItem::getItemCatName()], 'pkg3g4g', 'monthprice', 'period', 'plan', 'pkg_price', 'prom_price', 'yck', 'income_return', 'month_return', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{pkgupdate} {pkgdelete}', 'buttons' => ['pkgupdate' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0']); }, 'pkgdelete' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this package?'), 'data-method' => 'post', 'data-pjax' => '0']); }]]]]); ?> </div> <?php /* // 'openid', // 'nickname', // 'title', <p>
<?php $itemPayKindOption = $model->getItemPayKindOption(); $supportpay_count = count($itemPayKindOption); U::W($itemPayKindOption); ?> <?php //当产品为 惠购流量包产品时,不需要用户选择支付方式,直接订购,营业厅扣除用户话费,办理相应业务 //校园优惠季 + 流量宝 活动 直接订购,办理相应业务 if ($model->cid == 90000 || $model->cid == 90001 || $model->cid == 90002 || $model->cid == 90003 || $model->cid == 90004 || $model->cid == 90005 || $model->cid == 90006 || $model->cid == 90007 || $model->cid == 90008 || $model->cid == 90009 || $model->cid == 90010 || $model->cid == 80000 || $model->cid == 80001) { ?> <!-- nothing --> 选择用户类型 <?php echo $form->field($model, 'memo')->label(false)->dropDownList(MItem::getUserTypeOption()); ?> <?php } else { ?> <?php echo $form->field($model, 'memo')->textinput(['id' => 'memo', 'maxlength' => '256', 'placeholder' => '给卖家留言'])->label(false); ?> <!-- iphone6s 和宽带产品只是预订不用支付 --> <?php if ($model->cid != 4006 && $model->cid != 80050 && $model->cid != 80051 && $model->cid != 80052 && $model->cid != 80053 && $model->cid != 80054) { ?> <div> <fieldset data-role="controlgroup" data-type="horizontal" id="paykind-field">
</h1> <?php //echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('增加商品', ['itemcreate'], ['class' => 'btn btn-primary']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'options' => ['class' => 'table-responsive'], 'tableOptions' => ['class' => 'table table-striped'], 'columns' => [['attribute' => 'cid', 'value' => function ($model, $key, $index, $column) { return MItem::getItemCatName($model->cid); }, 'filter' => MItem::getItemCatName(), 'headerOptions' => array('style' => 'width:15%;')], 'quantity', 'old_price', 'price', ['attribute' => 'title'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{itemupdate} {itemdelete}', 'buttons' => ['itemupdate' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('yii', 'Update'), 'data-pjax' => '0']); }, 'itemdelete' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0']); }]]]]); ?> </div> <?php /* // 'openid', // 'nickname', // 'title', <p>