Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 1756192

Browse files
committed
chore(update): elxiir -> 1.9 & clean up warnings
1 parent 41f5b11 commit 1756192

File tree

7 files changed

+67
-48
lines changed

7 files changed

+67
-48
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ _tuts/
1919
docs/draft.ex
2020
cover/excoveralls.html
2121
node_modules/
22+
.elixir_ls/

.travis.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
language: elixir
22
elixir:
3-
- 1.6.6
3+
- 1.9.0
44
otp_release:
5-
- 20.1
6-
- 21.0
5+
- 22.0.5
76
node_js:
8-
- 8
7+
- 10
98
sudo: false
109
addons:
1110
postgresql: '9.4'

lib/groupher_server/mailer/templates/notify_admin_payment.ex

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
44
just copy and paste raw string to: https://mjml.io/try-it-live
55
"""
66

7-
alias GroupherServer.Billing.BillRecord
7+
# alias GroupherServer.Billing.BillRecord
88

99
def html(record) do
1010
"""
@@ -121,9 +121,9 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
121121
<td style="direction:ltr;font-size:0px;padding:20px 0;padding-bottom:0;text-align:center;vertical-align:top;">
122122
<!--[if mso | IE]>
123123
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
124-
124+
125125
<tr>
126-
126+
127127
<td
128128
class="" style="vertical-align:top;width:600px;"
129129
>
@@ -144,9 +144,9 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
144144
</div>
145145
<!--[if mso | IE]>
146146
</td>
147-
147+
148148
</tr>
149-
149+
150150
</table>
151151
<![endif]-->
152152
</td>
@@ -177,12 +177,12 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
177177
<td style="direction:ltr;font-size:0px;padding:20px 0;padding-bottom:0;padding-top:0;text-align:center;vertical-align:top;">
178178
<!--[if mso | IE]>
179179
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
180-
180+
181181
<tr>
182182
<td
183183
class="" width="600px"
184184
>
185-
185+
186186
<table
187187
align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
188188
>
@@ -196,9 +196,9 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
196196
<td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;vertical-align:top;">
197197
<!--[if mso | IE]>
198198
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
199-
199+
200200
<tr>
201-
201+
202202
<td
203203
class="" style="vertical-align:top;width:600px;"
204204
>
@@ -262,9 +262,9 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
262262
</div>
263263
<!--[if mso | IE]>
264264
</td>
265-
265+
266266
</tr>
267-
267+
268268
</table>
269269
<![endif]-->
270270
</td>
@@ -276,10 +276,10 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
276276
</td>
277277
</tr>
278278
</table>
279-
279+
280280
</td>
281281
</tr>
282-
282+
283283
</table>
284284
<![endif]-->
285285
</td>
@@ -310,12 +310,12 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
310310
<td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;vertical-align:top;">
311311
<!--[if mso | IE]>
312312
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
313-
313+
314314
<tr>
315315
<td
316316
class="" width="600px"
317317
>
318-
318+
319319
<table
320320
align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
321321
>
@@ -329,9 +329,9 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
329329
<td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;vertical-align:top;">
330330
<!--[if mso | IE]>
331331
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
332-
332+
333333
<tr>
334-
334+
335335
<td
336336
class="" style="vertical-align:top;width:600px;"
337337
>
@@ -349,7 +349,7 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
349349
align="center" border="0" cellpadding="0" cellspacing="0" role="presentation"
350350
>
351351
<tr>
352-
352+
353353
<td>
354354
<![endif]-->
355355
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="float:none;display:inline-table;">
@@ -367,7 +367,7 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
367367
</table>
368368
<!--[if mso | IE]>
369369
</td>
370-
370+
371371
</tr>
372372
</table>
373373
<![endif]-->
@@ -386,9 +386,9 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
386386
</div>
387387
<!--[if mso | IE]>
388388
</td>
389-
389+
390390
</tr>
391-
391+
392392
</table>
393393
<![endif]-->
394394
</td>
@@ -400,15 +400,15 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
400400
</td>
401401
</tr>
402402
</table>
403-
403+
404404
</td>
405405
</tr>
406-
406+
407407
<tr>
408408
<td
409409
class="" width="600px"
410410
>
411-
411+
412412
<table
413413
align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600"
414414
>
@@ -422,9 +422,9 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
422422
<td style="direction:ltr;font-size:0px;padding:20px 0;padding-top:0;text-align:center;vertical-align:top;">
423423
<!--[if mso | IE]>
424424
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
425-
425+
426426
<tr>
427-
427+
428428
<td
429429
class="" style="width:600px;"
430430
>
@@ -433,7 +433,7 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
433433
<!--[if mso | IE]>
434434
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
435435
<tr>
436-
436+
437437
<td
438438
style="vertical-align:top;width:600px;"
439439
>
@@ -458,16 +458,16 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
458458
</div>
459459
<!--[if mso | IE]>
460460
</td>
461-
461+
462462
</tr>
463463
</table>
464464
<![endif]-->
465465
</div>
466466
<!--[if mso | IE]>
467467
</td>
468-
468+
469469
</tr>
470-
470+
471471
</table>
472472
<![endif]-->
473473
</td>
@@ -479,10 +479,10 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
479479
</td>
480480
</tr>
481481
</table>
482-
482+
483483
</td>
484484
</tr>
485-
485+
486486
</table>
487487
<![endif]-->
488488
</td>
@@ -583,7 +583,7 @@ defmodule GroupherServer.Email.Templates.NotifyAdminPayment do
583583
<td style="padding: 0 0 0 15px;">2018/05/24 03:22</td>
584584
</tr>
585585
</mj-table>
586-
586+
587587
</mj-column>
588588
</mj-section>
589589

