Merge pull request '更新api' (#12) from mkm into master

Reviewed-on: http://git.excellentkk.cn/mkm/TaskSystem/pulls/12
This commit is contained in:
mkm 2023-08-03 10:16:15 +08:00
commit 217826ef36
5 changed files with 28 additions and 19 deletions

View File

@ -80,11 +80,13 @@ class AccountLogController extends BaseApiController
} }
//公司日流水统计 //公司日流水统计
public function company_lists(){ public function company_lists()
return $this->dataLists(new AccountLogLists(),'company_lists'); {
return $this->success('ok',(new AccountLogLists())->company_lists());
} }
//公司月流水统计 //公司月流水统计
public function company_year_count(){ public function company_year_count()
return $this->dataLists(new AccountLogLists(),'company_year_count'); {
return $this->success('ok',(new AccountLogLists())->company_year_count());
} }
} }

View File

@ -40,7 +40,7 @@ class CompanyController extends BaseApiController
public function unsigned() public function unsigned()
{ {
$myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray(); $myCompany = Company::findOrEmpty($this->userInfo['company_id'])->toArray();
$query = Company::where(['street' => $myCompany['street'], 'company_type' => [17, 18]]); $query = Company::where(['street' => $myCompany['street'], 'company_type' => [17, 18],'is_contract'=>0]);
$count = $query->count(); $count = $query->count();
$companies = $query->select()->toArray(); $companies = $query->select()->toArray();
return $this->success('', ['count' => $count, 'data' => $companies]); return $this->success('', ['count' => $count, 'data' => $companies]);

View File

@ -102,12 +102,13 @@ class AccountLogLists extends BaseApiDataLists
*/ */
public function company_lists(): array public function company_lists(): array
{ {
$field = 'change_type,change_amount,action,create_time,remark'; $field = 'change_type,change_amount,action,create_time,remark,user_id';
$where=[ $where=[
'company_id'=>$this->params['company_id'] 'company_id'=>$this->params['company_id']
]; ];
$lists = UserAccountLog::field($field) $lists = UserAccountLog::field($field)
->where($where) ->where($where)
->with(['userInfo'])
->whereDay('create_time') ->whereDay('create_time')
->order('id', 'desc') ->order('id', 'desc')
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
@ -168,6 +169,7 @@ class AccountLogLists extends BaseApiDataLists
} }
} }
} }
$data[$k]['remark']='任务收益';
if(!isset($data[$k]['income'])||!isset($data[$k]['expenditure'])){ if(!isset($data[$k]['income'])||!isset($data[$k]['expenditure'])){
unset($data[$k]); unset($data[$k]);
} }

View File

@ -27,4 +27,9 @@ class UserAccountLog extends BaseModel
use SoftDelete; use SoftDelete;
protected $deleteTime = 'delete_time'; protected $deleteTime = 'delete_time';
public function userInfo()
{
return $this->hasOne(User::class, 'id', 'user_id')->field('id,nickname');
}
} }

@ -1 +1 @@
Subproject commit 1294ea49ff9ecc4532821f8798304816cbf8dd74 Subproject commit 9acc82cd23d807280ddd29df2117e7890094d049