diff --git a/addons/qingdong/controller/Autotask.php b/addons/qingdong/controller/Autotask.php index 4fb7b39..8a2f0b1 100644 --- a/addons/qingdong/controller/Autotask.php +++ b/addons/qingdong/controller/Autotask.php @@ -96,13 +96,17 @@ class Autotask extends \think\addons\Controller Log::error($e->getMessage()); } } - if (AdminConfig::getConfigValue('chengjiao', AdminConfig::TYPE_SEAS) == 1) {//未成交客户回收 + if (AdminConfig::getConfigValue('chengjiao', AdminConfig::TYPE_SEAS) == 1) {//未成交客户或者未上传营业执照的回收 $day = AdminConfig::getConfigValue('chengjiao_day', AdminConfig::TYPE_SEAS); $where = [ 'receivetime' => ['<', strtotime('-' . $day . ' day')], 'contract_status' => 0 ]; - $customers = Customer::where($where)->field('id,name,owner_staff_id')->select(); + $where2 = [ + 'receivetime' => ['<', strtotime('-' . $day . ' day')], + 'business_img' => '' + ]; + $customers = Customer::whereor(function($query) use ($where){$query->where($where);})->whereor(function($query) use ($where2){$query->where($where2);})->field('id,name,owner_staff_id')->select(); try { foreach ($customers as $c) { Customer::moveSeas($c['id']); diff --git a/application/admin/controller/general/Profile.php b/application/admin/controller/general/Profile.php index feffa99..02a786e 100644 --- a/application/admin/controller/general/Profile.php +++ b/application/admin/controller/general/Profile.php @@ -55,20 +55,20 @@ class Profile extends Backend array_flip(array('email', 'nickname', 'password', 'avatar')) )); unset($v); - if (!Validate::is($params['email'], "email")) { - $this->error(__("Please input correct email")); - } - if (isset($params['password'])) { - if (!Validate::is($params['password'], "/^[\S]{6,30}$/")) { - $this->error(__("Please input correct password")); - } - $params['salt'] = Random::alnum(); - $params['password'] = md5(md5($params['password']) . $params['salt']); - } - $exist = Admin::where('email', $params['email'])->where('id', '<>', $this->auth->id)->find(); - if ($exist) { - $this->error(__("Email already exists")); - } +// if (!Validate::is($params['email'], "email")) { +// $this->error(__("Please input correct email")); +// } +// if (isset($params['password'])) { +// if (!Validate::is($params['password'], "/^[\S]{6,30}$/")) { +// $this->error(__("Please input correct password")); +// } +// $params['salt'] = Random::alnum(); +// $params['password'] = md5(md5($params['password']) . $params['salt']); +// } +// $exist = Admin::where('email', $params['email'])->where('id', '<>', $this->auth->id)->find(); +// if ($exist) { +// $this->error(__("Email already exists")); +// } if ($params) { $admin = Admin::get($this->auth->id); $admin->save($params); diff --git a/application/admin/controller/qingdong/customer/Contract.php b/application/admin/controller/qingdong/customer/Contract.php index f577a0a..0904ec3 100644 --- a/application/admin/controller/qingdong/customer/Contract.php +++ b/application/admin/controller/qingdong/customer/Contract.php @@ -154,7 +154,22 @@ class Contract extends Base { return json($result); } - + //查看即将到期的合同 + $company = Db::name("company")->where('id','=',CID)->find(); + $day = $company['contract_day']; + + $staff = Staff::info(); + $contracts = $this->model->where('owner_staff_id','=',$staff->id)->where('contract_status','in',[0,1])->where('check_status','=',2) + ->where('end_time','>=',date('Y-m-d'))->where('end_time','<=',date('Y-m-d',strtotime("+{$day} days")))->select(); + $contract_name = []; + foreach ($contracts as $v){ + $contract_name[] = "".$v['name']."(".$v['num'].")于".$v['end_time']; + } + $contract_str = ""; + if(count($contract_name)){ + $contract_str = "您的合同 ".implode(";",$contract_name)." 到期,请关注续约情况!!!"; + } + $this->view->assign("contract_str",$contract_str); $field = FormField::getFields(FormField::CONTRACT_TYPE); $this->assignconfig('fields', $field); return $this->view->fetch(); diff --git a/application/admin/controller/qingdong/department/Staff.php b/application/admin/controller/qingdong/department/Staff.php index e4c8546..e7eb8be 100644 --- a/application/admin/controller/qingdong/department/Staff.php +++ b/application/admin/controller/qingdong/department/Staff.php @@ -74,6 +74,15 @@ class Staff extends Base { return json($result); } + //获取当前企业的席位数 + $vip_user_nums = 1000000; + $user_nums = $this->model->where('cid','=',CID)->count(); + + $company = Db::name("company")->where('id','=',CID)->find(); + $vip_user_nums = $company['vip_user_nums']; + + $this->view->assign('vip_user_nums', $vip_user_nums); + $this->view->assign('user_nums', $user_nums); return $this->view->fetch(); } @@ -85,6 +94,16 @@ class Staff extends Base { */ public function add() { if ($this->request->isAjax()) { + //获取当前企业的席位数 + $user_nums = $this->model->where('cid','=',CID)->count(); + + $company = Db::name("company")->where('id','=',CID)->find(); + $vip_user_nums = $company['vip_user_nums']; + + if($user_nums>=$vip_user_nums){ + $this->error('您的席位数已用完,请购买席位后重新添加'); + } + $data = $this->request->post('row/a'); $mobile=$data['mobile']; diff --git a/application/admin/controller/qingdong/general/Seastype.php b/application/admin/controller/qingdong/general/Seastype.php index 4de02e8..a89e430 100644 --- a/application/admin/controller/qingdong/general/Seastype.php +++ b/application/admin/controller/qingdong/general/Seastype.php @@ -27,12 +27,12 @@ class Seastype extends Base } public function index() { - $types=$this->model->where('cid',CID)->select(); + $types=$this->model->where([])->select(); if (empty($types)) {//没有默认公海 则添加 $insert = [ 'id' => 1, 'name' => '默认公海', - 'remarks' => '客户不满足其他公海规则时,会移入当前公海' + 'remarks' => '客户不满足其他公海规则时,会移入当前公海', ]; $this->model->insert($insert); $staff_rule = ['type' => 'data', 'pid' => 1, 'title' => '默认公海', 'name' => 1]; diff --git a/application/admin/controller/qingdong/product/Member.php b/application/admin/controller/qingdong/product/Member.php index 144ebdd..c84d3a0 100644 --- a/application/admin/controller/qingdong/product/Member.php +++ b/application/admin/controller/qingdong/product/Member.php @@ -56,9 +56,9 @@ class Member extends Base //获取所有权限 $list2 = Db::name('auth_group')->where('status','=','normal')->select(); $roles = array_column($list2,'name','id'); - //获取当前用户所在企业的权限组 - $company = Db::name('company')->where("id",CID)->find(); - $group_id = $company['group_id']; +// //获取当前用户所在企业的权限组 +// $company = Db::name('company')->where("id",CID)->find(); +// $group_id = $company['group_id']; if ($this->request->isAjax()) { @@ -70,15 +70,15 @@ class Member extends Base //负责人为空 $list = $this->model->where($where)->order($sort, $order)->paginate($limit); $row=$list->items(); - $group_level = 0; - foreach ($row as $k => $v) { - if($v['group_id'] == $group_id){ - $group_level = $v['group_level']; - break; - } - - $row[$k] = $v; - } +// $group_level = 0; +// foreach ($row as $k => $v) { +// if($v['group_id'] == $group_id){ +// $group_level = $v['group_level']; +// break; +// } +// +// $row[$k] = $v; +// } foreach ($row as $k => $v) { @@ -86,13 +86,13 @@ class Member extends Base $v['buy'] = 0; $v['buy_name'] = '可升级'; - if($group_level>$v['group_level']){ - $v['buy'] = 1; - $v['buy_name'] = '无需升级'; - }else if($v['group_id'] == $group_id){ - $v['buy'] = 1; - $v['buy_name'] = '已拥有'; - } +// if($group_level>$v['group_level']){ +// $v['buy'] = 1; +// $v['buy_name'] = '无需升级'; +// }else if($v['group_id'] == $group_id){ +// $v['buy'] = 1; +// $v['buy_name'] = '已拥有'; +// } $row[$k] = $v; } @@ -101,6 +101,16 @@ class Member extends Base return json($result); } + //获取当前企业的席位数 + $vip_user_nums = 1000000; + $user_nums = Db::name("qingdong_staff")->where('cid','=',CID)->count(); + + $company = Db::name("company")->where('id','=',CID)->find(); + $vip_user_nums = $company['vip_user_nums']; + + $this->view->assign('vip_user_nums', $vip_user_nums); + $this->view->assign('user_nums', $user_nums); + return $this->view->fetch(); } diff --git a/application/admin/controller/qingdong/product/Memberproduct.php b/application/admin/controller/qingdong/product/Memberproduct.php index 5312298..dcd635b 100644 --- a/application/admin/controller/qingdong/product/Memberproduct.php +++ b/application/admin/controller/qingdong/product/Memberproduct.php @@ -92,6 +92,8 @@ class Memberproduct extends Base if($count>0){ $this->error("权限等级已存在!!"); } + + $result = false; Db::startTrans(); try { diff --git a/application/admin/view/general/profile/index.html b/application/admin/view/general/profile/index.html index ed5ff9d..94d5901 100644 --- a/application/admin/view/general/profile/index.html +++ b/application/admin/view/general/profile/index.html @@ -74,10 +74,10 @@ -
- - -
+ + + +
diff --git a/application/admin/view/qingdong/customer/contract/index.html b/application/admin/view/qingdong/customer/contract/index.html index 4e8cb3e..fe425a9 100644 --- a/application/admin/view/qingdong/customer/contract/index.html +++ b/application/admin/view/qingdong/customer/contract/index.html @@ -107,6 +107,17 @@
- + + + \ No newline at end of file diff --git a/application/admin/view/qingdong/department/staff/add.html b/application/admin/view/qingdong/department/staff/add.html index feb1805..2cc7433 100644 --- a/application/admin/view/qingdong/department/staff/add.html +++ b/application/admin/view/qingdong/department/staff/add.html @@ -44,13 +44,13 @@ -
- -
- -
-
+ + + + + + +
diff --git a/application/admin/view/qingdong/department/staff/edit.html b/application/admin/view/qingdong/department/staff/edit.html index 8d41690..81bf3ba 100644 --- a/application/admin/view/qingdong/department/staff/edit.html +++ b/application/admin/view/qingdong/department/staff/edit.html @@ -46,13 +46,13 @@
-
- -
- -
-
+ + + + + + +
diff --git a/application/admin/view/qingdong/department/staff/index.html b/application/admin/view/qingdong/department/staff/index.html index 1633931..3d27e1a 100644 --- a/application/admin/view/qingdong/department/staff/index.html +++ b/application/admin/view/qingdong/department/staff/index.html @@ -9,6 +9,7 @@
{:build_toolbar('refresh,add')} + 总席位数:{$vip_user_nums}    已开通席位数:{$user_nums}    购买席位
diff --git a/application/admin/view/qingdong/product/company/edit.html b/application/admin/view/qingdong/product/company/edit.html index bc4fe08..a2177a0 100644 --- a/application/admin/view/qingdong/product/company/edit.html +++ b/application/admin/view/qingdong/product/company/edit.html @@ -46,12 +46,21 @@
- + + +
+
+ +
+
+ + type="text" value="{$row.vip_user_nums}">
+
diff --git a/application/admin/view/qingdong/product/member/detail.html b/application/admin/view/qingdong/product/member/detail.html index 7bab97e..299a668 100644 --- a/application/admin/view/qingdong/product/member/detail.html +++ b/application/admin/view/qingdong/product/member/detail.html @@ -46,6 +46,11 @@

+
+ 席位数 +

+
+
diff --git a/application/admin/view/qingdong/product/member/index.html b/application/admin/view/qingdong/product/member/index.html index 771c714..b9f1074 100644 --- a/application/admin/view/qingdong/product/member/index.html +++ b/application/admin/view/qingdong/product/member/index.html @@ -7,6 +7,9 @@
+
+ 总席位数:{$vip_user_nums}    已开通席位数:{$user_nums} +
diff --git a/application/admin/view/qingdong/product/memberproduct/add.html b/application/admin/view/qingdong/product/memberproduct/add.html index dd9962d..8dbeb2b 100644 --- a/application/admin/view/qingdong/product/memberproduct/add.html +++ b/application/admin/view/qingdong/product/memberproduct/add.html @@ -28,7 +28,13 @@ type="number">
- +
+
+ + +
+
diff --git a/application/admin/view/qingdong/product/memberproduct/detail.html b/application/admin/view/qingdong/product/memberproduct/detail.html index 7bab97e..299a668 100644 --- a/application/admin/view/qingdong/product/memberproduct/detail.html +++ b/application/admin/view/qingdong/product/memberproduct/detail.html @@ -46,6 +46,11 @@

+
+ 席位数 +

+
+
diff --git a/application/admin/view/qingdong/product/memberproduct/edit.html b/application/admin/view/qingdong/product/memberproduct/edit.html index 3074f56..cdeb8b1 100644 --- a/application/admin/view/qingdong/product/memberproduct/edit.html +++ b/application/admin/view/qingdong/product/memberproduct/edit.html @@ -14,6 +14,7 @@
+
@@ -32,12 +33,22 @@
+ + +
+
+ + +
+
+
diff --git a/application/api/controller/Pay.php b/application/api/controller/Pay.php index b661b05..37e6381 100644 --- a/application/api/controller/Pay.php +++ b/application/api/controller/Pay.php @@ -53,6 +53,10 @@ class Pay extends Controller //获取权限 更新当前企业的权限 $product = Db::name("product")->where("id",'=',$order['org_id'])->find(); + //获取当前企业信息 + $company = Db::name("company")->where('id','=',$order['cid'])->find(); + $vip_user_nums = $company['vip_user_nums']; + if($product){ $group_id = $product['group_id']; $expire_time = strtotime("+1 years"); @@ -61,6 +65,7 @@ class Pay extends Controller "expire_time" => $expire_time, "is_pay" => 1, "is_default" => 0, + "vip_user_nums" => intval($vip_user_nums)+$product['user_nums'], //增加席位数 ]; Db::name("company")->where("id","=",$order['cid'])->update($update2); } diff --git a/public/assets/js/backend/qingdong/customer/contract.js b/public/assets/js/backend/qingdong/customer/contract.js index 13f16f8..4b2599b 100644 --- a/public/assets/js/backend/qingdong/customer/contract.js +++ b/public/assets/js/backend/qingdong/customer/contract.js @@ -1,5 +1,17 @@ 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 () { // 初始化表格参数配置 diff --git a/public/assets/js/backend/qingdong/product/company.js b/public/assets/js/backend/qingdong/product/company.js index 42cf4c5..c1329e0 100644 --- a/public/assets/js/backend/qingdong/product/company.js +++ b/public/assets/js/backend/qingdong/product/company.js @@ -41,7 +41,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field : 'nickname', title : '联系人', operate : false}, {field : 'mobile', title : '企业电话', operate : false}, {field : 'address', title : '企业地址', operate : false}, - {field : 'expire_time_str', title : '到期日期', operate : false}, + {field : 'vip_user_nums', title : '席位数', operate : false}, ] ], search:false, diff --git a/public/assets/js/backend/qingdong/product/member.js b/public/assets/js/backend/qingdong/product/member.js index 636850e..b21419e 100644 --- a/public/assets/js/backend/qingdong/product/member.js +++ b/public/assets/js/backend/qingdong/product/member.js @@ -42,6 +42,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field : 'price', title : '价格', operate : false}, {field : 'org_price', title : '原价', operate : false}, {field : 'group_name', title : '会员权限', operate : false}, + {field : 'user_nums', title : '席位数', operate : false}, {field : 'group_level', title : '权限等级', operate : false}, {field : 'buy_name', title : '状态', operate : false}, { diff --git a/public/assets/js/backend/qingdong/product/memberproduct.js b/public/assets/js/backend/qingdong/product/memberproduct.js index df3afc2..9310aea 100644 --- a/public/assets/js/backend/qingdong/product/memberproduct.js +++ b/public/assets/js/backend/qingdong/product/memberproduct.js @@ -44,6 +44,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field : 'price', title : '价格', operate : false}, {field : 'org_price', title : '原价', operate : false}, {field : 'group_name', title : '会员权限', operate : false}, + {field : 'user_nums', title : '席位数', operate : false}, {field : 'group_level', title : '权限等级', operate : false}, {field : 'status', title : '状态',formatter: Table.api.formatter.status, searchList: { '下架': __('下架'),'上架': __('上架')}}, {