public function actionGetType() { $type_data = MakeType::model()->findAll(array("condition" => "OrganID = " . Commonmodel::getOrganID())); //. " AND IsDefault = 0" foreach ($type_data as $key => $type) { $data[$key]['ID'] = $type->ID; $data[$key]['TypeName'] = $type->TypeName; } echo json_encode($data); }
public function actionDestorytype() { $bool = MakeType::model()->deleteByPk($_POST['ID'], 'TypeQuantity=:TypeQuantity and IsDefault!=:IsDefault', array('TypeQuantity' => 0, 'IsDefault' => 1)); if ($bool == 1) { $result['success'] = "客户类别删除成功!"; } else { $result['errorMsg'] = "系统异常,客户类别删除失败!"; } echo json_encode($result); }