|
|
@@ -131,7 +131,6 @@ class BonusSend extends BaseObject {
|
|
|
public function putFakeOrder() {
|
|
|
echo('开始处理-假订单' . PHP_EOL);
|
|
|
$fakeOrder= Order::find()->where(['PERIOD_NUM'=>$this->_periodNum, 'IS_AUTO'=>'1'])->asArray()->all();
|
|
|
-// print_r($fakeOrder);exit;
|
|
|
foreach($fakeOrder as $fOrder){
|
|
|
$oRemainPv=RemainPv::findOne(["USER_ID"=>$fOrder['USER_ID']]);
|
|
|
$transactionRemain = \Yii::$app->db->beginTransaction();
|
|
|
@@ -412,7 +411,8 @@ class BonusSend extends BaseObject {
|
|
|
echo sprintf("时间:[%s]数据库发奖,当前page为:【%s】" . PHP_EOL, date('Y-m-d H:i:s', time()), $page);
|
|
|
$periodNum = $this->_periodNum;
|
|
|
// 从奖金结算表中获取当期未发放的所有数据
|
|
|
- $allData = CalcBonus::findUseDbCalc()
|
|
|
+// $allData = CalcBonus::findUseDbCalc()
|
|
|
+ $allData = CalcBonus::find()
|
|
|
->yearMonth($this->_calcYearMonth)
|
|
|
->where(
|
|
|
'(IS_SENT=0 OR IS_SENT=2) AND CALC_MONTH=:CALC_MONTH AND PERIOD_NUM=:PERIOD_NUM',
|
|
|
@@ -564,7 +564,8 @@ class BonusSend extends BaseObject {
|
|
|
public function updateEmpLevel(int $offset = 0) {
|
|
|
if ($this->_isCalcMonth) {
|
|
|
$empLv = EmployLevel::getIdConvertLevelSortCache();
|
|
|
- $allData = CalcBonus::findUseDbCalc()
|
|
|
+// $allData = CalcBonus::findUseDbCalc()
|
|
|
+ $allData = CalcBonus::find()
|
|
|
->yearMonth($this->_calcYearMonth)
|
|
|
->where(
|
|
|
'CALC_MONTH=:CALC_MONTH AND PERIOD_NUM=:PERIOD_NUM',
|
|
|
@@ -621,7 +622,8 @@ class BonusSend extends BaseObject {
|
|
|
public function updateCrownLevel(int $offset = 0)
|
|
|
{
|
|
|
$starCrownLv = StarCrownLevel::getIdConvertLevelSortCache();
|
|
|
- $allData = CalcBonusQY::findUseDbCalc()
|
|
|
+// $allData = CalcBonusQY::findUseDbCalc()
|
|
|
+ $allData = CalcBonusQY::find()
|
|
|
->yearMonth($this->_calcYearMonth)
|
|
|
->where(
|
|
|
'CALC_MONTH=:CALC_MONTH AND PERIOD_NUM=:PERIOD_NUM',
|
|
|
@@ -743,15 +745,21 @@ class BonusSend extends BaseObject {
|
|
|
* @throws \yii\db\Exception
|
|
|
*/
|
|
|
public function updateUserPerf(int $offset = 0) {
|
|
|
- $allData = PerfPeriod::findUseDbCalc()->yearMonth($this->_calcYearMonth)->where('PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum])->orderBy('ID ASC')->offset($offset)->limit($this->_limit)->all();
|
|
|
+// $allData = PerfPeriod::findUseDbCalc()
|
|
|
+ $allData = PerfPeriod::find()
|
|
|
+ ->yearMonth($this->_calcYearMonth)->where('PERIOD_NUM=:PERIOD_NUM', [':PERIOD_NUM' => $this->_periodNum])->orderBy('ID ASC')->offset($offset)->limit($this->_limit)->all();
|
|
|
if ($allData) {
|
|
|
$transaction = Yii::$app->db->beginTransaction();
|
|
|
try {
|
|
|
foreach ($allData as $data) {
|
|
|
$isUpdate = false;
|
|
|
- if (UserPerf::findUseDbCalc()->where('USER_ID=:USER_ID', [':USER_ID' => $data['USER_ID']])->exists()) {
|
|
|
+// if (UserPerf::findUseDbCalc()
|
|
|
+ if (UserPerf::find()
|
|
|
+ ->where('USER_ID=:USER_ID', [':USER_ID' => $data['USER_ID']])->exists()) {
|
|
|
// 判断本期是否已经更新过业绩
|
|
|
- if (!UserPerfUpdate::findUseDbCalc()->yearMonth($this->_calcYearMonth)->where('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM', [':USER_ID' => $data['USER_ID'], ':PERIOD_NUM' => $this->_periodNum])->exists()) {
|
|
|
+// if (!UserPerfUpdate::findUseDbCalc()
|
|
|
+ if (!UserPerfUpdate::find()
|
|
|
+ ->yearMonth($this->_calcYearMonth)->where('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM', [':USER_ID' => $data['USER_ID'], ':PERIOD_NUM' => $this->_periodNum])->exists()) {
|
|
|
$isUpdate = true;
|
|
|
// 更新业绩
|
|
|
UserPerf::updateAll([
|
|
|
@@ -851,15 +859,21 @@ class BonusSend extends BaseObject {
|
|
|
if (!$this->_isCalcMonth) {
|
|
|
return true;
|
|
|
}
|
|
|
- $allData = PerfMonth::findUseDbCalc()->where('CALC_MONTH=:CALC_MONTH', [':CALC_MONTH' => $this->_calcYearMonth])->orderBy('ID ASC')->offset($offset)->limit($this->_limit)->all();
|
|
|
+// $allData = PerfMonth::findUseDbCalc()
|
|
|
+ $allData = PerfMonth::find()
|
|
|
+ ->where('CALC_MONTH=:CALC_MONTH', [':CALC_MONTH' => $this->_calcYearMonth])->orderBy('ID ASC')->offset($offset)->limit($this->_limit)->all();
|
|
|
if ($allData) {
|
|
|
$transaction = Yii::$app->db->beginTransaction();
|
|
|
try {
|
|
|
foreach ($allData as $data) {
|
|
|
$isUpdate = false;
|
|
|
- if (UserPerf::findUseDbCalc()->where('USER_ID=:USER_ID', [':USER_ID' => $data['USER_ID']])->exists()) {
|
|
|
+// if (UserPerf::findUseDbCalc()
|
|
|
+ if (UserPerf::find()
|
|
|
+ ->where('USER_ID=:USER_ID', [':USER_ID' => $data['USER_ID']])->exists()) {
|
|
|
// 判断本期是否已经更新过业绩
|
|
|
- if (!UserPerfMonthUpdate::findUseDbCalc()->where('USER_ID=:USER_ID AND CALC_MONTH=:CALC_MONTH', [':USER_ID' => $data['USER_ID'], ':CALC_MONTH' => $this->_calcYearMonth])->exists()) {
|
|
|
+// if (!UserPerfMonthUpdate::findUseDbCalc()
|
|
|
+ if (!UserPerfMonthUpdate::find()
|
|
|
+ ->where('USER_ID=:USER_ID AND CALC_MONTH=:CALC_MONTH', [':USER_ID' => $data['USER_ID'], ':CALC_MONTH' => $this->_calcYearMonth])->exists()) {
|
|
|
$isUpdate = true;
|
|
|
// 更新业绩
|
|
|
UserPerf::updateAll([
|
|
|
@@ -1091,7 +1105,9 @@ class BonusSend extends BaseObject {
|
|
|
* @throws \yii\db\Exception
|
|
|
*/
|
|
|
public function sendSmsLoop(int $offset = 0) {
|
|
|
- $allData = UserInfo::findUseDbCalc()->select('USER_ID,ALLOW_RECONSUME_SMS_TO')->where('ALLOW_RECONSUME_SMS=1')->offset($offset)->limit($this->_limit)->all();
|
|
|
+// $allData = UserInfo::findUseDbCalc()
|
|
|
+ $allData = UserInfo::find()
|
|
|
+ ->select('USER_ID,ALLOW_RECONSUME_SMS_TO')->where('ALLOW_RECONSUME_SMS=1')->offset($offset)->limit($this->_limit)->all();
|
|
|
if ($allData) {
|
|
|
$smsWallet = explode(",", $this->_sysConfig['smsWallet']['VALUE']);
|
|
|
$smsFee = $this->_sysConfig['smsFee']['VALUE'];
|