市场业绩功能提交

master
zhengyongxing 4 years ago
parent 3beeb81063
commit 6e767a739c

@ -3,6 +3,7 @@
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
use Base\Service\LeavePercentageService;
/**
* 后台首页控制器
@ -12,6 +13,7 @@ class MarketPercentageController extends ThinkController
{
protected $coefficient = [];
private $leavePercentage ;
protected function _initialize()
{
@ -23,6 +25,8 @@ class MarketPercentageController extends ThinkController
$this->coefficient[$value['pay_time']][$value['admin_id']] = $value['coefficient'] / 100;
}
LeavePercentageService::unSettlementList();
parent::_initialize();
}
@ -582,28 +586,28 @@ class MarketPercentageController extends ThinkController
if (is_administrator() || session('user_group_id') == 15 || session('user_group_id') == 14 || session('user_group_id') == 19 || session('user_group_id') == 23) {
unset($map['admin_id']);
$markerData = M("ucenter_member")->field("id")->where(['work_status' => 1])->select();
if ($markerData) {
$admin_map['sys_member.uid'] = ['not in', array_column($markerData, 'id')];
}
// $markerData = M("ucenter_member")->field("id")->where(['work_status' => 1])->select();
//
// if ($markerData) {
// $admin_map['sys_member.uid'] = ['not in', array_column($markerData, 'id')];
// }
$admin_data = M("member")
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
->where(['group_id' => ['in', '11,12,21']])
->where($admin_map)
// ->where($admin_map)
->select();
if ($admin_data) {
$map['admin_id'] = ['in', array_column($admin_data, 'admin_id')];
}
if (!in_array($_REQUEST['admin_id'], array_column($markerData, 'id'))) {
// if (!in_array($_REQUEST['admin_id'], array_column($markerData, 'id'))) {
$_REQUEST['admin_id'] ? ($map['admin_id'] = $_REQUEST['admin_id']) : '';
} else {
$this->display("marketstaffsettle");
die();
}
// } else {
// $this->display("marketstaffsettle");
// die();
// }
}

@ -389,6 +389,22 @@ class UserController extends AdminController
}
}
if (strtotime($_POST['apply_leave_time'])<time()) {
$this->error('申请离职时间不能早于当前时间!');
}
if (strtotime($_POST['leave_time'])<time()) {
$this->error('离职时间不能早于当前时间!');
}
if (strtotime($_POST['apply_leave_time'])>strtotime($_POST['leave_time'])) {
$this->error('申请离职时间不得晚于离职时间!');
}
if ((strtotime($_POST['apply_leave_time'])&&!strtotime($_POST['leave_time']))||!strtotime($_POST['apply_leave_time'])&&strtotime($_POST['leave_time'])) {
$this->error('申请离职时,申请离职时间与离职时间都必须填写!');
}
$group = M('auth_group', 'sys_')->where(['id' => I('auth')])->find();
if (is_null($group)) {
$this->error('角色类型不存在!');
@ -430,6 +446,8 @@ class UserController extends AdminController
$info['second_pwd'] = (empty($spwd) || $spwd == $oldspwd) ? $oldspwd : $spwd;
$info['email'] = $_POST['email'];
$info['mobile'] = isset($_POST['mobile']) ? $_POST['mobile'] : '';
$_POST['apply_leave_time'] ? ($info['apply_leave_time'] = strtotime($_POST['apply_leave_time'])):'';
$_POST['leave_time'] ? ($info['leave_time'] = strtotime($_POST['leave_time'])):'';
if($_POST['work_status']) {
$info['work_status'] = $_POST['work_status'];
}
@ -463,6 +481,9 @@ class UserController extends AdminController
$map['id'] = $_GET['id'];
$Member = D('UcenterMember')->where($map)->find();
$Member['apply_leave_time'] = date("Y-m-d",$Member['apply_leave_time']);
$Member['leave_time'] = date("Y-m-d",$Member['leave_time']);
$data = D('Member')->where(array('uid' => $_GET['id']))->find();
$au = D('AuthGroupAccess')->where(array('uid' => $_GET['id']))->find();

@ -68,6 +68,18 @@
<!-- </if>-->
</td>
</tr>
<tr>
<td class="l">申请离职时间:</td>
<td class="r">
<input type="text" id="apply_leave_time" name="apply_leave_time" class="" value="{$list['apply_leave_time']}" placeholder="申请离职时间" autocomplete="off"/>
</td>
</tr>
<tr>
<td class="l">离职时间:</td>
<td class="r">
<input type="text" id="leave_time" name="leave_time" class="" value="{$list['leave_time']}" placeholder="离职时间" autocomplete="off"/>
</td>
</tr>
<tr>
<td class="l noticeinfo">离职状态</td>
<td class="r table_radio table_radio2">
@ -78,7 +90,7 @@
<label>
<input type="radio" class="inp_radio" value="0" name="work_status" <if condition="$list['work_status'] eq 0"> checked</if> > 未离职
</label></span>
<span class="notice-text" style="line-height:1.4;width:68%;">离职状态,市场专员离职发放后自动标志未离职</span>
<!-- <span class="notice-text" style="line-height:1.4;width:68%;">离职状态,市场专员离职发放后自动标志未离职</span>-->
</td>
</tr>
@ -119,6 +131,11 @@
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<div class="common_settings">
@ -134,6 +151,29 @@
<block name="script">
<script>
$('#apply_leave_time').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
});
$('#leave_time').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
});
$bind_wx=$("#bind_wx").prop('checked');
if($bind_wx){
cpsw=check(1);

@ -0,0 +1,77 @@
<?php
namespace base\Service;
class LeavePercentageService
{
// private $isLeave = [0=>''];
private $model;
static $arrUnSettlementList = [];
private function __construct()
{
$this->model = M("ucenter_member");
}
static function getInstance() {
}
/**
* 不结算的管理员列表
* @return array
*/
public function unSettlementList() {
if (isset(self::$arrUnSettlementList)) {
return;
}
$data = $this->model ->where(['work_status'=>0])->select();
$returnData = [];
foreach ($data as $key => $value) {
$returnData[$value['id']] = $value['leave_time'];
}
self::$arrUnSettlementList = $returnData;
}
public function isSettlement($date = '',$admin_id= 0) {
//未离职结算
if (!isset(self::$arrUnSettlementList[$admin_id])) {
return true;
}
//判断往后日期都不结算
if (self::$arrUnSettlementList[$admin_id]
&&date("Y-m",self::$arrUnSettlementList[$admin_id])!=$date
&&strtotime($date)>self::$arrUnSettlementList[$admin_id]) {
return false;
}
//当月离职时间在职时间小于30天不结算
if (self::$arrUnSettlementList[$admin_id]
&&date("Y-m",self::$arrUnSettlementList[$admin_id])==$date
&&(strtotime(date("Y-m-t",strtotime($date)))-self::$arrUnSettlementList[$admin_id])<86400*30) {
return false;
}
return true;
}
public function leaveTiming() {
}
}

@ -2785,3 +2785,7 @@ ADD COLUMN `apply_admin_id` int(11) NOT NULL DEFAULT 0 COMMENT '申請管理員I
ALTER TABLE `tab_society_info`
ADD COLUMN `sociaty_level` tinyint(2) NOT NULL DEFAULT 0 COMMENT '公会等级 1S 2A 3B 4其他 ' AFTER `create_account`;
ALTER TABLE `sys_ucenter_member`
ADD COLUMN `apply_leave_time` int(11) NOT NULL DEFAULT 0 COMMENT '申请离职时间' AFTER `work_status`,
ADD COLUMN `leave_time` int(11) NOT NULL DEFAULT 0 COMMENT '离职时间' AFTER `apply_leave_time`;
Loading…
Cancel
Save