|
@@ -63,16 +63,19 @@ class LhcNumber extends Controller
|
|
|
if ($id) {
|
|
if ($id) {
|
|
|
$info = LhcNumberModel::where('id', $id)->first();
|
|
$info = LhcNumberModel::where('id', $id)->first();
|
|
|
if (!$info) throw new Exception('数据不存在');
|
|
if (!$info) throw new Exception('数据不存在');
|
|
|
- } else if (!empty($params['game']) && !empty($params['gameplay'])) {
|
|
|
|
|
- $info = LhcNumberModel::where('game', $params['game'])->where('gameplay', $params['gameplay'])->first();
|
|
|
|
|
- if (!$info) throw new Exception('数据不存在');
|
|
|
|
|
|
|
+ $info->odds = $params['odds'];
|
|
|
|
|
+ $info->updated_by = auth()->id();
|
|
|
|
|
+ $info->save();
|
|
|
|
|
+ } else if (!empty($params['game']) ) {
|
|
|
|
|
+ $where[] = ['game', $params['game']];
|
|
|
|
|
+ if (!empty($params['gameplay'])) {
|
|
|
|
|
+ $where[] = ['gameplay', $params['gameplay']];
|
|
|
|
|
+ }
|
|
|
|
|
+ LhcNumberModel::where($where)->update(['odds' => $params['odds'], 'updated_by' => auth()->id()]);
|
|
|
} else {
|
|
} else {
|
|
|
throw new Exception('参数错误');
|
|
throw new Exception('参数错误');
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- $info->odds = $params['odds'];
|
|
|
|
|
- $info->updated_by = auth()->id();
|
|
|
|
|
- $info->save();
|
|
|
|
|
|
|
+
|
|
|
return $this->success();
|
|
return $this->success();
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
|
|
return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
|