新增补链时判断是否已结算

master
chenzhi 5 years ago
parent 1ccbd03a0f
commit 60c7bdce34

@ -13,7 +13,7 @@ class MemberController extends ThinkController
*/ */
public function user_info($p=0){ public function user_info($p=0){
//设定默认时间 //设定默认时间
if(!array_key_exists("time_start",$_REQUEST)){ if(!array_key_exists("time_start",$_REQUEST) && I('type') != 2){
$this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d'))); $this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d')));
} }
//基础信息 //基础信息

@ -115,6 +115,12 @@ class MendController extends ThinkController {
if ($_POST['order_time'] == '') { if ($_POST['order_time'] == '') {
$this->error('没有订单日期'); $this->error('没有订单日期');
} }
//判断是否已经结算
if(self::checkSettlement(strtotime($_POST['order_time']),$_POST['promote_id'])){
$this->error('在订单日期内含有已经结算的订单,无法补链');
}
$create = $_REQUEST; $create = $_REQUEST;
$create['order_time'] = date($create['order_time']); $create['order_time'] = date($create['order_time']);
$params = array( $params = array(
@ -150,6 +156,29 @@ class MendController extends ThinkController {
$this->display(); $this->display();
} }
} }
private function checkSettlement($order_time,$prmoote_id)
{
//判断是否已经结算
//获取会长信息
$Promote = M('promote','tab_');
$prmootedata = $Promote->field('chain')->find($prmoote_id);
$chain = trim($prmootedata['chain'], '/');
if ($chain == '') {
$prmoote_id = 0;
} else {
$prmoote_id = explode('/', $chain)[0];
}
$jsres = M("Settlement","tab_")->where(array(
"total_money"=>array("GT",0),
"starttime"=>array("ELT",$order_time),
"endtime"=>array("EGT",$order_time),
"promote_id"=>$prmoote_id
))->find();
if($jsres) return true;
return false;
# code...
}
//补链详情 //补链详情
public function shiftInfo() public function shiftInfo()
{ {

Loading…
Cancel
Save