public function testPersist() { $jsonFilename = __DIR__ . '/workdir/persisting.json'; file_put_contents($jsonFilename, '[]'); $table = new Table($jsonFilename); $table->insert(['foo' => 'bar', 'baz' => 'bat']); $table->insert(['ab' => 'cd', 'ef' => 'gh']); $table->persist(); $tableLoaded = new Table($jsonFilename); $this->assertSame(2, $tableLoaded->count()); unlink($jsonFilename); }
public static function OnlineIt($order_id, $pay_id, $money, $currency = 'CNY', $service = 'alipay', $bank = '支付宝') { list($_, $_, $quantity, $_) = explode('-', $pay_id); if (!$order_id || !$pay_id || $money <= 0) { return false; } $order = Table::Fetch('order', $order_id); if ($order['state'] == 'unpay') { Table::UpdateCache('order', $order_id, array('pay_id' => $pay_id, 'money' => $money, 'state' => 'pay', 'service' => $service, 'quantity' => $quantity, 'pay_time' => time())); $order = Table::FetchForce('order', $order_id); if ($order['state'] == 'pay') { $table = new Table('pay'); $table->id = $pay_id; $table->order_id = $order_id; $table->money = $money; $table->currency = $currency; $table->bank = $bank; $table->service = $service; $table->create_time = time(); $table->insert(array('id', 'order_id', 'money', 'currency', 'service', 'create_time', 'bank')); //TeamBuy Operation ZTeam::BuyOne($order); } } return true; }
public static function Create($email, $city_id) { if (!Utility::ValidEmail($email, true)) { return; } $secret = md5($email . $city_id); $table = new Table('subscribe', array('email' => $email, 'city_id' => $city_id, 'secret' => $secret)); Table::Delete('subscribe', $email, 'email'); $table->insert(array('email', 'city_id', 'secret')); }
public static function Create($mobile, $city_id, $secret = null, $enable = false) { if (!Utility::IsMobile($mobile, true)) { return; } $secret = $secret ? $secret : Utility::VerifyCode(); $have = Table::Fetch('smssubscribe', $mobile, 'mobile'); if ($have && $have['city_id'] == $city_id && 'Y' == $have['enable']) { return true; } $table = new Table('smssubscribe', array('mobile' => $mobile, 'enable' => $enable ? 'Y' : 'N', 'city_id' => $city_id, 'secret' => $secret)); Table::Delete('smssubscribe', $mobile, 'mobile'); return $table->insert(array('mobile', 'city_id', 'secret', 'enable')); }
public static function Create($email, $city_id) { if (!Utility::ValidEmail($email, true)) { return; } $secret = md5($email . $city_id); $table = new Table('subscribe', array('email' => $email, 'city_id' => $city_id, 'secret' => $secret)); Table::Delete('subscribe', $email, 'email'); $table->insert(array('email', 'city_id', 'secret')); /* notice */ /* $host = $_SERVER['HTTP_HOST']; $u = "http://notice.zuitu.com/subscribe.php?email={$email}&city_id={$city_id}&secret={$secret}&host={$host}"; Utility::HttpRequest($u); */ }
/** * @return mixed The primary key value(s), as an associative array if the * key is compound, or a scalar if the key is single-column. */ protected function _doInsert() { /** * Execute the INSERT (this may throw an exception) */ $data = array_intersect_key($this->getArrayCopy(), $this->_cleanData); $primaryKey = $this->_table->insert($data); /** * Save the new primary key value in _data. The primary key may have * been generated by a sequence or auto-increment mechanism, and this * merge should be done before the _postInsert() method is run, so the * new values are available for logging, etc. */ $this->setFromArray($primaryKey); return $primaryKey; }
public static function OnlineIt($order_id, $pay_id, $money, $currency = 'CNY', $service = 'alipay', $bank = '支付宝', $trade_no = '') { list($_, $_, $quantity, $_) = explode('-', $pay_id); if (!$order_id || !$pay_id || $money <= 0) { return false; } $order = Table::Fetch('order', $order_id); $team = Table::Fetch('team', $order['team_id']); $user_id = abs(intval($order['user_id'])); team_state($team); if ($order['state'] == 'unpay') { $table = new Table('pay'); $table->id = $pay_id; $table->vid = $trade_no; $table->order_id = $order_id; $table->money = $money; $table->currency = $currency; $table->bank = $bank; $table->service = $service; $table->create_time = time(); $ia = array('id', 'vid', 'order_id', 'money', 'currency', 'service', 'create_time', 'bank'); if (Table::Fetch('pay', $pay_id) || !$table->insert($ia)) { return false; } //update user money; +money Table::UpdateCache('user', $user_id, array('money' => array("money + {$money}"))); $u = array('user_id' => $user_id, 'admin_id' => 0, 'money' => $money, 'direction' => 'income', 'action' => 'paycharge', 'detail_id' => $pay_id, 'create_time' => time()); DB::Insert('flow', $u); $user = Table::FetchForce('user', $user_id); //print_r($user);exit; if ($user['money'] < $order['origin']) { return false; } if (in_array($team['state'], array('soldout')) || $team['end_time'] < time()) { return false; } Table::UpdateCache('order', $order_id, array('pay_id' => $pay_id, 'money' => $money, 'state' => 'pay', 'trade_no' => $trade_no, 'service' => $service, 'quantity' => $quantity, 'pay_time' => time())); $order = Table::FetchForce('order', $order_id); if ($order['state'] == 'pay') { //TeamBuy Operation ZTeam::BuyOne($order); } } return true; }
/** * 用户信息转移 * @author tianyunchong * @datetime 2016/05/26 */ ini_set('magic_quotes_gpc', "1"); include_once "../common.php"; $conn = new Table("forbuyers-test"); $connLocal = new Table("local198"); $supid = 0; while (1) { $userArr = $conn->findAll("select * from fbsupplier.fb_sup_user where supid > '" . $supid . "' limit 100"); if (empty($userArr)) { break; } foreach ($userArr as $value) { $supid = $value["supid"]; $existArr = $connLocal->findOne("select * from fbsupplier.fb_sup_user where supid = '" . $supid . "' limit 1"); if ($existArr) { continue; } /** 邮箱不能重复 */ $existArr = $connLocal->findOne("select * from fbsupplier.fb_sup_user where email = '" . $value["email"] . "' limit 1"); if ($existArr) { continue; } $value["notice"] = intval($value["notice"]); $connLocal->insert($value, "fbsupplier.fb_sup_user"); echo $supid . "\t" . $value["username"] . "\n"; } }
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; need_login(); need_auth(abs(intval($INI['system']['forum'])) > 0); $publics = option_category('public'); if ($_POST) { $topic = new Table('topic', $_POST); if ($topic->category == 'city') { $topic->city_id = $city['id']; } else { $topic->public_id = $topic->category; } $topic->user_id = $topic->last_user_id = $login_user_id; $topic->create_time = $topic->last_time = time(); $topic->reply_number = 0; $insert = array('user_id', 'city_id', 'public_id', 'content', 'last_user_id', 'last_time', 'reply_number', 'create_time', 'title'); if ($topic_id = $topic->insert($insert)) { Utility::Redirect(WEB_ROOT . "/forum/topic.php?id={$topic_id}"); } $topic = $_POST; } $id = abs(intval($_GET['id'])); include template('forum_new');
public static function PostNewComments($details) { $added_date = date('Y-m-d :H:m:s'); $user_id = $details['user_id']; $team_id = $details['team_id']; $comments = $details['comments']; $table = new Table('comments', array('user_id' => $user_id, 'team_id' => $team_id, 'comments' => $comments, 'added_date' => $added_date, 'status' => 'active')); $table->insert(array('user_id', 'team_id', 'comments', 'added_date', 'status')); }
$header = array(); $header[] = "serveToken:" . microtime(1); $header[] = "apiKey:1kg8tunzfxt8zvzpf53vjr5es45lvszh"; $str = curlPost($api, $header, $postData); if (!isset($str["accessToken"])) { exit("用户登录验证失败!\n"); } else { echo "用户登录验证成功!\n"; } /*查询下所有的推广计划 */ $api = "https://api.e.360.cn/2.0/account/getCampaignIdList"; $header[] = "accessToken:" . $str["accessToken"]; $header[] = "sessionToken:" . $str["sessionToken"]; $params = array("format" => "json"); $str = curlPost($api, $header, $params); if (!isset($str["campaignIdList"])) { exit("无法获取到任何推广计划id\n"); } else { echo "所有推广计划获取成功!\n"; } $campaignIdList = $str["campaignIdList"]; /* 根据推广信息id查询推广计划的具体内容*/ $campaignArr = array(); $api = "https://api.e.360.cn/2.0/campaign/getInfoByIdList"; $params = array("format" => "json", "idList" => json_encode($campaignIdList)); $str = curlPost($api, $header, $params); foreach ($str["campaignList"] as $value) { $conn->insert(array("id" => $value["id"], "title" => $value["name"]), "tianyunzi.360_jihua"); echo "计划[" . $value["name"] . "]插入\n"; continue; }
public function actionCreate() { $this->layout = false; $table = new Table(); $column = new Column(); if (isset($_POST['Table'], $_POST['Column'])) { $table->attributes = $_POST['Table']; $column->attributes = $_POST['Column']; /* * Add index */ $addIndices = array(); if (isset($_POST['createIndexPrimary'])) { $column->createPrimaryKey = true; } if (isset($_POST['createIndex'])) { $addIndices['INDEX'] = $column->COLUMN_NAME; } if (isset($_POST['createIndexUnique'])) { $column->createUniqueKey = true; } if (isset($_POST['createIndexFulltext'])) { $addIndices['FULLTEXT'] = $column->COLUMN_NAME . (array_search($column->COLUMN_NAME, $addIndices) !== false ? '_fulltext' : ''); } $table->columns = array($column); if ($sql = $table->insert()) { $response = new AjaxResponse(); $response->addNotification('success', Yii::t('core', 'successAddTable', array('{table}' => $table->TABLE_NAME)), null, $sql); $response->redirectUrl = '#tables/' . $table->TABLE_NAME . '/structure'; $response->executeJavaScript('sideBar.loadTables(schema);'); foreach ($addIndices as $type => $indexName) { try { $index = new Index(); $index->throwExceptions = true; $index->TABLE_NAME = $table->TABLE_NAME; $index->TABLE_SCHEMA = $this->schema; $index->INDEX_NAME = $indexName; $index->setType($type); $indexCol = new IndexColumn(); $indexCol->COLUMN_NAME = $column->COLUMN_NAME; $index->columns = array($indexCol); $sql = $index->save(); $response->addNotification('success', Yii::t('core', 'successCreateIndex', array('{index}' => $index->INDEX_NAME)), null, $sql); $response->refresh = true; } catch (DbException $ex) { $response->addNotification('error', Yii::t('core', 'errorCreateIndex', array('{index}' => $index->INDEX_NAME)), $ex->getText(), $ex->getSql()); } } $this->sendJSON($response); } } $collations = Collation::model()->findAll(array('order' => 'COLLATION_NAME', 'select' => 'COLLATION_NAME, CHARACTER_SET_NAME AS collationGroup')); CHtml::generateRandomIdPrefix(); $data = array('table' => $table, 'column' => $column, 'collations' => $collations, 'storageEngines' => StorageEngine::getSupportedEngines()); $data['columnForm'] = $this->renderPartial('/column/formBody', $data, true); $this->render('form', $data); }
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); need_auth('admin'); $id = abs(intval($_REQUEST['id'])); $category = Table::Fetch('category', $id); $table = new Table('category', $_POST); $table->letter = strtoupper($table->letter); $uarray = array('zone', 'ename', 'letter', 'name', 'czone', 'sort_order'); if (!$_POST['name'] || !$_POST['ename'] || !$_POST['letter']) { Session::Set('error', '中文名称、英文名称、首字母均不能为空'); Utility::Redirect(null); } if ($category) { if ($flag = $table->update($uarray)) { Session::Set('notice', '编辑分类成功'); } else { Session::Set('error', '编辑分类失败'); } option_category($category['zone'], true); } else { if ($flag = $table->insert($uarray)) { Session::Set('notice', '新建分类成功'); } else { Session::Set('error', '新建分类失败'); } } option_category($table->zone, true); Utility::Redirect(null);
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(true); $pages = array('help_tour' => '玩转' . $INI['system']['abbreviation'], 'help_faqs' => '常见问题', 'help_zuitu' => '什么是' . $INI['system']['abbreviation'], 'help_api' => '开发API', 'about_contact' => '联系方式', 'about_us' => '关于' . $INI['system']['abbreviation'], 'about_job' => '工作机会', 'about_terms' => '用户协议', 'about_privacy' => '隐私声明'); $id = strval($_GET['id']); if ($id && !in_array($id, array_keys($pages))) { Utility::Redirect(WEB_ROOT . "/manage/system/page.php"); } $n = Table::Fetch('page', $id); if ($_POST) { $table = new Table('page', $_POST); $table->SetStrip('value'); if ($n) { $table->SetPk('id', $id); $table->update(array('id', 'value')); } else { $table->insert(array('id', 'value')); } Session::Set('notice', "页面:{$pages[$id]}编辑成功"); Utility::Redirect(WEB_ROOT . "/manage/system/page.php?id={$id}"); } $value = $n['value']; include template('manage_system_page');
exit; } elseif ($action == 'add') { $question['type'] = 'radio'; $question['is_show'] = 1; $question['order'] = 0; include template('manage_vote_question_edit'); exit; //添加问题,数据处理 } elseif ($action == 'add_submit') { $question['title'] = isset($_POST['question']['title']) ? addslashes(htmlspecialchars($_POST['question']['title'])) : ''; $question['type'] = isset($_POST['question']['type']) && $_POST['question']['type'] == 'radio' ? 'radio' : 'checkbox'; $question['is_show'] = isset($_POST['question']['is_show']) && $_POST['question']['is_show'] ? 1 : 0; $question['order'] = isset($_POST['question']['order']) && is_numeric($_POST['question']['order']) ? $_POST['question']['order'] : '0'; $table = new Table('vote_question', $question); $title_check = Table::Count('vote_question', array("title = '{$question['title']}'")); if ($title_check) { Session::Set('error', '“' . $question['title'] . '”已存在,请换一个标题。'); Utility::Redirect(WEB_ROOT . '/manage/vote/question.php?action=add'); exit; } $table->addtime = time(); $table->insert(array('title', 'type', 'is_show', 'addtime', 'order')); Session::Set('notice', '添加调查问题成功'); Utility::Redirect(WEB_ROOT . '/manage/vote/question.php?action=list-all'); exit; } if ($action == 'add' || $action == 'edit') { include template('manage_vote_question_edit'); } else { include template('manage_vote_question_list'); }
$insertArr["newUrl"] = substr($insertArr["pcDestinationUrl"], 0, $pos); $insertArr["newUrl"] .= "&se=baidu&planid=" . $insertArr["campaignId"] . "&unitid=" . $insertArr["adgroupId"] . "&keyid=" . $insertArr["id"]; //$insertArr["newUrl"] .= "#baidu&" . $insertArr["campaignId"] . "&" . $insertArr["adgroupId"] . "&" . $insertArr["id"]; if ($insertArr["newUrl"] == $insertArr["pcDestinationUrl"]) { echo $insertArr["keyword"] . " 链接未变化\n"; continue; } if (!strstr($insertArr["pcDestinationUrl"], "gongchang.com")) { echo $insertArr["keyword"] . " 链接已经存在gongchang.com\n"; continue; } // $str = $insertArr["keyword"] . "\n"; // $str .= "from: " . $insertArr["pcDestinationUrl"] . "\n"; // $str .= "to: " . $insertArr["newUrl"] . "\n\n"; echo $insertArr["keyword"] . "\n"; $conn->insert($insertArr, "tianyunzi.baidu_keywords"); } } $conn->close(); } function updateKeyword($keywordId, $url) { $data = array("header" => array("token" => "1f888ce6fb38730a14a6afe7437fc3b4", "username" => "郑州悉知", "password" => "GCWgcd7232275"), "body" => array("keywordTypes" => array())); $data["body"]["keywordTypes"][] = array("keywordId" => $keywordId, "pcDestinationUrl" => $url); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.baidu.com/json/sms/service/KeywordService/updateWord"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); //$data是每个接口的json字符串 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
if ($sended) { Session::Set('error', '每IP每手机号每小时只能找回一次密码'); redirect(WEB_ROOT . '/account/repass.php'); } else { $user = Table::Fetch('user', strval($_POST['mobile']), 'mobile'); if ($user) { //设置6位随机数字密码 $new_password = Utility::VerifyCode(); $content = $INI['system']['sitename'] . " 您的用户名:" . $user['username'] . " 新密码:" . $new_password . " 请及时修改密码。"; //长度不能超过70个字符 $ret = sms_send($_POST['mobile'], $content); if ($ret === true) { //插入获取验证码数据记录 $verifycode_data = array('mobile' => $_POST['mobile'], 'getip' => Utility::GetRemoteIp(), 'verifycode' => $new_password, 'dateline' => time(), 'reguid' => $user['id'], 'regdateline' => time(), 'status' => 3); $table = new Table('verifycode', $verifycode_data); $table->insert(array('mobile', 'getip', 'verifycode', 'dateline', 'reguid', 'regdateline', 'status')); $password = ZUser::GenPassword($new_password); Table::UpdateCache('user', $user['id'], array('password' => $password, 'recode' => '')); Session::Set('notice', '成功发送找回密码短信到手机号:' . $_POST['mobile'] . ' 请稍候查看短信及时修改密码'); redirect(WEB_ROOT . '/account/repass.php'); } else { Session::Set('error', '找回密码短信发送失败,错误码:' . $ret . ''); redirect(WEB_ROOT . '/account/repass.php'); } } Session::Set('error', '你的手机号没有在本站注册'); redirect(WEB_ROOT . '/account/repass.php'); } } } }
if (!isset($str["keywordList"])) { echo "无法查询到关键词\n"; continue; } foreach ($str["keywordList"] as $value1) { if (!strstr($value1["destinationUrl"], "&se=360")) { echo "============插入计划[" . $value["jhtitle"] . "],分组[" . $value["title"] . "],关键词[" . $value1["word"] . "]不包含#360============\n"; continue; } $insertArr = array("id" => $value1["id"], "name" => $value1["word"], "groupid" => $value["id"], "groupname" => $value["title"], "jhid" => $value["jhid"], "jhtitle" => $value["jhtitle"], "oldUrl" => $value1["destinationUrl"]); if (!strstr($value1["destinationUrl"], "gongchang.com")) { echo "=============计划[" . $value["jhtitle"] . "], 分组[" . $value["title"] . "],关键词[" . $value1["word"] . "]不存在gongchang.com==============\n"; continue; } $pos = stripos($insertArr["oldUrl"], "&se=360"); $insertArr["newUrl"] = substr($insertArr["oldUrl"], 0, $pos); $insertArr["newUrl"] .= "&se=360&planid=" . $value["jhid"] . "&unitid=" . $value["id"] . "&keyid=" . $value1["id"]; if ($insertArr["newUrl"] == $insertArr["oldUrl"]) { echo "=============计划[" . $value["jhtitle"] . "], 分组[" . $value["title"] . "],关键词[" . $value1["word"] . "]链接未变化==============\n"; continue; } // $str = "计划:" . $value["jhtitle"] . "\n"; // $str .= "分组:" . $value["title"] . "\n"; // $str .= "关键词:" . $value1["word"] . "\n"; // $str .= "链接:" . $value1["destinationUrl"] . "\n"; // $str .= "将会修改为:" . $insertArr["newUrl"] . "\n\n"; $conn->insert($insertArr, "tianyunzi.360_keywords"); continue; } } }
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; need_login(); $action = strval($_GET['action']); $id = $team_id = abs(intval($_GET['id'])); $team = Table::Fetch('team', $team_id); if ($action == 'remove' && $team['user_id'] == $login_user_id) { DB::DelTableRow('team', array('id' => $team_id)); json("jQuery('#team-list-id-{$team_id}').remove();", 'eval'); } else { if ($action == 'ask') { $content = trim($_POST['content']); if ($content) { $table = new Table('ask', $_POST); $table->user_id = $login_user_id; $table->team_id = $team['id']; $table->city_id = $team['city_id']; $table->create_time = time(); $table->insert(array('user_id', 'team_id', 'city_id', 'content', 'create_time')); } json(0); } } json(0);
$team['begin_time'] = strtotime($team['begin_time']); $team['end_time'] = strtotime($team['end_time']); $team['expire_time'] = strtotime($team['expire_time']); $team['image'] = upload_image('upload_image', null, 'team'); $team['image1'] = upload_image('upload_image1', null, 'team', 380); $team['image2'] = upload_image('upload_image2', null, 'team', 380); $table = new Table('team', $team); $table->SetStrip('summary', 'detail', 'systemreview', 'notice'); if ($team_id = $table->insert($insert)) { if ($team['charity_id'] != 0) { $dealcharity['charity_id'] = $team['charity_id']; $dealcharity['value'] = str_replace('%', '', $team['value']); $dealcharity['deal_id'] = $team_id; $dcTable = new Table('deals_charity', $dealcharity); $dealinsert = array('charity_id', 'value', 'deal_id'); $dcTable->insert($dealinsert); } Utility::Redirect(WEB_ROOT . "/manage/team/index.php"); } } else { $profile = Table::Fetch('leader', $login_user_id, 'user_id'); //1 $team = array(); $team['user_id'] = $login_user_id; $team['begin_time'] = strtotime('+1 days'); $team['end_time'] = strtotime('+2 days'); $team['expire_time'] = strtotime('+3 months +1 days'); $team['min_number'] = 10; $team['per_number'] = 1; $team['market_price'] = 1; $team['team_price'] = 1;
} $feedback['user_id'] = isset($login_user['id']) ? $login_user['id'] : 0; $feedback['username'] = isset($login_user['username']) ? $login_user['username'] : ''; $feedback['ip'] = $ip; $feedback['addtime'] = $time_now; $table_feedback = new Table('vote_feedback', $feedback); $feedback_id = $table_feedback->insert(array('user_id', 'username', 'ip', 'addtime')); if (!$feedback_id) { Session::Set('error', '添加失败,数据库操作失败。'); redirect( WEB_ROOT . '/vote/index.php'); } foreach($vote_list AS $vote) { $vote['feedback_id'] = $feedback_id; $table_vote = new Table('vote_feedback_question', $vote); $table_vote->insert(array('feedback_id', 'question_id', 'options_id')); } foreach($input_list AS $input) { $input['feedback_id'] = $feedback_id; $table_input = new Table('vote_feedback_input', $input); $flag = $table_input->insert(array('feedback_id', 'options_id', 'value')); } if (is_post()) { Session::Set('notice', '提交数据成功,感谢您的参与。'); } redirect( WEB_ROOT . '/vote/index.php');
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); if ($_POST) { $table = new Table('partner', $_POST); $table->SetStrip('location', 'other'); $table->create_time = time(); $table->user_id = $login_user_id; $table->password = ZPartner::GenPassword($table->password); $table->insert(array('username', 'user_id', 'city_id', 'title', 'bank_name', 'bank_user', 'bank_no', 'create_time', 'location', 'other', 'homepage', 'contact', 'mobile', 'phone', 'password', 'address')); Utility::Redirect(WEB_ROOT . '/manage/partner/index.php'); } include template('manage_partner_create');
$table->money = $total_fee; $table->order_id = $out_trade_no; $table->state = 'pay'; $table->quantity = $quantity; $table->service = 'chinabank'; $flag = $table->update(array('state', 'pay_id', 'money', 'order_id', 'quantity', 'service')); if ($flag) { $table = new Table('pay'); $table->id = $out_trade_no; $table->order_id = $order_id; $table->money = $total_fee; $table->currency = 'CNY'; $table->bank = '网银(支付宝)'; $table->service = 'chinabank'; $table->create_time = time(); $table->insert(array('id', 'order_id', 'money', 'currency', 'service', 'create_time', 'bank')); $order = Table::Fetch('order', $order_id); //update team,user,order,flow state// ZTeam::BuyOne($order); //查找地市 $area = Table::Fetch('t_city_category_rel', $team["city_id"], 'category_id'); //查找用户 $user = Table::Fetch('user', $order["user_id"], 'id'); $order_type = '3'; //更新支付状态 PayService::afterPayDoSomething($team, $order, $user, $area, $out_trade_no, $order_type); Phplog::RecordOrderSuccessLog(" 流水号:" . $_POST['trade_no'] . " 通知id:" . $_POST['notify_id'] . " 团购订单号:" . $order_id . " 支付金额:" . $total_fee . " 通知时间时间:" . $_POST['notify_time']); $is_ok = true; } else { Phplog::RecordOrderFailLog(" 流水号:" . $payNo . " 团购订单号:" . $orderId . " 支付金额:" . $amount . " 支付银行:" . $banks . " 送货信息:" . $contractName . " 发票抬头:" . $invoiceTitle . " 支付人:" . $mobile . " 支付时间:" . $payDate . " 保留字段:" . $reserved); }
/** * 拉取测试环境所有的产品到本地用于测试 * @author tianyunchong * @datetime 2016/05/25 */ ini_set('magic_quotes_gpc', "1"); include_once "../common.php"; $conn = new Table("forbuyers-test"); $connLocal = new Table("local198"); $cid = 1; while (1) { $companyArr = $conn->findAll("select * from fbsupplier.fb_company where cid > '" . $cid . "' limit 100"); if (empty($companyArr)) { break; } foreach ($companyArr as $value) { $cid = $value["cid"]; $existArr = $connLocal->findOne("select * from fbsupplier.fb_company where cid = '" . $cid . "' limit 1"); if ($existArr) { continue; } $value["comdesc"] = addslashes($value["comdesc"]); $value["cncomname"] = addslashes($value["cncomname"]); $value["encomname"] = addslashes($value["encomname"]); $value["address"] = addslashes($value["address"]); $value["tmpaddress"] = addslashes($value["tmpaddress"]); $value["promain"] = addslashes($value["promain"]); $connLocal->insert($value, "fbsupplier.fb_company"); echo $cid . "\t" . $value["encomname"] . "\n"; } }
$errors['storage'] = true; } if (trim(Request::post('backups') !== '')) { $errors['backups'] = true; } if (trim(Request::post('tmp') !== '')) { $errors['tmp'] = true; } // If errors is 0 then install cms if (count($errors) == 0) { // Update options Option::update(array('maintenance_status' => 'off', 'sitename' => Request::post('sitename'), 'siteurl' => Request::post('siteurl'), 'description' => __('Site description', 'system'), 'keywords' => __('Site keywords', 'system'), 'slogan' => __('Site slogan', 'system'), 'defaultpage' => 'home', 'timezone' => Request::post('timezone'), 'system_email' => Request::post('email'), 'theme_site_name' => 'default', 'theme_admin_name' => 'default')); // Get users table $users = new Table('users'); // Insert new user with role = admin $users->insert(array('login' => Security::safeName(Request::post('login')), 'password' => Security::encryptPassword(Request::post('password')), 'email' => Request::post('email'), 'hash' => Text::random('alnum', 12), 'date_registered' => time(), 'role' => 'admin')); // Write .htaccess $htaccess = file_get_contents('.htaccess'); $save_htaccess_content = str_replace("/%siteurlhere%/", $rewrite_base, $htaccess); $handle = fopen('.htaccess', "w"); fwrite($handle, $save_htaccess_content); fclose($handle); // Installation done :) header("location: index.php?install=done"); } else { Notification::setNow('errors', $errors); } } ?> <!DOCTYPE html> <html lang="en">
$team['partner_id'] = abs(intval($partner_id)); $team['sort_order'] = 0; $team['fare'] = abs(intval($team['fare'])); $team['farefree'] = abs(intval($team['farefree'])); $team['end_time'] = strtotime($team['end_time']); $team['expire_time'] = strtotime($team['expire_time']); $team['image'] = upload_image('upload_image', null, 'team', true); $team['image1'] = upload_image('upload_image1', null, 'team'); $team['image2'] = upload_image('upload_image2', null, 'team'); $table = new Table('team', $team); //team_type == goods if ($table->team_type == 'goods') { $table->min_number = 1; } $table->SetStrip('detail', 'systemreview', 'notice'); if ($team_id = $table->insert($insert)) { Session::Set('notice', '新建项目成功, 请耐心等待审核!'); Utility::Redirect(WEB_ROOT . "/biz/index.php"); } } else { $profile = Table::Fetch('leader', $login_user_id, 'user_id'); //1 $team = array(); $team['user_id'] = $login_user_id; $team['begin_time'] = strtotime('+0 days'); $team['end_time'] = strtotime('+2 days'); $team['expire_time'] = strtotime('+3 months +1 days'); $team['min_number'] = 10; $team['per_number'] = 1; $team['market_price'] = 1; $team['team_price'] = 1;
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); need_auth('market'); if ($_POST) { $table = new Table('partner', $_POST); $table->SetStrip('location', 'other'); $table->create_time = time(); $table->user_id = $login_user_id; $table->password = ZPartner::GenPassword($table->password); $table->group_id = abs(intval($table->group_id)); $table->city_id = abs(intval($table->city_id)); $table->open = strtoupper($table->open) == 'Y' ? 'Y' : 'N'; $table->display = strtoupper($table->display) == 'Y' ? 'Y' : 'N'; $table->image = upload_image('upload_image', null, 'team', true); $table->image1 = upload_image('upload_image1', null, 'team'); $table->image2 = upload_image('upload_image2', null, 'team'); $table->insert(array('username', 'user_id', 'city_id', 'title', 'group_id', 'bank_name', 'bank_user', 'bank_no', 'create_time', 'location', 'other', 'homepage', 'contact', 'mobile', 'phone', 'password', 'address', 'open', 'display', 'image', 'image1', 'image2', 'longlat')); $partner = DB::GetTableRow('partner', array('username' => $username, 'password' => $password)); // 更新商户支付信息 if ($login_partner) { $table = new Table('partner_pay', $_POST); $table->SetPk('id', $partner['id']); $insert = array('id', 'tenpaymid', 'tenpaysec', 'alipaymid', 'alipaysec'); $flag = $table->insert($insert); } Session::Set('notice', '新建商户成功'); Utility::Redirect(WEB_ROOT . '/manage/partner/index.php'); } include template('manage_partner_create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); //$data是每个接口的json字符串 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不加会报证书问题 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不加会报证书问题 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8')); $result = curl_exec($ch); $result = json_decode($result, true); if (empty($result) || !isset($result["body"]["data"])) { exit("无法获取baidu计划数据\n"); } foreach ($result["body"]["data"] as $value) { $conn->insert(array("id" => $value["campaignId"], "name" => $value["campaignName"], "status" => $value["status"]), "tianyunzi.baidu_jihua"); echo "新增新计划 " . $value["campaignName"] . "\n"; } class Config { public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'tianyunzi'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('55651c3e54ae6.sh.cdb.myqcloud.com', 'cdb_outerroot', 'ScIwH*3fEB(', 'cn_clubnew', 8287), 'txonline' => array('172.17.18.4', 'gckeyword', 'WVwVaxADjX9z3PHd', 'gckeyword')); public static $cateApiUrl = 'http://cate.ch.gongchang.com/cate_json/'; } class Table { public $conn = ''; public $config; public function __construct($connName) { $db = Config::$dbArr; $this->config = $db[$connName];
$table->SetPk('id', $id); $table->update($insert); DB::Update('team',$id,array('dptpl_id'=>$_POST['dptpl_id'])); log_admin('team', '编辑team项目',$insert); Session::Set('notice', '编辑项目信息成功'); redirect( WEB_ROOT . "/manage/team/index.php"); } else if ( $team['id'] ) { log_admin('team', '非法编辑team项目',$insert); Session::Set('error', '非法编辑'); redirect( WEB_ROOT . "/manage/team/index.php"); } if ( $table->insert($insert) ) { log_admin('team', '新建team项目',$insert); Session::Set('notice', '新建项目成功'); redirect( WEB_ROOT . "/manage/team/index.php"); } else { log_admin('team', '编辑team项目失败',$insert); Session::Set('error', '编辑项目失败'); redirect(null); } } $groups = DB::LimitQuery('category', array( 'condition' => array( 'zone' => 'group','fid' => '0', ), )); $groups = Utility::OptionArray($groups, 'id', 'name');
if($oldpass==$login_partner['password']){ $store = Table::Fetch('store', $_POST['store_id']); if($store['partner_id']!=$partner_id) { die(print_R($store)); Session::Set('error', '请合法操作,该门店不属于你的管理'); redirect( WEB_ROOT . '/m_biz/index.php'); } $table = new Table('partner', $_POST); $table->SetStrip('location', 'other'); $table->fid = $partner_id; $table->create_time = time(); $table->password = ZPartner::GenPassword($table->password); $table->insert(array( 'username', 'user_id', 'fid','store_id', 'city_id', 'title', 'group_id', 'bank_name', 'bank_user', 'bank_no', 'create_time', 'location', 'other', 'homepage', 'contact', 'mobile', 'phone', 'password', 'address', 'open', 'display', 'image', 'image1', 'image2', 'longlat', )); redirect( WEB_ROOT . '/m_biz/accountmanagement.php'); }else{ Session::Set('error', '密码输入错误'); redirect( WEB_ROOT . '/m_biz/addstoreaccount.php?score_id='.$_POST['store_id']); } } $city_ids = Utility::GetColumn($teams, 'city_id'); $cities = Table::Fetch('category', $city_ids);