diff --git a/application/admin/controller/general/Profile.php b/application/admin/controller/general/Profile.php index 02a786e..47c4ff2 100644 --- a/application/admin/controller/general/Profile.php +++ b/application/admin/controller/general/Profile.php @@ -5,6 +5,7 @@ namespace app\admin\controller\general; use app\admin\model\Admin; use app\common\controller\Backend; use fast\Random; +use think\Db; use think\Session; use think\Validate; @@ -70,10 +71,17 @@ class Profile extends Backend // $this->error(__("Email already exists")); // } if ($params) { - $admin = Admin::get($this->auth->id); + $admin = Session::get('admin')?Session::get('admin'):Session::get('member'); + if(!$admin){ + $this->redirect('index/register', [], 302); + } + + $admin = Admin::get($admin['id']); $admin->save($params); //因为个人资料面板读取的Session显示,修改自己资料后同时更新Session - Session::set("admin", $admin->toArray()); +// Session::set("admin", $admin->toArray()); + $adminInfo = Db::name("admin")->where('id','=',$this->auth->id)->find(); + Session::set("admin", $adminInfo); $this->success(); } $this->error(); diff --git a/application/admin/controller/qingdong/customer/Customer.php b/application/admin/controller/qingdong/customer/Customer.php index bd07123..ae38a45 100644 --- a/application/admin/controller/qingdong/customer/Customer.php +++ b/application/admin/controller/qingdong/customer/Customer.php @@ -32,6 +32,7 @@ use addons\qingdong\model\Business; use PhpOffice\PhpWord\TemplateProcessor; use PhpOffice\PhpWord\Settings; use think\Db; +use think\Env; use think\Exception; /** @@ -1515,4 +1516,114 @@ class Customer extends Base return $this->view->fetch(); } + public function getImgInfo(){ + $result = [ + "business_name" => '', + "business_range" => '', + "business_legal" => '', + "business_social" => '', + "business_establish" => '', + "business_address" => '', + "business_type" => '', + ]; + + $file = input('url', ''); + if($file == ""){ + return json($result); + } + + $token = cache("baidu_api_token"); + if(!$token){ + $resStr = $this->get_token(); + $res = json_decode($resStr,true); + $token = $res['access_token']; + $expires_in = $res['expires_in']; + cache("baidu_api_token",$token,$expires_in-10 ); + } + + $url = 'https://aip.baidubce.com/rest/2.0/ocr/v1/business_license?access_token=' . $token; + if(substr($file,0,4)!="http"){ + $file = Env::get('ext.domain', $_SERVER['HTTP_HOST']).$file; + } + try { + $img = file_get_contents($file); + } catch (Exception $e){ + return json($result); + } + if(!$img){ + return json($result); + } + $img = base64_encode($img); + + $bodys = array( + 'image' => $img + ); + $resStr = $this->request_post($url, $bodys); + $res = json_decode($resStr,true); + $res2 = $res['words_result']; + $result = [ + "business_name" => $res2['单位名称']['words'] ?? "", + "business_range" => $res2['经营范围']['words'] ?? "", + "business_legal" => $res2['法人']['words'] ?? "", + "business_social" => $res2['社会信用代码']['words'] ?? "", + "business_establish" =>$res2['成立日期']['words'] ?? "", + "business_address" => $res2['地址']['words'] ?? "", + "business_type" => $res2['类型']['words'] ?? "", + ]; + return json($result); + } + + + /** + * 发起http post请求(REST API), 并获取REST请求的结果 + * @param string $url + * @param string $param + * @return - http response body if succeeds, else false. + */ + function request_post($url = '', $param = '') + { + if (empty($url) || empty($param)) { + return false; + } + + $postUrl = $url; + $curlPost = $param; + // 初始化curl + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $postUrl); + curl_setopt($curl, CURLOPT_HEADER, 0); + // 要求结果为字符串且输出到屏幕上 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + // post提交方式 + curl_setopt($curl, CURLOPT_POST, 1); + curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost); + // 运行curl + $data = curl_exec($curl); + curl_close($curl); + + return $data; + } + + + public function get_token(){ + $curl = curl_init(); + curl_setopt_array($curl, array( + CURLOPT_URL => "https://aip.baidubce.com/oauth/2.0/token?client_id=VBgaZy6xOiHsWVRMTuOqRynw&client_secret=fe6OOmXCZzt2B7BDGo6ctyR3TPEZkmws&grant_type=client_credentials", + CURLOPT_TIMEOUT => 30, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_CUSTOMREQUEST => 'POST', + + + CURLOPT_HTTPHEADER => array( + 'Content-Type: application/json', + 'Accept: application/json' + ), + + )); + $response = curl_exec($curl); + curl_close($curl); + return $response; + } + } diff --git a/application/admin/controller/qingdong/customer/Need.php b/application/admin/controller/qingdong/customer/Need.php index b960ce1..198f212 100644 --- a/application/admin/controller/qingdong/customer/Need.php +++ b/application/admin/controller/qingdong/customer/Need.php @@ -38,6 +38,7 @@ class Need extends Base $where['next_time'] = array(array('egt',date('Y-m-d 00:00:00')),array('lt',date('Y-m-d 23:59:59'))); $where['follow_type'] = ['neq', '其它']; $where['status'] = 0; + $where['cid'] = CID; // 待跟进客户 $where1['relation_type'] = 1; $customerlist = Record::where($where)->where($where1)->column('relation_id'); @@ -143,6 +144,8 @@ class Need extends Base $where['next_time'] = array(array('egt',date('Y-m-d 00:00:00')),array('lt',date('Y-m-d 23:59:59'))); $where['follow_type'] = ['neq', '其它']; $where['status'] = 0; + $where['cid'] = CID; + // 待跟进客户 $where1['relation_type'] = 1; $customerlist = Record::where($where)->where($where1)->column('relation_id'); diff --git a/application/admin/view/general/profile/index.html b/application/admin/view/general/profile/index.html index 94d5901..a1c8e4c 100644 --- a/application/admin/view/general/profile/index.html +++ b/application/admin/view/general/profile/index.html @@ -54,8 +54,9 @@
{:__('Click to edit')}
- + +
建议尺寸100X100;点击前往,裁剪后上传图片

