Merge pull request '优化' (#390) from hotfix/remove_promote_package into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/390
master
廖金灵 3 years ago
commit 84a6b21f88

@ -1621,7 +1621,7 @@ function getGameList($partner_id) {
function getAdminData ($uid) { function getAdminData ($uid) {
$adminData = SM('auth_group_access','sys_') $adminData = SM('auth_group_access','sys_')
->field('data_empower_type,data_president,show_data,show_market_admin,show_promote') ->field('data_empower_type,data_president,show_data,show_market_admin,show_promote,allow_over_week')
->join('left join sys_auth_group on sys_auth_group_access.group_id=sys_auth_group.id') ->join('left join sys_auth_group on sys_auth_group_access.group_id=sys_auth_group.id')
->where(array('uid'=>$uid))->find(); ->where(array('uid'=>$uid))->find();
@ -1697,6 +1697,9 @@ function resetUserAuth()
$userAuth['data_empower_type'] = $adminData['data_empower_type']; $userAuth['data_empower_type'] = $adminData['data_empower_type'];
$userAuth['data_president'] = $adminData['data_president']; $userAuth['data_president'] = $adminData['data_president'];
$userAuth['show_data'] = $adminData['show_data']; $userAuth['show_data'] = $adminData['show_data'];
$userAuth['show_market_admin'] = $adminData['show_market_admin'];
$userAuth['allow_over_week'] = $adminData['allow_over_week'];
$userAuth['show_promote'] = $adminData['show_promote'];
session('user_group_id',$groupId); session('user_group_id',$groupId);
session('user_auth', $userAuth); session('user_auth', $userAuth);
session('user_auth_sign', data_auth_sign($userAuth)); session('user_auth_sign', data_auth_sign($userAuth));

@ -529,7 +529,7 @@ class AuthManagerController extends AdminController{
$auth_group = M('AuthGroup')->where( array('status'=>array('egt','0'),'module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) ) $auth_group = M('AuthGroup')->where( array('status'=>array('egt','0'),'module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) )
->getfield('id,id,title,rules'); ->getfield('id,id,title,rules');
// var_dump($auth_group);die(); // var_dump($auth_group);die();
$empower_type = M('AuthGroup')->field('data_empower_type,show_data,show_market_admin,show_promote')->where(array('id'=>$_GET['group_id']))->find(); $empower_type = M('AuthGroup')->field('data_empower_type,show_data,show_market_admin,show_promote,allow_over_week')->where(array('id'=>$_GET['group_id']))->find();
// var_dump($empower_type);die(); // var_dump($empower_type);die();
$this->assign('data_empower_type', $empower_type['data_empower_type']); $this->assign('data_empower_type', $empower_type['data_empower_type']);
@ -537,6 +537,7 @@ class AuthManagerController extends AdminController{
$this->assign('auth_group', $auth_group); $this->assign('auth_group', $auth_group);
$this->assign('show_market_admin', $empower_type['show_market_admin']); $this->assign('show_market_admin', $empower_type['show_market_admin']);
$this->assign('show_promote', $empower_type['show_promote']); $this->assign('show_promote', $empower_type['show_promote']);
$this->assign('allow_over_week', $empower_type['allow_over_week']);
$this->display(); $this->display();
} }
@ -547,6 +548,7 @@ class AuthManagerController extends AdminController{
$data_empower_type = I('data_empower_type'); $data_empower_type = I('data_empower_type');
$show_data = I('show_data'); $show_data = I('show_data');
$show_market_admin = I('show_market_admin'); $show_market_admin = I('show_market_admin');
$allow_over_week = I('allow_over_week');
$show_promote = I('show_promote'); $show_promote = I('show_promote');
$promoteData = I('promote_data'); $promoteData = I('promote_data');
@ -577,6 +579,7 @@ class AuthManagerController extends AdminController{
'data_president' => $promoteData, 'data_president' => $promoteData,
'show_data' => $show_data, 'show_data' => $show_data,
'show_market_admin' => $show_market_admin, 'show_market_admin' => $show_market_admin,
'allow_over_week' => $allow_over_week,
'show_promote' => $show_promote, 'show_promote' => $show_promote,
))) { ))) {

@ -127,6 +127,11 @@ class MendController extends ThinkController {
$service = new MendService(); $service = new MendService();
try { try {
if (session('user_auth')['allow_over_week'] && $params['allow_over_week'] == 1) {
$params['allow_over_week'] = 1;
} else {
$params['allow_over_week'] = 0;
}
$service->addMendTask($params); $service->addMendTask($params);
$userData = M('user','tab_')->field(['account', 'promote_id', 'promote_account'])->where(['id' => $params['user_id']])->find(); $userData = M('user','tab_')->field(['account', 'promote_id', 'promote_account'])->where(['id' => $params['user_id']])->find();
@ -136,7 +141,8 @@ class MendController extends ThinkController {
'key' => $userData['account'].'/'.$userData['promote_account'].'/'.$promoteToData['account'], 'key' => $userData['account'].'/'.$userData['promote_account'].'/'.$promoteToData['account'],
'op_name' => '编辑推广补链', 'op_name' => '编辑推广补链',
'url' => U('Mend/edit', ['id' => $userData['id']]), 'url' => U('Mend/edit', ['id' => $userData['id']]),
'menu' => '推广员-推广员管理-推广补链-编辑推广补链' 'menu' => '推广员-推广员管理-推广补链-编辑推广补链',
'content' => json_encode($params)
]); ]);
$this->success('补链成功', U('lists'), 2); $this->success('补链成功', U('lists'), 2);
@ -157,8 +163,7 @@ class MendController extends ThinkController {
$this->m_title = '推广补链'; $this->m_title = '推广补链';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find()); $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Mend/lists','status'=>1])->find());
$this->assign('allow_over_week', session('user_auth')['allow_over_week']);
$this->display(); $this->display();
} }
} }
@ -264,7 +269,7 @@ class MendController extends ThinkController {
{ {
$id = I('id'); $id = I('id');
$info = M("mend", 'tab_')->where("id = {$id} and status = 0")->find(); $info = M("mend", 'tab_')->where("id = {$id} and status = 0")->find();
if(empty($mend)){ if(empty($info)){
$this->error("补链不存在或已处理"); $this->error("补链不存在或已处理");
} }
$info['order_time'] = date("Y-m-d",$info['order_time']); $info['order_time'] = date("Y-m-d",$info['order_time']);

@ -81,6 +81,7 @@ class MemberModel extends Model {
'data_president'=>$adminData['data_president'], 'data_president'=>$adminData['data_president'],
'show_data'=>$adminData['show_data'], 'show_data'=>$adminData['show_data'],
'show_market_admin'=>$adminData['show_market_admin'], 'show_market_admin'=>$adminData['show_market_admin'],
'allow_over_week' => $adminData['allow_over_week'],
'show_promote'=>$adminData['show_promote'], 'show_promote'=>$adminData['show_promote'],
); );
session('user_group_id',$groupId); session('user_group_id',$groupId);

@ -113,6 +113,23 @@
</td> </td>
</tr> </tr>
<tr>
<td class="l noticeinfo" style="padding-left: 15px;">是否允许跨周补链:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="allow_over_week"
<if condition="$allow_over_week==1"> checked </if>> 是
</label>
<label>
<input type="radio" class="inp_radio" value="0" name="allow_over_week"
<if condition="$allow_over_week==0"> checked </if>> 否
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

@ -90,6 +90,22 @@
<input type="text" name="order_time" autocomplete="off" class="date" value="{:I('order_time')}" placeholder="订单日期" /> <input type="text" name="order_time" autocomplete="off" class="date" value="{:I('order_time')}" placeholder="订单日期" />
</td> </td>
</tr> </tr>
<if condition="$allow_over_week==1">
<tr>
<td class="l noticeinfo">是否跨周补链:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label>
<input type="radio" class="inp_radio" value="1" name="allow_over_week">
</label>
<label>
<input type="radio" class="inp_radio" value="0" name="allow_over_week" checked>
</label>
</span>
<span class="notice-text"></span>
</td>
</tr>
</if>
<tr> <tr>
<td class="l noticeinfo">备注</td> <td class="l noticeinfo">备注</td>
<td class="r table_radio"> <td class="r table_radio">

@ -17,9 +17,9 @@ class MendService
public function addMendTask($params, $permPromote = null, $handlePromote = null) public function addMendTask($params, $permPromote = null, $handlePromote = null)
{ {
$userId = $params['user_id'] ?? 0; $userId = $params['user_id'] ?? 0;
$remark = $params['remark'] ?? '';
$orderTime = $params['order_time'] ?? ''; $orderTime = $params['order_time'] ?? '';
$toPromoteId = $params['promote_id_to'] ?? ''; $toPromoteId = $params['promote_id_to'] ?? '';
$allowOverWeek = $params['allow_over_week'] ?? 0;
$promoteService = new PromoteService(); $promoteService = new PromoteService();
if ($toPromoteId == -1) { if ($toPromoteId == -1) {
@ -51,11 +51,11 @@ class MendService
} }
} }
if ($this->checkOrderTime(strtotime($orderTime))) { if (!$allowOverWeek && !$this->checkOrderTime(strtotime($orderTime))) {
throw new \Exception('仅能补链本周数据,请重新选择补链时间'); throw new \Exception('仅能补链本周数据,请重新选择补链时间');
} }
if ($this->checkPromote(strtotime($orderTime), $user['account'])) { if (!$this->checkPromote(strtotime($orderTime), $user['account'])) {
throw new \Exception('在订单日期内含有多个推广员,无法补链'); throw new \Exception('在订单日期内含有多个推广员,无法补链');
} }
@ -87,18 +87,18 @@ class MendService
$checktime = strtotime("$sdefaultDate -" . ($w ? $w - $first : 6) .' days'); //本周开始时间 $checktime = strtotime("$sdefaultDate -" . ($w ? $w - $first : 6) .' days'); //本周开始时间
if($orderTime >= $checktime){ if($orderTime >= $checktime){
//在本周允许换绑 //在本周允许换绑
return false; return true;
} }
return true; return false;
} }
private function checkPromote($orderTime, $account) private function checkPromote($orderTime, $account)
{ {
$res = M('Spend','tab_')->field('promote_id')->where(['pay_time' => array('EGT', $orderTime), 'user_account' => $account])->group('promote_id')->select(); $res = M('Spend','tab_')->field('promote_id')->where(['pay_time' => array('EGT', $orderTime), 'user_account' => $account])->group('promote_id')->select();
if(count($res)>1) { if(count($res) > 1) {
return true; return false;
} }
return false; return true;
} }
} }

@ -2833,4 +2833,6 @@ ADD COLUMN `status` tinyint(1) NULL DEFAULT 0 COMMENT '退款状态' AFTER `crea
ADD COLUMN `check_time` int(11) NULL DEFAULT 0 COMMENT '确认时间' AFTER `status`; ADD COLUMN `check_time` int(11) NULL DEFAULT 0 COMMENT '确认时间' AFTER `status`;
ALTER TABLE `tab_spend_refund` ALTER TABLE `tab_spend_refund`
ADD COLUMN `admin` varchar(50) NULL DEFAULT '' COMMENT '操作人' AFTER `check_time`; ADD COLUMN `admin` varchar(50) NULL DEFAULT '' COMMENT '操作人' AFTER `check_time`;
alter table sys_auth_group add column `allow_over_week` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否允许跨周补链' after show_promote;
Loading…
Cancel
Save