AgentController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace addons\Agent\console\controllers;
  3. use addons\Agent\common\logic\reward\TeamAchievement;
  4. use yii\console\Controller;
  5. use addons\Agent\common\models\AgentDelayLog;
  6. use common\models\mall\Mall;
  7. class AgentController extends Controller
  8. {
  9. public function actionIndex()
  10. {
  11. //结算按月结算渠道业绩额外奖励
  12. $obj = new TeamAchievement();
  13. $obj->teamAchievementExtra();
  14. }
  15. // 延时结算,站内脚本
  16. public function actionDelay()
  17. {
  18. $mall_list = Mall::getEnableMallList(true);
  19. foreach ($mall_list as $mall) {
  20. $where['status'] = 0;
  21. $where['mall_id'] = $mall['id'];
  22. $agentDelayLogList = AgentDelayLog::find()->select('id,created_at,day_num,source_table_id,mall_id,order_no')->where($where)->orderBy('id asc');
  23. $nowTime = time();
  24. foreach ($agentDelayLogList->asArray()->batch(1000) as $item) {
  25. foreach($item as $v) {
  26. if($nowTime > $v['created_at'] + $v['day_num'] * 86400){
  27. $data['source_table_ids'] = $v['source_table_id'];
  28. $data['mall_id'] = $v['mall_id'];
  29. $data['order_no'] = $v['order_no'];
  30. (new \addons\Agent\common\logic\reward\DelayUnfrozen())->handle($data);
  31. }
  32. }
  33. }
  34. }
  35. }
  36. }