|
@@ -5,6 +5,7 @@ namespace app\admin\controller\coupon;
|
|
use app\controller\Curd;
|
|
use app\controller\Curd;
|
|
use app\model\Card;
|
|
use app\model\Card;
|
|
use app\model\CardIssue;
|
|
use app\model\CardIssue;
|
|
|
|
+use app\model\CardMain;
|
|
use app\model\SysCategory;
|
|
use app\model\SysCategory;
|
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
|
@@ -26,16 +27,21 @@ class CardIssueController extends Curd
|
|
|
|
|
|
public function select(Request $request): Response
|
|
public function select(Request $request): Response
|
|
{
|
|
{
|
|
|
|
+ $cardMainName = $request->get('card_main_name');
|
|
[$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
|
[$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
|
$order = $request->get('order', 'desc');
|
|
$order = $request->get('order', 'desc');
|
|
$field = $field ?? 'card_issue_addtimes';
|
|
$field = $field ?? 'card_issue_addtimes';
|
|
|
|
|
|
- if (!empty($where['card_main_name'])) {
|
|
|
|
- $where['card_main_name'] = ['like', $where['card_main_name']];
|
|
|
|
|
|
+ if (!empty($where['card_issue_name'])) {
|
|
|
|
+ $where['card_issue_name'] = ['like', $where['card_issue_name']];
|
|
}
|
|
}
|
|
if (!empty($where['card_issue_addtimes'])) {
|
|
if (!empty($where['card_issue_addtimes'])) {
|
|
- $where['card_main_addtimes'][0] = strtotime($where['card_main_addtimes'][0]);
|
|
|
|
- $where['card_main_addtimes'][1] = strtotime($where['card_main_addtimes'][1]);
|
|
|
|
|
|
+ $where['card_issue_addtimes'][0] = strtotime($where['card_issue_addtimes'][0]);
|
|
|
|
+ $where['card_issue_addtimes'][1] = strtotime($where['card_issue_addtimes'][1]);
|
|
|
|
+ }
|
|
|
|
+ if (!empty($cardMainName)) {
|
|
|
|
+ $cardMainIds = CardMain::where('card_main_name', 'like', '%' . $cardMainName . '%')->pluck('card_main_id')->toArray();
|
|
|
|
+ $where['join_issue_card_main_id'] = ['in', $cardMainIds];
|
|
}
|
|
}
|
|
|
|
|
|
$query = $this->doSelect($where, $field, $order);
|
|
$query = $this->doSelect($where, $field, $order);
|
|
@@ -62,7 +68,7 @@ class CardIssueController extends Curd
|
|
$model = $model->where($column, $value[0], "%$value[1]%");
|
|
$model = $model->where($column, $value[0], "%$value[1]%");
|
|
} elseif (in_array($value[0], ['>', '=', '<', '<>'])) {
|
|
} elseif (in_array($value[0], ['>', '=', '<', '<>'])) {
|
|
$model = $model->where($column, $value[0], $value[1]);
|
|
$model = $model->where($column, $value[0], $value[1]);
|
|
- } elseif ($value[0] == 'in' && !empty($value[1])) {
|
|
|
|
|
|
+ } elseif ($value[0] == 'in') {
|
|
$valArr = $value[1];
|
|
$valArr = $value[1];
|
|
if (is_string($value[1])) {
|
|
if (is_string($value[1])) {
|
|
$valArr = explode(",", trim($value[1]));
|
|
$valArr = explode(",", trim($value[1]));
|