|
@@ -15,6 +15,7 @@ use support\Response;
|
|
use app\model\CardBatch;
|
|
use app\model\CardBatch;
|
|
use app\model\Card;
|
|
use app\model\Card;
|
|
use app\admin\service\card\CardService;
|
|
use app\admin\service\card\CardService;
|
|
|
|
+use app\admin\service\sys_manage\CategoryService;
|
|
|
|
|
|
class CardBatchService
|
|
class CardBatchService
|
|
{
|
|
{
|
|
@@ -31,6 +32,10 @@ class CardBatchService
|
|
try {
|
|
try {
|
|
// 添加卡批次
|
|
// 添加卡批次
|
|
$model = new CardBatch();
|
|
$model = new CardBatch();
|
|
|
|
+ if (is_array($params['join_card_batch_category_id'])) {
|
|
|
|
+ $params['join_card_batch_category_id'] = end($params['join_card_batch_category_id']);
|
|
|
|
+ }
|
|
|
|
+
|
|
$model->join_card_batch_user_id = $params['join_card_batch_user_id']; // 批次创建用户 user_id
|
|
$model->join_card_batch_user_id = $params['join_card_batch_user_id']; // 批次创建用户 user_id
|
|
$model->join_card_batch_category_id = $params['join_card_batch_category_id']; // 批次卡分类ID
|
|
$model->join_card_batch_category_id = $params['join_card_batch_category_id']; // 批次卡分类ID
|
|
$model->card_batch_status = $params['card_batch_status']; // 批次状态
|
|
$model->card_batch_status = $params['card_batch_status']; // 批次状态
|
|
@@ -243,6 +248,12 @@ class CardBatchService
|
|
|
|
|
|
|
|
|
|
if (!empty($rows)) {
|
|
if (!empty($rows)) {
|
|
|
|
+
|
|
|
|
+ // 查询所有分类信息
|
|
|
|
+ $category = array_column($rows, 'join_card_batch_category_id');
|
|
|
|
+ $categoryInfos = CategoryService::getCategoryInfos($category) ?? [];
|
|
|
|
+ $categoryInfos && $categoryInfos = array_column($categoryInfos, null, 'category_id');
|
|
|
|
+
|
|
// 查询求和数据信息
|
|
// 查询求和数据信息
|
|
$card_batch_id_string = implode(',', array_column($rows, 'card_batch_id'));
|
|
$card_batch_id_string = implode(',', array_column($rows, 'card_batch_id'));
|
|
$sql = "select join_card_batch_id,
|
|
$sql = "select join_card_batch_id,
|
|
@@ -280,6 +291,7 @@ class CardBatchService
|
|
$card_status_total = array_column($card_status_total, null, 'join_card_batch_id');
|
|
$card_status_total = array_column($card_status_total, null, 'join_card_batch_id');
|
|
foreach ($rows as $key => &$value) {
|
|
foreach ($rows as $key => &$value) {
|
|
$value['card_batch_status_value'] = $cardBatchModel::CARD_BATCH_STATUS[$value['card_batch_status']];
|
|
$value['card_batch_status_value'] = $cardBatchModel::CARD_BATCH_STATUS[$value['card_batch_status']];
|
|
|
|
+ $value['category_name'] = $categoryInfos[$value['join_card_batch_category_id']]['category_name'] ?? "";
|
|
if ($value['card_batch_validtimes'] == 0) {
|
|
if ($value['card_batch_validtimes'] == 0) {
|
|
$value['card_batch_validtimes_value'] = "永久";
|
|
$value['card_batch_validtimes_value'] = "永久";
|
|
} else {
|
|
} else {
|