本文整理汇总了PHP中Common::myDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Common::myDate方法的具体用法?PHP Common::myDate怎么用?PHP Common::myDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Common
的用法示例。
在下文中一共展示了Common::myDate方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
{/loop}
</select>
{else}
<select style="font-size: 14px;width:100%;height:30px; color:#2a2a2a; margin-top:10px; margin-left:-5px;" id="tarveldate" name="tarveldate">
<option>暂无价格信息</option>
</select>
{/if}
</div>
</div>
<div class="order-m">
<form action="{$cmsurl}order/create" method="post" name="form1" id="form1">
<input type="hidden" name="id" id="id" value="{$row['id']}">
<input type="hidden" id="ordertype" name="ordertype" value="1" />
<input type="hidden" id="dateid" name="dateid" value="<?php
echo Common::myDate('Y-m-d', $suit[0]['price_arr'][0]['dayid']);
?>
" />
<input type="hidden" id="suitid" name="suitid" value="{$suit[0]['id']}" />
<h3>预定人数{$suit[0]['dingjin']}</h3>
<ul>
<li id="manli">
<label>成人:</label>
<span>
<span class="order-btn minus minus-active" id="plus"></span>
<input type="text" id="dingnum" min="1" max="100" class="order-txt-n" name="dingnum" value="1" />
<input type="hidden" id="price" name="price" value="{intval($suit[0]['price_arr'][0]['adultprice'])}" />
<span class="order-btn plus plus-active" id="minus"></span>
</span>
<span class="order-jg">成人价<em>¥</em><em id="dismanprice">{intval($suit[0]['price_arr'][0]['adultprice'])}</em></span>
</li>
示例2: action_view
public function action_view()
{
$id = $this->params['id'];
$info = ORM::factory('question', $id)->as_array();
$info['productname'] = $info['questype'] == 0 ? ORM::factory('question')->getProductName($info['productid'], $info['typeid']) : $info['title'];
$info['addtime'] = Common::myDate('Y-m-d', $info['addtime']);
$this->assign('info', $info);
$this->display('stourtravel/question/show');
}
示例3: action_genexcel
public function action_genexcel()
{
$typeid = $this->params['typeid'];
$timetype = $this->params['timetype'];
$starttime = strtotime(Arr::get($_GET, 'starttime'));
$endtime = strtotime(Arr::get($_GET, 'endtime'));
$status = $_GET['status'];
switch ($timetype) {
case 1:
$time_arr = $this->getTimeRange(1);
break;
case 2:
$time_arr = $this->getTimeRange(2);
break;
case 3:
$time_arr = $this->getTimeRange(3);
break;
case 5:
$time_arr = $this->getTimeRange(5);
break;
case 6:
$time_arr = array($starttime, $endtime);
break;
}
$stime = date('Y-m-d', $time_arr[0]);
$etime = date('Y-m-d', $time_arr[1]);
$w = "addtime>={$time_arr['0']} and addtime<={$time_arr['1']} and typeid='{$typeid}'";
if ($status !== null && $status !== '') {
$w .= " and status={$status}";
}
$arr = ORM::factory('member_order')->where($w)->get_all();
$table = "<table><tr>";
$table .= "<td>订单号</td>";
$table .= "<td>产品名称</td>";
$table .= "<td>预订日期</td>";
$table .= "<td>使用日期</td>";
$table .= "<td>成人数量</td>";
$table .= "<td>成人价格</td>";
if ($typeid == 1) {
$table .= "<td>儿童数量</td>";
$table .= "<td>儿童价格</td>";
$table .= "<td>老人数量</td>";
$table .= "<td>老人价格</td>";
$table .= "<td>保险</td>";
}
$table .= "<td>应付总额</td>";
$table .= "<td>交易状态</td>";
$table .= "<td>预订人</td>";
$table .= "<td>联系电话</td>";
$table .= "<td>使用日期</td>";
$table .= "</tr>";
foreach ($arr as $row) {
$order = $row;
$price = 0;
$insurancePrice = 0;
if ($order['typeid'] != 2) {
$price = intval($order['dingnum']) * $order['price'] + intval($order['childnum']) * $order['childprice'] + intval($order['oldnum']) * $order['oldprice'];
if (!empty($order['usejifen']) && !empty($order['jifentprice'])) {
$price = $price - intval($order['jifentprice']);
//减去积分抵现的价格.
}
} else {
$orderlist = ORM::factory('member_order')->where('pid', '=', $row['id'])->get_all();
$price = 0;
$totalnum = 0;
foreach ($orderlist as $subrow) {
$price += intval($subrow['dingnum']) * intval($subrow['price']);
$totalnum += $subrow['dingnum'];
}
}
if ($order['typeid'] == 1) {
$insInfo = ORM::factory('insurance_booking')->where("bookordersn", '=', $order['ordersn'])->find()->as_array();
if ($insInfo['payprice']) {
$price += $insInfo['payprice'];
$insurancePrice = $insInfo['payprice'];
}
}
$childOrderLabel = $row['pid'] == 0 ? '' : "[子订单]";
$table .= "<tr>";
$table .= "<td>" . $childOrderLabel . "{$row['ordersn']}</td>";
$table .= "<td>{$row['productname']}</td>";
$table .= "<td>" . Common::myDate('Y-m-d H:i:s', $row['addtime']) . "</td>";
$table .= "<td>{$row['usedate']}</td>";
$table .= "<td>{$row['dingnum']}</td>";
$table .= "<td>{$row['price']}</td>";
if ($typeid == 1) {
$table .= "<td>{$row['childnum']}</td>";
$table .= "<td>{$row['childprice']}</td>";
$table .= "<td>{$row['oldnum']}</td>";
$table .= "<td>{$row['oldprice']}</td>";
$table .= "<td>{$insurancePrice}</td>";
}
$table .= "<td>{$price}</td>";
$table .= "<td>" . Model_Member_Order::getStatusName($row['status']) . "</td>";
$table .= "<td>{$row['linkman']}</td>";
$table .= "<td>{$row['linktel']}</td>";
$table .= "<td>{$row['usedate']}</td>";
$table .= "</tr>";
}
$table .= "</table>";
//.........这里部分代码省略.........
示例4: action_index
public function action_index()
{
$action = $this->params['action'];
if (empty($action)) {
$this->display('stourtravel/tools/visit_list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$sttime = ARR::get($_GET, 'sttime');
$engine = ARR::get($_GET, 'searchengine');
$order = 'order by a.access_time desc';
$w = "where a.id is not null";
if (!empty($keyword)) {
$w .= " and a.keywords like '%{$keyword}%'";
}
if (!empty($sttime)) {
$sttime = strtotime($sttime);
$w .= " and a.access_time >= {$sttime} ";
}
if (!empty($ettime)) {
$ettime = strtotime($ettime);
$w .= " and a.access_time <= {$sttime} ";
}
if (!empty($engine)) {
$w .= " and a.searchengine = '{$engine}'";
}
$sql = "select a.* from sline_stats as a {$w} {$order} limit {$start},{$limit}";
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_stats a {$w} ")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['access_time'] = Common::myDate('Y-m-d H:i:s', $v['access_time']);
$v['searchengine'] = $this->getSearchEngine($v['searchengine']);
$new_list[] = $v;
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('stats', $id);
$model->delete();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
if (is_numeric($id)) {
$model = ORM::factory('stats')->where('id', '=', $id)->find();
}
if ($model->id) {
$model->{$field} = $val;
$model->update();
if ($model->saved()) {
echo 'ok';
} else {
echo 'no';
}
}
}
}
}
}
}
}
示例5: rewriteVersion
public static function rewriteVersion($ver, $beta, $pubdate)
{
$file = Kohana::find_file('data', 'version');
@chmod($file, 0777);
if (!is_writeable($file)) {
echo "版本文件'{$file}'不支持写入,无法更新系统!";
exit;
}
$versiontype = $beta == 1 ? '测试版' : '正式版';
$pubdate = Common::myDate('Y-m-d', strtotime($pubdate));
$fp = fopen($file, 'w');
flock($fp, 3);
fwrite($fp, "<" . "?php\r\n");
fwrite($fp, "\$pcode = 'stourwebcms';\r\n");
fwrite($fp, "\$cVersion ='" . $ver . "';\r\n");
fwrite($fp, "\$versiontype ='" . $versiontype . "';\r\n");
fwrite($fp, "\$pubdate ='" . $pubdate . "';\r\n");
fwrite($fp, "?" . ">");
fclose($fp);
}
示例6: action_ajax_upgrade
public function action_ajax_upgrade()
{
$out = array();
if (!$this->checkdir()) {
$out['status'] = 0;
$out['msg'] = '没有权限操作,请打开网站目录写权限';
//目录无写权限
echo json_encode($out);
exit;
}
if (!$this->checkLicense()) {
$out['status'] = 0;
$out['msg'] = '序列号验证失败,请检查序列号';
//序列号错误
$out['type'] = 'license_err';
echo json_encode($out);
exit;
}
$model = new Model_Upgrade3();
$info = $model->getNewVersion();
if ($info['Success'] == 1) {
if (!empty($info['Data'])) {
include PUBLICPATH . '/vendor/httpdown.class.php';
include PUBLICPATH . '/vendor/pclzip.lib.php';
$versionlist = array_reverse($info['Data']);
$unzippath = BASEPATH;
//解压路径
$savepath = APPPATH . "/data/patch/";
//更新包存储路径
$ver = $versionlist[0];
$downloadurl = $ver['Url'];
$filename = $savepath . $ver['Name'] . '.zip';
$htd = new HttpDown();
//实例化下载类
$htd->OpenUrl($downloadurl);
$ok = $htd->SaveToBin($filename);
if ($ok) {
$archive = new PclZip($filename);
$extractResult = $archive->extract(PCLZIP_OPT_PATH, $unzippath, PCLZIP_CB_PRE_EXTRACT, 'preExtractCallBack', PCLZIP_OPT_REPLACE_NEWER);
if ($extractResult == 0 || $this->exists_extract_error($extractResult)) {
//die("Error : ".$archive->errorInfo(true));
$out['status'] = 0;
$out['msg'] = '升级文件解压失败,请检查目录及子目录是否有写权限';
//目录无写权限
echo json_encode($out);
exit;
} else {
@unlink($filename);
}
//数据库升级
if (file_exists(BASEPATH . '/sql.php')) {
$sqlfile = BASEPATH . '/sql.php';
$url = $GLOBALS['cfg_basehost'] . '/sql.php';
$flag = Common::http($url);
if (strlen($flag) > 3) {
$out['status'] = 0;
$out['msg'] = '数据库升级失败,请检查' . $flag;
//数据库升级有错误,执行失败
echo json_encode($out);
exit;
} else {
@unlink($sqlfile);
}
}
//反馈版本信息
$regstatus = $model->regUpgradeStatus($downloadurl);
//版本包升级成功
if ($regstatus['Success'] == 1) {
//写版本
$pubdate = Common::myDate('Y-m-d', strtotime($ver['ReleaseDate']));
$version = $ver['Version'];
$model->rewriteVersion($version, 0, $pubdate);
//@unlink($filename);
$out['status'] = 1;
$out['currentversion'] = '思途CMS' . $ver['Version'];
echo json_encode($out);
exit;
} else {
$out['status'] = 0;
$out['msg'] = '更新服务器登记版本失败!';
echo json_encode($out);
exit;
}
} else {
$out['status'] = 0;
$out['msg'] = '下载升级包失败!';
echo json_encode($out);
exit;
}
} else {
$out['status'] = 0;
$out['msg'] = '此版本为官方内测版本,不能升级!';
echo json_encode($out);
exit;
}
} else {
$out['status'] = 0;
$out['msg'] = '获取新版本信息失败!';
echo json_encode($out);
exit;
//.........这里部分代码省略.........
示例7: action_article
public function action_article()
{
$action = $this->params['action'];
if (empty($action)) {
$this->assign('kindmenu', Common::getConfig('menu_sub.articlekind'));
//分类设置项
$this->display('stourtravel/article/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$kindid = Arr::get($_GET, 'kindid');
$attrid = Arr::get($_GET, 'attrid');
$webid = Arr::get($_GET, 'webid');
$webid = $webid == "" ? -1 : $webid;
$keyword = Common::getKeyword($keyword);
$sort = json_decode(Arr::get($_GET, 'sort'), true);
$order = 'order by a.modtime desc';
$specOrders = array('attrid', 'kindlist', 'iconlist', 'themelist');
if ($sort[0]['property']) {
if ($sort[0]['property'] == 'displayorder') {
$prefix = '';
} else {
if ($sort[0]['property'] == 'ishidden') {
$prefix = 'a.';
} else {
if ($sort[0]['property'] == 'templet') {
$prefix = 'a.';
} else {
if ($sort[0]['property'] == 'modtime') {
$prefix = 'a.';
} else {
if (in_array($sort[0]['property'], $specOrders)) {
$prefix = 'order_';
}
}
}
}
}
$order = 'order by ' . $prefix . $sort[0]['property'] . ' ' . $sort[0]['direction'] . ',a.modtime desc';
}
$w = "a.id is not null";
$w .= empty($keyword) ? '' : " and a.title like '%{$keyword}%'";
$w .= empty($kindid) ? '' : " and find_in_set({$kindid},a.kindlist)";
$w .= empty($attrid) ? '' : " and find_in_set({$attrid},a.attrid)";
$w .= $webid == '-1' ? '' : " and a.webid={$webid}";
if (empty($kindid)) {
$sql = "select a.id,a.aid,a.title,a.attrid,a.kindlist,a.webid,a.addtime,a.ishidden,a.themelist,a.iconlist,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,\nb.isjian,ifnull(b.displayorder,999999) as displayorder,b.isding,a.modtime,a.templet from sline_article as a left join sline_allorderlist b on (a.id=b.aid and b.typeid=4) where {$w} {$order} limit {$start},{$limit}";
} else {
$sql = "select a.id,a.aid,a.title,a.attrid,a.kindlist,a.webid,a.addtime,a.ishidden,a.themelist,a.iconlist,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist,b.isjian,b.displayorder,b.isding,a.modtime,a.templet from sline_article as a left join sline_kindorderlist as b on (b.classid={$kindid} and a.id=b.aid and b.typeid=4) where {$w} {$order} limit {$start},{$limit}";
}
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_article a where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['kindname'] = Model_Destinations::getKindnameList($v['kindlist']);
$v['attrname'] = Model_Article_Attr::getAttrnameList($v['attrid']);
$v['modtime'] = Common::myDate('Y-m-d', $v['modtime']);
$v['url'] = Common::getBaseUrl($v['webid']) . '/raiders/show_' . $v['aid'] . '.html';
$new_list[] = $v;
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('article', $id);
$model->deleteClear();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
$kindid = Arr::get($_POST, 'kindid');
if ($field == 'displayorder') {
$displayorder = empty($val) ? 9999 : $val;
if (is_numeric($id)) {
if (empty($kindid)) {
$order = ORM::factory('allorderlist');
$order_mod = $order->where("aid='{$id}' and typeid=4 and webid=0")->find();
if ($order_mod->id) {
$order_mod->displayorder = $displayorder;
} else {
$order_mod->displayorder = $displayorder;
$order_mod->aid = $id;
$order_mod->webid = 0;
$order_mod->typeid = 4;
}
$order_mod->save();
if ($order_mod->saved()) {
echo 'ok';
//.........这里部分代码省略.........
示例8: action_index
public function action_index()
{
$action = $this->params['action'];
if (empty($action)) {
$this->display('stourtravel/member/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$order = 'order by a.jointime desc';
if (!empty($keyword)) {
$w = "where (a.nickname like '%{$keyword}%' or a.email like '%{$keyword}%' or a.mobile like '%{$keyword}%')";
}
$sql = "select a.* from sline_member as a {$w} {$order} limit {$start},{$limit}";
//echo $sql;
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_member a ")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['logintime'] = Common::myDate('Y-m-d', $v['logintime']);
$v['id'] = $v['mid'];
$new_list[] = $v;
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('member', $id);
$model->delete();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
if (is_numeric($id)) {
$model = ORM::factory('member')->where('mid', '=', $id)->find();
}
if ($model->mid) {
$model->{$field} = $val;
$model->update();
if ($model->saved()) {
echo 'ok';
} else {
echo 'no';
}
}
}
}
}
}
}
}
示例9: getSuitPriceArr
/**
* 生成格式化的数据
* 用于日历中进行呈现
* @param $arr
*/
public function getSuitPriceArr($year, $month, $suitid, $typeid)
{
$start = strtotime("{$year}-{$month}-1");
$end = strtotime("{$year}-{$month}-31");
$table = self::$priceTableArr[$typeid];
$arr = ORM::factory($table)->where('suitid', '=', $suitid)->and_where('day', '>=', $start)->and_where('day', '<=', $end)->get_all();
$price = array();
foreach ($arr as $row) {
if ($row) {
$day = $row['day'];
$price[$day]['date'] = Common::myDate('Y-m-d', $row['day']);
$price[$day]['basicprice'] = isset($row['adultbasicprice']) ? $row['adultbasicprice'] : $row['basicprice'];
$price[$day]['profit'] = isset($row['adultprofit']) ? $row['adultprofit'] : $row['profit'];
$price[$day]['price'] = isset($row['adultprice']) ? $row['adultprice'] : $row['price'];
$price[$day]['child_basicprice'] = isset($row['childbasicprice']) ? $row['childbasicprice'] : 0;
$price[$day]['child_profit'] = isset($row['childprofit']) ? $row['childprofit'] : 0;
$price[$day]['child_price'] = isset($row['childprice']) ? $row['childprice'] : 0;
$price[$day]['old_basicprice'] = isset($row['oldbasicprice']) ? $row['oldbasicprice'] : 0;
$price[$day]['old_profit'] = isset($row['oldprofit']) ? $row['oldprofit'] : 0;
$price[$day]['old_price'] = isset($row['oldprice']) ? $row['oldprice'] : 0;
$price[$day]['suitid'] = $suitid;
$price[$day]['number'] = $row['number'];
//库存
$price[$day]['description'] = $row['description'];
//描述
if ($typeid == 1) {
$price[$day]['roombalance'] = $row['roombalance'];
}
}
}
return $price;
}
示例10: action_index
public function action_index()
{
$action = $this->params['action'];
$typeid = $this->typeid;
if (empty($action)) {
$this->assign('kindmenu', self::$kind);
//分类设置项
$this->display('stourtravel/tongyong/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$kindid = Arr::get($_GET, 'kindid');
$attrid = Arr::get($_GET, 'attrid');
$webid = Arr::get($_GET, 'webid');
$webid = empty($webid) ? 0 : $webid;
$keyword = Common::getKeyword($keyword);
$sort = json_decode(Arr::get($_GET, 'sort'), true);
$order = 'order by a.modtime desc';
$specOrders = array('attrid', 'kindlist', 'iconlist', 'themelist');
if ($sort[0]['property']) {
if ($sort[0]['property'] == 'displayorder') {
$prefix = 'b.';
} else {
if ($sort[0]['property'] == 'ishidden') {
$prefix = 'a.';
} else {
if ($sort[0]['property'] == 'addtime') {
$prefix = 'a.';
} else {
if (in_array($sort[0]['property'], $specOrders)) {
$prefix = 'order_';
}
}
}
}
$order = 'order by ' . $prefix . $sort[0]['property'] . ' ' . $sort[0]['direction'] . ',a.modtime desc';
}
$w = "a.typeid='{$typeid}'";
$w .= empty($keyword) ? '' : " and a.title like '%{$keyword}%'";
$w .= empty($kindid) ? '' : " and find_in_set({$kindid},a.kindlist)";
$w .= empty($attrid) ? '' : " and find_in_set({$attrid},a.attrid)";
$w .= $webid == '-1' ? '' : " and a.webid={$webid}";
if (empty($kindid)) {
$sql = "select a.*,b.displayorder,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist from sline_model_archive as a left join sline_allorderlist b on (a.id=b.aid and b.typeid='{$typeid}') where {$w} {$order}";
} else {
$sql = "select a.*,b.displayorder,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,if(length(ifnull(a.themelist,''))=0,0,1) as order_themelist from sline_model_archive as a left join sline_kindorderlist as b on (b.classid={$kindid} and a.id=b.aid and b.typeid='{$typeid}') where {$w} {$order} ";
}
$total = DB::query(1, $sql)->execute();
$sql .= " limit {$start},{$limit}";
$list = DB::query(1, $sql)->execute()->as_array();
$new_list = array();
$moduleinfo = Model_Model::getModuleInfo($typeid);
foreach ($list as $k => $v) {
$v['kindname'] = Model_Destinations::getKindnameList($v['kindlist']);
$v['attrname'] = Model_Article_Attr::getAttrnameList($v['attrid']);
$v['modtime'] = Common::myDate('Y-m-d', $v['modtime']);
$v['modulepinyin'] = $moduleinfo['pinyin'];
$iconname = Model_Icon::getIconName($v['iconlist']);
$name = '';
foreach ($iconname as $icon) {
if (!empty($icon)) {
$name .= '<span style="color:red">[' . $icon . ']</span>';
}
}
$v['iconname'] = $name;
$v['series'] = Common::getSeries($v['id'], $typeid);
//编号
//供应商信息
$supplier = ORM::factory('supplier')->where("id='{$v['supplierlist']}'")->find()->as_array();
$v['suppliername'] = $supplier['suppliername'];
$v['linkman'] = $supplier['linkman'];
$v['mobile'] = $supplier['mobile'];
$v['address'] = $supplier['address'];
$v['qq'] = $supplier['qq'];
//套餐信息
$homes = ORM::factory('model_suit')->where("productid", '=', $v['id'])->get_all();
//读取套餐
if (!empty($homes)) {
$v['tr_class'] = 'parent-product-tr';
}
$new_list[] = $v;
foreach ($homes as $key => $val) {
$val['title'] = $val['suitname'];
$val['suitid'] = $val['id'];
$val['id'] = 'suit_' . $val['id'];
$val['productid'] = $val['productid'];
$val['sellprice'] = $val['sellprice'];
$val['ourprice'] = $val['ourprice'];
if ($key != count($homes) - 1) {
$val['tr_class'] = 'suit-tr';
}
$new_list[] = $val;
}
}
$result['total'] = $total->count();
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
//.........这里部分代码省略.........
示例11: action_list
public function action_list()
{
$action = $this->params['action'];
if (empty($action)) {
$posArr = $this->geneHtmlPosarr();
$this->assign('posArr', $posArr);
$kindlist = json_encode(ORM::factory('help_kind')->where("webid=0")->get_all());
$this->assign('kindmenu', Common::getConfig('menu_sub.helpkind'));
//分类设置项
$this->assign('kindlist', $kindlist);
$this->display('stourtravel/help/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$keyword = Arr::get($_GET, 'keyword');
$kindid = Arr::get($_GET, 'kindid');
$sort = json_decode(Arr::get($_GET, 'sort'), true);
if ($sort[0]['property']) {
//print_r($sort[0]->property);
if ($sort[0]['property'] == 'displayorder') {
$order = 'order by displayorder ' . $sort[0]['direction'];
} else {
if ($sort[0]['property'] == 'modtime') {
$order = 'order by modtime ' . $sort[0]['direction'];
}
}
} else {
$order = 'order by modtime desc';
}
$w = "id is not null";
$w .= empty($keyword) ? '' : " and title like '%{$keyword}%'";
$w .= empty($kindid) ? '' : " and kindid={$kindid}";
$sql = "select *,ifnull(displayorder,9999) as displayorder from sline_help where {$w} {$order} limit {$start},{$limit} ";
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_help where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
foreach ($list as $k => $v) {
$list[$k]['modtime'] = Common::myDate('Y-m-d', $list[$k]['modtime']);
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('help', $id);
$model->deleteClear();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
$model = ORM::factory('help', $id);
$model->{$field} = $val;
$model->save();
if ($model->saved()) {
echo 'ok';
} else {
echo 'no';
}
}
}
}
}
}
}
示例12: action_index
public function action_index()
{
$action = $this->params['action'];
$typeid = 11;
if (empty($action)) {
$this->assign('kindmenu', Common::getConfig('menu_sub.jiebankind'));
//分类设置项
$this->display('stourtravel/jieban/list');
} else {
if ($action == 'read') {
$start = Arr::get($_GET, 'start');
$limit = Arr::get($_GET, 'limit');
$kindid = Arr::get($_GET, 'kindid');
$attrid = Arr::get($_GET, 'attrid');
$sort = json_decode(Arr::get($_GET, 'sort'), true);
$order = 'order by a.addtime desc';
$specOrders = array('attrid', 'kindlist', 'iconlist', 'themelist');
if ($sort[0]['property']) {
if ($sort[0]['property'] == 'displayorder') {
$prefix = '';
} else {
if ($sort[0]['property'] == 'ishidden') {
$prefix = 'a.';
} else {
if (in_array($sort[0]['property'], $specOrders)) {
$prefix = 'order_';
}
}
}
$order = 'order by ' . $prefix . $sort[0]['property'] . ' ' . $sort[0]['direction'] . ',a.addtime desc';
}
$w = "a.id is not null";
$w .= empty($kindid) ? '' : " and find_in_set({$kindid},a.kindlist)";
$w .= empty($attrid) ? '' : " and find_in_set({$attrid},a.attrid)";
$sql = "select a.*,if(length(ifnull(a.attrid,''))=0,0,1) as order_attrid,if(length(ifnull(a.kindlist,''))=0,0,1) as order_kindlist,if(length(ifnull(a.iconlist,''))=0,0,1) as order_iconlist,ifnull(b.displayorder,9999) as displayorder from sline_jieban as a left join sline_allorderlist b on (a.id=b.aid and b.typeid={$typeid}) where {$w} {$order} limit {$start},{$limit}";
$totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_jieban a where {$w}")->execute()->as_array();
$list = DB::query(Database::SELECT, $sql)->execute()->as_array();
$new_list = array();
foreach ($list as $k => $v) {
$v['kindname'] = Model_Destinations::getKindnameList($v['kindlist']);
$v['attrname'] = Model_Jieban_Attr::getAttrnameList($v['attrid']);
$v['title'] = Model_Jieban::genTitle($v, $v['day']);
$memberinfo = ORM::factory('member', $v['memberid'])->as_array();
$v['membername'] = $memberinfo['nickname'];
$v['membermobile'] = $memberinfo['mobile'];
$v['joinnum'] = Model_Jieban::getJoinNum($v['id']);
$iconname = Model_Icon::getIconName($v['iconlist']);
$name = '';
foreach ($iconname as $icon) {
if (!empty($icon)) {
$name .= '<span style="color:red">[' . $icon . ']</span>';
}
}
$v['iconname'] = $name;
$v['series'] = Common::getSeries($v['id'], $typeid);
//编号
$v['addtime'] = Common::myDate('Y-m-d', $v['addtime']);
$new_list[] = $v;
}
$result['total'] = $totalcount_arr[0]['num'];
$result['lists'] = $new_list;
$result['success'] = true;
echo json_encode($result);
} else {
if ($action == 'save') {
} else {
if ($action == 'delete') {
$rawdata = file_get_contents('php://input');
$data = json_decode($rawdata);
$id = $data->id;
if (is_numeric($id)) {
$model = ORM::factory('jieban', $id);
$model->delete();
}
} else {
if ($action == 'update') {
$id = Arr::get($_POST, 'id');
$field = Arr::get($_POST, 'field');
$val = Arr::get($_POST, 'val');
$kindid = Arr::get($_POST, 'kindid');
if ($field == 'displayorder') {
$displayorder = empty($val) ? 9999 : $val;
if (is_numeric($id)) {
if (empty($kindid)) {
$order = ORM::factory('allorderlist');
$order_mod = $order->where("aid='{$id}' and typeid={$typeid} and webid=0")->find();
if ($order_mod->id) {
$order_mod->displayorder = $displayorder;
} else {
$order_mod->displayorder = $displayorder;
$order_mod->aid = $id;
$order_mod->webid = 0;
$order_mod->typeid = 11;
}
$order_mod->save();
if ($order_mod->saved()) {
echo 'ok';
} else {
echo 'no';
}
//.........这里部分代码省略.........