コード例 #1
0
 public function actionView($id)
 {
     $commodityOrderDetail = CommodityOrderDetail::findOne($id);
     if (empty($commodityOrderDetail)) {
         throw new HttpException(404, '查看失败,数据不存在!');
     }
     $commodityOrder = CommodityOrder::findOne($commodityOrderDetail->coid);
     if (empty($commodityOrder)) {
         throw new HttpException(404, '查看失败,数据不存在!');
     }
     return $this->render('view', ['model' => $commodityOrder]);
 }
コード例 #2
0
 public function actionAllot($id)
 {
     $model = CommodityOrder::findOne($id);
     if (empty($model)) {
         throw new HttpException(404, '操作失败,放单不存在!');
     }
     $dataProvider = new ActiveDataProvider(['query' => CommodityOrderDetail::find()->where('coid = :coid', [':coid' => $model->id])->orderBy('keyword'), 'pagination' => false]);
     $users = User::find()->where('rid = 4')->all();
     $users_json = array();
     $enarray = ['value' => '', 'text' => '未分配'];
     array_push($users_json, $enarray);
     foreach ($users as $user) {
         $enarray = ['value' => $user->id, 'text' => $user->username];
         array_push($users_json, $enarray);
     }
     $users_json = json_encode($users_json);
     $recommend_json = [['value' => '1', 'text' => '是'], ['value' => '0', 'text' => '否']];
     $recommend_json = json_encode($recommend_json);
     return $this->render('allot', array('dataProvider' => $dataProvider, 'users_json' => $users_json, 'recommend_json' => $recommend_json));
 }
コード例 #3
0
ファイル: index.php プロジェクト: vilison/yii2-order
    $commodityOrder = CommodityOrder::findOne($data['coid']);
    return $commodityOrder->sku;
}], ['attribute' => '要求', 'value' => function ($data) {
    $commodityOrder = CommodityOrder::findOne($data['coid']);
    if (empty($commodityOrder->rule)) {
        $commodityOrder->rule = '';
    }
    return $commodityOrder->rule;
}], ['class' => 'yii\\grid\\Column', 'header' => '买手信用', 'content' => function ($data) {
    $commodityOrder = CommodityOrder::findOne($data['coid']);
    if (empty($commodityOrder->credit)) {
        $commodityOrder->credit = '';
    }
    return '<span id="credit' . $data['id'] . '">' . $commodityOrder->credit . '</span>';
}], ['attribute' => '最近30天交易不超', 'value' => function ($data) {
    $commodityOrder = CommodityOrder::findOne($data['coid']);
    if (empty($commodityOrder->trade_num)) {
        $commodityOrder->trade_num = '';
    }
    return $commodityOrder->trade_num;
}], ['attribute' => '关键词', 'value' => function ($data) {
    return $data['keyword'];
}], ['attribute' => '浏览入口', 'value' => function ($data) {
    return $data['entrance'];
}], ['attribute' => '卡位条件', 'value' => function ($data) {
    if (empty($data['condition'])) {
        $data['condition'] = '';
    }
    return $data['condition'];
}], ['attribute' => '笔数', 'value' => function ($data) {
    return $data['num'];