You've already forked qlg.tsgz.moe
							
							Merge remote-tracking branch 'origin/master'
This commit is contained in:
		| @@ -21,12 +21,12 @@ class UserVouchers extends Base{ | ||||
| 		//应释放总额 | ||||
| 		$toPaySum = $payFast + $paySlow; | ||||
| 		Db::startTrans(); | ||||
| 		try{             | ||||
| 		try{ | ||||
|             $m = Model('common/Table'); | ||||
|             $m->setTable('user_vouchers_summary');   | ||||
|             $m->setTable('user_vouchers_summary'); | ||||
|             if(1 == date('j')){ | ||||
|                 //每月损耗 | ||||
|                 $monthScale = round((100-dataConf('couponsNextMonthInitSacle'))*0.01,2);                | ||||
|                 $monthScale = round((100-dataConf('couponsNextMonthInitSacle'))*0.01,2); | ||||
|                 $giveList = $m->getList([],'id, userId, expectedProductNum, expectedCouponsNum'); | ||||
|                 foreach ($giveList as &$g) { | ||||
|                     if($g['expectedProductNum'] > 0){ | ||||
| @@ -38,7 +38,7 @@ class UserVouchers extends Base{ | ||||
|                         $this->insertVouchersNotice($g['userId'],0,0,$decNum,$desc='预获优惠券月耗损',0,1); | ||||
|                     } | ||||
|                 } | ||||
|             }         | ||||
|             } | ||||
|             $where['isDisabled'] = 0; | ||||
|             //总预获产品券 | ||||
|             $allPreProduct = $m->getSum($where,'expectedProductNum'); | ||||
| @@ -128,7 +128,7 @@ class UserVouchers extends Base{ | ||||
|                 $data['isGive'] = 1; | ||||
|     			$data['giveDate'] = $time; | ||||
|     			$data['giveDay'] = $v['giveDay'] + 1; | ||||
|     			$m->updateInfo(['id'=>$v['id']],$data); | ||||
|                 Db::name('user_vouchers_summary')->where(['id'=>$v['id']])->update($data); | ||||
|     		} | ||||
|             Db::commit(); | ||||
|             Db::startTrans(); | ||||
| @@ -136,18 +136,16 @@ class UserVouchers extends Base{ | ||||
|             // A、当“助购预获”值为负数时,每天0.1%耗损在“预获产品券”值扣减。 | ||||
|             // B、当“预获产品券”值为负数时,每天0.1%耗损在“预获优惠券”值扣减。 | ||||
|             // C、当“助购预获”值和“预获产品券”值同为负数时,每天0.1%耗损在“预获优惠券”值同时扣减。 | ||||
|             $vm = Model('common/Table'); | ||||
|             $vm->setTable('user_vouchers_summary'); | ||||
|             $data = $vm->whereOr(["helpSaleNum"=>["lt", 0]])->whereOr(["expectedProductNum"=>["lt", 0]])->select(); | ||||
|             $data = Db::name('user_vouchers_summary')->whereOr(["helpSaleNum"=>["lt", 0]])->whereOr(["expectedProductNum"=>["lt", 0]])->select(); | ||||
|             foreach ($data as $_each){ | ||||
|                 if($_each["expectedProductNum"]<0){ | ||||
|                     $count = (float)$_each["expectedProductNum"]; | ||||
|                     if($_each["helpSaleNum"] < 0)$count+=(float)$_each["helpSaleNum"]; | ||||
|                     $this->insertVouchersNotice($_each["userId"], 0, 0, $count*((float)dataConf("deductionRateWhennegPreCoupons")/100), | ||||
|                     model('common/UserVouchers')->insertVouchersNotice($_each["userId"], 0, 0, $count*((float)dataConf("deductionRateWhennegPreCoupons")/100), | ||||
|                         "预获产品券为负,每天耗损预获优惠券", 0); | ||||
|                 }else{ | ||||
|                     $count = (float)$_each["helpSaleNum"]; | ||||
|                     $this->insertVouchersNotice($_each["userId"], 0, $count*((float)dataConf("deductionRateWhennegPreCoupons")/100), | ||||
|                     model('common/UserVouchers')->insertVouchersNotice($_each["userId"], 0, $count*((float)dataConf("deductionRateWhennegPreCoupons")/100), | ||||
|                         0, "助购预获为负,每天耗损预获产品券", 0); | ||||
|                 } | ||||
|             } | ||||
| @@ -177,8 +175,7 @@ class UserVouchers extends Base{ | ||||
|             $m->insertInfo(['targetType'=>0,'targetId'=>$userId,'dataSrc'=>1,'money'=>$alreadyProductNum,'moneyName'=>1,'remark'=>$desc,'moneyType'=>$isAdd,'payType'=>'qlgpay','createTime'=>date('Y/m/d H:i:s')]); | ||||
|         } | ||||
|     	if($alreadyCouponsNum>0){ | ||||
|             $m->insertInfo(['targetType'=>0,'targetId'=>$userId,'dataSrc'=>1,'money'=>$alreadyProductNum,'moneyName'=>2,'remark'=>$desc,'moneyType'=>$isAdd,'payType'=>'qlgpay','createTime'=>date('Y/m/d H:i:s')]); | ||||
|  | ||||
|             $m->insertInfo(['targetType'=>0,'targetId'=>$userId,'dataSrc'=>1,'money'=>$alreadyCouponsNum,'moneyName'=>2,'remark'=>$desc,'moneyType'=>$isAdd,'payType'=>'qlgpay','createTime'=>date('Y/m/d H:i:s')]); | ||||
|         } | ||||
|     	//插入或更新详细表 | ||||
|     	$m->setTable('users'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user