当前位置: 首页>>代码示例>>PHP>>正文


PHP model函数代码示例

本文整理汇总了PHP中model函数的典型用法代码示例。如果您正苦于以下问题:PHP model函数的具体用法?PHP model怎么用?PHP model使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了model函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _initialize

 /**
  * 模块初始化,获取当前用户管理的应用
  */
 public function _initialize()
 {
     $this->appList = model('App')->getManageApp($this->mid);
     if (empty($this->appList)) {
         $this->error(L('PUBLIC_NO_FRONTPLATFORM_PERMISSION'));
     }
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:10,代码来源:ManageAction.class.php

示例2: render

 /**
  * 渲染分享发布框模板
  * @example
  * $data['send_type'] string 分享发送类型
  * $data['app_name'] string 发布分享所在的应用名称
  * $data['initHtml'] string 发布分享框中的默认内容
  * $data['cancomment'] integer 是否可以评论 
  *$data['channelID']  发布到某个频道的id
  * @param array $data 发布分享框的配置参数
  * @return string 渲染后的模板内容
  */
 public function render($data)
 {
     $var = array();
     //频道id
     $var['channelID'] = $data['channelID'];
     $var['initHtml'] = '';
     $var['post_event'] = 'post_group_feed';
     $var['cancomment'] = 0;
     is_array($data) && ($var = array_merge($var, $data));
     !$var['send_type'] && ($var['send_type'] = 'send_weibo');
     $weiboSet = model('Xdata')->get('admin_Config:feed');
     $var['initNums'] = $weiboSet['weibo_nums'];
     $var['weibo_type'] = $weiboSet['weibo_type'];
     $var['weibo_premission'] = $weiboSet['weibo_premission'];
     !$var['type'] && ($var['type'] = 'post');
     !$var['app_name'] && ($var['app_name'] = 'public');
     !$var['prompt'] && ($var['prompt'] = '转发成功');
     $var['time'] = $_SERVER['REQUEST_TIME'];
     $var['topicHtml'] = t($data['topicHtml']);
     // 获取安装的应用列表
     $var['hasChannel'] = model('App')->isAppNameOpen('channel');
     // 权限控制
     $type = array('face', 'at', 'image', 'video', 'file', 'topic', 'contribute');
     foreach ($type as $value) {
         !isset($var['actions'][$value]) && ($var['actions'][$value] = true);
     }
     // 渲染模版
     $content = $this->renderFile(dirname(__FILE__) . "/SendGroupWeibo.html", $var);
     self::$rand++;
     unset($var, $data);
     // 输出数据
     return $content;
 }
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:44,代码来源:SendGroupWeiboWidget.class.php

示例3: weibo

 public function weibo()
 {
     // 解析参数
     $_REQUEST['param'] = unserialize(urldecode($_REQUEST['param']));
     $active_field = $_REQUEST['param']['active_field'] == 'title' ? 'title' : 'body';
     $this->assign('has_status', $_REQUEST['param']['has_status']);
     $this->assign('is_success_status', $_REQUEST['param']['is_success_status']);
     $this->assign('status_title', t($_REQUEST['param']['status_title']));
     // 解析模板(统一使用模板的body字段)
     $_REQUEST['data'] = unserialize(urldecode($_REQUEST['data']));
     $content = model('Template')->parseTemplate(t($_REQUEST['tpl_name']), array($active_field => $_REQUEST['data']));
     // 设置微博发布框的权限
     $type = array('at', 'image', 'video', 'file', 'contribute');
     $actions = array();
     foreach ($type as $value) {
         $actions[$value] = false;
     }
     $this->assign('actions', $actions);
     $this->assign('title', $content['title']);
     $this->assign('initHtml', $content['body']);
     $this->assign('content', h($content[$active_field]));
     $this->assign('source', $_REQUEST['data']['source']);
     $this->assign('sourceUrl', $_REQUEST['data']['url']);
     $this->assign('type', $_REQUEST['data']['type']);
     $this->assign('type_data', $_REQUEST['data']['type_data']);
     $this->assign('button_title', t(urldecode($_REQUEST['button_title'])));
     $this->assign('addon_info', urldecode($_REQUEST['addon_info']));
     $this->display();
 }
开发者ID:yang7hua,项目名称:hunshe,代码行数:29,代码来源:WidgetAction.class.php

示例4: setConfig

 /**
  * Sets a configuration value - updates if it exists otherwise insert.
  * @param string $key
  * @param string $value
  * @param integer $user_id
  */
 public function setConfig($key = false, $value = false, $user_id = NULL)
 {
     $new_rc = array('current_value' => $value, 'config_key' => $key, 'user_id' => $user_id);
     $cfg_model = model()->open('config');
     $cfg = $this->configRecord($key, $user_id);
     return is_array($cfg) ? $cfg_model->update($new_rc, $cfg['id']) : $cfg_model->insert($new_rc);
 }
开发者ID:viveleroi,项目名称:AspenMSM,代码行数:13,代码来源:Settings.php

示例5: index

 /**
  * 我的收藏页面
  */
 public function index()
 {
     $map['uid'] = $GLOBALS['ts']['uid'];
     $weiboSet = model('Xdata')->get('admin_Config:feed');
     $this->assign($weiboSet);
     // TODO:后续可能由表中获取语言KEY
     $d['tabHash'] = array('feed' => L('PUBLIC_WEIBO'));
     $d['tab'] = model('Collection')->getCollTab($map);
     $this->assign($d);
     // 安全过滤
     $t = t($_GET['t']);
     !empty($t) && ($map['source_table_name'] = $t);
     $key = t($_POST['collection_key']);
     if ($key === '') {
         $list = model('Collection')->getCollectionList($map, 20);
     } else {
         $list = model('Collection')->searchCollections($key, 20);
         $this->assign('collection_key', $key);
         $this->assign('jsonKey', json_encode($key));
     }
     $this->assign($list);
     $this->setTitle(L('PUBLIC_COLLECTION_INDEX'));
     // 我的收藏
     // 是否有返回按钮
     $this->assign('isReturn', 1);
     // 获取用户统计信息
     $userData = model('UserData')->getUserData($GLOBALS['ts']['mid']);
     $this->assign('favoriteCount', $userData['favorite_count']);
     $userInfo = model('User')->getUserInfo($this->mid);
     $this->setTitle('我的收藏');
     $this->setKeywords($userInfo['uname'] . '的收藏');
     $this->display();
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:36,代码来源:CollectionAction.class.php

示例6: doSwitch

 public function doSwitch()
 {
     global $_W, $_GPC;
     $m = array_merge($_W['modules']['userapi'], $_W['account']['modules'][$_W['modules']['userapi']['mid']]);
     $cfg = $m['config'];
     if ($_W['ispost']) {
         $rids = explode(',', $_GPC['rids']);
         if (is_array($rids)) {
             $cfg = array();
             foreach ($rids as $rid) {
                 $cfg[intval($rid)] = true;
             }
             $this->saveSettings($cfg);
         }
         exit;
     }
     require model('rule');
     $rs = rule_search("weid = 0 AND module = 'userapi' AND `status`=1");
     $ds = array();
     foreach ($rs as $row) {
         $reply = pdo_fetch('SELECT * FROM ' . tablename($this->tablename) . ' WHERE `rid`=:rid', array(':rid' => $row['id']));
         $r = array();
         $r['title'] = $row['name'];
         $r['rid'] = $row['id'];
         $r['description'] = $reply['description'];
         $r['switch'] = $cfg[$r['rid']] ? ' checked="checked"' : '';
         $ds[] = $r;
     }
     include $this->template('switch');
 }
开发者ID:yunsite,项目名称:my-we7,代码行数:30,代码来源:module.php

示例7: edit

 /**
  * 编辑活动
  */
 public function edit()
 {
     $id = I('id');
     if (IS_POST) {
         $data = I('data');
         if ($_FILES['act_banner']['name']) {
             $result = $this->ectouchUpload('act_banner', 'banner_image');
             if ($result['error'] > 0) {
                 $this->message($result['message'], NULL, 'error');
             }
             /* 生成banner链接 */
             $data2['act_banner'] = substr($result['message']['act_banner']['savepath'], 2) . $result['message']['act_banner']['savename'];
             $this->model->table('touch_activity')->data($data2)->where('act_id=' . $id)->update();
         }
         $this->message(L('edit_favourable_ok'), url('index'));
     }
     /* 查询附表信息 */
     $touch_result = $this->model->table('touch_activity')->where('act_id=' . $id)->find();
     $favourable = model('GoodsBase')->favourable_info($id);
     /* 附表信息不存在则生成 */
     if (empty($touch_result)) {
         $data['act_id'] = $id;
         $this->model->table('touch_activity')->data($data)->insert();
     } else {
         $favourable['act_banner'] = $touch_result['act_banner'];
         $favourable['act_content'] = html_out($touch_result['act_content']);
     }
     /* 模板赋值 */
     $this->assign('favourable', $favourable);
     $this->assign('ur_here', L('edit_favourable'));
     $this->assign('action_link', array('text' => L('06_goods_brand_list'), 'href' => url('index')));
     $this->display();
 }
开发者ID:noikiy,项目名称:shop-3,代码行数:36,代码来源:FavourableController.class.php

示例8: getUnreadCount

 /**
  * 用户的通知统计数目
  * @return mix 通知统计状态和数目
  */
 public function getUnreadCount()
 {
     $count = model('UserCount')->getUnreadCount($this->mid);
     $data['status'] = 1;
     $data['data'] = $count;
     echo json_encode($data);
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:11,代码来源:UserCountAction.class.php

示例9: search

 public function search()
 {
     if (empty($_REQUEST["start_time"])) {
         $datas['start_time'] = 0;
     } else {
         $datas['start_time'] = $_REQUEST['start_time'];
     }
     if (empty($_REQUEST["end_time"])) {
         $datas['end_time'] = date("Y-m-d H:i:s");
     } else {
         $datas['end_time'] = $_REQUEST['end_time'];
     }
     if (!empty($_REQUEST["account"])) {
         $datas['username'] = $_REQUEST['account'];
     }
     if (!empty($_REQUEST["ip"])) {
         $datas['ip'] = $_REQUEST['ip'];
     }
     if ($_REQUEST['status'] != 'all') {
         $datas['status'] = $_REQUEST['status'];
     }
     $datas['date'] = array('between', "{$datas['start_time']},{$datas['end_time']}");
     $page_data = model("Log")->logList($datas);
     $this->assign("list", $page_data["data"]);
     $this->assign("page", $page_data["page"]);
     $this->display("Log:index");
 }
开发者ID:WALES7CH,项目名称:TP-Admin,代码行数:27,代码来源:LogController.class.php

示例10: unsetNotificationCount

 public function unsetNotificationCount()
 {
     if (empty($this->user_id) && isset($this->mid)) {
         switch ($this->data['type']) {
             // 暂仅允许message/weibo_commnet/atMe
             case 'message':
                 return (int) model('Message')->setAllIsRead($this->mid);
             case 'weibo_comment':
                 return (int) model('UserCount')->setZero($this->mid, 'comment');
             case 'atMe':
                 return (int) model('UserCount')->setZero($this->mid, 'atme');
             default:
                 return 0;
         }
     } else {
         switch ($this->data['type']) {
             // 暂仅允许message/weibo_commnet/atMe
             case 'message':
                 return (int) model('Message')->setAllIsRead($this->user_id);
             case 'weibo_comment':
                 return (int) model('UserCount')->setZero($this->user_id, 'comment');
             case 'atMe':
                 return (int) model('UserCount')->setZero($this->user_id, 'atme');
             default:
                 return 0;
         }
     }
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:28,代码来源:UserApi.class.php

示例11: doRegister

 public function doRegister()
 {
     $email = safe($_POST['email']);
     $uname = safe($_POST['uname']);
     $password = safe($_POST['password']);
     $repassword = safe($_POST['re_password']);
     if ($password != $repassword) {
         redirect(U('/Public/register', $_POST), 3, '两次的密码不符');
     }
     $service = model('UserRegister');
     $uid = $service->register($email, $uname, $password, true);
     if (!$uid) {
         redirect(U('/Public/register', $_POST), 3, $service->getLastError());
     } else {
         //redirect(U('/Public/login'), 1, '注册成功');
         if ($user = model('Passport')->getLocalUser($email, $password)) {
             if ($user['is_active'] == 0) {
                 redirect(U('wap/Public/login'), 3, '帐号尚未激活,请激活后重新登录');
             }
             $result = model('Passport')->registerLogin($user);
             redirect(U('wap/Index/index'));
         } else {
             redirect(U('wap/Public/login'), 3, '帐号或密码错误,请重新输入');
         }
     }
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:26,代码来源:PublicAction.class.php

示例12: getZBConfig

 public function getZBConfig()
 {
     //获取配置简单加密
     $key = $this->data['key'];
     if (md5($this->key) != $key) {
         return $this->rd('', '认证失败', 1);
     }
     $chongzhi_info = model('Xdata')->get('admin_Config:charge');
     $info['cash_exchange_ratio_list'] = getExchangeConfig('cash');
     $info['charge_ratio'] = $chongzhi_info['charge_ratio'] ?: '100';
     //1人民币等于多少积分
     $info['charge_description'] = $chongzhi_info['description'] ?: '充值描述';
     //充值描述
     $field = $this->data['field'];
     //关键字  不传为全部
     if ($field) {
         $field = explode(',', $field);
         foreach ($info as $key => $value) {
             if (!in_array($key, $field)) {
                 unset($info[$key]);
             }
         }
     }
     return $this->rd($info);
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:25,代码来源:ApplicationApi.class.php

示例13: feedback

 /**
  * 添加意见反馈操作
  */
 public function feedback()
 {
     if (t($_POST['textarea'])) {
         $feedbacktype = D('')->table(C('DB_PREFIX') . 'feedback_type')->where('type_name = "' . t($_POST['select']) . '"')->find();
         $map['feedbacktype'] = $feedbacktype['type_id'];
         $map['feedback'] = t($_POST['textarea']);
         $map['uid'] = $this->mid;
         $map['cTime'] = time();
         $map['type'] = 0;
         $res = model('Feedback')->add($map);
         if ($map['feedback'] == '') {
             $this->error(L('PUBLIC_INPUT_FEEDBACK'));
             // 请填写反馈内容
         }
         if ($res) {
             $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll();
             foreach ($touid as $k => $v) {
                 model('Notify')->sendNotify($v['uid'], 'feedback_audit');
             }
             $return = array('status' => 1, 'data' => L('PUBLIC_REPORTING_INFO'));
             $this->assign('jumpUrl', U('public/Index/index'));
             $this->success(L('PUBLIC_SUBMIT_FEEDBACK_SUCCESS'));
             // 提交成功,感谢您的反馈
         } else {
             $this->error(model()->getError());
         }
     } else {
         $this->error(L('PUBLIC_INPUT_FEEDBACK'));
         // 请填写反馈内容
     }
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:34,代码来源:FeedbackAction.class.php

示例14: test

 function test()
 {
     $a = model('Test');
     $key = '1234';
     $this->swoole->cache->delete($key);
     $this->db->getAffectedRows();
 }
开发者ID:matyhtf,项目名称:swoole_framework,代码行数:7,代码来源:User.php

示例15: doshorturl

 public function doshorturl()
 {
     $data['shorturl_type'] = $_POST['shorturl_type'];
     $data['customize_url'] = h($_POST['customize_url']);
     model('Xdata')->lput('shorturl', $data);
     $this->redirect('admin/Plugin/shorturl');
 }
开发者ID:armebayelm,项目名称:thinksns-vietnam,代码行数:7,代码来源:PluginAction.class.php


注:本文中的model函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。