lib/groupher_server/mailer/templates/thanks_donation.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ defmodule GroupherServer.Email.Templates.ThanksDonation do
9797
9898
<mj-column width="100%">
9999
<mj-text color="#6f8696" align="center" font-weight="bold" font-size="18px">
100-
# #{user.nickname}, 感谢您的打赏 #
100+
# xxx 感谢您的打赏 #
101101
</mj-text>
102-
102+
103103
<mj-divider border-width="1px" border-style="dashed" border-color="#002F39" />
104104
<mj-table color="#6C8695" font-size="18px" line-height="40px">
105105
<tr style="border-top:1px solid #6C8695;text-align:left;">
@@ -128,11 +128,11 @@ defmodule GroupherServer.Email.Templates.ThanksDonation do
128128
</tr>
129129
</mj-table>
130130
<mj-divider border-width="1px" border-style="dashed" border-color="#617B8A" />
131-
131+
132132
<mj-text color="#6f8696" align="left" font-size="15px">
133133
您的善举将全部被用于社区服务器的维护和运营,如有任何疑问,请将上述账单截图发送至 support@group.coderplanets.com, 我会第一时间为您处理。再次感谢, 祝生活愉快!
134134
</mj-text>
135-
135+
136136
</mj-column>
137137
</mj-section>
138138

lib/groupher_server/statistics/delegates/contribute.ex

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule GroupherServer.Statistics.Delegate.Contribute do
77
alias GroupherServer.Accounts.User
88
alias GroupherServer.CMS.Community
99
alias GroupherServer.Statistics.{UserContribute, CommunityContribute}
10-
alias Helper.{ORM, QueryBuilder}
10+
alias Helper.{Cache, ORM, QueryBuilder}
1111

1212
@community_contribute_days get_config(:general, :community_contribute_days)
1313
@user_contribute_months get_config(:general, :user_contribute_months)
@@ -61,10 +61,29 @@ defmodule GroupherServer.Statistics.Delegate.Contribute do
6161
Returns the list of community_contribute by latest 6 days.
6262
"""
6363
def list_contributes_digest(%Community{id: id}) do
64-
%Community{id: id}
65-
|> get_contributes()
66-
|> to_counts_digest(days: @community_contribute_days)
67-
|> done
64+
scope = "community.contributes.#{id}"
65+
66+
case Cache.get(scope) do
67+
{:ok, result} ->
68+
{:ok, result}
69+
70+
{:error, _} ->
71+
%Community{id: id}
72+
|> get_contributes()
73+
|> to_counts_digest(days: @community_contribute_days)
74+
|> done
75+
|> cache_result(scope)
76+
end
77+
end
78+
79+
defp cache_result({:ok, result}, scope) do
80+
IO.inspect scope, label: "put cashe"
81+
Cache.put(scope, result)
82+
{:ok, result}
83+
end
84+
85+
defp cache_result({:error, result}, _scope) do
86+
{:error, result}
6887
end
6988

7089
defp get_contributes(%Community{id: id}) do

lib/helper/html.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ defmodule Helper.HTML do
44
"""
55

66
import Ecto.Changeset
7-
alias Phoenix.HTML
7+
# alias Phoenix.HTML
88

99
def safe_string(%Ecto.Changeset{valid?: true, changes: changes} = changeset, field) do
1010
case Map.has_key?(changes, field) do

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ defmodule GroupherServer.Mixfile do
55
[
66
app: :groupher_server,
77
version: "0.1.7",
8-
elixir: "~> 1.4",
8+
elixir: "~> 1.9",
99
elixirc_paths: elixirc_paths(Mix.env()),
1010
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
1111
dialyzer: [plt_add_deps: :transitive, ignore_warnings: ".dialyzer_ignore.exs"],

0 commit comments

Comments
 (0)