feat: add syj promote workflow
This commit is contained in:
23
pro_v3.5.1/app/dao/syj/PromoteAmountLogDao.php
Normal file
23
pro_v3.5.1/app/dao/syj/PromoteAmountLogDao.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\dao\syj;
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\syj\PromoteAmountLog;
|
||||
|
||||
class PromoteAmountLogDao extends BaseDao
|
||||
{
|
||||
protected function setModel(): string
|
||||
{
|
||||
return PromoteAmountLog::class;
|
||||
}
|
||||
|
||||
public function getUserList(int $uid, int $page, int $limit): array
|
||||
{
|
||||
$model = $this->getModel()->where('uid', $uid);
|
||||
$count = (clone $model)->count();
|
||||
$list = $model->order('add_time', 'desc')->page($page, $limit)->select()->toArray();
|
||||
return compact('list', 'count');
|
||||
}
|
||||
}
|
||||
15
pro_v3.5.1/app/dao/syj/PromoteRewardTriggerDao.php
Normal file
15
pro_v3.5.1/app/dao/syj/PromoteRewardTriggerDao.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\dao\syj;
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\syj\PromoteRewardTrigger;
|
||||
|
||||
class PromoteRewardTriggerDao extends BaseDao
|
||||
{
|
||||
protected function setModel(): string
|
||||
{
|
||||
return PromoteRewardTrigger::class;
|
||||
}
|
||||
}
|
||||
43
pro_v3.5.1/app/dao/syj/PromoteSettlementDao.php
Normal file
43
pro_v3.5.1/app/dao/syj/PromoteSettlementDao.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\dao\syj;
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\syj\PromoteSettlement;
|
||||
|
||||
class PromoteSettlementDao extends BaseDao
|
||||
{
|
||||
protected function setModel(): string
|
||||
{
|
||||
return PromoteSettlement::class;
|
||||
}
|
||||
|
||||
public function getUserList(int $uid, int $page, int $limit): array
|
||||
{
|
||||
$model = $this->getModel()->where('uid', $uid);
|
||||
$count = (clone $model)->count();
|
||||
$list = $model->order('add_time', 'desc')->page($page, $limit)->select()->toArray();
|
||||
return compact('list', 'count');
|
||||
}
|
||||
|
||||
public function getAdminList(array $where, int $page, int $limit): array
|
||||
{
|
||||
$model = $this->getModel()->alias('s')
|
||||
->leftJoin('user u', 'u.uid = s.uid')
|
||||
->leftJoin('syj_promote_task t', 't.id = s.task_id')
|
||||
->field('s.*,t.task_no,u.nickname,u.phone');
|
||||
if (isset($where['audit_status']) && $where['audit_status'] !== '') {
|
||||
$model = $model->where('s.audit_status', (int)$where['audit_status']);
|
||||
}
|
||||
if (!empty($where['settle_type'])) {
|
||||
$model = $model->where('s.settle_type', $where['settle_type']);
|
||||
}
|
||||
if (!empty($where['keyword'])) {
|
||||
$model = $model->where('t.task_no|u.nickname|u.phone|u.uid', 'like', '%' . $where['keyword'] . '%');
|
||||
}
|
||||
$count = (clone $model)->count();
|
||||
$list = $model->order('s.add_time', 'desc')->page($page, $limit)->select()->toArray();
|
||||
return compact('list', 'count');
|
||||
}
|
||||
}
|
||||
73
pro_v3.5.1/app/dao/syj/PromoteTaskDao.php
Normal file
73
pro_v3.5.1/app/dao/syj/PromoteTaskDao.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\dao\syj;
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\syj\PromoteTask;
|
||||
|
||||
class PromoteTaskDao extends BaseDao
|
||||
{
|
||||
protected function setModel(): string
|
||||
{
|
||||
return PromoteTask::class;
|
||||
}
|
||||
|
||||
public function getUserList(int $uid, array $where, int $page, int $limit): array
|
||||
{
|
||||
$model = $this->getModel()->where('uid', $uid);
|
||||
if (isset($where['status']) && $where['status'] !== '') {
|
||||
$model = $model->where('status', (int)$where['status']);
|
||||
}
|
||||
$count = (clone $model)->count();
|
||||
$list = $model->order('add_time', 'desc')->page($page, $limit)->select()->toArray();
|
||||
return compact('list', 'count');
|
||||
}
|
||||
|
||||
public function getAdminList(array $where, int $page, int $limit): array
|
||||
{
|
||||
$model = $this->getModel()->alias('t')
|
||||
->leftJoin('user u', 'u.uid = t.uid')
|
||||
->field('t.*,u.nickname,u.phone');
|
||||
if (!empty($where['keyword'])) {
|
||||
$keyword = '%' . $where['keyword'] . '%';
|
||||
$model = $model->where('t.task_no|t.source_order_no|u.nickname|u.phone|u.uid', 'like', $keyword);
|
||||
}
|
||||
if (isset($where['status']) && $where['status'] !== '') {
|
||||
$model = $model->where('t.status', (int)$where['status']);
|
||||
}
|
||||
if (isset($where['reward_trigger_status']) && $where['reward_trigger_status'] !== '') {
|
||||
$model = $model->where('t.reward_trigger_status', (int)$where['reward_trigger_status']);
|
||||
}
|
||||
if (!empty($where['start_time'])) {
|
||||
$model = $model->where('t.add_time', '>=', strtotime($where['start_time']));
|
||||
}
|
||||
if (!empty($where['end_time'])) {
|
||||
$model = $model->where('t.add_time', '<=', strtotime($where['end_time']) + 86399);
|
||||
}
|
||||
$count = (clone $model)->count();
|
||||
$list = $model->order('t.add_time', 'desc')->page($page, $limit)->select()->toArray();
|
||||
return compact('list', 'count');
|
||||
}
|
||||
|
||||
public function getEarliestActiveTask(int $uid): ?array
|
||||
{
|
||||
$row = $this->getModel()
|
||||
->where('uid', $uid)
|
||||
->where('status', 0)
|
||||
->order('add_time', 'asc')
|
||||
->lock(true)
|
||||
->find();
|
||||
return $row ? $row->toArray() : null;
|
||||
}
|
||||
|
||||
public function getCashoutAvailableTasks(int $uid): array
|
||||
{
|
||||
return $this->getModel()
|
||||
->where('uid', $uid)
|
||||
->where('status', 0)
|
||||
->whereBetween('progress_count', [1, 3])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
24
pro_v3.5.1/app/dao/syj/PromoteTaskRecordDao.php
Normal file
24
pro_v3.5.1/app/dao/syj/PromoteTaskRecordDao.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\dao\syj;
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\syj\PromoteTaskRecord;
|
||||
|
||||
class PromoteTaskRecordDao extends BaseDao
|
||||
{
|
||||
protected function setModel(): string
|
||||
{
|
||||
return PromoteTaskRecord::class;
|
||||
}
|
||||
|
||||
public function getTaskRecords(int $taskId, int $uid = 0): array
|
||||
{
|
||||
$model = $this->getModel()->where('task_id', $taskId);
|
||||
if ($uid > 0) {
|
||||
$model = $model->where('uid', $uid);
|
||||
}
|
||||
return $model->order('step_no', 'asc')->select()->toArray();
|
||||
}
|
||||
}
|
||||
21
pro_v3.5.1/app/dao/syj/PromoteUserAmountDao.php
Normal file
21
pro_v3.5.1/app/dao/syj/PromoteUserAmountDao.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\dao\syj;
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\syj\PromoteUserAmount;
|
||||
|
||||
class PromoteUserAmountDao extends BaseDao
|
||||
{
|
||||
protected function setModel(): string
|
||||
{
|
||||
return PromoteUserAmount::class;
|
||||
}
|
||||
|
||||
public function lockByUid(int $uid): ?array
|
||||
{
|
||||
$row = $this->getModel()->where('uid', $uid)->lock(true)->find();
|
||||
return $row ? $row->toArray() : null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user