Commit 4aa55ac8 authored by clone's avatar clone

Merge branch 'test' into test-hujun1.15

# Conflicts: # application/api_broker/controller/Broker.php # application/api_broker/controller/Client.php # application/api_broker/controller/OrderLog.php # application/api_broker/extend/Basic.php # application/api_broker/service/ReportService.php # application/index/controller/CellPhone.php # application/index/controller/Member.php # application/index/extend/Basic.php # application/index/view/global/navigation.html # application/index/view/member/users_list.html # application/index/view/remark/remark_follow_index.html # application/model/OrderModel.php # application/model/SecretReport.php # application/model/Users.php # application/route.php # public/resource/js/RemarkFollowIndex.js # public/resource/js/user.js # public/resource/template/user_template_tpl.html
parents 45cdfe7a f0e849c1
File mode changed from 100755 to 100644
......@@ -73,7 +73,8 @@ class AttentionShop extends Basic
$order_ = 'a.create_time desc';
//b.room_num_left 前端显示已下架,不可点击到详情
$field = "a.id,a.house_id,b.title,b.area,b.room_area2,b.price,b.shangpu_tags,b.room_num_left,c.foreign_name";
$field = "a.id,a.house_id,b.title,b.room_area,b.room_area2,b.price,b.shangpu_tags,b.shangpu_type,b.room_num_left
,b.rent_type,c.foreign_name";
if (!isset($params["user_id"])) {
return $this->response("101", "用户id不能为空");
......@@ -92,6 +93,7 @@ class AttentionShop extends Basic
$result[$key]["images"] = $imgArr;
}
return $this->response("200", "request success", $result);
}
......
......@@ -48,10 +48,11 @@ class Banner extends Basic
*/
public function addOrSave()
{
$params = array(
/* $params = array(
"id" => 2,
"is_show" => 0
);
);*/
$params = $this->params;
$msg = isset($params['id']) ? "修改" : "新增";
$result = $this->bannerModel->addOrUpdate($params);
if ($result['code'] == 200) {
......@@ -67,10 +68,11 @@ class Banner extends Basic
*/
public function upIsShow()
{
$params = array(
/* $params = array(
"id" => 1,
"is_show" => 1
);
);*/
$params = $this->params;
$result = $this->bannerModel->upIsShow($params);
if ($result['code'] == 200) {
return $this->response("200", "update success", $result["msg"]);
......
......@@ -5,8 +5,8 @@ use app\api\extend\Basic;
use app\model\Agents;
use app\model\Evaluate;
use app\model\EvaluateSign;
use app\model\JournalAccounts;
use think\Db;
use app\model\Remarks;
/**
* Description of Agents
*
......@@ -16,7 +16,7 @@ use think\Db;
* Intro :
*/
class Broker extends Basic{
/**
* 获取当前商铺或街铺的经纪人
*
......@@ -132,12 +132,14 @@ class Broker extends Basic{
return $this->response($data['status'], $data['msg'], $data['data']);
}
/**
* 查询评论和成交记录
*
* @return type
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function commentAndDeal() {
$params = $this->params;
......@@ -150,16 +152,18 @@ class Broker extends Basic{
$pageSize = empty($params['pageSize']) ? PAGESIZE : $params['pageSize'];
$evalutate = new Evaluate();
$journal = new JournalAccounts();
$remarks = new Remarks();
$fields_evaluate = 'house_id,user_id,user_nick,user_phone,user_pic,evaluate_grade,evaluate_content,evaluate_sign,a.create_time,record_id,a.source';
$fields_journal = 'a.house_id,j.singntime';
$fields_journal = 'house_id,apply_id,created';
$where['shopuser_id'] = $params['agent_id'];
$where['transaction_status'] = 3;
switch ($params['type']) {
case 0:
//评价列表信息
$result['evaluate'] = $evalutate->getEvaluate($pageNo, $pageSize, 'a.id desc', $fields_evaluate, '', $params['agent_id']);
//成交记录
$result['journalAccounts'] = $journal->getJournalHouseInfo($pageNo, $pageSize, 'j.id desc', $fields_journal, 'j.transaction_status = 3', $params['agent_id']);
$result['journalAccounts'] = $remarks->getJournalHouseInfo($pageNo, $pageSize, 'id desc', $fields_journal, $where, $params['agent_id']);
$data['data'] = $result;
break;
case 1:
......@@ -169,7 +173,7 @@ class Broker extends Basic{
break;
case 2:
//成交记录
$result['journalAccounts'] = $journal->getJournalHouseInfo($pageNo, $pageSize, 'j.id desc', $fields_journal, 'j.transaction_status = 3', $params['agent_id']);
$result['journalAccounts'] = $remarks->getJournalHouseInfo($pageNo, $pageSize, 'id desc', $fields_journal, $where, $params['agent_id']);
$data['data'] = $result;
break;
default:
......
......@@ -264,8 +264,8 @@ class Member extends Basic
}
}
}
$insert_data['referrer_id'] = $referrer_id;
}
$insert_data['referrer_id'] = $referrer_id;
$insert_data['referrer_source'] = $referrer_source;
$insert_data['status'] = 0;
$insert_data['create_time'] = $date;
......
......@@ -55,7 +55,7 @@ class Shop extends Basic
$params = $this->params;
$field = "a.id,a.agent_id,a.title,a.address,a.city,disc,a.disccircles,a.sales,a.yetai,a.room_area,a.room_area2,
a.shangpu_type,a.is_test,a.room_num_left,a.shangpu_tags,a.carefully_chosen,a.price,b.foreign_name,b.address_detail_c,
a.shangpu_type,a.is_test,a.room_num_left,a.shangpu_tags,a.carefully_chosen,a.price,a.rent_type,b.foreign_name,b.address_detail_c,
b.foreign_advantage";
$conditions = [];
......@@ -90,15 +90,22 @@ class Shop extends Basic
$conditions['a.shangpu_type'] = array( "eq", $params['shangpu_type'] );
}
//面积 room_area最小面积 room_area2最大面积 参考老版本
//面积 room_area最小面积 room_area2最大面积 参考老版本
if (isset($params['area_start']) && isset($params['area_end'])) {
$conditions['a.room_area'] = array( 'between', array( $params['area_start'], $params['area_end'] ) );
$conditions['a.room_area2'] = array( 'between', array( $params['area_start'], $params['area_end'] ) );
$conditions['a.room_area'] = array( 'between', array( $params['area_start'], $params['area_end'] ) );
//街铺只有一个room_area
if ($params['shangpu_type'] == 0) {
$conditions['a.room_area2'] = array( 'between', array( $params['area_start'], $params['area_end'] ) );
}
} else if (isset($params['area_start']) && !isset($params['area_end'])) { //100米以上不用传结束面积
$conditions['a.room_area'] = array( 'egt', $params['area_start'] );
$conditions['a.room_area2'] = array( 'egt', $params['area_start'] );
$conditions['a.room_area'] = array( 'egt', $params['area_start'] );
if ($params['shangpu_type'] == 0) {
$conditions['a.room_area2'] = array( 'egt', $params['area_start'] );
}
}
if (isset($params['money_start']) && isset($params['money_end'])) { //面积
$conditions['a.price'] = array( 'between', array( $params['money_start'], $params['money_end'] ) );
} else if (isset($params['money_start']) && !isset($params['money_end'])) {
......@@ -155,7 +162,7 @@ class Shop extends Basic
$field = "a.id,a.management_fee,a.title,a.address,a.city,a.room_area,a.room_area2,a.business_area,a.disc,a.disccircles,
a.sales,a.slotting_fee,a.transfer_fee, a.yetai,a.room_area2,a.shangpu_type,a.is_test,a.sellingpoint,a.singn_rule,
a.business_date,a.start_business_date,a.opentime,a.has_gas,a.traffic,a.has_moved,a.room_num_left,a.room_num_total,
a.shangpu_tags,a.carefully_chosen,a.price,a.dish,a.file_path,b.foreign_name,b.address_detail_c,
a.shangpu_tags,a.carefully_chosen,a.price,a.dish,a.file_path,a.rent_type,b.foreign_name,b.address_detail_c,
b.foreign_advantage";
$conditions = [];
......@@ -171,7 +178,7 @@ class Shop extends Basic
$result["api_path"] = IMG_PATH;
$param["house_id"] = $params['id'];
//todo 这里的是否要更改成b端后台上传的类型
//$param["imgtype"] = 2;
$param["imgtype"] = 2;
$result["images"] = $this->dbImg->getHouseImages($param, 15);
$param["imgtype"] = 4;//图片类型:1效果图,2实景图,3样板图,4户型图,5交通图
$result["plan_images"] = $this->dbImg->getHouseImages($param, 4);
......@@ -186,7 +193,7 @@ class Shop extends Basic
$attention["is_del"] = array( "eq", 0 );;
$attResult = $this->attentionModel->getAttentionByUserIdAndHouseId($attention);
if (count($attResult) > 0)
$result ["attention"] = $attResult["id"];
$result ["attention"] = $attResult[0]["id"];
}
......
......@@ -234,7 +234,7 @@ class Broker extends Basic
return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]);
}
$searchdate = $params['searchdate'];
$searchdate = empty($params['searchdate']) ? '':$params['searchdate'];
$pagenum = isset($params['pagenum']) ? $params['pagenum'] : 1;
$pagesize = 15;
$user_id = $params['user_id'];
......
......@@ -68,11 +68,11 @@ class CellPhone extends Basic
$this->data = ['phone' => $phone_x['phone_x']];
} else {
$this->code = 101;
$this->msg = 'Binding failure.';
$this->msg = '绑定失败,请重试!';
}
} else {
$this->code = 102;
$this->msg = 'Number pool run out.';
$this->msg = '号码使用完,请联系运营人员。';
}
}
} else {
......
......@@ -42,17 +42,19 @@ class Client extends Basic
*/
public function editClient() {
header('Access-Control-Allow-Origin:*');
$table=New Agents();
$data=array();
if ($this->params['user_nick'] || $this->params['user_nick'] || $this->params['id']) {
if (!empty($this->params['user_nick']) || !empty($this->params['id'])) {
if ($this->request->isPost()) {
if ($this->params['id']) {
if (!empty($this->params['id'])) {
//编辑
//编辑
$data['start'] = $this->user->edit($this->params, $this->params['id']);
$this->operating_records($this->params['ccr_id'], $type=3, $remark='用户编辑',0,$this->params['id']);
} else {
//添加
$data['start'] = $this->user->edit($this->params);
if ($data['start'] == -1) {
if ($data['start'] != 1) {
$this->code = 101;
$this->msg = '该用户已存在';
}
......@@ -61,11 +63,16 @@ class Client extends Basic
$data['id']= $this->user->id;
$this->operating_records($this->params['ccr_id'], $type=3, $remark='用户添加',0,$data['id']);
}else{
$this->code = 101;
$this->msg = '提交重复!';
$data['id']= $this->user->id;
//获取客方数据
$name=$table->where('id',$this->params['agents_id'])->value('realname');
//var_dump($name);
$remark='客方添加为 '.$name;
$this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$data['id']);
}
}
} else {
$data['start'] = $this->user->getClient($this->params['id']);
......@@ -105,7 +112,6 @@ class Client extends Basic
return $this->response(200,'成功',$data);
}
/**app 经纪人用户列表
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
......@@ -113,44 +119,33 @@ class Client extends Basic
*/
public function agentUserTb(){
header('Access-Control-Allow-Origin:*');
$table= new Users;
$table = new Users;
$data['msg'] = '';
$time=date("Y-m-d H:i:s",time());//当前时间
$time = date("Y-m-d H:i:s",time());//当前时间
$params = $this->request->param();
$search=$params['search'];
if(empty($params['agent_id'])){
return $this->response(100,'参数不全');
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//条件
//time_minute_diff 时间差(分)48小时内增加的【拥有经纪人】的客户为--受保护客户
$field = ['id as user_id','user_nick','user_phone','agent_id','referrer_id','create_time',"TIMESTAMPDIFF(MINUTE,create_time,'{$time}')as time_minute_diff"];
$where = " agent_id in({$params['agent_id']}) ";
$field=['id as user_id',
'user_nick',
'user_phone',
'agent_id',
'referrer_id',
'create_time',
"TIMESTAMPDIFF(MINUTE,create_time,'{$time}')as time_minute_diff"];
$where=" ( agent_id in(0,{$params['agent_id']})
or TIMESTAMPDIFF(MINUTE,create_time,'{$time}') > 2880 )";
if(!empty($search)){
$where.=" and user_nick like '%$search%' or user_phone like '%$search%' ";
$data['search']=$search;
if(!empty($params['search'])){
//搜索客户--可以搜索自己的客户and 不在保护期的客户
$where = " (agent_id in(0,{$params['agent_id']}) or agent_id is null or TIMESTAMPDIFF(MINUTE,create_time,'{$time}') > 2880 )
and ( user_nick like '%{$params['search']}%' or user_phone like '%{$params['search']}%' ) ";
$data['search'] = $params['search'];
}
// echo $where;exit;
$order="id desc";
$data['list']=$table->getAgentUserTb($pageNo, $pageSize,$order,$field, $where);
$total=$table->getUserAgentTotal($where);
$data['total']= ceil($total / $pageSize);
$data['page']=$pageNo;
$data['list'] = $table->getAgentUserTb($pageNo, $pageSize,'id desc',$field, $where);
$total = $table->getMyUserCount($where);
$data['total'] = ceil($total / $pageSize);
$data['page'] = $pageNo;
return $this->response(200,'成功',$data);
}
......
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\FollowUpService;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/24
* Time : 14:24
* Intro:
*/
class FollowUp extends Basic
{
private $service_;
private $followUpModel;
public function __construct($request = null)
{
parent::__construct($request);
$this->service_ = new FollowUpService();
$this->followUpModel = new OFollowUp();
}
/**
* 报备
* @return \think\Response
*/
public function report()
{
/* $params = $this->params;
if (!isset($params['report_agent_id']) || !isset($params['report_store_id']) || !isset($params['user_id']) ||
!isset($params['house_ids']) || !isset($params['vehicle']) ) {
return $this->response("101", "请求参数错误");
}*/
$params = array(
"report_agent_id" => 1,
"report_store_id" => 1,
"user_id" => 1,
"house_ids" => "1,2,3",
"vehicle" => 10,
"intro" => "123123123",
"to_see_time" => date("Y-m-d H:i:s", time()),
);
$result = $this->followUpModel->addFollowUp($params);
if($result["code"] == 200){
return $this->response("200", "request success", ["id",$result["msg"]]);
}else{
return $this->response("101", "request faild");
}
}
}
\ No newline at end of file
......@@ -19,6 +19,8 @@ class Report extends Basic
{
private $service_;
private $fulModel;
private $oReportModel;
public function __construct($request = null)
......
......@@ -39,6 +39,7 @@ class Basic extends Controller
protected $agentPhone;
protected $timeStamp_;
protected $filterVerify = array(
'broker/login',
'broker/token',
'broker/getShopList',
'broker/getShopDetail',
......@@ -69,7 +70,18 @@ class Basic extends Controller
$jwt = new JWT();
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array('HS256')); //解码token
$this->timeStamp_ = $result->timeStamp_;
if (isset($result->data)) {
$this->timeStamp_ = $result->timeStamp_;
$this->agentPhone = $result->data->phone;
$is = Db::table('agents')->where('phone', $this->agentPhone)->count();
} else {
$is = 0;
}
if ($is == 0) {
echo json_encode(array("code" => "300", "msg" => "用户验证失败,重新登录!", "data" => [], "type" => "json"));
exit;
}
$this->agentPhone = $result->data->phone;
$is = Db::table('agents')->where('phone', $result->data->phone)->count();
......@@ -120,8 +132,8 @@ class Basic extends Controller
public function verifyTime()
{
//authToken有效期为30天
if ((time() - $this->timeStamp_) > 2592000) {
//authToken有效期为30天2592000,1年31449601
if ((time() - $this->timeStamp_) > 31449601) {
echo json_encode(array( "code" => "300", "msg" => "AuthToken失效,请重新登录!", "data" => [], "type" => "json" ));
exit;
}
......
<?php
namespace app\api_broker\service;
use app\model\OFollowUp;
use app\model\OrderModel;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/26
* Time : 16:41
* Intro:
*/
class FollowUpService {
private $followUpModel;
private $orderModel;
function __construct()
{
$this->followUpModel = new OFollowUp();
$this->orderModel = new OrderModel();
}
/**
* 生成报备和保存订单
* @param $agent_id
* @param $store_id
* @param $user_id
* @param $house_ids
* @param $vehicle
* @param $intro
* @param $predict_see_time
* @return int
*/
public function verifyReport($agent_id,$store_id,$user_id,$house_ids,$vehicle,$intro,$predict_see_time){
$id = $this->oFollowUpBin($agent_id,$store_id,$user_id,$vehicle,$intro,$predict_see_time);
if($id > 0){
$house_arr = explode(",",$house_ids);
$order_arr = [];
foreach($house_arr as $k => $v ){
//todo 批量插入到数据库
$order_no = $this->createOrderNumber();
array_push($order_arr,$this->orderBin($order_no,$id,$v));
}
//todo 保存order表
return $this->orderModel->insertOrderByAll($order_arr);
}
}
/**
* 订单号
* @return string
*/
private function createOrderNumber(){
return time() . mt_rand(100000,999999);
}
/**
* 报备主表
* @param $report_agent_id
* @param $report_store_id
* @param $user_id
* @param $vehicle
* @param $intro
* @param $predict_see_time
* @return array
*/
private function oFollowUpBin($report_agent_id,$report_store_id,$user_id,$vehicle,$intro,$predict_see_time){
$param["report_agent_id"] = $report_agent_id;
$param["report_store_id"] = $report_store_id;
$param["user_id"] = $user_id;
$param["vehicle"] = $vehicle;
$param["status"] = 0;
$param["intro"] = $intro;
$param["predict_see_time"] = date("Y-m-d H:i:s",$predict_see_time);
$param["create_time"] = date("Y-m-d H:i:s",time());
$param["update_time"] = date("Y-m-d H:i:s",time());
return $this->followUpModel->addFollowUp($param);
}
private function orderBin($order_no,$f_id,$house_id){
$param["order_no"] = $order_no;
$param["f_id"] = $f_id;
$param["house_id"] = $house_id;
return $param;
}
}
\ No newline at end of file
......@@ -78,7 +78,7 @@ class Index
$field = "a.id,a.management_fee,a.title,a.address,a.city,a.room_area,a.room_area2,a.business_area,a.disc,a.disccircles,
a.sales,a.slotting_fee,a.transfer_fee, a.yetai,a.room_area2,a.shangpu_type,a.is_test,a.sellingpoint,a.singn_rule,
a.business_date,a.start_business_date,a.opentime,a.has_gas,a.traffic,a.has_moved,a.room_num_left,a.room_num_total,
a.shangpu_tags,a.carefully_chosen,a.price,a.dish,a.file_path,b.foreign_name,b.address_detail_c,
a.shangpu_tags,a.carefully_chosen,a.price,a.dish,a.file_path,a.rent_type,b.foreign_name,b.address_detail_c,
b.foreign_advantage";
$conditions = [];
if (empty($id)) {
......
......@@ -59,41 +59,26 @@
<span class="b1_span">
剩余铺数
</span>
<span class="b1_span_totl">
<span class="balance_num">
</span>/
<span class="balance_num2">
</span>
<span class="b1_span_totl pu_num">
</span>
</li>
<li class="ul_b2">
<span class="b1_span">
商铺面积
</span>
<span class="b1_span2">
<span class="b1_span3">
</span>
-
<span class="b1_span34">
</span>
<span class="b1_span_totl pu_area">
</span>
<font class="b1_font">
</font>
</span>
</li>
<li class="ul_b3">
<span class="b1_span">
商业面积
</span>
<span class="b1_span2">
<span class="b1_span4">
<span class="b1_span_totl shy_area">
</span>
<font class="b1_font">
</font>
</span>
</span>
</li>
</ul>
</div>
......
......@@ -47,7 +47,8 @@
</div>
<script src="/app/js/jquery.js"></script>
<!--<script src="/app/js/jquery.js"></script>-->
<script src="/app/js/jquery-1122-min.js" charset="UTF-8"></script>
<script src="/app/js/common.js" charset="UTF-8"></script>
<script src="/app/js/share_register.js"></script>
</body>
......
<?php
//配置文件
return [
];
\ No newline at end of file
<?php
namespace app\chat\consts;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/9
* Time : 13:27
* Intro:
*/
class ConfigConst
{
const CLIENT_ID = "YXA6hqlTwLr0EeeNFrlhHiI-Xg";
const CLIENT_SECRET = "YXA6BkraoPZqZYJoLce4sCyRebXMC48";
const API_PATH = "https://a1.easemob.com/";
const ORG_NAME = "1157170531115254";
const APP_NAME = "tonglianjituan";
}
\ No newline at end of file
<?php
namespace app\chat\consts;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/9
* Time : 16:54
* Intro:
*/
class ErrorCodeConst
{
//聊天
const ERROR_CODE_PARAM_NOT_EXIST = 110001;
const ERROR_CODE_TARGET_TYPE_ERROR = 110002;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?php
namespace app\chat\extend;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/8
* Time : 16:54
* Intro:
*/
use app\chat\consts\ConfigConst;
use app\chat\utils\CurlUtil;
use http\Exception;
use think\Cache;
use think\Controller;
use Think\Log;
use think\Request;
use think\Response;
class Basic extends Controller
{
/**
* 访问请求对象
* @var Request
*/
public $request;
/**
* 请求参数
* @var mixed|null
*/
public $params;
/**
* app通讯接口授权token
* @var
*/
public $accessToken;
/**
* 基础接口SDK
* @param Request|null $request
*/
public function __construct(Request $request = null)
{
// CORS 跨域 Options 检测响应
$this->corsOptionsHandler();
// 输入对象
$this->request = is_null($request) ? Request::instance() : $request;
if (strtoupper($this->request->method()) === "GET") {
$this->params = $this->request->param();
} elseif (strtoupper($this->request->method()) === "POST") {
$this->params = $this->request->param() != null ? $this->request->param() : null;
}
$this->accessToken = Cache::get('access_token');
$expires_in = Cache::get('expires_in');
$application = Cache::get('application');
$accredit_time = Cache::get('accredit_time');
if (!$this->accessToken || !$expires_in || !$application || !$accredit_time || (time() - $accredit_time) > $expires_in) {
//todo 这里加个验证 多少时间内不能重复请求
$this->getToken();
if (Cache::get('access_token')) {
$this->accessToken = Cache::get('access_token');
} else {
echo json_encode(array( "code" => "300", "msg" => "accessToken拉取失败,请稍后再试!", "data" => [], "type" => "json" ));
exit;
}
}
}
/**
* 输出返回数据
* @param string $msg 提示消息内容
* @param string $code 业务状态码
* @param mixed $data 要返回的数据
* @param string $type 返回类型 JSON XML
* @return Response
*/
public function response($code = 'SUCCESS', $msg, $data = [], $type = 'json')
{
$result = [ 'code' => $code, 'msg' => $msg, 'data' => $data, 'type' => strtolower($type) ];
return Response::create($result, $type);
}
public function getApiPath()
{
return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME;
}
/**
* Cors Options 授权处理
*/
public static function corsOptionsHandler()
{
if (request()->isOptions()) {
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Headers:Accept,Referer,Host,Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Content-Type,Cookie,token');
header('Access-Control-Allow-Credentials:true');
header('Access-Control-Allow-Methods:GET,POST,OPTIONS');
header('Access-Control-Max-Age:1728000');
header('Content-Type:text/plain charset=UTF-8');
header('Content-Length: 0', true);
header('status: 204');
header('HTTP/1.0 204 No Content');
exit;
}
}
/**
* 获取调取接口的access_token
*/
public function getToken()
{
$url = "/token";
$data = [
"grant_type" => "client_credentials",
"client_id" => ConfigConst::CLIENT_ID,
"client_secret" => ConfigConst::CLIENT_SECRET
];
$curl = new CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$apiUrl = $this->getApiPath() . $url;
try {
$response = $curl->post($apiUrl, json_encode($data));
$response = json_decode($response,true);
if ($response) {
Cache::set('access_token', $response["access_token"]);
Cache::set('expires_in', $response["expires_in"]);
Cache::set('application', $response["application"]);
Cache::set('accredit_time', time());
}
} catch (Exception $e) {
Log::record('class:Basic,function:getToken get token ,Exception :' . $e, "error");
}
Log::record('class:Basic,function:getToken get token' , "info");
}
}
This diff is collapsed.
<?php
namespace app\chat\service;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/23
* Time : 14:15
* Intro:
*/
class GroupService
{
//todo
}
\ No newline at end of file
<?php
namespace app\chat\utils;
/**
* Parses the response from a Curl request into an object containing
* the response body and an associative array of headers
*
* @author qianfunian <qianfunian@51jk.com>
**/
class CurlResponse {
/**
* The body of the response without the headers block
*
* @var string
**/
public $body = '';
/**
* An associative array containing the response's headers
*
* @var array
**/
public $headers = array();
/**
* Accepts the result of a curl request as a string
*
* <code>
* $response = new CurlResponse(curl_exec($curl_handle));
* echo $response->body;
* echo $response->headers['Status'];
* </code>
*
* @param string $response
**/
function __construct($response) {
# Headers regex
$pattern = '#HTTP/\d\.\d.*?$.*?\r\n\r\n#ims';
# Extract headers from response
preg_match_all($pattern, $response, $matches);
$headers_string = array_pop($matches[0]);
$headers = explode("\r\n", str_replace("\r\n\r\n", '', $headers_string));
# Remove headers from the response body
$this->body = str_replace($headers_string, '', $response);
# Extract the version and status from the first header
$version_and_status = array_shift($headers);
preg_match('#HTTP/(\d\.\d)\s(\d\d\d)\s(.*)#', $version_and_status, $matches);
$this->headers['Http-Version'] = $matches[1];
$this->headers['Status-Code'] = $matches[2];
$this->headers['Status'] = $matches[2].' '.$matches[3];
# Convert headers into an associative array
foreach ($headers as $header) {
preg_match('#(.*?)\:\s(.*)#', $header, $matches);
$this->headers[$matches[1]] = $matches[2];
}
}
/**
* Returns the response body
*
* <code>
* $curl = new Curl;
* $response = $curl->get('google.com');
* echo $response; # => echo $response->body;
* </code>
*
* @return string
**/
function __toString() {
return $this->body;
}
}
\ No newline at end of file
<?php
namespace app\chat\utils;
/**
* A basic CURL wrapper
*
* @author qianfunian <qianfunian@51jk.com>
**/
class CurlUtil {
/**
* The file to read and write cookies to for requests
*
* @var string
**/
public $cookie_file;
/**
* Determines whether or not requests should follow redirects
*
* @var boolean
**/
public $follow_redirects = true;
/**
* An associative array of headers to send along with requests
*
* @var array
**/
public $headers = array();
/**
* An associative array of CURLOPT options to send along with requests
*
* @var array
**/
public $options = array();
/**
* The referer header to send along with requests
*
* @var string
**/
public $referer;
/**
* The user agent to send along with requests
*
* @var string
**/
public $user_agent;
/**
* Stores an error string for the last request if one occurred
*
* @var string
* @access protected
**/
protected $error = '';
/**
* Stores resource handle for the current CURL request
*
* @var resource
* @access protected
**/
protected $request;
/**
* Initializes a Curl object
*
* Sets the $cookie_file to "curl_cookie.txt" in the current directory
* Also sets the $user_agent to $_SERVER['HTTP_USER_AGENT'] if it exists, 'Curl/PHP '.PHP_VERSION.' (http://github.com/shuber/curl)' otherwise
**/
function __construct() {
$this->cookie_file = dirname(__FILE__).DIRECTORY_SEPARATOR.'curl_cookie.txt';
$this->user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'Curl/PHP ' . PHP_VERSION;
}
/**
* Makes an HTTP DELETE request to the specified $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $url
* @param array|string $vars
* @return CurlResponse object
**/
function delete($url, $vars = array()) {
return $this->request('DELETE', $url, $vars);
}
/**
* Returns the error string of the current request if one occurred
*
* @return string
**/
function error() {
return $this->error;
}
/**
* Makes an HTTP GET request to the specified $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $url
* @param array|string $vars
* @return CurlResponse
**/
function get($url, $vars = array()) {
$vars['platform_type'] = 130;
if (!empty($vars)) {
$url .= (stripos($url, '?') !== false) ? '&' : '?';
$url .= (is_string($vars)) ? $vars : http_build_query($vars, '', '&');
}
return $this->request('GET', $url);
}
/**
* Makes an HTTP HEAD request to the specified $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $url
* @param array|string $vars
* @return CurlResponse
**/
function head($url, $vars = array()) {
return $this->request('HEAD', $url, $vars);
}
/**
* Makes an HTTP POST request to the specified $url with an optional array or string of $vars
*
* @param string $url
* @param array|string $vars
* @return CurlResponse|boolean
**/
function post($url, $vars = array()) {
if (!is_string($vars)) {
$vars['platform_type'] = 130;
}
return $this->request('POST', $url, $vars);
}
/**
* Makes an HTTP PUT request to the specified $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $url
* @param array|string $vars
* @return CurlResponse|boolean
**/
function put($url, $vars = array()) {
return $this->request('PUT', $url, $vars);
}
/**
* Makes an HTTP request of the specified $method to a $url with an optional array or string of $vars
*
* Returns a CurlResponse object if the request was successful, false otherwise
*
* @param string $method
* @param string $url
* @param array|string $vars
* @return CurlResponse|boolean
**/
function request($method, $url, $vars = array()) {
$this->error = '';
$this->request = curl_init();
if (is_array($vars)) $vars = http_build_query($vars, '', '&');
$this->set_request_method($method);
$this->set_request_options($url, $vars);
$this->set_request_headers();
$response = curl_exec($this->request);
if ($response) {
$response = new CurlResponse($response);
} else {
$this->error = curl_errno($this->request).' - '.curl_error($this->request);
}
curl_close($this->request);
return $response;
}
/**
* Formats and adds custom headers to the current request
*
* @return void
* @access protected
**/
protected function set_request_headers() {
$headers = array();
foreach ($this->headers as $key => $value) {
$headers[] = $key.': '.$value;
}
curl_setopt($this->request, CURLOPT_HTTPHEADER, $headers);
}
/**
* Set the associated CURL options for a request method
*
* @param string $method
* @return void
* @access protected
**/
protected function set_request_method($method) {
switch (strtoupper($method)) {
case 'HEAD':
curl_setopt($this->request, CURLOPT_NOBODY, true);
break;
case 'GET':
curl_setopt($this->request, CURLOPT_HTTPGET, true);
break;
case 'POST':
curl_setopt($this->request, CURLOPT_POST, true);
break;
default:
curl_setopt($this->request, CURLOPT_CUSTOMREQUEST, $method);
}
}
/**
* Sets the CURLOPT options for the current request
*
* @param string $url
* @param string $vars
* @return void
* @access protected
**/
protected function set_request_options($url, $vars) {
/* echo $url;
dump($vars);
dump($this->options);
echo $this->request;
exit;*/
curl_setopt($this->request, CURLOPT_URL, $url);
if (!empty($vars)) curl_setopt($this->request, CURLOPT_POSTFIELDS, $vars);
# Set some default CURL options
curl_setopt($this->request, CURLOPT_HEADER, true);
curl_setopt($this->request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->request, CURLOPT_USERAGENT, $this->user_agent);
if ($this->cookie_file) {
curl_setopt($this->request, CURLOPT_COOKIEFILE, $this->cookie_file);
curl_setopt($this->request, CURLOPT_COOKIEJAR, $this->cookie_file);
}
if ($this->follow_redirects) curl_setopt($this->request, CURLOPT_FOLLOWLOCATION, true);
if ($this->referer) curl_setopt($this->request, CURLOPT_REFERER, $this->referer);
# Set any custom CURL options
foreach ($this->options as $option => $value) {
curl_setopt($this->request, constant('CURLOPT_'.str_replace('CURLOPT_', '', strtoupper($option))), $value);
}
}
}
\ No newline at end of file
<?php
namespace app\chat\utils;
use app\chat\consts\ConfigConst;
use Think\Log;
use think\Cache;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/8
* Time : 17:17
* Intro: 发送消息类
*/
class RPush
{
/**
* 发送消息
* @param $user_name
* @param $target_type
* @param $target
* @param $msg_content
* @param $from
* @param $type
* @param $access_token
* @param $callback
*/
public function send($user_name,$target_type, $target, $msg_content, $from, $type, $access_token, $callback)
{
//todo
if(Cache::get('save_message_num')){
$save_message_num=Cache::get('save_message_num');
if($save_message_num>10){
sleep(1);
Cache::set('save_message_num', 0);
}else{
$save_message_num=$save_message_num+1;
Cache::set('save_message_num', $save_message_num);
}
}else{
Cache::set('save_message_num', 0);
}
$response = $this->sendRequestByCurl($user_name,$target_type, $target, $msg_content, $from, $type, $access_token);
call_user_func_array([ $callback[0], $callback[1] ], [ $response, $target, $from, $msg_content ]);
}
/** curl参数拼凑
* @param $user_name
* @param $target_type users 给用户发消息。chatgroups: 给群发消息,chatrooms: 给聊天室发消息
* @param $target 注意这里需要用数组,数组长度建议不大于20,即使只有一个用户,也要用数组 ['u1'],给用户发送时数组元素是用户名,
* 给群组发送时数组元素是groupid
* @param $type //目前只有文本的消息
* @param $msg_content
* @param $from
* @param $type
* @param $access_token
* @return \app\chat\utils\CurlResponse|bool
*/
public function sendRequestByCurl($user_name,$target_type, $target, $msg_content, $from, $type, $access_token)
{
$arr = array(
'target_type' => $target_type,
'target' => $target,
'msg' => [ "type" => "txt", "msg" => $msg_content ],
'from' => $from,
'ext' => [ "msg_type" => $type ,"user_name"=>$user_name]
);
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl();
$response = $curl->post($url, $data);
Log::record('info -------------' . json_encode($response), "info");
return $response;
}
/**
* 请求api
* @return string
*/
private function buildSendUrl()
{
return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME . "/messages";
}
}
\ No newline at end of file
<?php
namespace app\chat\utils;
use app\chat\consts\ConfigConst;
use app\chat\utils;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/18
* Time : 14:47
* Intro: 注册环信用户
*/
class RegisterUtil
{
const IM_REGISTER_USER = "/users";
const IM_DELETE_USER = "/users";
/**
* @param $username
* @param $password
* @return CurlResponse|bool
*/
public function registerByCurl($username, $password)
{
$arr = array(
'username' => $username,
'password' => $password,
);
$data = json_encode($arr);
$curl = new CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl() . self::IM_REGISTER_USER;
$response = $curl->post($url, $data);
return $response;
}
/**
* @param $username
* @param $access_token
* @return CurlResponse|bool
*/
public function deleteByCurl($username, $access_token)
{
$arr = array(
'username' => $username,
);
$data = json_encode($arr);
$curl = new CurlUtil();
$curl->delete();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl() . self::IM_DELETE_USER;
$response = $curl->post($url, $data);
return $response;
}
/**
* 请求api
* @return string
*/
private function buildSendUrl()
{
return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME;
}
}
\ No newline at end of file
<?php
namespace app\chat\utils;
use app\chat\consts\ConfigConst;
use Think\Log;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/8
* Time : 17:17
* Intro: 发送消息类
*/
class UGroup
{
/** 创建一个群
* 朱伟 2018年01月25日
*/
public function createGroup($group_name, $group_users, $group_users_admin='admin',$access_token)
{
$arr= array(
"groupname"=>$group_name, //群组名称,此属性为必须的
"desc"=>"good", //群组描述,此属性为必须的
"public"=>true, //是否是公开群,此属性为必须的
"maxusers"=>300, //群组成员最大数(包括群主),值为数值类型,默认值200,最大值2000,此属性为可选的
"members_only"=>true, // 加入群是否需要群主或者群管理员审批,默认是false
"allowinvites"=> true, //是否允许群成员邀请别人加入此群。 true:允许群成员邀请人加入此群,false:只有群主或者管理员才可以往群里加人。
"owner"=>$group_users_admin, //群组的管理员,此属性为必须的
"members"=>$group_users //群组成员,此属性为可选的,但是如果加了此项,数组元素至少一个(注:群主jma1不需要写入到members里面)
);
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl();
$response = $curl->post($url, $data);
Log::record('------createGroup-------' . json_encode($response), "info");
return $response;
}
/** del一个群
* 朱伟 2018年01月25日
*/
public function deleteGroup($group_id,$access_token)
{
$arr= array();
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl().$group_id;
$response = $curl->delete($url, $data);
Log::record('-------deleteGroup------' . json_encode($response), "info");
return $response;
}
/** 获取群成员
* 朱伟 2018年01月26日
*/
public function getGroupUser($group_id,$pagenum,$pagesize,$access_token)
{
$arr= array();
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl().$group_id.'users?pagenum='.$pagenum.'&pagesize='.$pagesize;
$response = $curl->get($url, $data);
Log::record('-------deleteGroup------' . json_encode($response), "info");
return $response;
}
/** 添加群组成员
* 朱伟 2018年01月26日
*/
public function addGroupUserByIds($group_id,$username,$access_token)
{
$arr= array();
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl().$group_id.'/users/'.$username;
$response = $curl->post($url, $data);
Log::record('-------addGroupUserByIds------' . json_encode($response), "info");
return $response;
}
/**
* 移除群组成员
* 朱伟 2018年01月29日
* @param $group_id
* @param $username
* @param $access_token
* @return CurlResponse|bool
*/
public function delGroupUserByIds($group_id,$username,$access_token)
{
$arr= array();
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
$url = $this->buildSendUrl().$group_id.'/users/'.$username;
$response = $curl->post($url, $data);
Log::record('-------delGroupUserByIds------' . json_encode($response), "info");
return $response;
}
/**
* 添加群组管理员
* 朱伟 2018年01月29日
* @param $group_id
* @param $username
* @param $access_token
* @return CurlResponse|bool
*/
public function addGroupManage($group_id,$username,$access_token)
{
$arr= array("newadmin"=>$username);
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
//Path: /{org_name}/{app_name}/chatgroups/{group_id}/admin
$url = $this->buildSendUrl().$group_id.'/admin';
$response = $curl->delete($url, $data);
Log::record('-------delGroupUserByIds------' . json_encode($response), "info");
return $response;
}
/**
* 移除群组管理员
* 朱伟 2018年01月29日
* @param $group_id
* @param $username
* @param $access_token
* @return CurlResponse|bool
*/
public function delGroupManage($group_id,$username,$access_token)
{
$arr= array();
$data = json_encode($arr);
$curl = new \app\chat\utils\CurlUtil();
$curl->headers = [
"Accept" => "application/json",
"Content-Type" => "application/json;charset=utf-8",
'Authorization' => "Bearer " . $access_token,
];
$curl->options = [
"CURLOPT_SSL_VERIFYPEER" => 0,
"CURLOPT_SSL_VERIFYHOST" => 2,
];
//
$url = $this->buildSendUrl().$group_id.'/admin/'.$username;
$response = $curl->delete($url, $data);
Log::record('-------delGroupUserByIds------' . json_encode($response), "info");
return $response;
}
/**
* 请求api
* @return string
*/
private function buildSendUrl()
{
return ConfigConst::API_PATH . ConfigConst::ORG_NAME . "/" . ConfigConst::APP_NAME.'/chatgroups/' ;
}
}
\ No newline at end of file
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
a1.easemob.com FALSE / FALSE 1517538110 rememberMe deleteMe
......@@ -93,4 +93,46 @@ function down_file($url, $dir, $filename=''){
fwrite($fp2, $img);
fclose($fp2);
return $filename;
}
\ No newline at end of file
}
/**
* 隐藏客户手机号中间几位
* zhuwei 2017年12月22日15:33:48
*/
function hide_customer_phone($phone)
{
//首先去除前后'|'
$phone=trim($phone, "|");
//然后判断里面是否有'|'
if(strpos($phone, "|") !== false){
$explode_phone = explode("|", $phone);
foreach ($explode_phone as $k => $v) {
if(checkMobileValidity($v)){
$explode_phone[$k]=substr_replace($v,'****',3,4);
}
}
return implode("|", $explode_phone);
}else{
if(checkMobileValidity($phone)){
$phone=substr_replace($phone,'****',3,4);
}
return $phone;
}
}
/**^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$
* 验证手机号是否正确
* zhuwei 2017-10-18 17:28:01
*/
function checkMobileValidity($phone)
{
$mobilephone = trim($phone);
// $exp = "/^13[0-9]{1}[0-9]{8}$|15[012356789]{1}[0-9]{8}$|18[012356789]{1}[0-9]{8}$|14[57]{1}[0-9]$/";
$exp = "/^(1[0-9])\d{9}$/";
if (preg_match($exp, $mobilephone)) {
return true;
} else {
return false;
}
}
......@@ -13,9 +13,10 @@ define('IMG_PATH','https://admin.tonglianjituan.com/houseImg/');
define('LOCAL_IMG_HOST','/resource/lib/Attachments/');
define('PAGESIZE', 15); //分页每页条数
define('ADMIN_URL_TL','https://admin.tonglianjituan.com/'); //B端网址
define('CURRENT_URL', 'http://'.$_SERVER['HTTP_HOST'].'/'); //取当前域名地址
define('HEADERIMGURL', CURRENT_URL . 'static'. DS . 'head_portrait/'); //用户头像地址
define('AGENTHEADERIMGURL', CURRENT_URL . 'static'. DS . 'agent_head_portrait/'); //经纪人头像地址
//define('TEST_ADMIN_URL_TL','https://dev.tonglianjituan.com/'); //B端网址
define('CURRENT_URL', 'http://'.$_SERVER['HTTP_HOST'].DS); //取当前域名地址
define('HEADERIMGURL', CURRENT_URL . 'static'. DS . 'head_portrait/'); //头像地址
define('CHAT_IMG_URL', CURRENT_URL . 'static'. DS . 'chat_image/'); //聊天图片地址
define('CK_IMG_URL', CURRENT_URL . '/resource/lib/Attachments/'); //ck 资源文件
define('_POOLKEY','FC100000022056027');//隐私号码
define('_TLSYPoolKey','FC100000022056027');//隐私号码池
......
......@@ -54,4 +54,4 @@ return [
'datetime_format' => false,
// 是否需要进行SQL性能分析
'sql_explain' => false,
];
\ No newline at end of file
];
<?php
namespace app\extra;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/9
* Time : 15:20
* Intro: redis connect class
*/
class RedisPackage
{
protected static $handler = null;
protected $options = [
'host' => '101.132.186.250',
'port' => 6379,
'password' => '',
'select' => 0,
'timeout' => 0,
'expire' => 0,
'persistent' => false,
'prefix' => '',
];
public function __construct($options = [])
{
if (!extension_loaded('redis')) { //判断是否有扩展(如果你的apache没reids扩展就会抛出这个异常)
throw new \BadFunctionCallException('not support: redis');
}
if (!empty($options)) {
$this->options = array_merge($this->options, $options);
}
$func = $this->options['persistent'] ? 'pconnect' : 'connect'; //判断是否长连接
self::$handler = new \Redis;
self::$handler->$func($this->options['host'], $this->options['port'], $this->options['timeout']);
if ('' != $this->options['password']) {
self::$handler->auth($this->options['password']);
}
if (0 != $this->options['select']) {
self::$handler->select($this->options['select']);
}
}
/**
* 写入缓存
* @param string $key 键名
* @param string $value 键值
* @param int $exprie 过期时间 0:永不过期
* @return bool
*/
public static function set($key, $value, $exprie = 0)
{
if ($exprie == 0) {
$set = self::$handler->set($key, $value);
} else {
$set = self::$handler->setex($key, $exprie, $value);
}
return $set;
}
/**
* 读取缓存
* @param string $key 键值
* @return mixed
*/
public static function get($key)
{
$fun = is_array($key) ? 'Mget' : 'get';
return self::$handler->{$fun}($key);
}
/**
* 获取值长度
* @param string $key
* @return int
*/
public static function lLen($key)
{
return self::$handler->lLen($key);
}
/**
* 将一个或多个值插入到列表头部
* @param $key
* @param $value
* @return int
*/
public static function LPush($key, $value, $value2 = null, $valueN = null)
{
return self::$handler->lPush($key, $value, $value2, $valueN);
}
/**
* 移出并获取列表的第一个元素
* @param string $key
* @return string
*/
public static function lPop($key)
{
return self::$handler->lPop($key);
}
}
\ No newline at end of file
......@@ -38,4 +38,5 @@ function list_to_tree($list, $pk='id', $pid = 'pid', $child = '_child', $root =
}
}
return $tree;
}
\ No newline at end of file
}
......@@ -15,9 +15,9 @@ use think\Session;
class Auth extends Basic
{
protected $authGroupModel;
protected $authGroupModel;
protected $authRuleModel;
/**
......@@ -26,7 +26,7 @@ class Auth extends Basic
public function index(){
return view('index');
}
/**
* 权限分配
......@@ -129,7 +129,7 @@ class Auth extends Basic
$group_id=$this->request->param('id');
$table= New AuthGroup();
if ($this->request->isPost()) {
$data = input('post.');
......@@ -140,9 +140,9 @@ class Auth extends Basic
]
);
if($err!=1){
return $this->response(100, $err);
}
if($err!=1){
return $this->response(100, $err);
}
//新增或者编辑数据
if(empty($data['id'])){
$data['create_time']= date( 'Y-m-d H:i:s',time());
......@@ -191,7 +191,7 @@ class Auth extends Basic
return $menus;
}
}
/**
* 角色权限分配or查看
......@@ -205,7 +205,7 @@ class Auth extends Basic
* @throws \think\exception\DbException
*/
public function accessLook(){
$table= New AuthGroup;
$table= New AuthGroup;
$group_id=$this->request->param('id');
$data['title']='权限分配';
// echo $group_id;
......@@ -231,7 +231,7 @@ class Auth extends Basic
}else{
return $this->response(100, '失败');
}
//}
} else{
......@@ -258,7 +258,7 @@ class Auth extends Basic
$table= New AuthGroup;
$data = input('post.');
// prt($data);
// prt($data);
$data['rules']=trim($data['rules'],',');
//提交数据
if ( $table->editData($data,$data['id'])) {
......@@ -287,8 +287,8 @@ class Auth extends Basic
}
}
/**
/**
* 设置角色的状态
*/
public function updateGroup(){
......@@ -306,7 +306,7 @@ class Auth extends Basic
//权限表界面
public function authRuleIndex(){
return view('auth_rule_index');
return view('auth_rule_index');
}
......@@ -328,7 +328,7 @@ class Auth extends Basic
$params = $this->request->param();
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//条件
//条件
$field="a.id,a.name,a.title,a.depend_flag,a.type,a.pid,a.icon,a.sort,if(a.is_menu,'是','否')is_menu,a.status,ifnull(b.title,'顶级') as title2";
$where='a.status in(0,1)';
$search=$params['search'];
......@@ -338,10 +338,10 @@ class Auth extends Basic
}
$order='a.pid asc,a.sort asc';
$join=[['auth_rule b', ' a.pid=b.id','left']];
$data['list'] = $table->authRuleList($pageNo, $pageSize,$order,$field,$join, $where);
$data['total'] = $table->getTotal($where,'a');
// prt($list);//转化arr
//prt(collection($list)->toArray());//转化arr
$data['list'] = $table->authRuleList($pageNo, $pageSize,$order,$field,$join, $where);
$data['total'] = $table->getTotal($where,'a');
// prt($list);//转化arr
//prt(collection($list)->toArray());//转化arr
return $this->response(200,'成功',$data);
}
......@@ -384,7 +384,7 @@ class Auth extends Basic
public function updateAuthRule(){
$group_id=$this->request->param('id');
$table= New AuthRule;
if ($this->request->isPost()) {
......@@ -422,13 +422,13 @@ class Auth extends Basic
$order='';
$join=[['auth_rule b', ' a.pid=b.id','left']];
$info= $table->authRuleList2($order,$field,$join, $where);
//echo $table->getLastSql();
//echo $table->getLastSql();
return $this->response(200, '取值', $info[0]);
}
}
}
}
\ No newline at end of file
......@@ -111,7 +111,7 @@ class Banner extends Basic
$params["is_show"] = $_POST["is_show"];
}
if (empty($params["title"]) || empty($params["type"]) || empty($params["url"]) || empty($params["cover_image"]) || empty($params["sort"])) {
if (empty($params["title"]) || empty($params["cover_image"]) || empty($params["sort"])) {
return $this->response("101", "请提交正确的请求参数");
}
if (isset($params['id'])) {
......
......@@ -140,6 +140,7 @@ class Broker extends Basic
case 2:
$res = $hg->addAgents($this->params['agents_id'], $this->params['houses_id'], $this->params['type']);break;
default :
$res = [];
$data['status'] = 101;
$data['msg'] = 'type is null';
}
......
......@@ -118,6 +118,9 @@ class BusinessDistrict extends Basic
public function regions() {
$params = $this->request->param();
$regions = new Regions();
$params['code'] = empty($params['code'])? $params['code'] : '';
$params['parent_code'] = empty($params['parent_code'])? $params['parent_code'] : '';
$params['type'] = empty($params['type'])? $params['type'] : '';
$data = $regions->getRegions($params['code'], $params['parent_code'], $params['type']);
return $this->response(200, '', $data);
}
......
......@@ -168,30 +168,30 @@ class CellPhone extends Basic
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$report = new SecretReport();
$field = 'agents_id,users_id,release_time,start_time,call_type,call_time,time,voice_file,create_time';
$field = 'agents_id,users_id,call_type,call_time,time,voice_file';
$where = [];
if ($this->params['start_time']) {
$where['create_time'] = ['> time', $this->params['start_time']];
if (!empty($this->params['start_date'])) {
$where['create_time'] = ['> time', $this->params['start_date']];
}
if ($this->params['end_time']) {
$where['create_time'] = ['< time', $this->params['end_time']];
if (!empty($this->params['end_date'])) {
$where['create_time'] = ['< time', $this->params['end_date']];
}
if ($this->params['call_name']) {
if (!empty($this->params['call_name'])) {
$where['realName'] = ['LIKE', $this->params['call_name'].'%'];
}
if ($this->params['call_phone']) {
$where['phone_a'] = [$this->params['call_phone']];
if (!empty($this->params['call_phone'])) {
$where['phone_no'] = ['LIKE',$this->params['call_phone'].'%'];
}
if ($this->params['client_phone']) {
$where['phone_b'] = [$this->params['client_phone']];
if (!empty($this->params['client_phone'])) {
$where['peer_no'] = ['LIKE',$this->params['client_phone'].'%'];
}
if ($this->params['client_name']) {
if (!empty($this->params['client_name'])) {
$where['user_nick'] = ['LIKE', $this->params['client_name'].'%'];
}
......@@ -215,23 +215,23 @@ class CellPhone extends Basic
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$report = new SecretReport();
$field = 'a.id,b.phone,sum(time) as time,agents_id,call_type';
$field = 'a.id,b.phone,sum(time) as time,agents_id,call_type,release_time,start_time';
$where = [];
if ($this->params['start_time']) {
$where['create_time'] = ['> time', $this->params['start_time']];
if (!empty($this->params['start_date'])) {
$where['create_time'] = ['> time', $this->params['start_date']];
}
if ($this->params['end_time']) {
$where['create_time'] = ['< time', $this->params['end_time']];
if (!empty($this->params['end_date'])) {
$where['create_time'] = ['< time', $this->params['end_date']];
}
if ($this->params['agents_name']) {
if (!empty($this->params['agents_name'])) {
$where['realName'] = ['LIKE', $this->params['agents_name'].'%'];
}
if ($this->params['phone']) {
$where['phone'] = [$this->params['phone']];
if (!empty($this->params['phone'])) {
$where['phone'] = ['LIKE',$this->params['phone'].'%'];
}
$data['list'] = $report->getCallCollect($pageNo, $pageSize, 'id desc', $field, $where);
......
......@@ -32,8 +32,10 @@ class District extends Basic
$pageSize = empty($this->params['pageSize']) ? 10 : $this->params['pageSize'];
$agents = new ADistrict();
$where = '';
$join = 0;
$where = '';
$join = 0;
$field = '';
if ($this->params['search'] != NULL) {
$field = 'a.id,a.district_name,a.create_time,b.name,b.phone';
$where .= "a.status=0 AND (phone like '{$this->params['search']}%' or name like '{$this->params['search']}%')";
......
......@@ -104,17 +104,17 @@ class Houses extends Basic
}
/*所在城市*/
if ($this->params['city'] != NULL) {
if (!empty($this->params['city'])) {
$where['city'] = $this->params['city'];
}
/*所在区*/
if ($this->params['disc'] != NULL) {
if (!empty($this->params['disc'])) {
$where['disc'] = $this->params['disc'];
}
/*状态 0待审批 1上架 2下架 3回收*/
if ($this->params['status'] != NULL) {
if (!empty($this->params['status'])) {
$where['status'] = $this->params['status'];
}
......@@ -172,7 +172,7 @@ class Houses extends Basic
//案场权限人搜索
if (empty($params['dish'])) {
/*楼盘编号*/
if ($params['id'] != NULL) {
if (!empty($params['id'])) {
$where['id'] = $params['id'];
}
$where['status'] = ['<>',3];
......
......@@ -104,7 +104,7 @@ class Login extends Basic
foreach($nav2 as $k=> $v){
if($r2[$k]){
if(!empty($r2[$k])){
$nav2[$k]['cz'] = $r2[$k];
}
}
......
......@@ -29,8 +29,9 @@ class Member extends Basic{
return view('member/users_list');
}
/**
* 用户列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
......@@ -47,22 +48,24 @@ class Member extends Basic{
$where['status'] = 0;
if (!empty($params['name'])) {
$where['user_nick'] = ['like', '%'.$params['name'].'%'];
$where['a.user_nick'] = ['like', $params['name'].'%'];
}
if (!empty($params['phone'])) {
$where['user_phone'] = ['like', '%'.$params['phone'].'%'];
$where['user_phone'] = ['like', $params['phone'].'%'];
}
if (!empty($params['invite'])) {
$where['phone'] = ['like', '%'.$params['invite'].'%'];
$where['user_phone'] = ['like', $params['invite'].'%'];
$where['invite'] = 1;
}
if (!empty($params['id'])) {
$where['id'] = $params['id'];
$where['a.id'] = $params['id'];
}
$fields = 'id,user_nick,user_phone,sex,user_pic,create_time,user_pswd,referrer_id,status,source';
$data['list'] = $this->user->getUserAgent($pageNo, $pageSize, '', $fields, $where);
$fields = 'a.id,a.user_nick,a.user_phone,a.user_pic,a.create_time,a.user_pswd,a.referrer_id,a.referrer_source';
$data['list'] = $this->user->getUserAgent($pageNo, $pageSize, 'a.id DESC', $fields, $where);
$data['total'] = $this->user->getUserAgentTotal($where);
return $this->response($data['status'], $data['msg'], $data);
}
......
......@@ -35,15 +35,15 @@ class WatchShop extends Basic
$where = array();
if (!empty($params['start_date']) && empty($params['end_date'])) {
$where['create_time'] = ['> time', $params['start_date']];
$where['create_time'] = ['> time', $params['start_date'].' 00:00:00'];
}
if (!empty($params['end_date']) && empty($params['start_date'])) {
$where['create_time'] = ['< time', $params['end_date']];
$where['create_time'] = ['< time', $params['end_date'].' 23:59:59'];
}
if (!empty($params['start_date']) && !empty($params['end_date'])) {
$where['create_time'] = ['between time', [$params['start_date'],$params['end_date']]];
$where['create_time'] = ['between time', [$params['start_date'].' 00:00:00',$params['end_date'].' 23:59:59']];
}
if (!empty($params['name'])) {
......
......@@ -63,39 +63,49 @@ class Basic extends Controller
$this->userVerify();
}
$this->userAuth($requestPath);
$this->userAuth($requestPath);
}
/**
* 权限判定
*
* @param $requestPath
* @return Response
*/
public function userAuth($requestPath){
$session = Session::get("userinfo.nav");
$rule = 0;
if ($session != NULL) {
//判断当前控制器用户是否拥有进入权限
foreach ($session as $v){
//不区分大小写
if (strcasecmp(trim($v['name']), $requestPath) == 0){
$rule = $v;
}
$session= Session::get("userinfo.nav");
$r=0;
//判断当前控制器用户是否拥有进入权限
foreach ($session as $v){
//不区分大小写
if(strcasecmp(trim($v['name']),$requestPath)==0){
$r=$v;
}
}
if ($rule == 0){
if ($this->request->isAjax()){
return $this->response('300','没有权限');
if($r=='0'){
if($this->request->isAjax()){
return $this->response('300','没有权限');
}else{
// $this->error('没有当前页面权限');
}
} else {
Session::set("userRule",$rule);
}else{
Session::set("userRule",$r);
}
//print_r($r);
}
/**
* 验证登录时效
*/
......
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="RemarkFollowIndex" />
<style>
.modal-body{
height: 600px;
overflow-y: auto;
padding-bottom: 60px;
}
.user-ul2{
width: 100%;
height: auto;
padding-bottom: 15px;
float: left;
}
.user-ul2 li{
list-style: none;
line-height: 30px;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="col-lg-10 col-lg-offset-0">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li>
<a href="javascript:;">跟进列表</a>
</li>
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="9">
<form id="form_search">
<span class="fore-span ld-Marheight">跟进时间:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="start_date" name="start_date" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="end_date" name="end_date" type="date">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="customer_name" placeholder="客户姓名" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="customer_phone" placeholder="客户手机号" type="tel" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="follow_content" placeholder="跟进内容" type="text" value="">
<span class="btn btn-default btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-default btn3 ld-Marheight" id="reset">重置</span>
</form>
</td>
</tr>
<tr>
<th class="text-center">跟进时间</th>
<th class="text-center">跟进内容/跟进标签</th>
<th class="text-center">跟进人</th>
<th class="text-center">客户姓名</th>
<th class="text-center">客户电话</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody class="text-center" id="follow_list">
<!--<tr>-->
<!--<td>212</td>-->
<!--<td>商场</td>-->
<!--<td>长兴</td>-->
<!--<td>1000</td>-->
<!--<td>是</td>-->
<!--<td>2018-01-16 17:02:00</td>-->
<!--<td>已租</td>-->
<!--<td>张娜张-->
<!--<a data-toggle="modal" data-id="77" href="#modal-watch" class="btn1 btn-danger add_applies">修改</a>-->
<!--</td>-->
<!--<td>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">编辑</a>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">推荐至首页</a>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">设置案场权限人</a>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">是否独家</a>-->
<!--<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="77" onclick="alertFollow(this)">操作记录</a>-->
<!--<a data-toggle="modal" data-id="77" href="#modal-watch" class="btn1 btn-danger add_applies" onclick="delete_house(4720)">删除</a>-->
<!--</td>-->
<!--</tr>-->
</table>
</div>
<!-- /#page-content-wrapper -->
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--操作详情记录-->
<div class="modal fade" id="modal-record" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
客户资料/跟进
</h4>
</div>
<div class="modal-body modal-body1">
<table class="table table-striped table-bordered table-hover table-condensed" id="caozuo_hide">
<thead>
<tr>
<td colspan="9">
<form id="form1">
<span class="fore-span ld-Marheight">客户编号:</span>
<span class="fore-span ld-Marheight" id="cus_id"></span>
<span class="fore-span ld-Marheight">姓名:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="cus_name" name="name" type="text">
<select class="form-control btn4 ld-Marheight" id="sex">
<option value="" class="successModel">性别</option>
<option value="0"></option>
<option value="1"></option>
</select>
<span class="fore-span ld-Marheight">电话:</span>
<span class="fore-span ld-Marheight" id="cus_phone"></span>
<div class="row">
</div>
<span class="fore-span ld-Marheight">上传时间:</span>
<span class="fore-span ld-Marheight" id="cus_date"></span>
<div class="row">
</div>
<div class="form-group" >
<span class="fore-span ">客方:</span>
<div class="col-sm-9">
<input type="text" class="form-control btn6 " name="pwd" autocomplete="off" id="cus_fang">
<ul class="user-ul2">
</ul>
</div>
</div>
</form>
</td>
</tr>
<tr>
<th class="text-center">跟进内容</th>
<th class="text-center">跟进人</th>
<th class="text-center">跟进时间</th>
</tr>
</thead>
<tbody class="text-center" id="caozuo_table">
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="button" class="btn btn-primary submit_edit" data-dismiss="modal">
提交
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
......@@ -33,7 +33,7 @@
<div class="form-group">
<div class="input-group search-form">
<input type="text" name="search" class="form-control search-input pull-right" value="" placeholder="请输入ID/用户名/昵称">
<span class="input-group-btn">
<span class="input-group-btn">
<button id="search" type="button" class="btn btn-success search-btn"><i class="glyphicon glyphicon-search"></i></button>
</span>
</div>
......@@ -112,8 +112,8 @@
</h4>
</div>
<div class="modal-body">
<div class="auth" id="access_box">
</div>
<div class="auth" id="access_box">
</div>
</div>
......
......@@ -25,7 +25,7 @@
<a href="/admin.php/index/advertising"> 首页弹窗</a>
</li>
<li role="presentation">
<a href="/admin.php/index/users_list.html"> 户列表</a>
<a href="/admin.php/index/users_list.html"> 户列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/watch_shop.html"> 预约看铺列表</a>
......@@ -64,17 +64,8 @@
<li role="presentation">
<a href="/admin.php/index/BusinessDistrict.html">商圈列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/CellPhoneIndex.html">总记录列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/CellPhoneAgentIndex.html">经纪人通话列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/phoneList.html">号码池列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/bindPhoneListIndex.html">号码绑定列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/CellPhoneIndex.html">通话记录</a>
......
File mode changed from 100755 to 100644
......@@ -6,6 +6,26 @@
overflow-y: auto;
padding-bottom: 60px;
}
.user-ul{
width: 100%;
height: auto;
padding-bottom: 15px;
float: left;
}
.user-ul li{
list-style: none;
line-height: 30px;
}
.user-ul2{
width: 100%;
height: auto;
padding-bottom: 15px;
float: left;
}
.user-ul2 li{
list-style: none;
line-height: 30px;
}
</style>
<!--导航star-->
......@@ -86,7 +106,7 @@
</div>
<!-- /#wrapper -->
<!-- /#新增户模态框 -->
<!-- /#新增户模态框 -->
<div class="modal fade" id="modal_add_user" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
......@@ -95,7 +115,7 @@
&times;
</button>
<h4 class="modal-title" >
添加
添加
</h4>
</div>
<div class="modal-body">
......@@ -110,7 +130,7 @@
<div class="form-group">
<label for="inputEmail3" class="col-sm-3 control-label">性别:</label>
<div class="col-sm-9">
<select class="form-control btn6" id="">
<select class="form-control btn6" id="user_sex">
<option value="" class="successModel">性别</option>
<option value="0"></option>
<option value="1"></option>
......@@ -120,22 +140,26 @@
<div class="form-group" >
<label class="col-sm-3 control-label">电话:</label>
<div class="col-sm-9">
<input type="password" class="form-control btn6" name="pwd" autocomplete="off" id="set_father_id2">
<input type="password" class="form-control btn6" name="user_phone" autocomplete="off" id="set_father_id2">
<span class="use-span text-danger">(必填)</span>
</div>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">客方:</label>
<div class="col-sm-9">
<input type="password" class="form-control btn6" name="pwd" autocomplete="off" id="set_father_id3">
<input type="text" class="form-control btn6" name="pwd" autocomplete="off" id="set_father_id3">
<ul class="user-ul">
</ul>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" id="close">关闭
</button>
<button type="button" class="btn btn-primary" id="add_user">
<button type="button" class="btn btn-primary" id="add_user" data-dismiss="modal">
提交
</button>
</div>
......@@ -179,9 +203,20 @@
</div>
<span class="fore-span ld-Marheight">上传时间:</span>
<span class="fore-span ld-Marheight" id="cus_date"></span>
<span class="fore-span ld-Marheight">客方:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="cus_fang" name="cus_fang" type="text">
<div class="row">
</div>
<div class="form-group" >
<span class="fore-span ">客方:</span>
<div class="col-sm-9">
<input type="text" class="form-control btn6 " name="pwd" autocomplete="off" id="cus_fang">
<ul class="user-ul2">
</ul>
</div>
</div>
</form>
</td>
......@@ -256,7 +291,7 @@
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="button" class="btn btn-primary" id="edit_add">
<button type="button" class="btn btn-primary" id="edit_add" data-dismiss="modal">
提交
</button>
</div>
......
......@@ -279,5 +279,21 @@ class AAgents extends BaseModel
return $result;
}
public function saveList(){
}
//分页列表
public function getList($p = 1, $pageSize = 15, $order_ = 'id desc', $field = '',$join='', $where = '')
{
$data = $this->field($field)
->alias('a')
->join($join)
->where($where)
->order($order_)
->limit($pageSize)
->page($p)
->select();
return $data;
}
}
\ No newline at end of file
......@@ -7,41 +7,43 @@ use think\Db;
class Agents extends Model
{
protected $table = 'agents';
/**
* 查询经纪人
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @param string $house_id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*
* @param type $pageNo
* @param type $pageSize
* @param type $order_
* @param type $field
* @param type $params
* @param type $house_id 查询该街铺和商铺的经纪人评论信息
* @return type
*/
public function getUser($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '') {
public function getUser($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '')
{
if ($house_id == '') {
$data = $this->field($field)->alias('a')
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
} else {
$data = $this->field($field)->alias('a')
->join('u_evaluate b','a.id = b.agents_id','left')
->where('find_in_set('.$house_id.', house_ids) or find_in_set('.$house_id.', house_ids2)')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
->join('u_evaluate b', 'a.id = b.agents_id', 'left')
->where('find_in_set(' . $house_id . ', house_ids) or find_in_set(' . $house_id . ', house_ids2)')
->where($params)
->where('level=2 or level=5')
->group('a.id')
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
return $data;
......@@ -55,18 +57,19 @@ class Agents extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function agentsDetail($id) {
public function agentsDetail($id)
{
if ($id) {
$result = $this->field('id,realname,created,sub_shopname,head_portrait')
->where('level=2 or level=5')
->where('id',$id)->find();
$result['head_portrait'] = 'user_header/'.$result['head_portrait']; //头像
$evaluate_grade = Db::table('u_evaluate')
->field('sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num')
->where('agents_id',$id)->where('is_show',0)->find();
$result = $this->field('id,realname,created,sub_shopname,head_portrait')
->where('level=2 or level=5')
->where('id', $id)->find();
$result['head_portrait'] = 'user_header/' . $result['head_portrait']; //头像
$evaluate_grade = Db::table('u_evaluate')
->field('sum(evaluate_grade) as evaluate_grade, count(*) as evaluate_num')
->where('agents_id', $id)->where('is_show', 0)->find();
if ($evaluate_grade['evaluate_grade']) {
$grade = floor(($evaluate_grade['evaluate_grade']/2)/$evaluate_grade['evaluate_num']);
$grade = floor(($evaluate_grade['evaluate_grade'] / 2) / $evaluate_grade['evaluate_num']);
} else {
$grade = 0;
}
......@@ -74,33 +77,55 @@ class Agents extends Model
$result['evaluate_grade'] = $grade; //评分等级
$result['evaluate_num'] = $evaluate_grade['evaluate_num']; //评论数量
$result['watch_shop'] = Db::table('u_appoint_watch_shop')
->where('agents_id',$id)->count(); //看铺
->where('agents_id', $id)->count(); //看铺
$result['head_portrait'] = ADMIN_URL_TL.$result['head_portrait'];
$journal = new JournalAccounts();
$fields = 'count(j.id) as num';
$result['JournalAccounts'] = $journal->getJournalHouseInfoId($fields, $id)['num']; //成交记录
$remarks = new Remarks();
$fields = 'id';
$where['shopuser_id'] = $id;
$where['transaction_status'] = 3;
$Journal_num = $remarks->getJournalHouseInfoId($fields, $where);
$result['JournalAccounts'] = count($Journal_num); //成交记录
$current_time = time();
$user_time = strtotime($result['created']);
$year = date('Y', $current_time) - date('Y', $user_time);
$year = date('Y', $current_time) - date('Y', $user_time);
//入职年限
if ($year == 0) {
$result['created'] = $year .'个月以上';
$result['created'] = $year . '个月以上';
} else {
$result['created'] = $year . '年以上';
$result['created'] = $year . '年以上';
}
$result['label'] = array(0=>'待定标签数据',1=>'待定标签数据');
$data = $result;
$result['label'] = array( 0 => '待定标签数据', 1 => '待定标签数据' );
$data = $result;
} else {
$data = false;
}
return $data;
}
/**
* 获取经纪人 by zw
* @param $field
* @param $where_
* @return array|false|\PDOStatement|string|Model
*/
public function getAgentsById($field, $where_)
{
$data = $this
->field($field)
->where($where_)
->select();
return $data;
}
/**
* 查询经纪人列表
*
......@@ -115,7 +140,8 @@ class Agents extends Model
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgents($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '') {
public function getAgents($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params, $house_id = '')
{
if ($house_id == '') {
$data = $this->field($field)
->where($params)
......@@ -126,7 +152,7 @@ class Agents extends Model
->select();
} else {
$data = $this->field($field)
->where('find_in_set('.$house_id.', house_ids) or find_in_set('.$house_id.', house_ids2)')
->where('find_in_set(' . $house_id . ', house_ids) or find_in_set(' . $house_id . ', house_ids2)')
->where($params)
->where('level=2 or level=5')
->order($order_)
......
......@@ -32,9 +32,11 @@ class AliYunPhone extends BaseModel
$phone_x = Db::table('aliYun_binding_phone')->alias('a')
->join('aliYun_phone b','a.aliYun_phone_id = b.id','left')
->where([
'phone_b' => $phone,
'a.status' => 1
'phone_b' => $phone,
'a.status' => 0,
'b.status' => 0
])->value('phone_x');
if ($phone_x) {
$where['phone_x'] = $phone_x;
}
......
......@@ -111,13 +111,10 @@ class AttentionModel extends Model
*/
public function getAttentionByUserIdAndHouseId($params)
{
$result = $this->field("id")
return $this->field("id")
->where($params)
->limit(1)
->select();
if (count($result) > 0) {
return $result[0];
}
return null;
}
}
This diff is collapsed.
<?php
// 权限模型
namespace app\model;
use think\Model;
class AuthGroupAccess extends BaseModel
{
// 设置完整的数据表(包含前缀)
// protected $table = 'think_access';
// 设置数据表(不含前缀)
// protected $name = 'auth_rule';
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
/**
* 用户组信息
* @param integer $uid [description]
* @return [type] [description]
*/
public function userGroupInfo($uid = 0)
{
if (!$uid) return false;
$result = $this->alias('a')->join('__AUTH_GROUP__ b','a.group_id = b.id')->where(['a.uid'=>$uid,'a.status'=>1])->field('a.group_id,b.title')->select();
if ($result) {
foreach ($result as $key => $row) {
$return[$row['group_id']] = $row['title'];
}
return $return;
}
return false;
}
public function delUid($name,$ids){
$r=$this->where($name,'in',$ids)->delete();
return $r;
}
/**
* 获取组对应的用户Uids
* @param string $group_id [description]
* @return [type] [description]
* @date 2017-10-17
* @author 心云间、凝听 <981248356@qq.com>
*/
public static function groupUserUids($group_id)
{
return $return = self::where('group_id',$group_id)->column('uid');
}
<?php
// 权限模型
namespace app\model;
use think\Model;
class AuthGroupAccess extends BaseModel
{
// 设置完整的数据表(包含前缀)
// protected $table = 'think_access';
// 设置数据表(不含前缀)
// protected $name = 'auth_rule';
// 定义时间戳字段名
protected $createTime = false;
protected $updateTime = false;
/**
* 用户组信息
* @param integer $uid [description]
* @return [type] [description]
*/
public function userGroupInfo($uid = 0)
{
if (!$uid) return false;
$result = $this->alias('a')->join('__AUTH_GROUP__ b','a.group_id = b.id')->where(['a.uid'=>$uid,'a.status'=>1])->field('a.group_id,b.title')->select();
if ($result) {
foreach ($result as $key => $row) {
$return[$row['group_id']] = $row['title'];
}
return $return;
}
return false;
}
public function delUid($name,$ids){
$r=$this->where($name,'in',$ids)->delete();
return $r;
}
/**
* 获取组对应的用户Uids
* @param string $group_id [description]
* @return [type] [description]
* @date 2017-10-17
* @author 心云间、凝听 <981248356@qq.com>
*/
public static function groupUserUids($group_id)
{
return $return = self::where('group_id',$group_id)->column('uid');
}
}
\ No newline at end of file
<?php
//权限规则模型
namespace app\model;
class AuthRule extends BaseModel
{
// 设置完整的数据表(包含前缀)
// protected $table = 'think_access';
// 设置数据表(不含前缀)
// protected $name = 'auth_rule';
// 设置birthday为时间戳类型(整型)
// protected $type = [
// 'birthday' => 'timestamp',
// ];
/**
* 将格式数组转换为树
*
* @param array $list
* @param integer $level 进行递归时传递用的参数
*/
private $formatTree; //用于树型数组完成递归格式的全局变量
private function _toFormatTree($list,$level=0,$title = 'title') {
foreach($list as $key=>$val){
$tmp_str=str_repeat("&nbsp;",$level*2);
$tmp_str.="└";
$val['level'] = $level;
$val['title_show'] =$level==0 ? $val[$title]."&nbsp;" : $tmp_str.$val[$title]."&nbsp;";
// $val['title_show'] = $val['id'].'|'.$level.'级|'.$val['title_show'];
if(!array_key_exists('_child',$val)){
array_push($this->formatTree,$val);
}else{
$tmp_ary = $val['_child'];
unset($val['_child']);
array_push($this->formatTree,$val);
$this->_toFormatTree($tmp_ary,$level+1,$title); //进行下一层递归
}
}
return;
}
public function toFormatTree($list,$title = 'title',$pk='id',$pid = 'pid',$root = 0){
$list = list_to_tree($list,$pk,$pid,'_child',$root);
$this->formatTree = array();
$this->_toFormatTree($list,0,$title);
return $this->formatTree;
}
/**
* 记录总数
*
* @param $params
* @param $as
* @return int|string
*/
public function getTotal($params,$as='')
{
return $this->alias($as)->where($params)->count();
}
/**查询不带分页
* @param string $order
* @param string $field
* @param string $join
* @param string $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function authRuleList2( $order = '', $field = '',$join='', $where = ''){
$data = $this->field($field)
->alias('a')
->join($join)
->where($where)
->order($order)
->select();
return $data;
}
/**查询带分页
* @param int $p
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $join
* @param string $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function authRuleList($p = 1, $pageSize = 15, $order_ = '', $field = '',$join='', $where = ''){
$data = $this->field($field)
->alias('a')
->join($join)
->where($where)
->order($order_)
->limit($pageSize)
->page($p)
->select();
return $data;
}
/**检查重复
* @param $name
* @param $key
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function repetition($name,$key){
$r=$this->field($name)
->where($name,'=',$key)
->select();
//$this->getLastSql();
if($r){
return true;
}else{
return false;
}
}
/**
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function loginRule($where){
$r=$this->field('id,name,title,pid')
->where($where)
->select();
// $this->getLastSql();
return $r;
}
//更新数据
public function saveStatus($name,$key,$ids){
$r = $this->where("id",'in',$ids)->update([$name=>$key]);
return $r;
}
<?php
//权限规则模型
namespace app\model;
class AuthRule extends BaseModel
{
// 设置完整的数据表(包含前缀)
// protected $table = 'think_access';
// 设置数据表(不含前缀)
// protected $name = 'auth_rule';
// 设置birthday为时间戳类型(整型)
// protected $type = [
// 'birthday' => 'timestamp',
// ];
/**
* 将格式数组转换为树
*
* @param array $list
* @param integer $level 进行递归时传递用的参数
*/
private $formatTree; //用于树型数组完成递归格式的全局变量
private function _toFormatTree($list,$level=0,$title = 'title') {
foreach($list as $key=>$val){
$tmp_str=str_repeat("&nbsp;",$level*2);
$tmp_str.="└";
$val['level'] = $level;
$val['title_show'] =$level==0 ? $val[$title]."&nbsp;" : $tmp_str.$val[$title]."&nbsp;";
// $val['title_show'] = $val['id'].'|'.$level.'级|'.$val['title_show'];
if(!array_key_exists('_child',$val)){
array_push($this->formatTree,$val);
}else{
$tmp_ary = $val['_child'];
unset($val['_child']);
array_push($this->formatTree,$val);
$this->_toFormatTree($tmp_ary,$level+1,$title); //进行下一层递归
}
}
return;
}
public function toFormatTree($list,$title = 'title',$pk='id',$pid = 'pid',$root = 0){
$list = list_to_tree($list,$pk,$pid,'_child',$root);
$this->formatTree = array();
$this->_toFormatTree($list,0,$title);
return $this->formatTree;
}
/**
* 记录总数
*
* @param $params
* @param $as
* @return int|string
*/
public function getTotal($params,$as='')
{
return $this->alias($as)->where($params)->count();
}
/**查询不带分页
* @param string $order
* @param string $field
* @param string $join
* @param string $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function authRuleList2( $order = '', $field = '',$join='', $where = ''){
$data = $this->field($field)
->alias('a')
->join($join)
->where($where)
->order($order)
->select();
return $data;
}
/**查询带分页
* @param int $p
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $join
* @param string $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function authRuleList($p = 1, $pageSize = 15, $order_ = '', $field = '',$join='', $where = ''){
$data = $this->field($field)
->alias('a')
->join($join)
->where($where)
->order($order_)
->limit($pageSize)
->page($p)
->select();
return $data;
}
/**检查重复
* @param $name
* @param $key
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function repetition($name,$key){
$r=$this->field($name)
->where($name,'=',$key)
->select();
//$this->getLastSql();
if($r){
return true;
}else{
return false;
}
}
/**
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function loginRule($where){
$r=$this->field('id,name,title,pid')
->where($where)
->select();
// $this->getLastSql();
return $r;
}
//更新数据
public function saveStatus($name,$key,$ids){
$r = $this->where("id",'in',$ids)->update([$name=>$key]);
return $r;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100755 to 100644
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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