/** * Bind data to the view. * * @param View $view * @return void */ public function compose($view) { if (!isset($view['categories'])) { $categories = ProductCategory::whereNull('category_id')->with('subitems')->get(); $view->with('categories', $categories); $view->with('parent', null); } }
public function post() { if (IS_POST) { $data = json_decode(Request::post('keyword'), TRUE); $data['rank'] = $data['istop'] == 1 ? 255 : min(255, intval($data['rank'])); $data['module'] = v('module.name'); $data['keywords'] = $data['keyword']; $rid = service('WeChat')->rule($data); //调用模块的执行方法 $module = new $this->moduleClass(); //字段验证 if ($msg = $module->fieldsValidate($rid)) { message($msg, 'back', 'error'); } //使模块保存回复内容 $module->fieldsSubmit($rid); message('规则保存成功', u('post', ['rid' => $rid, 'm' => v('module.name')])); } //获取关键词回复 if ($rid = Request::get('rid')) { $data = Db::table('rule')->find($rid); if (empty($data)) { message('回复规则不存在', 'back', 'error'); } $data['keyword'] = Db::table('rule_keyword')->orderBy('id', 'asc')->where('rid', $rid)->get(); View::with('rule', $data); } $module = new $this->moduleClass(); $moduleForm = $module->fieldsDisplay($rid); return view()->with('moduleForm', $moduleForm); }
/** * 支付 * * @param $param */ public function weixin($param) { if (!v('module.name') || !Session::get('member.uid') || empty($param['goods_name']) || empty($param['fee']) || empty($param['body']) || empty($param['tid'])) { message('支付参数错误,请重新提交', 'back', 'error'); } if ($pay = Db::table('pay')->where('tid', $param['tid'])->first()) { if ($pay['status'] == 1) { message('定单已经支付完成', $param['back_url'], 'success'); } } $data['siteid'] = SITEID; $data['uid'] = Session::get('member.uid'); $data['tid'] = $param['tid']; $data['fee'] = $param['fee']; $data['goods_name'] = $param['goods_name']; $data['attach'] = isset($param['attach']) ? $param['attach'] : ''; //附加数据 $data['module'] = v('module.name'); $data['body'] = $param['body']; $data['attach'] = $param['attach']; $data['status'] = 0; $data['is_usecard'] = isset($param['is_usecard']) ? $param['is_usecard'] : 0; $data['card_type'] = isset($param['card_type']) ? $param['card_type'] : ''; $data['card_id'] = isset($param['is_usecard']) ? $param['card_id'] : 0; $data['card_fee'] = isset($param['card_fee']) ? $param['card_fee'] : 0; if (empty($pay)) { Db::table('pay')->insertGetId($data); } Session::set('pay', ['tid' => $data['tid'], 'module' => v('module.name'), 'siteid=' => SITEID]); View::with('data', $data); View::make('server/build/template/pay.html'); }
public function doWebLists() { $Model = new CreditsRecord(); //会员信息 $user = Db::table('member')->where('uid', Session::get('member.uid'))->first(); if ($timerange = q('get.timerange')) { //有筛选时间的 $timerange = explode('至', $timerange); $total = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->where('createtime', '>=', strtotime($timerange[0]))->where('createtime', '<=', strtotime($timerange[1]))->count(); $page = Page::row(8)->make($total); $data = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->where('createtime', '>=', strtotime($timerange[0]))->where('createtime', '<=', strtotime($timerange[1]))->limit(Page::limit())->get(); } else { $total = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->count(); $page = Page::row(8)->make($total); $data = $Model->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->limit(Page::limit())->get(); } //收入 $income = $Model->where('num', '>', 0)->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->sum('num'); //支出 $expend = $Model->where('num', '<', 0)->where('uid', Session::get('member.uid'))->where('credittype', q('get.type'))->sum('num'); View::with(['income' => $income, 'expend' => $expend]); View::with('page', $page); View::with('user', $user); View::with('data', $data); View::make($this->ucenter_template . '/credit_lists.html'); }
public function run() { //分配表单验证数据 View::with('errors', Session::flash('errors')); //清除闪存 Session::flash('[del]'); }
public function index() { //商品分类 $cate = new \Home\Model\Cate(); $cateData = $cate->getChan(); // p($cateData); View::with('cateData', $cateData); //创建商品对象 $goods = new \Home\Model\Goods(); //最新发布商品 $new = $goods->getNew(); View::with('new', $new); //重组分类列表,并去取出8件商品 $cateTree = $cateData; foreach ($cateData as $k => $v) { $a = array(); //取该分组下的三级分类 foreach ($v['_data'] as $m => $n) { $a = array_merge($a, array_keys($n['_data'])); } unset($cateTree[$k]['_data']); $cateTree[$k]['three'] = $a; if ($a) { $level_goods = $goods->whereIn('cate_id', $a)->limit(8)->get(); $cateTree[$k]['level_goods'] = $level_goods; } } // p($cateTree); View::with('cateTree', $cateTree); View::make($this->tpl . 'index.html'); }
public function moduleBrowser() { service('user')->loginAuth(); View::with('modules', v('site.modules')); View::with('useModules', explode(',', q('get.mid', '', []))); return view(); }
/** * Attach required data to Dashboard Menus view. * * @param View $view * @return void */ public function compose($view) { $routes = $this->getAllRoutes(); $partials = $this->getDropdownPartials(); $pages = $this->getPages(); $view->with('routes', $routes)->with('partials', $partials)->with('pages', $pages); }
public function compose(View $view) { $tags = Tag::orderBy('id', 'DESC')->get(); $categories = Category::orderBy('id', 'DESC')->simplepaginate(7); $images = Image::orderBy('id', 'DESC')->paginate(4); $view->with('tags', $tags)->with('categories', $categories)->with('images', $images); }
public function doSiteSitePost() { if (IS_POST) { $data = json_decode($_POST['data'], TRUE); $data['site_info'] = $_POST['data']; $insertId = $this->web->save($data); $web['id'] = $this->webid ?: $insertId; //添加回复规则 $rule = []; $rule['rid'] = Db::table('reply_cover')->where('web_id', $web['id'])->pluck('rid'); $rule['module'] = 'cover'; $rule['name'] = '微站:' . $data['title']; $rule['keywords'] = [['content' => $data['keyword']]]; $rid = service('WeChat')->rule($rule); //添加封面回复 $replyCover = new ReplyCover(); $replyCover->where('rid', $rid)->delete(); $data['web_id'] = $web['id']; $data['rid'] = $rid; $data['module'] = 'article'; $data['url'] = '?a=entry/home&m=article&t=web&siteid=' . SITEID . '&webid=' . $web['id']; $replyCover->save($data); message('保存站点数据成功', site_url('site'), 'success'); } if ($this->webid) { //编辑数据时 $web = $this->web->find($this->webid); $field = json_decode($web['site_info'], TRUE); $field['id'] = $this->webid; } View::with('field', isset($field) ? json_encode($field, JSON_UNESCAPED_UNICODE) : ''); return View::make($this->template . '/manage/sitePost.php'); }
public function index() { $id = Q('pid'); $node = new \Admin\Model\Node(); $node = $node->getchannletree(); $access = (array) $this->db->getAccessNode($id); View::with('node', $node)->with('access', $access)->make(); }
public function doWebEmploy() { $tid = q('get.tid', 0, 'intval'); //会员卡卷记录 $ticket = Db::table('ticket')->where('tid', $tid)->first(); View::with('ticket', $ticket); View::make($this->ucenter_template . '/ticket_employ.html'); }
public function pay() { //分配模板文件配置 $tplData['title'] = "在线支付"; $tplData['css'] = "cart|pay"; View::with('tplData', $tplData); View::make($this->tpl . 'pay.html'); }
public function run() { //分配表单验证数据 $errors = \Session::flash('validate'); \View::with('errors', $errors); //清除闪存 \Session::flash('[del]'); }
public function doWebShow() { $id = q('get.id', 0, 'intval'); $article = Db::table('reply_news')->where('id', $id)->first(); $tpl = __TEMPLATE__ . '/article.html'; View::with('hdcms', $article); return view($tpl); }
public function doWebHome() { $uc = Db::table('web_page')->where('siteid', SITEID)->where('type', 3)->first(); //获取菜单 $menus = Db::table('web_nav')->where('siteid', SITEID)->where('entry', 'profile')->get(); //会员信息 View::with(['uc' => $uc, 'menus' => $menus]); return View::make($this->ucenter_template . '/home.html'); }
public function article() { $id = Q('id', 0, 'intval'); $article = Db::table('article a')->where('a.id', '=', $id)->first(); $category = Db::table('category')->where('id', '=', $article['cid'])->first(); $cms = $article; $cms['category'] = $category; View::with('cms', $cms)->make($this->tpl . '/article.html'); }
public function article() { $article_id = Q('article'); $article = $this->db->where('article_id', $article_id)->first(); //分配模板文件配置 $tplData['title'] = $article['article_title']; $tplData['css'] = "article"; View::with('tplData', $tplData); View::with('article', $article)->make($this->tpl . 'article.html'); }
public function doWebRegister() { if (IS_POST) { service('member')->register($_POST); message('恭喜你,注册成功!系统将跳转到登录页面', web_url('login'), 'success', 3); } $placeholder = [1 => '手机号', 2 => '邮箱', 3 => '手机号/邮箱']; View::with('placeholder', $placeholder[v('site.setting.register.item')]); return View::make($this->ucenter_template . '/register.html'); }
public function fieldsDisplay($rid = 0) { //要嵌入规则编辑页的自定义内容,这里 $rid 为对应的规则编号,新增时为 0 $contents = []; if ($rid) { //编辑时读取原数据 $contents = Db::table('reply_basic')->where('rid', $rid)->get(); } View::with('contents', json_encode($contents ?: [])); return View::fetch($this->template . '/fieldsDisplay.html'); }
public function doWebSetting() { if (IS_POST) { $_POST['uid'] = Session::get('member.uid'); if (m('Member')->save()) { Util::instance('member')->updateSession(); message('修改成功', web_url('entry/home'), 'success'); } } View::with('user', Session::get('member')); View::make($this->ucenter_template . '/change_user_info.html'); }
public function register() { $Config = new \system\model\Config(); if (IS_POST) { $Config->id = 1; $Config->register = Request::post('register'); $Config->save(); message('保存成功', 'back', 'success'); } View::with('group', Db::table('user_group')->get()); View::with('field', v('config.register')); return view(); }
public function edit() { if (IS_POST) { if ($this->db->edit()) { View::success('操作成功', 'index'); } else { View::error($this->db->getError()); } } else { $field = $this->db->getOne(); View::with('field', $field)->make(); } }
public function edit() { if (IS_POST) { if ($this->db->update()) { $this->success('更新成功', U('index')); } else { $this->error($this->db->getError()); } } else { $data = $this->db->find(Q('id')); $data2 = $this->db->getEditData($data['id'], $data['pid']); View::with('data', $data)->with('data2', $data2)->make(); } }
public function index() { $data = Dir::tree('template'); // p($data); $dirs = array(); foreach ($data as $d) { if (is_file($d['path'] . '/config.php')) { $d['active'] = $d['filename'] == C('web.style') ? 'class="active"' : ''; $d = array_merge($d, require $d['path'] . '/config.php'); $dirs[] = $d; } } View::with('dirs', $dirs)->make(); }
public function create() { if (IS_POST) { if ($this->db->store()) { $this->success('创建节点成功', 'index'); } else { $this->error($this->db->getError()); } } else { $data = $this->db->getAll(); // p($data); View::with('data', $data)->make(); } }
public function edit() { if (IS_POST) { if ($this->db->edit()) { $this->success('文章修改成功', 'index'); } else { $this->error($this->getError()); } } else { $article_id = Q('article_id'); $article = $this->db->where('article_id', $article_id)->first(); View::with('article', $article)->make(); } }
public function recovery() { if ($dir = Q("get.dir")) { $config = array('dir' => 'backup/' . $dir, 'url' => U('recovery'), 'time' => 0.2); //设置还原配置 if (Backup::recoveryInit($config)) { //执行还原 go('runRecovery'); } else { $this->error(Backup::getError(), 'recovery'); } } else { View::with('data', Backup::getBackupDir('backup'))->make(); } }
public function index() { //获取商品信息 $goods = new \Admin\Model\Goods(); $goodsData = $goods->getOne(); View::with('goodsData', $goodsData); //获取商品属性值 $goods_attr = new \Admin\Model\GoodsAttr(); $attrData = $goods_attr->groupAttr($goodsData['goods_id']); View::with('attrData', $attrData); //获取商品规格标题 $attrName = $goods_attr->getAttrName($goodsData['goods_id']); View::with('attrName', $attrName); View::make(); }
public function edit() { if (IS_POST) { if ($this->db->edit()) { View::success('操作成功', 'index'); } else { View::error($this->db->getError()); } } else { //分配品牌分类 $cate = new \Admin\Model\ShopCate(); $cateData = $cate->getAll(); $field = $this->db->getOne(); View::with('field', $field)->with('cateData', $cateData)->make(); } }