Skip to content

Commit

Permalink
修复切换订阅interval
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed May 26, 2022
1 parent b1af657 commit 1c580ea
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion back/api/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export default (app: Router) => {
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
if (cron_parser.parseExpression(req.body.schedule).hasNext()) {
if (
!req.body.schedule ||
cron_parser.parseExpression(req.body.schedule).hasNext()
) {
const subscriptionService = Container.get(SubscriptionService);
const data = await subscriptionService.create(req.body);
return res.send({ code: 200, data });
Expand Down
2 changes: 1 addition & 1 deletion back/data/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class Subscription {

constructor(options: Subscription) {
this.id = options.id;
this.name = options.name;
this.name = options.name || options.alias;
this.type = options.type;
this.schedule = options.schedule;
this.status =
Expand Down
3 changes: 1 addition & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ RUN set -x \
&& rm -rf /var/cache/apk/* \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& touch ~/.bashrc \
&& git config --global user.email "qinglong@@users.noreply.github.com" \
&& git config --global user.name "qinglong" \
&& npm install -g pnpm \
&& pnpm setup \
&& source /root/.bashrc \
&& source ~/.bashrc \
&& pnpm add -g pm2 ts-node typescript tslib \
&& git clone -b ${QL_BRANCH} ${QL_URL} ${QL_DIR} \
&& cd ${QL_DIR} \
Expand Down
4 changes: 4 additions & 0 deletions shell/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ patch_version() {
pnpm i -g ts-node typescript tslib
fi

# 兼容pnpm@7
pnpm setup
source ~/.bashrc

git config --global pull.rebase false

cp -f $dir_root/.env.example $dir_root/.env
Expand Down
6 changes: 3 additions & 3 deletions src/pages/subscription/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ const SubscriptionModal = ({
}) => {
const [intervalType, setIntervalType] = useState('days');
const [intervalNumber, setIntervalNumber] = useState<number>();
const intervalTypeChange = (e) => {
setIntervalType(e.target.value);
onChange?.({ type: e.target.value, value: intervalNumber });
const intervalTypeChange = (type: string) => {
setIntervalType(type);
onChange?.({ type, value: intervalNumber });
};

const numberChange = (value: number) => {
Expand Down

0 comments on commit 1c580ea

Please sign in to comment.