Merge pull request 'mkm' (#34) from mkm into dev

Reviewed-on: #34
This commit is contained in:
mkm 2023-09-08 18:30:30 +08:00
commit 71c56c0718
4 changed files with 26 additions and 23 deletions

View File

@ -12,17 +12,12 @@ class RemoteController extends BaseApiController
public array $notNeedLogin = ['index']; public array $notNeedLogin = ['index'];
public function shang_date_total_price($company,$isDay=1,$arr=[],$template_id=0) public function shang_date_total_price($company,$arr=[],$template_id=0)
{ {
if($isDay==1){
$start_time = date('Y-m-d'); $start_time = date('Y-m-d');
$time=strtotime($start_time)+86399; $time=strtotime($start_time)+86399;
$end_time=date('Y-m-d H:i:s',$time); $end_time=date('Y-m-d H:i:s',$time);
}else{
$start_time = date('Y-m-d',strtotime('-1 day', time()));
$time=strtotime($start_time)+86399;
$end_time=date('Y-m-d H:i:s',$time);
}
if(isset($arr['start_time']) && $arr['end_time']){ if(isset($arr['start_time']) && $arr['end_time']){
$start_time = $arr['start_time']; $start_time = $arr['start_time'];
$end_time = $arr['end_time']; $end_time = $arr['end_time'];

View File

@ -45,7 +45,6 @@ class TaskController extends BaseApiController
$param['end_time']=date('Y-m-d H:i:s',$end); $param['end_time']=date('Y-m-d H:i:s',$end);
$where[] = ['start_time', 'between', [$time, $end]]; $where[] = ['start_time', 'between', [$time, $end]];
} }
} }
if (isset($param['status']) && $param['status'] > 0) { if (isset($param['status']) && $param['status'] > 0) {
$where[] = ['status', '=', $param['status']]; $where[] = ['status', '=', $param['status']];
@ -58,8 +57,9 @@ class TaskController extends BaseApiController
foreach ($res as $k => $item) { foreach ($res as $k => $item) {
if ($item['type'] == 33) { if ($item['type'] == 33) {
$company = Company::where('id', $item['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade,responsible_area')->find(); // 可能要判断预存金是否满足 $company = Company::where('id', $item['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade,responsible_area')->find(); // 可能要判断预存金是否满足
$find = App(RemoteController::class)->shang_date_total_price($company,1,$param,$item['template_id']); $find = App(RemoteController::class)->shang_date_total_price($company,$param,$item['template_id']);
if ($find != false) { if ($find != false) {
if($time<time()){
$transaction_pool=TaskTemplate::where('id',$item['template_id'])->value('transaction_pool'); $transaction_pool=TaskTemplate::where('id',$item['template_id'])->value('transaction_pool');
if($transaction_pool==0){ if($transaction_pool==0){
$find['transaction_pool']=0; $find['transaction_pool']=0;
@ -67,7 +67,8 @@ class TaskController extends BaseApiController
$find['transaction_pool']=$transaction_pool; $find['transaction_pool']=$transaction_pool;
} }
$res[$k]['extend']['transaction'] = $find; $res[$k]['extend']['transaction'] = $find;
Task::where('id',$item['id'])->update(['extend'=>json_encode(['transaction'=>$find],true)]); }
// Task::where('id',$item['id'])->update(['extend'=>json_encode(['transaction'=>$find],true)]);
} else { } else {
$res[$k]['extend']['transaction'] = ''; $res[$k]['extend']['transaction'] = '';
} }

View File

@ -16,14 +16,16 @@ namespace app\api\lists;
use app\common\enum\user\AccountLogEnum; use app\common\enum\user\AccountLogEnum;
use app\common\model\user\UserAccountLog; use app\common\model\user\UserAccountLog;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig\Sum;
use app\common\lists\ListsExtendInterface;
use app\common\lists\ListsSearchInterface;
/** /**
* 账户流水列表 * 账户流水列表
* Class AccountLogLists * Class AccountLogLists
* @package app\shopapi\lists * @package app\shopapi\lists
*/ */
class AccountLogLists extends BaseApiDataLists class AccountLogLists extends BaseApiDataLists implements ListsExtendInterface
{ {
/** /**
@ -79,16 +81,20 @@ class AccountLogLists extends BaseApiDataLists
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->select() ->select()
->toArray(); ->toArray();
foreach ($lists as &$item) { foreach ($lists as &$item) {
$item['type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']); $item['type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
$symbol = $item['action'] == AccountLogEnum::DEC ? '-' : '+'; $symbol = $item['action'] == AccountLogEnum::DEC ? '-' : '+';
$item['change_amount_desc'] = $symbol . $item['change_amount']; $item['change_amount_desc'] = $symbol . $item['change_amount'];
} }
return $lists; return $lists;
} }
public function extend(){
$deposit=UserAccountLog::where($this->queryWhere())->where('change_type',203)->sum('change_amount');
$user_money=UserAccountLog::where($this->queryWhere())->where('change_type',202)->sum('change_amount');
return ['deposit'=>$deposit,'user_money'=>$user_money];
}
/** /**
* @notes 获取数量 * @notes 获取数量

View File

@ -74,6 +74,7 @@ class TaskLogic extends BaseLogic
public static function CronAdd(array $v, $datas): bool public static function CronAdd(array $v, $datas): bool
{ {
try { try {
$v['day_count']=$v['day_count']+1;
if ($v['types'] == 3) { if ($v['types'] == 3) {
$task = Task::where('template_id', $v['id'])->find(); $task = Task::where('template_id', $v['id'])->find();
if ($task) { if ($task) {