{$admin.nickname|htmlentities}

diff --git a/application/admin/view/qingdong/customer/contacts/detail.html b/application/admin/view/qingdong/customer/contacts/detail.html index d32068c..c284b37 100644 --- a/application/admin/view/qingdong/customer/contacts/detail.html +++ b/application/admin/view/qingdong/customer/contacts/detail.html @@ -42,8 +42,8 @@
编辑 - 发送邮件 - 发送短信 + + 删除
diff --git a/application/admin/view/qingdong/customer/contract/detail.html b/application/admin/view/qingdong/customer/contract/detail.html index cec61db..ed24d02 100644 --- a/application/admin/view/qingdong/customer/contract/detail.html +++ b/application/admin/view/qingdong/customer/contract/detail.html @@ -121,9 +121,9 @@ 编辑 {/if} - 导出word + + +
diff --git a/application/admin/view/qingdong/customer/contract/index.html b/application/admin/view/qingdong/customer/contract/index.html index fe425a9..a916157 100644 --- a/application/admin/view/qingdong/customer/contract/index.html +++ b/application/admin/view/qingdong/customer/contract/index.html @@ -1,5 +1,10 @@ +
+
+
+
+ 工商信息 +
+
+
+ +
+
+ 单位名称: + {$row.business_name} +
+
+
+
+ 法人: + {$row.business_legal} +
+
+
+
+ 社会信用代码: + {$row.business_social} +
+
+
+
+ 成立日期: + {$row.business_establish} +
+
+
+
+ 详细地址: + {$row.business_address} +
+
+
+
+ 企业类型: + {$row.business_type} +
+
+
+
+ 经营范围: + {$row.business_range} +
+
+
+
diff --git a/application/admin/view/qingdong/customer/customer/edit.html b/application/admin/view/qingdong/customer/customer/edit.html index 2bd8006..18d7d84 100644 --- a/application/admin/view/qingdong/customer/customer/edit.html +++ b/application/admin/view/qingdong/customer/customer/edit.html @@ -9,6 +9,22 @@
+
+
+ + +
+ +
+ +
+ +
+
    +
    +
    + + {include file="qingdong/common/form_edit" /}
    @@ -33,6 +49,66 @@
    + + +
    +
    +
    +

    工商信息

    +
    +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    +
    + + +
    +
    + +
    @@ -44,3 +120,55 @@ + + + \ No newline at end of file diff --git a/application/admin/view/qingdong/customer/leadspool/index.html b/application/admin/view/qingdong/customer/leadspool/index.html index 4e4bddf..7ece458 100644 --- a/application/admin/view/qingdong/customer/leadspool/index.html +++ b/application/admin/view/qingdong/customer/leadspool/index.html @@ -9,7 +9,7 @@
    {:build_toolbar('refresh,add')} - 导入 + 批量分配
    {:build_toolbar('refresh,add')} - 导入 - 导出 + +
    li.active > a, .skin-blue-light .treeview-menu > li > a:hover { - color: #000; + color: #4776ff; } .skin-blue-light .treeview-menu > li.active > a { font-weight: 600; diff --git a/public/assets/js/backend/qingdong/customer/contract.js b/public/assets/js/backend/qingdong/customer/contract.js index 4b2599b..3ad9f07 100644 --- a/public/assets/js/backend/qingdong/customer/contract.js +++ b/public/assets/js/backend/qingdong/customer/contract.js @@ -1,19 +1,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { - $(function(){ - var contract_str = $("#contract_str").val(); - console.log(contract_str,111) - if(contract_str !== ""){ - layer.open({ - type: 0, //可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层) - title: ['合同到期提醒', 'font-size:18px; color:orange;'],//数组第二项可以写任意css样式;如果你不想显示标题栏,你可以title: false - content: contract_str, - btn: [], - offset:"rb" - }); - } - }); + var Controller = { index : function () { + $(function(){ + var contract_str = $("#contract_str").val(); + if(contract_str !== ""){ + layer.open({ + type: 0, //可传入的值有:0(信息框,默认)1(页面层)2(iframe层)3(加载层)4(tips层) + title: ['合同到期提醒', 'font-size:18px; color:orange;'],//数组第二项可以写任意css样式;如果你不想显示标题栏,你可以title: false + content: contract_str, + btn: [], + offset:"rb" + }); + } + }); + // 初始化表格参数配置 Table.api.init();