function act_insertBlackList($data, $table) { //表名,SET,WHERE $key = array(); $value = array(); foreach ($data as $k => $v) { $key[] = $k; $value[] = $v; } $set = " (" . implode(',', $key) . ") VALUE ('" . implode("','", $value) . "')"; $ret = OmAvailableModel::addTNameRow($table, $set); if ($ret) { return true; } else { self::$errCode = OmAvailableModel::$errCode; self::$errMsg = OmAvailableModel::$errMsg; return false; } }
public function view_addBlackList() { $omAvailableAct = new OmAvailableAct(); $data = array(); $data['platformUsername'] = isset($_REQUEST['platformUsername']) ? $_REQUEST['platformUsername'] : ''; $data['username'] = isset($_REQUEST['username']) ? $_REQUEST['username'] : ''; $data['usermail'] = isset($_REQUEST['usermail']) ? $_REQUEST['usermail'] : ''; $data['street'] = isset($_REQUEST['street']) ? $_REQUEST['street'] : ''; $data['phone'] = isset($_REQUEST['phone']) ? $_REQUEST['phone'] : ''; $data['platformId'] = isset($_REQUEST['platformId']) ? $_REQUEST['platformId'] : ''; $postAccount = isset($_REQUEST['account']) ? $_REQUEST['account'] : ''; $data['addTime'] = time(); $data['addUser'] = '******'; if ($data['platformUsername'] == '') { $status = '平台名称不能为空'; header('location:index.php?mod=omBlackList&act=getOmBlackList&status=' . $status); exit; } $account = ''; foreach ($postAccount as $k => $v) { $data['account'] = $v; $ret = OmBlackListAct::act_insertBlackList($data, 'om_blacklist'); if (!$ret) { $state = '添加黑名单出错'; header('location:index.php?mod=omBlackList&act=getOmBlackList&status=' . $state); exit; } } $state = '添加成功'; header('location:index.php?mod=omBlackList&act=getOmBlackList&status=' . $state); exit; }