示例#1
0
/**
 * @company :万虎网络
 * @author:liushaohua
 * @time: 2015年7月14日 11:36:26
 * 
 */
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\file\FileInput;
use dosamigos\datetimepicker\DateTimePicker;
use common\models\fund\FundProductThirdproduct;
use common\models\base\fund\Thirdproduct;
$id = $model->id;
$thirdfundModel = [];
$modelmid = FundProductThirdproduct::find()->where(['product_id' => $id])->asArray()->all();
if ($modelmid) {
    foreach ($modelmid as $v) {
        array_push($thirdfundModel, Thirdproduct::find()->select('id')->where(['id' => $v['thirdproduct_id']])->asArray()->one());
    }
    $newth = [];
    foreach ($thirdfundModel as $k => $v) {
        array_push($newth, $v['id']);
    }
}
/* @var $this yii\web\View */
/* @var $model common\models\base\fund\product */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="product-form">
示例#2
0
 /**
  * Deletes an existing product model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = FundProductThirdproduct::find()->where(['product_id' => $id])->all();
     foreach ($model as $V) {
         $thirdproduct_id = $V->thirdproduct_id;
         $thirdModel = Thirdproduct::find()->where(['id' => $thirdproduct_id])->one();
         $thirdModel->process_status = 0;
         $thirdModel->save(false);
     }
     Product::updateAll(['status' => Product::STATUS_DELETE], ['id' => $id]);
     // $this->findModel($id)->delete();
     return $this->redirect(['index']);
 }