本文整理匯總了PHP中Model函數的典型用法代碼示例。如果您正苦於以下問題:PHP Model函數的具體用法?PHP Model怎麽用?PHP Model使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Model函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: modifypwOp
/**
* 修改密碼
*/
public function modifypwOp()
{
if (chksubmit()) {
if (trim($_POST['new_pw']) !== trim($_POST['new_pw2'])) {
//showMessage('兩次輸入的密碼不一致,請重新輸入');
showMessage(Language::get('index_modifypw_repeat_error'));
}
$admininfo = $this->getAdminInfo();
//查詢管理員信息
$admin_model = Model('admin');
$admininfo = $admin_model->getOneAdmin($admininfo['id']);
if (!is_array($admininfo) || count($admininfo) <= 0) {
showMessage(Language::get('index_modifypw_admin_error'));
}
//舊密碼是否正確
if ($admininfo['admin_password'] != md5(trim($_POST['old_pw']))) {
showMessage(Language::get('index_modifypw_oldpw_error'));
}
$new_pw = md5(trim($_POST['new_pw']));
$result = $admin_model->updateAdmin(array('admin_password' => $new_pw, 'admin_id' => $admininfo['admin_id']));
if ($result) {
showMessage(Language::get('index_modifypw_success'));
} else {
showMessage(Language::get('index_modifypw_fail'));
}
} else {
Language::read('admin');
Tpl::showpage('admin.modifypw');
}
}
示例2: inform_listOp
public function inform_listOp()
{
/*
* 生成分頁
*/
$page = new Page();
$page->setEachNum(10);
$page->setStyle('admin');
/*
* 得到該店被舉報禁售的列表
*/
$model_inform = Model('inform');
$condition = array();
$condition['inform_state'] = 2;
$condition['inform_store_id'] = $_SESSION['store_id'];
$condition['inform_handle_type'] = 3;
$condition['order'] = 'inform_id desc';
$list = $model_inform->getInform($condition, $page);
$this->profile_menu('inform_list');
Tpl::output('list', $list);
Tpl::output('show_page', $page->show());
Tpl::output('menu_sign', 'store_inform');
Tpl::output('menu_sign_url', 'index.php?act=store_inform');
Tpl::output('menu_sign1', 'store_inform');
Tpl::showpage('store_inform.list');
}
示例3: store_liveOp
public function store_liveOp()
{
if (chksubmit()) {
//編輯商戶信息
$params = array();
//參數
$params['store_vrcode_prefix'] = preg_match('/^[a-zA-Z0-9]{1,3}$/', $_POST['store_vrcode_prefix']) ? $_POST['store_vrcode_prefix'] : null;
$params['live_store_name'] = $_POST['live_store_name'];
$params['live_store_address'] = $_POST['live_store_address'];
$params['live_store_tel'] = $_POST['live_store_tel'];
$params['live_store_bus'] = $_POST['live_store_bus'];
$model_store = Model('store');
$res = $model_store->editStore($params, array('store_id' => $_SESSION['store_id']));
if ($res) {
showMessage('編輯成功', '', '', 'succ');
} else {
showMessage('編輯失敗', '', '', 'error');
}
}
$model_store = Model('store');
$store = $model_store->getStoreInfo(array('store_id' => $_SESSION['store_id']));
if (empty($store)) {
showMessage('該商家不存在');
}
Tpl::output('store', $store);
$this->profile_menu('store_live');
Tpl::showpage('store_liveinfo');
}
示例4: payment_saveOp
/**
* 編輯保存
*/
public function payment_saveOp()
{
$payment_id = intval($_POST["payment_id"]);
$data = array();
$data['payment_state'] = intval($_POST["payment_state"]);
switch ($_POST['payment_code']) {
case 'alipay':
$payment_config = array('alipay_account' => $_POST['alipay_account'], 'alipay_key' => $_POST['alipay_key'], 'alipay_partner' => $_POST['alipay_partner']);
break;
case 'wxpay':
$payment_config = array('wxpay_appid' => $_POST['wxpay_appid'], 'wxpay_mch_id' => $_POST['wxpay_mch_id'], 'wxpay_appsecret' => $_POST['wxpay_appsecret'], 'wxpay_key' => $_POST['wxpay_key']);
break;
case 'unionpay':
$payment_config = array('unionpay_account' => $_POST['unionpay_account'], 'cert_passwd' => $_POST['cert_passwd']);
break;
default:
showMessage(L('param_error'), '');
}
$data['payment_config'] = $payment_config;
$model_mb_payment = Model('mb_payment');
$result = $model_mb_payment->editMbPayment($data, array('payment_id' => $payment_id));
if ($result) {
showMessage(Language::get('nc_common_save_succ'), urlAdmin('mb_payment', 'payment_list'));
} else {
showMessage(Language::get('nc_common_save_fail'), urlAdmin('mb_payment', 'payment_list'));
}
}
示例5: indexOp
public function indexOp()
{
if (ob_get_level()) {
ob_end_clean();
}
$logic_queue = Logic('queue');
$worker = new QueueServer();
$queues = $worker->scan();
while (true) {
$content = $worker->pop($queues, 1800);
if (is_array($content)) {
$method = key($content);
$arg = current($content);
$result = $logic_queue->{$method}($arg);
if (!$result['state']) {
$this->log($result['msg'], false);
}
// echo date('Y-m-d H:i:s',time()).' '.$method."\n";
// flush();
// ob_flush();
} else {
$model = Model();
$model->checkActive();
unset($model);
// echo date('Y-m-d H:i:s',time())." ---\n";
// flush();
// ob_flush();
}
}
}
示例6: points_logOp
/**
* 積分日誌列表
*/
public function points_logOp()
{
$condition_arr = array();
$condition_arr['pl_memberid'] = $_SESSION['member_id'];
if ($_GET['stage']) {
$condition_arr['pl_stage'] = $_GET['stage'];
}
$condition_arr['saddtime'] = strtotime($_GET['stime']);
$condition_arr['eaddtime'] = strtotime($_GET['etime']);
if ($condition_arr['eaddtime'] > 0) {
$condition_arr['eaddtime'] += 86400;
}
$condition_arr['pl_desc_like'] = $_GET['description'];
//分頁
$page = new Page();
$page->setEachNum(10);
$page->setStyle('admin');
//查詢積分日誌列表
$points_model = Model('points');
$list_log = $points_model->getPointsLogList($condition_arr, $page, '*', '');
//查詢會員信息
$this->get_member_info();
//信息輸出
self::profile_menu('points');
Tpl::output('show_page', $page->show());
Tpl::output('list_log', $list_log);
Tpl::output('menu_sign', 'points');
Tpl::output('menu_sign_url', 'index.php?act=member_points');
Tpl::showpage('member_points');
}
示例7: _get_Own_Store_List
private function _get_Own_Store_List()
{
$model_store = Model('store');
//查詢條件
$condition = array();
if (!empty($_GET['sc_id']) && intval($_GET['sc_id']) > 0) {
$condition['sc_id'] = $_GET['sc_id'];
} elseif (!empty($_GET['keyword'])) {
//$condition['store_name'] = array('like', '%' . $_GET['keyword'] . '%');
}
//所需字段
$fields = "*";
//排序方式
$order = $this->_store_list_order($_GET['key'], $_GET['order']);
$store_list = $model_store->where($condition)->order($order)->page(10)->select();
$page_count = $model_store->gettotalpage();
$own_store_list = $store_list;
$simply_store_list = array();
foreach ($own_store_list as $key => $value) {
$simply_store_list[$key]['store_id'] = $own_store_list[$key]['store_id'];
$simply_store_list[$key]['store_name'] = $own_store_list[$key]['store_name'];
$simply_store_list[$key]['store_address'] = $own_store_list[$key]['store_address'];
$simply_store_list[$key]['store_area_info'] = $own_store_list[$key]['area_info'];
}
output_data(array('store_list' => $simply_store_list), mobile_page($page_count));
}
示例8: queueOp
public function queueOp()
{
if (ob_get_level()) {
ob_end_clean();
}
$model_queue = Model('queue', BASE_PATH);
$worker = new Uk86QueueServer();
while (true) {
$list_key = $worker->scan();
if (!empty($list_key) && is_array($list_key)) {
foreach ($list_key as $key) {
$content = $worker->pop($key);
if (empty($content)) {
continue;
}
$method = key($content);
$arg = current($content);
$model_queue->{$method}($arg);
echo date('Y-m-d H:i:s', time()) . ' ' . $method . "\n";
// $content['time'] = date('Y-m-d H:i:s',time());
// print_R($content);
// echo "\n";
flush();
ob_flush();
}
}
sleep(1);
}
}
示例9: storeOp
/**
* [storeOp 提交]
* @return [type] [description]
*/
public function storeOp()
{
$row = Model('member')->field('member_truename')->find($_SESSION['member_id']);
$table = Model('goods_source');
if ($_POST['gids']) {
foreach ($_POST['gids'] as $k => $v) {
$data['goods_id'] = $v;
$data['member_id'] = $_SESSION['member_id'];
$data['member_truename'] = $row['member_truename'];
$data['goods_price'] = $_POST['price'][$k];
$data['goods_url'] = $_POST['url'][$k];
$data['remark'] = $_POST['remark'][$k];
$data['udate'] = $_SERVER['REQUEST_TIME'];
$row2 = $table->field('id')->where('member_id=' . $_SESSION['member_id'] . ' AND goods_id=' . $v)->find();
if ($row2) {
$data['id'] = $row2['id'];
} else {
$data['cdate'] = $_SERVER['REQUEST_TIME'];
}
print_r($data);
$table->insert($data, true);
unset($data);
}
showMessage('提交成功', 'index.php?act=show_list');
} else {
showMessage('提交錯誤', 'index.php?act=show_list');
}
}
示例10: sinaunbindOp
/**
* 新浪解綁
*/
public function sinaunbindOp()
{
//修改密碼
$model_member = Model('member');
$update_arr = array();
if ($_POST['is_editpw'] == 'yes') {
/**
* 填寫密碼信息驗證
*/
$obj_validate = new Validate();
$obj_validate->validateparam = array(array("input" => $_POST["new_password"], "require" => "true", "validator" => "Length", "min" => 6, "max" => 20, "message" => Language::get('member_sconnect_password_null')), array("input" => $_POST["confirm_password"], "require" => "true", "validator" => "Compare", "operator" => "==", "to" => $_POST["new_password"], "message" => Language::get('member_sconnect_input_two_password_again')));
$error = $obj_validate->validate();
if ($error != '') {
showMessage($error, '', 'html', 'error');
}
$update_arr['member_passwd'] = md5(trim($_POST['new_password']));
}
$update_arr['member_sinaopenid'] = '';
$update_arr['member_sinainfo'] = '';
$edit_state = $model_member->editMember(array('member_id' => $_SESSION['member_id']), $update_arr);
if (!$edit_state) {
showMessage(Language::get('member_sconnect_password_modify_fail'), '', 'html', 'error');
}
session_unset();
session_destroy();
showMessage(Language::get('member_sconnect_unbind_success'), 'index.php?act=login&ref_url=' . urlencode('index.php?act=member_connect&op=sinabind'));
}
示例11: getAddressList
/**
* 讀取地址列表
*
* @param
* @return array 數組格式的返回結果
*/
public function getAddressList($condition, $order='address_id desc'){
$address_list = $this->where($condition)->order($order)->select();
if (empty($address_list)) return array();
if (C('delivery_isuse')) {
$dlyp_ids = array();$dlyp_new_list = array();
foreach ($address_list as $k => $v) {
if ($v['dlyp_id']) {
$dlyp_ids[] = $v['dlyp_id'];
}
}
if (!empty($dlyp_ids)) {
$model_delivery = Model('delivery_point');
$condition = array();
$condition['dlyp_id'] = array('in',$dlyp_ids);
$dlyp_list = $model_delivery->getDeliveryPointOpenList($condition);
foreach ($dlyp_list as $k => $v) {
$dlyp_new_list[$v['dlyp_id']]= $v;
}
}
if (!empty($dlyp_new_list)) {
foreach ($address_list as $k => $v) {
if (!$v['dlyp_id']) continue;
$dlyp_info = $dlyp_new_list[$v['dlyp_id']];
$address_list[$k]['area_info'] = $dlyp_info['dlyp_area_info'];
$address_list[$k]['address'] = '('.$dlyp_info['dlyp_address_name'].') '.$dlyp_info['dlyp_address']
. ',電話:'.trim($dlyp_info['dlyp_mobile'].','.$dlyp_info['dlyp_telephony'],',');
}
}
}
return $address_list;
}
示例12: indexOp
/**
* 單個活動信息頁
*/
public function indexOp()
{
//讀取語言包
Language::read('home_activity_index');
//得到導航ID
$nav_id = intval($_GET['nav_id']) ? intval($_GET['nav_id']) : 0;
Tpl::output('index_sign', $nav_id);
//查詢活動信息
$activity_id = intval($_GET['activity_id']);
if ($activity_id <= 0) {
showMessage(Language::get('para_error'), 'index.php', 'html', 'error');
//'缺少參數:活動編號'
}
$activity = Model('activity')->getOneById($activity_id);
if (empty($activity) || $activity['activity_type'] != '1' || $activity['activity_state'] != 1 || $activity['activity_start_date'] > time() || $activity['activity_end_date'] < time()) {
showMessage(Language::get('activity_index_activity_not_exists'), 'index.php', 'html', 'error');
//'指定活動並不存在'
}
Tpl::output('activity', $activity);
//查詢活動內容信息
$list = array();
$list = Model('activity_detail')->getGoodsList(array('order' => 'activity_detail.activity_detail_sort asc', 'activity_id' => "{$activity_id}", 'goods_show' => '1', 'activity_detail_state' => '1'));
Tpl::output('list', $list);
Tpl::output('html_title', C('site_name') . ' - ' . $activity['activity_title']);
Tpl::showpage('activity_show');
}
示例13: indexOp
public function indexOp()
{
$lang = Language::getLangContent();
$model_shares = Model('shares');
$condition = array();
$condition['store_id'] = $_SESSION['store_id'];
if (!empty($_GET['order_id'])) {
$condition['order_id'] = array('like', "%" . $_GET['order_id'] . "%");
}
$if_start_time = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_start_time']);
$if_end_time = preg_match('/^20\\d{2}-\\d{2}-\\d{2}$/', $_GET['query_end_time']);
$start_unixtime = $if_start_time ? strtotime($_GET['query_start_time']) : null;
$end_unixtime = $if_end_time ? strtotime($_GET['query_end_time']) : null;
if ($start_unixtime || $end_unixtime) {
$condition['add_time'] = array('time', array($start_unixtime, $end_unixtime));
}
$shares_list = $model_shares->getSharesList($condition, "*", 50);
$shares_sum = $model_shares->getSharesSum($_SESSION['store_id']);
$ShopShares = $model_shares->getShopShares($_SESSION['store_id']);
Tpl::output('ShopShares', $ShopShares['shares']);
Tpl::output('show_page', $model_shares->showpage());
Tpl::output('shares_list', $shares_list);
Tpl::output('shares_sum', $shares_sum);
Tpl::output('shares_id', trim($_GET['shares_id']));
Tpl::output('shares_time', trim($_GET['shares_time']));
Tpl::showpage('shares');
}
示例14: index
/**
* default method index
*
* @access public
* @return void
*/
public function index($id = 'file')
{
//Get page content for the selected menu item.
$this->menu_link = $id;
//$this->uri->segment(1, 'home');
$data = Model('page')->get_page_contents($this->menu_link);
/*
| Send data to Format Content and get back.
| See These Files For Processing:
| libraries/block/block_Library.php
*/
if (isset($data['content']) && count((array) $data['content']) > 0) {
//For static page, display full content by passing 2nd param as false.
$data['content'] = Model('page')->parseContent($data['content'], FALSE);
$data['content'] = Model('file')->process($data['content']);
} else {
//if content not found | Set meta to noindex, nofollow to save your website value to search engines.
$data['noindex'] = 'yes';
}
//main content block [content view]
$data['content_block'] = 'page_html/page_view';
/*
| @process_view('data', 'master page')
| @see app/core/MY_Controller.php
*/
$this->process_view($data);
}
示例15: skin_saveOp
public function skin_saveOp()
{
$insert = array();
$insert['member_id'] = $_SESSION['member_id'];
$insert['setting_skin'] = $_GET['skin'];
Model()->table('sns_setting')->insert($insert, true);
}