Commit c153b91f by HTML5-侯张振

新接口添加

parent d60907a1
......@@ -27,7 +27,7 @@ class Buildingmanageradmin extends CI_Controller
$this->load->model('user_model', 'user');
$this->load->model('building_model', 'building');
$this->load->model('user_building_model', 'user_building');
$this->load->model('manager_model','manager');
//获取城市
//加入城市和楼盘的权限控制
$u_id = (int)$this->session->userdata('u_id');
......@@ -52,16 +52,18 @@ class Buildingmanageradmin extends CI_Controller
//解析过滤条件
$con_arr = explode('_',$condition);
$this->data['con_arr'] = $con_arr;
$where = $this->_search($condition);
//$where = $this->_search($condition);
//每页记录数
$count = $this->user_building->get_user_count($where);
$count = $this->manager->get_all_count(array("role_id"=>10));
$this->data['count'] = $count;
$this->data['Pintubes'] =$this->manager->get_all_manager(array("role_id"=>10));
//var_dump($this->data['Pintube']);
$this->data['condition'] = $condition;
$this->data['page_size'] = self::PAGE_SIZE;
$this->data['api'] = site_url('admin/buildingmanageradmin/page_api');
$this->data['api'] = site_url('admin/buildingmanageradmin/page_api');
$this->load->view('admin/buildingmanager/index',$this->data);
}
......
......@@ -67,10 +67,23 @@ class Report extends CI_Controller
*/
public function index($page_no = 1)
{
// $this->load->model('sales_model','sales');
// $this->load->helper('eas');
// $api=new easApi;
// $results = $api->newgetCustomerPurchase(array('customer_id'=>'YOM/+vSxTR+Yn99/0GkE0PFxPvM='));
// var_dump($results);
// $results = $api->newgetCustomerVisit(array('customer_id'=>'wb9Np8vHRo+04OTuS6d6DPFxPvM='));
// //var_dump($results[0]["saleManColl"]);
// $checksalesnum='';
// $checksales=$results[0]["saleManColl"];
// foreach($checksales as $value){
//// var_dump($value["id"]);
// $checksalesID=$this->sales->get(array('rongchuang_user_id'=> $value["id"]));
// if(count($checksales,COUNT_NORMAL)>1){
// $checksalesnum.=','.$checksalesID['user_id'];
// }else{
// $checksalesnum=$checksalesID['user_id'];
// }
//
// };
// exit;
$get = $this->input->get();
......@@ -382,7 +395,11 @@ class Report extends CI_Controller
$dataLog['is_deleted'] = $customerBuilding['is_deleted'];
$dataLog['create_time'] = $customerBuilding['create_time'];
$dataLog['action_time'] = time();
if ($post['userType'] == 'sale'){
$dataLog['remark'] = '分配销售';
}else{
$dataLog['remark'] = '分配销售经理';
}
$this->customer_building_log->add($dataLog);
......@@ -481,21 +498,55 @@ class Report extends CI_Controller
$this->load->model('customer_building_model', 'customer_building');
$this->load->model('recommend_trace_model', 'recommend');
$this->load->model('customer_building_log_model','customer_building_log');
$this->load->model('sales_model','sales');
$this->load->helper('eas');
$api=new easApi;
$customerId = $this->customer->search_rongchuang_id();
if($customerId){
foreach ($customerId as $value) {
//获取接口返回值
$results = $api->newgetCustomerVisit(array('customer_id'=>$value['rongchuang_id']));
if(!empty($results)){
$entity_id = $this->customer_building->get_building_id($value['id']);
//记录客户跟进信息
$customerBuilding = $this->customer_building->get(array('id' => $entity_id['id']));
//获取返回的sale_id
$checksalesnum='';
$checksales=$results[0]["saleManColl"];
foreach($checksales as $value){
$checksalesID=$this->sales->get(array('rongchuang_user_id'=> $value["id"]));
if(count($checksales,COUNT_NORMAL)>1){
$checksalesnum.=','.$checksalesID['user_id'];
}else{
$checksalesnum=$checksalesID['user_id'];
}
};
if($customerBuilding['sale_id']!=$checksalesnum){
$this->customer_building->update_customer_building($value['id'],array('sale_id' => $checksalesnum));
$datasales['user_id'] = $customerBuilding['user_id'];
$datasales['customer_id'] = $customerBuilding['customer_id'];
$datasales['building_id'] = $customerBuilding['building_id'];
$datasales['distributor_id'] = $customerBuilding['distributor_id'];
$datasales['building_title'] = $customerBuilding['building_title'];
$datasales['sale_id'] = $customerBuilding['sale_id'];
$datasales['manager_id'] = $customerBuilding['manager_id'];
$datasales['distribution_status'] = $customerBuilding['distribution_status'];
$datasales['recommend_status'] = $customerBuilding['recommend_status'];
$datasales['is_deleted'] = $customerBuilding['is_deleted'];
$datasales['create_time'] = $customerBuilding['create_time'];
$datasales['action_time'] = time();
if($customerBuilding['sale_id']==0){
$datasales['remark'] = '分配';
}else{
$datasales['remark'] = '重新分配';
}
$this->customer_building_log->add($datasales);
}
if($customerBuilding['recommend_status'] < 2){
$this->customer_building->update_customer_building($value['id'],array('recommend_status' => 2));
}
//记录客户跟进信息
if ($customerBuilding) {
$dataLog['user_id'] = $customerBuilding['user_id'];
$dataLog['customer_id'] = $customerBuilding['customer_id'];
......@@ -556,6 +607,7 @@ class Report extends CI_Controller
$customerId = $this->customer->search_rongchuang_id();
if($customerId){
foreach ($customerId as $value) {
//获取返回值
$results = $api->newgetCustomerPurchase(array('customer_id'=>$value['rongchuang_id']));
if(!empty($results)){
......
......@@ -143,7 +143,7 @@ class Customer_building_model extends MY_Model{
->join('tb_building B', 'B.id = CB.building_id ', 'left')
->join('tb_customer C', 'C.id = CB.customer_id ', 'left')
->join('tb_region R', 'R.region_code = CB.city_code ', 'left')
->join('tb_user UP', 'UP.id = CB.sale_id', 'left')
->join('tb_user UP', 'UP.id in ("CB.sale_id")', 'left')
->join('tb_user U', 'U.id = CB.user_id', 'left')
->join('tb_user TU', 'TU.id = CB.manager_id', 'left')
->join('tb_distributor D', 'D.id = CB.distributor_id', 'left')
......@@ -226,7 +226,7 @@ class Customer_building_model extends MY_Model{
->from('tb_customer_building_log CB')
->join('tb_building B', 'B.id= CB.building_id', 'left')
->join('tb_customer TC', 'TC.id = CB.customer_id', 'left')
->join('tb_user US', 'US.id=CB.sale_id', 'left')
->join('tb_user US', 'US.id= in(."CB.sale_id".)', 'left')
->join('tb_user UM', 'UM.id = CB.manager_id', 'left')
->join('tb_user UU', 'UU.id = CB.user_id', 'left')
->join('tb_distributor D', 'D.uniqid_id=UU.uniqid_id', 'left');
......
......@@ -93,4 +93,29 @@ class Manager_model extends MY_Model{
}
}
public function get_all_count($where){
$this->db->select('count(*) total')
->from('tb_manager')
->where($where);
$query = $this->db->get();
// echo $this->db->last_query();exit;
if($query->num_rows() > 0)
{
$return = $query->row_array();
return $return['total'];
}
}
public function get_all_manager($where){
$this->db->select('M.manager_name manager_name,M.manager_phone manager_phone')
->from('tb_manager M')
// ->join('tb_buliding B','B.id = M.building_id','left'
->where($where);
$query = $this->db->get();
if($query->num_rows() > 0)
{
$return = $query->result_array();
return $return;
}
}
}
\ No newline at end of file
......@@ -49,7 +49,7 @@
</div>
</div>
<div class="girdScroller" style="overflow:auto;">
<div class="total" style="margin-bottom:10px;">总共:<span></span></div>
<div class="total" style="margin-bottom:10px;">总共:<span><?php echo $count?></span></div>
<table class="table table-striped table-bordered table-hover" id="sample_1">
<thead>
<tr>
......@@ -59,6 +59,15 @@
<th>是否启用</th>
<th> 操作 </th>
</tr>
<?php foreach($Pintubes as $Pintube):?>
<tr>
<td><?php echo $Pintube['manager_name']?></td>
<td><?php echo $Pintube['manager_phone']?></td>
<td></td>
<td></td>
<td><a id="view" href="javascript:;" class="btn default btn-xs blue"><i class="fa fa-globe"></i> 查看</a></td>
</tr>
<?php endforeach?>
</thead>
<tbody id="add-con">
</tbody>
......@@ -165,7 +174,8 @@
$(document).ready(function() {
var optInit = {callback: pageselectCallback};
optInit['items_per_page'] = _page_size;
//console.log(_page_size);
optInit['items_per_page'] = 24;
optInit['next_text'] = "下一页";
optInit['num_display_entries'] = 5;
optInit['num_edge_entries'] = 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment