|
@@ -188,6 +188,43 @@ class CardController extends Curd
|
|
|
return json_success('', $info);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新前置方法
|
|
|
+ * @param Request $request
|
|
|
+ * @return array
|
|
|
+ * @throws BusinessException
|
|
|
+ */
|
|
|
+ protected function updateInput(Request $request): array
|
|
|
+ {
|
|
|
+ $primary_key = $this->model->getKeyName();
|
|
|
+ $id = $request->post($primary_key);
|
|
|
+ $data = $this->inputFilter($request->post());
|
|
|
+ $model = $this->model->find($id);
|
|
|
+ if (!$model) {
|
|
|
+ throw new BusinessException('记录不存在', 2);
|
|
|
+ }
|
|
|
+ $cardExtendJson = [];
|
|
|
+ if (!empty($model->card_extend_json)) {
|
|
|
+ $cardExtendJson = json_decode($model->card_extend_json, true);
|
|
|
+ }
|
|
|
+ if ($data['is_issue'] == 'N') {
|
|
|
+ unset($cardExtendJson['issue_datetime']);
|
|
|
+ } elseif ($data['is_issue'] == 'Y') {
|
|
|
+ $cardExtendJson['issue_datetime'] = date('Y-m-d H:i:s');
|
|
|
+ }
|
|
|
+ $data['card_extend_json'] = json_encode($cardExtendJson);
|
|
|
+
|
|
|
+ if ($model->join_card_dept_id != $data['join_card_dept_id'] && empty($model->join_card_member_id)) {
|
|
|
+ $data['card_assign_datetime'] = date('Y-m-d H:i:s');
|
|
|
+ }
|
|
|
+
|
|
|
+ _syslog('储值卡', '编辑', $data, $request->all());
|
|
|
+
|
|
|
+ unset($data[$primary_key]);
|
|
|
+ return [$id, $data];
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @Desc 获取指定状态的 card_id
|
|
|
* @Author Gorden
|