|
@@ -368,16 +368,17 @@ class CardService
|
|
|
$cardBatchModel = new Card();
|
|
|
$model = $cardBatchModel::find($params['card_id']);
|
|
|
$model->card_name = $params['card_name'];
|
|
|
- $model->join_card_member_id = $params['join_card_member_id'];
|
|
|
- $params['card_status'] && $params['card_status'] = $model->card_status = Card::CARD_STATUS[$params['card_status']]; // 储值卡状态
|
|
|
+ $model->card_remark = $params['card_remark'] ?? "";
|
|
|
+ $params['join_card_member_id'] && $model->join_card_member_id = $params['join_card_member_id'] ?? "";
|
|
|
+ $params['card_status'] && $model->card_status = $params['card_status']; // 储值卡状态
|
|
|
if ($params['validtimes_status'] == 0) { // 卡批次有效期 0 永久天 1 增加 2减少
|
|
|
$model->card_validtimes = 0;
|
|
|
} elseif ($params['validtimes_status'] == 1) {
|
|
|
- $model->card_validtimes = baadd($model->card_validtimes + $params['card_batch_validtimes'] * 86400);
|
|
|
+ $model->card_validtimes = bcadd($model->card_validtimes, $params['card_validtimes'] * 86400);
|
|
|
} elseif ($params['validtimes_status'] == 2) {
|
|
|
- $card_validtimes = bcsub($model->card_validtimes - $params['card_batch_validtimes'] * 86400);
|
|
|
+ $card_validtimes = bcsub($model->card_validtimes, $params['card_validtimes'] * 86400);
|
|
|
// 修改后的有效期不允许小于当前时间
|
|
|
- if (!$card_validtimes <= time()) {
|
|
|
+ if ($card_validtimes <= time()) {
|
|
|
return json_fail('储值卡有效期必须大于当前时间~');
|
|
|
}
|
|
|
$model->card_validtimes = $card_validtimes;
|
|
@@ -397,7 +398,7 @@ class CardService
|
|
|
dump($e->getTrace());
|
|
|
return json_fail('数据写入失败~');
|
|
|
}
|
|
|
-// _syslog("修改储值卡", "储值卡id【" . $params['card_id'] . "】");
|
|
|
+ _syslog("修改储值卡", "储值卡id【" . $params['card_id'] . "】");
|
|
|
return json_success('success');
|
|
|
}
|
|
|
|