在任何產品下添加一個字段-bugfree

在ProductService.php下修改如下方法:

    public static function getProductAllFieldInfo($type, $productId)
    {
		$accessStateArr = Yii::app()->db->createCommand()
									->select('id')
									->from('{{field_config}}')
									->where('field_name = :field_name and product_id = :product_id',
											array(':field_name'=>'AccessState',':product_id'=>$productId))
									->queryAll();
		if(empty($accessStateArr))
		{
				   Yii::app()->db->createCommand()
				  ->insert('{{field_config}}',array('created_at'=>date('Y-m-d H:i:s'),'created_by'=>1,'updated_at'=>date('Y-m-d H:i:s'),'updated_by'=>1,'field_name'=>'AccessState','field_type'=>'single select','field_value'=>'通過,不通過','default_value'=>'','is_dropped'=>'0','field_label'=>'審覈狀態','type'=>'bug','belong_group'=>'bug_other','display_order'=>0,'editable_action'=>'opened,resolved,closed','validate_rule'=>'no','match_expression'=>'','product_id'=>$productId,'result_group'=>'result_status','lock_version'=>1,'is_required'=>'0'));
		}
        $searchResult = Yii::app()->db->createCommand()
                        ->select('*')
                        ->from('{{field_config}}')
                        ->where('type = :type and product_id = :productId and is_dropped = :isDropped',
                                array(':type' => $type,
                                    ':productId' => $productId,
                                    ':isDropped' => CommonService::$TrueFalseStatus['FALSE']))
                        ->order('belong_group,display_order desc')
                        ->queryAll();
        return $searchResult;
    }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章