settter
parent
0e8ead43e0
commit
a6323a8958
|
@ -232,7 +232,7 @@ class Consumer extends Base
|
|||
throw new ValidateException('用户无效!');
|
||||
}
|
||||
$data = AccountRepository::getInstance()->getBusinessFlowList($account->user_code,$page,$size,$keyword);
|
||||
$data->each(function ($item){
|
||||
$data["list"]->each(function ($item){
|
||||
$item->businessCover = $this->request->domain() . $item->background;
|
||||
});
|
||||
return $this->json(0,"success",$data);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace app\traits\account;
|
||||
|
||||
use app\model\BusinessFlow;
|
||||
use think\Collection;
|
||||
|
||||
trait BusinessFlowTrait
|
||||
{
|
||||
|
@ -16,9 +17,15 @@ trait BusinessFlowTrait
|
|||
*/
|
||||
public function getBusinessFlowList($accountCode, $page, $size,$keyword=null)
|
||||
{
|
||||
return BusinessFlow::alias("a")
|
||||
->join("business b","a.business_code = b.code")
|
||||
->where("a.user_code",$accountCode)
|
||||
$data = [
|
||||
'total' => 0,
|
||||
'current' => $page,
|
||||
'size' => $size,
|
||||
'list' => new Collection(),
|
||||
];
|
||||
$model = BusinessFlow::alias("a")
|
||||
->join("business b", "a.business_code = b.code")
|
||||
->where("a.user_code", $accountCode)
|
||||
->when(!empty($keyword), function ($q) use ($keyword) {
|
||||
$q->where("b.business_name", "like", "%{$keyword}%");
|
||||
})
|
||||
|
@ -29,10 +36,13 @@ trait BusinessFlowTrait
|
|||
"b.background",
|
||||
"a.create_time as createTime",
|
||||
"a.user_code as userCode",
|
||||
])
|
||||
->page($page,$size)
|
||||
]);
|
||||
$data["total"] = $model->count();
|
||||
$data["list"] = $model
|
||||
->page($page, $size)
|
||||
->order("a.id desc")
|
||||
->select();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue