本文整理汇总了PHP中get_current_company_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_current_company_id函数的具体用法?PHP get_current_company_id怎么用?PHP get_current_company_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_current_company_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _after_insert
protected function _after_insert($id)
{
// 线索、客户、商机等上次联系时间,更新
if (I('post.crm_clue_id')) {
// 线索
$related_id = I('post.crm_clue_id');
$model = "Crm/CrmClue";
} else {
if (I('post.customer_id')) {
// 客户
$related_id = I('post.customer_id');
$model = "Crm/Customer";
}
}
if ($model && $id) {
D($model)->where(array('id' => $id, 'company_id' => get_current_company_id()))->save(array('last_contact_time' => date('Y-m-d H:i:s')));
}
if (I('post.next_contact_time') && I('post.next_contact_content') && $related_id) {
// 更新日程
if (AppService::is_app_active('calendar')) {
$event_service = D('Calendar/Events');
$event_service->create(['subject' => I('post.next_contact_content'), 'type' => 'info', 'start_at' => I('post.next_contact_time'), 'end_at' => I('post.next_contact_time'), 'related_model' => $this->module_alias, 'related_id' => $related_id]);
$event_service->add();
}
}
}
开发者ID:DevlJs,项目名称:ones,代码行数:26,代码来源:CustomerCommunicateController.class.php
示例2: update_customer_head
public function update_customer_head($ids, $uid)
{
if (!$ids) {
return;
}
$company_id = get_current_company_id();
// 原始数据
$source = array();
if (!$uid) {
$source = $this->where(array('id' => array("IN", $ids)))->select();
$source = get_array_to_kv($source, 'user_id', 'id');
}
// 往来单位
$contacts_company = D('ContactsCompany/ContactsCompany', 'Service')->where(array('id' => array("IN", $ids)))->select();
$contacts_company = get_array_to_ka($contacts_company);
foreach ($ids as $id) {
$map = array('contacts_company_id' => $id, 'company_id' => $company_id);
$exists = $this->where($map)->find();
if ($exists) {
// 已存在更新负责人ID
$this->where($map)->save(array('head_id' => $uid));
} else {
// 不存在新增一条
$data = array('contacts_company_id' => $id, 'head_id' => $uid, 'user_id' => $uid, 'crm_clue_id' => null, 'company_id' => $company_id, 'source_from' => $contacts_company[$id]['source_form']);
$this->add($data);
}
}
$head_model = D('Crm/CustomerHeadLog');
$type = $uid ? 1 : 2;
foreach ($ids as $id) {
$user_id = $uid ? $uid : $source[$id];
$head_model->add(array('type' => $type, 'company_id' => $company_id, 'customer_id' => $id, 'user_id' => $user_id));
}
return true;
}
开发者ID:DevlJs,项目名称:ones,代码行数:35,代码来源:CustomerService.class.php
示例3: on_list
public function on_list()
{
$data = parent::on_list(true);
$actives = D('Home/CompanyActiveApps')->where(['company_id' => get_current_company_id()])->select();
$actives = get_array_by_field($actives, 'app_id');
$cleared_list = [];
$i = 0;
foreach ($data[1] as $k => $v) {
// 根据是否启用状态过滤
if (false !== $this->filter_only_active_status) {
if ($this->filter_only_active_status > 0 && !in_array($v['id'], $actives)) {
continue;
}
if ($this->filter_only_active_status < 1 && in_array($v['id'], $actives)) {
continue;
}
}
$cleared_list[$i] = $v;
if (in_array($v['id'], $actives)) {
$cleared_list[$i]['is_active'] = true;
} else {
$cleared_list[$i]['is_active'] = false;
}
$i++;
}
$data[1] = $cleared_list;
$this->response($data, 'app', true);
}
开发者ID:chinapaul,项目名称:ones,代码行数:28,代码来源:AppController.class.php
示例4: authorize
public function authorize($role_id, $nodes)
{
$data = array();
$included_id = array(0);
$authed_nodes = get_array_to_kv($this->get_authed_nodes_by_role($role_id), 'flag', 'auth_node_id');
foreach ($nodes as $node) {
if ($node['node']) {
$included_id[] = $node['node'];
}
// 在已授权列表中
if (array_key_exists($node['node'], $authed_nodes) && $authed_nodes[$node['node']] == $node['flag']) {
continue;
}
array_push($data, array('auth_node_id' => $node['node'], 'flag' => $node['flag'], 'auth_role_id' => $role_id, 'company_id' => get_current_company_id()));
}
$this->where(array('auth_node_id' => array('NOT IN', $included_id), 'auth_role_id' => $role_id))->delete();
if (!$data) {
return true;
}
foreach ($data as $k => $v) {
if (!$v['auth_node_id']) {
continue;
}
if (!$this->add($v)) {
$this->error = $this->getLastSql();
return false;
}
}
return true;
}
开发者ID:DevlJs,项目名称:ones,代码行数:30,代码来源:AuthorizeService.class.php
示例5: on_read
public function on_read()
{
list($id, $hash) = explode('_', I('get.hash'));
if ($hash) {
session(array('id' => $hash, 'expire' => 600));
session('[start]');
}
$file = D('Attachment')->where(array('company_id' => get_current_company_id(), 'id' => $id))->find();
if (!$file) {
return $this->httpError(404);
}
// 完整带协议地址(远程附件)
if (substr($file['real_url'], 0, 1) !== '/') {
} else {
$real_path = ENTRY_PATH . '/uploads' . $file['real_url'];
if (is_file($real_path)) {
$desc = substr($file['file_mime'], 0, 5) === 'image' ? '' : 'attachment';
header('Content-Type:' . $file['file_mime']);
header("Accept-Ranges: bytes");
header("Accept-Length: " . $file['file_size']);
header("Content-Disposition: {$desc}; filename=" . $file['source_name']);
readfile($real_path);
} else {
$this->httpError(404);
}
}
}
开发者ID:DevlJs,项目名称:ones,代码行数:27,代码来源:AttachmentController.class.php
示例6: where
public function where($map, $parse = null)
{
if (!$this->not_belongs_to_company && !$map['id']) {
$map["company_id"] = get_current_company_id();
}
return parent::where($map, $parse);
}
开发者ID:npk,项目名称:ones,代码行数:7,代码来源:CommonModel.class.php
示例7: where
public function where($map, $parse = null)
{
if (!$this->not_belongs_to_company) {
$this->real_model_name = $this->real_model_name ? $this->real_model_name : $this->getModelName();
$map[$this->real_model_name . ".company_id"] = get_current_company_id();
}
return parent::where($map, $parse);
}
开发者ID:DevlJs,项目名称:ones,代码行数:8,代码来源:CommonAdvModel.class.php
示例8: disable
public function disable($alias)
{
$apps_info = $this->where(array('alias' => array('IN', $alias)))->select();
if (!$apps_info) {
return true;
}
$model = D('Account/CompanyActiveApps');
return $model->where(array('app_id' => array('IN', get_array_to_kv($apps_info, 'id')), 'company_id' => get_current_company_id()))->delete();
}
开发者ID:npk,项目名称:ones,代码行数:9,代码来源:AppService.class.php
示例9: DBC
function DBC($alias = null)
{
$cache_key = "db_config_" . get_current_company_id();
$cached = S($cache_key);
if (DEBUG || !$cached) {
$cached = D('Home/Config', 'Service')->get_kv_config();
$cached = get_array_to_kv($cached, 'val', 'alias');
S($cache_key, $cached);
}
return $alias ? $cached[$alias] : $cached;
}
开发者ID:DevlJs,项目名称:ones,代码行数:11,代码来源:function.php
示例10: get_kv_config
public function get_kv_config($alias = null)
{
$cache_key = 'kv_db_configs/' . get_current_company_id();
$cached = S($cache_key);
if (DEBUG || !$cached) {
$source = $this->select();
$cached = array();
foreach ($source as $row) {
$cached[$row['alias']] = $row;
}
S($cache_key, $cached);
}
return $alias ? $cached[$alias] : $cached;
}
开发者ID:npk,项目名称:ones,代码行数:14,代码来源:ConfigService.class.php
示例11: on_list
public function on_list()
{
$data = parent::on_list(true);
$actives = D('Home/CompanyActiveApps')->where(['company_id' => get_current_company_id()])->select();
$actives = get_array_by_field($actives, 'app_id');
foreach ($data[1] as $k => $v) {
if (in_array($v['id'], $actives)) {
$data[1][$k]['is_active'] = true;
} else {
$data[1][$k]['is_active'] = false;
}
}
$this->response($data, 'app', true);
}
开发者ID:npk,项目名称:ones,代码行数:14,代码来源:AppController.class.php
示例12: do_delete
public function do_delete($ids)
{
if (!$ids) {
return;
}
$map = array('id' => array('IN', $ids), 'company_id' => get_current_company_id());
$files = $this->where($map)->select();
foreach ($files as $file) {
if (substr($file['real_url'], 0, 1) === '/') {
$local_path = $this->get_local_path($file['real_url']);
is_file($local_path) && @unlink($local_path);
}
}
$this->where($map)->delete();
}
开发者ID:DevlJs,项目名称:ones,代码行数:15,代码来源:AttachmentService.class.php
示例13: insert
public function insert($source_id, $data = array(), $fields = array(), $modelName)
{
$data = $data ? $data : I('post.');
if (!$fields) {
$fields = explode(",", I('post._data_model_fields_'));
}
if (!$fields) {
return;
}
$fields_config = D('DataModelField', 'Service')->where(array('id' => array('IN', $fields)))->select();
$company_id = get_current_company_id();
foreach ($fields_config as $config) {
if (array_key_exists($config['alias'], $data)) {
$insert_data_model_data = array('source_id' => $source_id, 'data_model_field_id' => $config['id'], 'data' => $data[$config['alias']], 'company_id' => $company_id);
}
$table = $config['search_able'] > 0 ? 'data_model_data_search' : 'data_model_data';
$this->table($table)->add($insert_data_model_data, array(), true);
}
}
开发者ID:DevlJs,项目名称:ones,代码行数:19,代码来源:DataModelDataService.class.php
示例14: on_post
public function on_post()
{
if (!I('get.is_push')) {
return parent::on_post();
}
$_GET['id'] = I('get.opp_id');
// print_r(I('get.id'));exit;
$rs = parent::on_put();
if (false !== $rs && I('get.is_push')) {
// 写客户沟通日志
$stage = D('Home/CommonType')->where(array('id' => I('post.status')))->getField('name');
$source = D('Marketing/SaleOpportunities')->find(I('get.id'));
$content = sprintf(__('marketing.Push Opportunities To %s Stage'), '`' . $stage . '`');
$content .= "\n\n";
$content .= I('post.push_remark');
$model = D('Crm/CustomerCommunicate');
$model->add(array('content' => $content, 'created' => I('post.last_contact_time'), 'sale_opportunities_id' => I('get.id'), 'customer_id' => $source['customer_id'], 'company_id' => get_current_company_id(), 'user_id' => get_current_user_id()));
// echo $model->getLastSql();
}
}
开发者ID:chinapaul,项目名称:ones,代码行数:20,代码来源:SaleOpportunitiesController.class.php
示例15: add_child
public function add_child($pid, $source_data, $table)
{
$parent = $this->find($pid);
if (!$parent) {
return false;
}
$company_id = get_current_company_id();
/**
* 更新右值
*/
$map = array("rgt" => array("EGT", $parent["rgt"]), "company_id" => $company_id);
$this->startTrans();
$rs = $this->where($map)->setInc('rgt', 2);
if (false === $rs) {
$this->rollback();
return false;
}
/**
* 更新左值
*/
$map = array("lft" => array("EGT", $parent["rgt"]), "company_id" => $company_id);
$rs = $this->where($map)->setInc('rgt', 2);
if (false === $rs) {
$this->rollback();
return false;
}
/**
* 插入新值
*/
$data = array("lft" => $parent["rgt"], "rgt" => $parent["rgt"] + 1, "company_id" => $company_id);
foreach ($source_data as $k => $v) {
$data[$k] = $v;
}
$rs = $this->table($table)->add($data);
if (!$rs) {
$this->rollback();
return false;
}
$this->commit();
return $rs;
}
开发者ID:DevlJs,项目名称:ones,代码行数:41,代码来源:CommonTreeModel.class.php
示例16: update_clue_head
public function update_clue_head($ids, $uid)
{
if (!$ids) {
return;
}
// 原始数据
$source = array();
if (!$uid) {
$source = $this->where(array('id' => array("IN", $ids)))->select();
$source = get_array_to_kv($source, 'user_id', 'id');
}
$result = $this->where(array("id" => array("IN", $ids)))->save(array("head_id" => $uid));
if (false === $result) {
return $result;
}
$head_model = D('Crm/CustomerHeadLog');
$company_id = get_current_company_id();
$type = $uid ? 1 : 2;
foreach ($ids as $id) {
$user_id = $uid ? $uid : $source[$id];
$head_model->add(array('type' => $type, 'company_id' => $company_id, 'crm_clue_id' => $id, 'user_id' => $user_id));
}
return $result;
}
开发者ID:chinapaul,项目名称:ones,代码行数:24,代码来源:CrmClueService.class.php
示例17: _filter
protected function _filter(&$map)
{
$map['Authorize.company_id'] = get_current_company_id();
$map['Authorize.auth_role_id'] = I('get.auth_role_id');
}
开发者ID:DevlJs,项目名称:ones,代码行数:5,代码来源:AuthorizeEvent.class.php
示例18: __construct
public function __construct()
{
//支持方法
if (!$this->allowMethod) {
$this->allowMethod = explode(",", strtolower(SUPPORTED_METHOD));
}
//session token
if (I('server.HTTP_TOKEN')) {
session(array('id' => I("server.HTTP_TOKEN"), 'expire' => 1800));
session('[start]');
$this->user = I("session.user");
$this->is_super_user = $this->user['is_super_user'];
if (isset($_SESSION['user']) && (!get_current_company_id() || !get_current_user_id())) {
return $this->login_required();
}
}
tag('before_controller_construct');
parent::__construct();
// 当前请求 =》 auth_node
$this->current_action_all = sprintf("%s.%s.%s.%s", lcfirst(MODULE_NAME), lcfirst(CONTROLLER_NAME), lcfirst(ACTION_NAME), $this->_method);
//当前用户所属公司
if ($this->user or true) {
$this->company = D("Account/Company")->relation(true)->find(get_current_company_id());
}
//当前公司启用应用
$this->activeApps = $this->baseApps;
if ($this->company) {
$this->activeApps = array_merge($this->activeApps, get_array_by_field($this->company['apps'], "alias"));
}
//启用应用
AppService::active($this->activeApps, $this->baseApps);
//当前模块前端别名
$this->module_alias = __(sprintf('%s.%s', lcfirst(MODULE_NAME), lcfirst(CONTROLLER_NAME)));
//导入非当前应用的插件及函数等信息
foreach ($this->activeApps as $app) {
$app = ucfirst($app);
if ($app == APP_NAME or $app == "common") {
continue;
}
// 插件
if (is_file(APPLICATION_PATH . $app . '/Conf/tags.php')) {
\Think\Hook::import(require APPLICATION_PATH . $app . '/Conf/tags.php');
}
// 函数
if (is_file(APPLICATION_PATH . $app . '/Common/function.php')) {
require_once APPLICATION_PATH . $app . '/Common/function.php';
}
}
//基本运行配置
$this->bootstrapConfigs = parse_yml(ENTRY_PATH . '/config.yaml');
//当前接口版本
if (I('server.HTTP_API_VERSION')) {
define('API_VERSION', I('server.HTTP_API_VERSION'));
} else {
define('API_VERSION', false);
}
//当前语言
$this->currentLanguage = $this->bootstrapConfigs["default_language"] ? $this->bootstrapConfigs["default_language"] : 'zh-cn';
if (I("server.HTTP_CLIENT_LANGUAGE")) {
$this->currentLanguage = I("server.HTTP_CLIENT_LANGUAGE");
}
if (I('get.lang')) {
$this->currentLanguage = I('get.lang');
}
define('CURRENT_LANGUAGE', $this->currentLanguage);
/*
* 解析应用配置
* * */
$cachedAppConfig = S("configs/app/all");
if (DEBUG or !$cachedAppConfig) {
foreach (new RecursiveFileFilterIterator(APP_PATH, "config.yml") as $item) {
$app = lcfirst(basename(dirname($item)));
$this->appConfigs[$app] = parse_yml($item);
}
S("configs/app/all", $this->appConfigs);
} else {
if (!DEBUG && $cachedAppConfig) {
$this->appConfigs = $cachedAppConfig;
}
}
AppService::$allAppConfigs = $this->appConfigs;
foreach ($this->appConfigs as $app => $config) {
$this->bootstrapConfigs['auth_dont_need_login'] = array_merge_recursive($this->bootstrapConfigs['auth_dont_need_login'], (array) $config['auth_dont_need_login']);
$this->bootstrapConfigs['auth_dont_need_check'] = array_merge_recursive($this->bootstrapConfigs['auth_dont_need_check'], (array) $config['auth_dont_need_check']);
}
// 当前表名
if (!$this->model_name) {
$this->model_name = ucfirst(CONTROLLER_NAME);
}
// 获得用户已授权节点
$authed_nodes = session('authed_nodes');
if (DEBUG || !$authed_nodes) {
$authed_nodes = D('Account/Authorize')->get_authed_nodes();
session('authed_nodes', $authed_nodes);
}
self::$authed_nodes = $authed_nodes;
AuthorizeService::set_authed_nodes($authed_nodes);
//当前动作权限检测
// @todo event, event_get
$current_node_auth_flag = DEBUG ? 1 : $this->check_permission();
//.........这里部分代码省略.........
开发者ID:DevlJs,项目名称:ones,代码行数:101,代码来源:BaseRestController.class.php
示例19: on_put
public function on_put()
{
// 提交的源数据
$source_data = I('post.');
$workflow_id = I('get.id');
$workflow_model = D('Bpm/Workflow');
$workflow = $workflow_model->where(array('id' => $workflow_id))->find();
if (!$workflow) {
$error = $workflow_model->getError();
$error = $error ? $error : __(CommonModel::MSG_NOT_FOUND);
$this->error($error);
}
$node_service = D('Bpm/WorkflowNode');
// 删除原数据
$node_service->where(['workflow_id' => $workflow_id])->save(['trashed' => 1]);
$company_id = get_current_company_id();
$id_map = [];
$node_ids = [];
foreach ($source_data as $group_value => $data) {
$nodes = $data['widgets'];
foreach ($nodes as $node) {
$node_data = [];
$node_data['label'] = $node['label'];
$node_data['node_type'] = $node['type'];
$node_data['action_type'] = $node['action_type'];
switch ($node['action_type']) {
case "n":
break;
case "e":
//service api
$node_data['action'] = $node['service_api'];
break;
case "u":
// 修改源数据
$node_data['action'] = $node['edit_source_config'];
break;
}
// 执行者
$node_data['executor'] = $group_value;
$node_data['workflow_id'] = $workflow_id;
$node_data['company_id'] = get_current_company_id();
// 提醒
$node_data['notify'] = $node['notify'];
$node_data['notify_content'] = $node['notify_content'];
$node_data['widget_id'] = $node['id'];
$node_data['status_label'] = $node['status_label'];
$node_data['widget_config'] = serialize($node);
if (!$node_service->create($node_data)) {
return $this->error($node_service->getError());
}
$node_id = $node_service->add();
/*
* 关联本表
* */
$id_map[$node['id']] = ['node_id' => $node_id, 'relation' => ['prev_nodes' => $node['prev_node_ids'], 'next_nodes' => $node['next_node_ids'], 'condition_true_nodes' => $node['condition_true_ids'], 'condition_false_nodes' => $node['condition_false_ids']]];
array_push($node_ids, $node_id);
}
}
/*
* 获取新近插入的节点
* */
$all_nodes = $node_service->where(array('id' => ['IN', $node_ids]))->select();
$all_nodes_map = get_array_to_kv($all_nodes, 'id', 'widget_id');
foreach ($id_map as $widget_id => $item) {
$map = ['id' => $item['node_id'], 'widget_id' => $widget_id];
$save_data = [];
foreach ($item['relation'] as $relation_field => $relation_ids) {
$relation_ids = array_unique($relation_ids);
foreach ($relation_ids as $relation_id) {
$save_data[$relation_field][] = $all_nodes_map[$relation_id];
}
$save_data[$relation_field] = implode(',', $save_data[$relation_field]);
}
$node_service->where($map)->save($save_data);
}
}
开发者ID:chinapaul,项目名称:ones,代码行数:76,代码来源:WorkflowBuilderController.class.php
示例20: change_user_role
public function change_user_role($uid, $role_ids)
{
$auth_roles = D('Account/AuthRole')->where([])->select();
$auth_roles = get_array_by_field($auth_roles, 'id');
$role_ids = array_intersect($role_ids, $auth_roles);
$auth_role_service = D('Account/AuthUserRole');
$auth_role_service->where(['user_id' => $uid])->delete();
$company_id = get_current_company_id();
foreach ($role_ids as $role_id) {
$auth_role_service->add(['user_id' => $uid, 'company_id' => $company_id, 'auth_role_id' => $role_id]);
}
}
开发者ID:joncv,项目名称:ones,代码行数:12,代码来源:UserService.class.php
注:本文中的get_current_company_id函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论