本文整理汇总了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);
}