public function action_index() { //$addmodule = ORM::factory('model')->where("id>13")->get_all(); $addmodule = Model_Model::getAllModule(); $this->assign('addmodule', $addmodule); $this->display('stourtravel/module/index'); }
public function action_found() { $addmodule = Model_Model::getAllModule(); $menu = Common::getConfig('menu_sub'); $this->assign('menu', $menu); $this->assign('addmodule', $addmodule); $this->display('stourtravel/public/found'); }
/** * (non-PHPdoc) * @see OnePiece5::Init() */ function Init() { parent::Init(); // In case of -> http://domain/app/?/smart-url if (isset($_SERVER['QUERY_STRING'][0]) and $_SERVER['QUERY_STRING'][0] === '/') { $this->isWikipedia(true); } }
public static function getAttr($typeid, $pid = 0) { $modelinfo = Model_Model::getModuleInfo($typeid); $attrtable = $modelinfo['attrtable']; $w = $typeid > 13 ? "and typeid={$typeid}" : ''; $model = ORM::factory($attrtable); $list = $model->where("isopen=1 and pid={$pid} {$w}")->get_all(); return $list; }
public function getProductName($id, $typeid) { $tablename = 'sline_' . self::$channeltable[$typeid]; $fields = array('1' => array('field' => 'title', 'link' => 'lines'), '2' => array('field' => 'title', 'link' => 'hotels'), '3' => array('field' => 'title', 'link' => 'cars'), '4' => array('field' => 'title', 'link' => 'raiders'), '5' => array('field' => 'title', 'link' => 'spots'), '6' => array('field' => 'title', 'link' => 'photos'), '8' => array('field' => 'title', 'link' => 'visa'), '13' => array('field' => 'title', 'link' => 'tuan')); $field = $fields[$typeid]['field']; $link = $fields[$typeid]['link']; if ($typeid > 13) { $module_info = Model_Model::getModuleInfo($typeid); $tablename = "sline_model_archive"; $field = 'title'; $link = $module_info['pinyin']; } $sql = "select aid,{$field} as title from {$tablename} where id='{$id}'"; $row = DB::query(Database::SELECT, $sql)->execute(); $out = "<a href=\"/{$link}/show_{$row[0]['aid']}.html\" class='product-title' target=\"_blank\">{$row[0]['title']}</a>"; return $out; }
public function action_ajax_model_save() { $arr = array('modulename' => Arr::get($_POST, 'modulename'), 'pinyin' => Arr::get($_POST, 'pinyin')); $status = Model_Model::createModel($arr); echo json_encode(array('status' => $status)); }
public function action_index() { $action = $this->params['action']; $typeid = $this->params['typeid']; $webid = Arr::get($_GET, 'webid'); $this->assign('typeid', $typeid); //订单模板 //$channelname = self::$channelArr[$typeid]; $channelname = Model_Model::getModuleName($typeid); if (empty($action)) { $this->assign('paysources', Model_Member_Order::getPaySources()); $this->assign('statusnames', Model_Member_Order::getStatusNamesJs()); $this->assign('position', $channelname . '订单'); $this->assign('channelname', $channelname); $this->display('stourtravel/order/list'); } else { if ($action == 'read') { $start = Arr::get($_GET, 'start'); $limit = Arr::get($_GET, 'limit'); $keyword = Arr::get($_GET, 'keyword'); $status = $_GET['status']; $paysource = $_GET['paysource']; $order = 'order by a.addtime desc'; $w = "where a.typeid = {$typeid}"; if ($status != '') { $w .= ' and a.status=' . $status; } if (!empty($paysource)) { $w .= " and a.paysource='{$paysource}'"; } if (!empty($keyword)) { $w .= " and (a.ordersn like '%{$keyword}%' or a.linkman like '%{$keyword}%' or a.linktel like '%{$keyword}%' or a.productname like '%{$keyword}%')"; $start = 0; } $w .= empty($webid) ? ' and a.webid=0' : " and a.webid={$webid}"; $sql = "select a.* from sline_member_order as a {$w} {$order} limit {$start},{$limit}"; $totalcount_arr = DB::query(Database::SELECT, "select count(*) as num from sline_member_order a {$w} ")->execute()->as_array(); $list = DB::query(Database::SELECT, $sql)->execute()->as_array(); $new_list = array(); foreach ($list as $k => $v) { $v['addtime'] = Common::myDate('Y-m-d H:i:s', $v['addtime']); if ($v['pid'] != 0) { $v['productname'] = $v['productname'] . "[<span style='color:red'>子订单</span>]"; } $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('order', $id); Model_member_Order::refundStorage($id, 'plus'); $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('order')->where('id', '=', $id)->find(); } if ($model->id) { $oldstatus = $model->status; $model->{$field} = $val; $model->update(); if ($model->saved()) { echo 'ok'; if ($field == 'status' && $val == 2) { // Model_Member_Order::refundJifen($id); Common::paySuccess($model->ordersn); } if ($field == 'status' && $val == 3) { Model_member_Order::refundStorage($id, 'plus'); } else { if ($field == 'status' && $oldstatus == 3 && $val == 1) { Model_Member_Order::refundStorage($id, 'minus'); //订单增加,库存减少 } } } else { echo 'no'; } } } } } } } }
$menu = Common::getConfig('menu_sub.' . $parentkey); foreach ($menu as $row) { $class = $row['itemid'] == $itemid ? " class='active' " : ''; echo '<a href="javascript:;"' . $class . ' data-url="' . $row['url'] . '">' . $row['name'] . '</a>'; } if ($parentkey == 'product') { //$addmodule = ORM::factory('model')->where("id>13")->get_all(); $addmodule = Model_Model::getAllModule(); foreach ($addmodule as $row) { $class = $row['id'] == $itemid ? " class='active' " : ''; echo '<a href="javascript:;"' . $class . ' data-url="tongyong/index/typeid/' . $row['id'] . '/parentkey/product/itemid/' . $v['id'] . '">' . $row['modulename'] . '</a>'; } } if ($parentkey == 'order') { //$addmodule = ORM::factory('model')->where("id>13")->get_all(); $addmodule = Model_Model::getAllModule(); foreach ($addmodule as $row) { $class = $row['id'] == $itemid ? " class='active' " : ''; echo '<a href="javascript:;"' . $class . ' data-url="order/index/parentkey/order/itemid/' . $row['id'] . '/typeid/' . $row['id'] . '">' . $row['modulename'] . '</a>'; } } ?> </div> </div> <script> $(document).ready(function(e) { /*$(".global_nav").mouseover(function(){ $(this).children(".mc").show() $(this).children().children(".tall").show() }) $(".global_nav").mouseout(function(){
/** * (non-PHPdoc) * @see Model_Model::Config() * @return Config_Sample */ function Config($name = "Config_Sample") { return parent::Config($name); }
public function delContentField($typeid, $id) { $table = self::$content_table[$typeid]; $isTongyong = false; if (empty($table)) { $isTongyong = true; $table = 'model_content'; } $model = ORM::factory($table, $id); $columnName = $model->columnname; $model->delete(); $extend_table = 'sline_' . Model_Model::getExtendTable($typeid); //扩展表名称 $result = DB::query(Database::DELETE, "alter table `{$extend_table}` drop column {$columnName}")->execute(); if (!$result) { return false; } $extendModel = ORM::factory('extend_field')->where('typeid', '=', $typeid)->and_where('fieldname', '=', $columnName)->find(); $extendModel->delete(); return true; }
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); } 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('model_archive', $id); $model->delete(); } else { if (strpos($id, 'suit') !== FALSE) { $suitid = substr($id, strpos($id, '_') + 1); $suit = ORM::factory('model_suit', $suitid); $suit->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 = $typeid; } $order_mod->save(); if ($order_mod->saved()) { echo 'ok'; } else { echo 'no'; } } else { $kindorder = ORM::factory('kindorderlist'); $kindorder_mod = $kindorder->where("aid='{$id}' and typeid={$typeid} and classid={$kindid}")->find(); if ($kindorder_mod->id) { $kindorder_mod->displayorder = $displayorder; } else { $kindorder_mod->displayorder = $displayorder; $kindorder_mod->aid = $id; $kindorder_mod->classid = $kindid; $kindorder_mod->typeid = $typeid; } $kindorder_mod->save(); if ($kindorder->saved()) { echo 'ok'; } else { echo 'no'; } } } else { if (strpos($id, 'suit') !== FALSE) { $suitid = substr($id, strpos($id, '_') + 1); $suit = ORM::factory('model_suit', $suitid); $suit->displayorder = $displayorder; if ($suit->id) { $suit->save(); if ($suit->saved()) { echo 'ok'; } else { echo 'no'; } } } } } else { if (is_numeric($id)) { $model = ORM::factory('model_archive', $id); } else { if (strpos($id, 'suit') !== FALSE) { $suitid = substr($id, strpos($id, '_') + 1); $model = ORM::factory('model_suit', $suitid); } } if ($model->id) { $model->{$field} = $val; if ($field == 'kindlist') { $model->{$field} = implode(',', Model_Destinations::getParentsStr($val)); } else { if ($field == 'attrid') { $model->{$field} = implode(',', Model_Attrlist::getParentsStr($val, $typeid)); } } $model->save(); if ($model->saved()) { echo 'ok'; } else { echo 'no'; } } } } } } } } }
public function action_dialog_productinfo() { $id = $_GET['id']; $typeid = $_GET['typeid']; $moduleinfo = Model_Model::getModuleInfo($typeid); $product_dest_table = $moduleinfo['pinyin'] . '_kindlist'; $model = new Model_Tongyong($product_dest_table); $info = $model->where("kindid", '=', $id)->find()->as_array(); $pageName = $moduleinfo['pinyin'] . '_list'; $templateList = Model_Page_Config::getTemplateList($pageName); $this->assign('templateList', $templateList); $this->assign('id', $id); $this->assign('typeid', $typeid); $this->assign('info', $info); $this->display('stourtravel/destination/dialog_productinfo'); }