本文整理匯總了PHP中model::table方法的典型用法代碼示例。如果您正苦於以下問題:PHP model::table方法的具體用法?PHP model::table怎麽用?PHP model::table使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model
的用法示例。
在下文中一共展示了model::table方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: indexAction
function indexAction()
{
//$_SESSION['openid']='orSDHtyha_AlF4dm4NZyLId-OUps';
if ($_GET['step'] != 5) {
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbe73369f870a0158&redirect_uri=http%3a%2f%2fh5.jiang-mei.com%2fyiboh5%2fcms%2fcp%2f?step=0&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
$this->getToken($url);
}
//第N步
$step = isset($_GET['step']) ? $_GET['step'] : '0';
$model = new model('seven_set');
//時間
$set = $model->get('*', array('id' => 1));
$start = $set['start'] ? $set['start'] : strtotime(date('Ymd'));
//測試七天數據
$this->assign('set', $set);
//打卡說明
$day = empty($_GET['day']) ? date('Y-m-d') : $_GET['day'];
//測試期間允許自定義時間
//活動開始時間
$set = $model->table('seven_set')->get('*', array('id' => 1));
$start = $set['start'] ? $set['start'] : strtotime(date('Ymd'));
//判斷今天是活動第幾天
$now = (strtotime($day) - $start) / 86400 + 1;
$this->assign('day', $now);
//是否在活動日期內
if ($now > 0 && $now < 8) {
$rule = $model->table('seven_rule')->get('*', array('times' => $now));
$this->assign('rule', $rule);
$this->assign('date', $day);
} else {
$this->assign('error', 1);
}
//獲取當前用戶今天打卡信息
$map['openid'] = $_SESSION['openid'];
$map['addtime'] = strtotime(date('Ymd'));
$info = $model->table('seven_list')->get('*', array('AND' => $map));
$this->assign('info', $info);
//第五步
if ($step == 5) {
$url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbe73369f870a0158&redirect_uri=http%3a%2f%2fh5.jiang-mei.com%2fyiboh5%2fcms%2fcp%2f?step=5&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
$this->getToken($url);
$data = $this->getList();
$this->assign('total', $data['total']);
$this->assign('list', $data['date']);
$this->assign('top', $this->getTop());
}
$this->assign('src', "http://" . $_SERVER['HTTP_HOST'] . __ROOT__ . '/static/home/images/fx1.jpg');
$this->display('cp_index' . $step);
}
示例2: indexAction
function indexAction()
{
//數量
$model = new model();
$total['admin'] = $model->table('admin')->count('*');
$count = $model->table('seven_user')->select('*', array('GROUP' => 'openid'));
$total['sign'] = count($count);
$this->assign('total', $total);
//最新簽到
$map['LIMIT'] = 5;
$map['ORDER'] = 'addtime desc';
$list = $model->table('seven_user')->select('*', $map);
$this->assign('list', $list);
$this->display();
}
示例3: calculate
public function calculate($address_id)
{
$total = 0;
$model = new model("fare");
$fare = $model->where("is_default=1")->find();
if ($fare) {
$addr = $model->table('address')->where("id={$address_id}")->find();
if ($addr) {
$city = $addr['city'];
$first_price = $fare['first_price'];
$second_price = $fare['second_price'];
$first_weight = $fare['first_weight'];
$second_weight = $fare['second_weight'];
$zoning = unserialize($fare['zoning']);
foreach ($zoning as $zon) {
if (preg_match(',' . $city . ',', ',' . $zon['area'] . ',') > 0) {
$first_price = $zon['f_price'];
$second_price = $zon['s_price'];
$first_weight = $zon['f_weight'];
$second_weight = $zon['s_weight'];
break;
}
}
if ($this->weight <= $first_weight) {
$total = $first_price;
} else {
$weight = $this->weight - $first_weight;
$total = $first_price + ceil($weight / $second_weight) * $second_price;
}
}
}
return sprintf("%01.2f", $total);
}
示例4: QM
/**
* 快速實例化模型對象 (不需要創建model文件)
*
* @param string $model_name 模型名
* @param string $db_config 要連接的數據庫配製,默認default
* @return object
*/
function QM($model_name, $db_config_name = 'default')
{
if (empty($GLOBALS['ePHP']['M_QM'][$model_name . 'Model'])) {
$GLOBALS['ePHP']['M_QM'][$model_name . 'Model'] = $obj = new model();
if ($db_config_name != 'default') {
$obj->dbconfig($db_config_name);
}
$obj->table(C($db_config_name . '.tb_prefix', 'db') . $model_name);
} else {
$obj = $GLOBALS['ePHP']['M_QM'][$model_name . 'Model'];
}
return $obj;
}
示例5: deleteAction
function deleteAction()
{
$model = new model();
$map['id'] = $_POST['id'];
$rs = $model->table('seven_list')->delete($map);
if (!($num = $model->table('seven_list')->count(array('openid' => $_POST['openid'])))) {
$res = $model->table('seven_user')->delete(array('openid' => $_POST['openid']));
} else {
$res = $model->table('seven_user')->update(array('total' => $num), array('openid' => $_POST['openid']));
}
$rs ? $this->json('操作成功') : $this->json('操作失敗', 0);
}