|
@@ -185,6 +185,9 @@ class CardService
|
|
$category = array_column($rows, 'join_card_category_id');
|
|
$category = array_column($rows, 'join_card_category_id');
|
|
$categoryInfos = CategoryService::getCategoryInfos($category) ?? [];
|
|
$categoryInfos = CategoryService::getCategoryInfos($category) ?? [];
|
|
$categoryInfos && $categoryInfos = array_column($categoryInfos, null, 'category_id');
|
|
$categoryInfos && $categoryInfos = array_column($categoryInfos, null, 'category_id');
|
|
|
|
+ // 查询会员信息
|
|
|
|
+
|
|
|
|
+
|
|
foreach ($rows as $key => &$value) {
|
|
foreach ($rows as $key => &$value) {
|
|
$value['category_name'] = $categoryInfos[$value['join_card_category_id']]['category_name'] ?? "";
|
|
$value['category_name'] = $categoryInfos[$value['join_card_category_id']]['category_name'] ?? "";
|
|
$value['card_status_value'] = Card::CARD_STATUS[$value['card_status']];
|
|
$value['card_status_value'] = Card::CARD_STATUS[$value['card_status']];
|
|
@@ -433,4 +436,39 @@ class CardService
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Notes: 储值卡绑定
|
|
|
|
+ * User: ZhouBenXu
|
|
|
|
+ * DateTime: 2024/7/2 下午6:08
|
|
|
|
+ * @param $params
|
|
|
|
+ * @return Response
|
|
|
|
+ */
|
|
|
|
+ public static function binding($params)
|
|
|
|
+ {
|
|
|
|
+ Db::beginTransaction();
|
|
|
|
+ try {
|
|
|
|
+ $card_ids = $params['card_id'];
|
|
|
|
+ if (!is_array($card_ids)) {
|
|
|
|
+ $card_ids = [$card_ids];
|
|
|
|
+ }
|
|
|
|
+ Card::whereIn('card_id', $card_ids)->update(['join_card_member_id'=>$params['join_card_member_id']]);
|
|
|
|
+ Db::commit();
|
|
|
|
+ } catch (\PDOException $e) {
|
|
|
|
+ Db::rollBack();
|
|
|
|
+ dump($e->getFile() . '(' . $e->getLine() . '):' . $e->getMessage());
|
|
|
|
+ return json_fail('数据写入失败~');
|
|
|
|
+ } catch (BusinessException $e) {
|
|
|
|
+ Db::rollBack();
|
|
|
|
+ dump($e->getFile() . '(' . $e->getLine() . '):' . $e->getMessage());
|
|
|
|
+ return json_fail($e->getMessage());
|
|
|
|
+ } catch (\Exception $e) {
|
|
|
|
+ Db::rollBack();
|
|
|
|
+ dump($e->getTrace());
|
|
|
|
+ return json_fail('数据写入失败~');
|
|
|
|
+ }
|
|
|
|
+ _syslog("绑定储值卡", "储值卡ID【" . implode(',', $card_ids) . '】');
|
|
|
|
+ return json_success('success');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|