限制两个会长推广某款游戏

master
elf 3 years ago
parent 9582f96b92
commit 4fe33c546f

@ -1206,7 +1206,7 @@ class PromoteService {
return array_unique(array_merge($historyGameIds, $nowGameIds)); return array_unique(array_merge($historyGameIds, $nowGameIds));
} }
public function checkPromoteLimitRule($promote) public function checkPromoteLimitRule($promote, $gameId = 0)
{ {
$accountString = 'wangshuai1,ouyangtianlin,zhangjiayuan02,zhangchuang,huangjian,lixiaojie01,youjinbo01,laijiansen,liutao001,huangdonyu,huangwenlu,qiujinwei,qiucanlon,panhailang,linzilun,xuechonbiao,chenfayun01,pengjun,shenyanwei,wusiju,kechengwei,linruidong,huzhoujian,linzelong,linwei1,zhanghanying,xushiming,linxuchen,zhengchengzhi,yaokaijie,wengyongbang,liaofaqian,zhangqing,liaojunwei,zhangming,zhaoxiaoyi01,zhongkaixin,zhangkaiyu,linwei01,dukunpeng,zhengjianzhou,wengshouxiong,caizhenxing,xiuguanxin,suyuelong,guozhijie,chenzhenghao,zhongyouling,linjian,xuwenye,zhengjinhe,huangyongqing,wangqiaozhen,jiangweihao,lijianfeng01,shaowenhui,huangyuhang,lianglingui,baoxiaohui,heyuming,linwanxi,jiangnan,ouzhijie,liguangcai,lican1,caiwenxin,xianggengyu,songzhibin,jinweiyuan,chenyixing,zhangxiang,denglan,yejiehui,wangbencai,huangzhenhon,liumeifu,xuliuyang,zhengmingquan,huangshengguang,liuweihuang,lixuemeng,xurongcheng,chenzhuo,caixiaodong,linhui,luwenjie,huangyonghao,xuguojin,ningyi01,zhouchongliang,chenshigang,chenyangwen,lijiayu,lanhua,zuojingjing,zhangxingliang,huangxinyu,pujianhao,zhengdongwei,xueyiqiang,lijiawei,tongqiang,huangxirui,wangjinfu,linhao01,chenlinzhi,zengjiawei,lijunjie01,xuwei01,diaowenfeng,guoyinzhen,chenzongda,luwujun,hongye,yangdegao,hehaiwei,zhangyutao,zhengxinyao,wangjunqi,wuyuze,linzejun,yangyunfeng,huangxiaojia,linqianyun,liyao01,huangkai,aihu01,wangshuai,zhangjiayuan01,youjinbo,zhangjiayuan,wengshouxion,ningyi'; $accountString = 'wangshuai1,ouyangtianlin,zhangjiayuan02,zhangchuang,huangjian,lixiaojie01,youjinbo01,laijiansen,liutao001,huangdonyu,huangwenlu,qiujinwei,qiucanlon,panhailang,linzilun,xuechonbiao,chenfayun01,pengjun,shenyanwei,wusiju,kechengwei,linruidong,huzhoujian,linzelong,linwei1,zhanghanying,xushiming,linxuchen,zhengchengzhi,yaokaijie,wengyongbang,liaofaqian,zhangqing,liaojunwei,zhangming,zhaoxiaoyi01,zhongkaixin,zhangkaiyu,linwei01,dukunpeng,zhengjianzhou,wengshouxiong,caizhenxing,xiuguanxin,suyuelong,guozhijie,chenzhenghao,zhongyouling,linjian,xuwenye,zhengjinhe,huangyongqing,wangqiaozhen,jiangweihao,lijianfeng01,shaowenhui,huangyuhang,lianglingui,baoxiaohui,heyuming,linwanxi,jiangnan,ouzhijie,liguangcai,lican1,caiwenxin,xianggengyu,songzhibin,jinweiyuan,chenyixing,zhangxiang,denglan,yejiehui,wangbencai,huangzhenhon,liumeifu,xuliuyang,zhengmingquan,huangshengguang,liuweihuang,lixuemeng,xurongcheng,chenzhuo,caixiaodong,linhui,luwenjie,huangyonghao,xuguojin,ningyi01,zhouchongliang,chenshigang,chenyangwen,lijiayu,lanhua,zuojingjing,zhangxingliang,huangxinyu,pujianhao,zhengdongwei,xueyiqiang,lijiawei,tongqiang,huangxirui,wangjinfu,linhao01,chenlinzhi,zengjiawei,lijunjie01,xuwei01,diaowenfeng,guoyinzhen,chenzongda,luwujun,hongye,yangdegao,hehaiwei,zhangyutao,zhengxinyao,wangjunqi,wuyuze,linzejun,yangyunfeng,huangxiaojia,linqianyun,liyao01,huangkai,aihu01,wangshuai,zhangjiayuan01,youjinbo,zhangjiayuan,wengshouxion,ningyi';
$accounts = explode(',', $accountString); $accounts = explode(',', $accountString);
@ -1215,6 +1215,13 @@ class PromoteService {
} }
$topPromote = $this->getTopPromote($promote); $topPromote = $this->getTopPromote($promote);
if (in_array($topPromote['account'], ['zhangle', 'changwanwl'])) {
if (in_array($gameId, [293, 294])) {
return false;
}
}
$rule = M('promote_limit_rules', 'tab_')->where(['promote_id' => $topPromote['id']])->order('created_at desc')->limit(1)->find(); $rule = M('promote_limit_rules', 'tab_')->where(['promote_id' => $topPromote['id']])->order('created_at desc')->limit(1)->find();
if ($rule) { if ($rule) {
if ($rule['started_at'] === null && $rule['ended_at'] === null) { if ($rule['started_at'] === null && $rule['ended_at'] === null) {

@ -2008,13 +2008,13 @@ class GameController extends BaseController
]); ]);
} }
$promoteService = new PromoteService(); try {
if (!$promoteService->isPresidentAccess($promote)) { $this->checkPromoteGameUrl($promote, $gameId);
} catch (\Exception $e) {
$this->ajaxReturn([ $this->ajaxReturn([
'status' => 0, 'status' => 0,
'message' => '请联系市场专员开启', 'message' => $e->getMessage(),
'data' => [ 'data' => []
]
]); ]);
} }
@ -2061,13 +2061,13 @@ class GameController extends BaseController
]); ]);
} }
$promoteService = new PromoteService(); try {
if (!$promoteService->isPresidentAccess($promote)) { $this->checkPromoteGameUrl($promote, $gameId);
} catch (\Exception $e) {
$this->ajaxReturn([ $this->ajaxReturn([
'status' => 0, 'status' => 0,
'message' => '请联系市场专员开启', 'message' => $e->getMessage(),
'data' => [ 'data' => []
]
]); ]);
} }
@ -2093,4 +2093,20 @@ class GameController extends BaseController
] ]
]); ]);
} }
public function checkPromoteGameUrl($promote, $gameId)
{
$promoteService = new PromoteService();
if (!$promoteService->isPresidentAccess($promote)) {
throw new \Exception('请联系市场专员开启');
}
$topPromote = $promoteService->getTopPromote($promote);
if (in_array($topPromote['account'], ['zhangle', 'changwanwl'])) {
if (in_array($gameId, [293, 294])) {
throw new \Exception('不能推广该游戏');
}
}
}
} }

@ -213,7 +213,7 @@ class HomeController extends Controller
} }
$promoteService = new PromoteService(); $promoteService = new PromoteService();
if (!$promoteService->checkPromoteLimitRule($promote)) { if (!$promoteService->checkPromoteLimitRule($promote, $gameId)) {
$this->error('链接已失效'); $this->error('链接已失效');
} }

@ -65,7 +65,7 @@ class PackageController extends Controller
} }
$promoteService = new PromoteService(); $promoteService = new PromoteService();
if (!$promoteService->checkPromoteLimitRule($promote)) { if (!$promoteService->checkPromoteLimitRule($promote, $gameId)) {
$this->error('链接已失效'); $this->error('链接已失效');
} }

@ -213,7 +213,7 @@ class HomeController extends Controller
} }
$promoteService = new PromoteService(); $promoteService = new PromoteService();
if (!$promoteService->checkPromoteLimitRule($promote)) { if (!$promoteService->checkPromoteLimitRule($promote, $gameId)) {
$this->error('链接已失效'); $this->error('链接已失效');
} }

Loading…
Cancel
Save